public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] arm64: mm: Ensure tail of unaligned initrd is reserved
Date: Tue, 23 Apr 2019 10:56:05 +0100	[thread overview]
Message-ID: <20190423095605.GA28879@fuggles.cambridge.arm.com> (raw)
In-Reply-To: <20190418042929.20189-1-bjorn.andersson@linaro.org>

On Wed, Apr 17, 2019 at 09:29:29PM -0700, Bjorn Andersson wrote:
> In the event that the start address of the initrd is not aligned, but
> has an aligned size, the base + size will not cover the entire initrd
> image and there is a chance that the kernel will corrupt the tail of the
> image.
> 
> By aligning the end of the initrd to a page boundary and then
> subtracting the adjusted start address the memblock reservation will
> cover all pages that contains the initrd.
> 
> Fixes: c756c592e442 ("arm64: Utilize phys_initrd_start/phys_initrd_size")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  arch/arm64/mm/init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 6bc135042f5e..7cae155e81a5 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -363,7 +363,7 @@ void __init arm64_memblock_init(void)
>  		 * Otherwise, this is a no-op
>  		 */
>  		u64 base = phys_initrd_start & PAGE_MASK;
> -		u64 size = PAGE_ALIGN(phys_initrd_size);
> +		u64 size = PAGE_ALIGN(phys_initrd_start + phys_initrd_size) - base;

Acked-by: Will Deacon <will.deacon@arm.com>

Catalin can pick this up as a fix for 5.1.

Will

      reply	other threads:[~2019-04-23  9:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18  4:29 [PATCH] arm64: mm: Ensure tail of unaligned initrd is reserved Bjorn Andersson
2019-04-23  9:56 ` Will Deacon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190423095605.GA28879@fuggles.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox