stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Nathan Chancellor <natechancellor@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	od@zcrc.me, linux-mips@vger.kernel.org,
	linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] MIPS: boot: Fix unaligned access with??\r
 CONFIG_MIPS_RAW_APPENDED_DTB
Date: Tue, 29 Dec 2020 18:20:04 +0000	[thread overview]
Message-ID: <GL54MQ.XG61RLIPAFCV@crapouillou.net> (raw)
In-Reply-To: <20201229150810.GA7832@alpha.franken.de>

Hi Thomas,

Le mar. 29 déc. 2020 à 16:08, Thomas Bogendoerfer 
<tsbogend@alpha.franken.de> a écrit :
> On Mon, Dec 28, 2020 at 10:30:36PM +0000, Paul Cercueil wrote:
>>  Le lun. 28 déc. 2020 à 23:25, Thomas Bogendoerfer
>>  <tsbogend@alpha.franken.de> a écrit :
>>  > On Wed, Dec 16, 2020 at 11:39:56PM +0000, Paul Cercueil wrote:
>>  > >  The compressed payload is not necesarily 4-byte aligned, at 
>> least
>>  > > when
>>  > >  compiling with Clang. In that case, the 4-byte value appended 
>> to the
>>  > >  compressed payload that corresponds to the uncompressed kernel 
>> image
>>  > >  size must be read using get_unaligned_le().
>>  > >
>>  > >  This fixes Clang-built kernels not booting on MIPS (tested on a
>>  > > Ingenic
>>  > >  JZ4770 board).
>>  > >
>>  > >  Fixes: b8f54f2cde78 ("MIPS: ZBOOT: copy appended dtb to the 
>> end of
>>  > > the kernel")
>>  > >  Cc: <stable@vger.kernel.org> # v4.7
>>  > >  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  > >  ---
>>  > >   arch/mips/boot/compressed/decompress.c | 2 +-
>>  > >   1 file changed, 1 insertion(+), 1 deletion(-)
>>  > >
>>  > >  diff --git a/arch/mips/boot/compressed/decompress.c
>>  > > b/arch/mips/boot/compressed/decompress.c
>>  > >  index c61c641674e6..47c07990432b 100644
>>  > >  --- a/arch/mips/boot/compressed/decompress.c
>>  > >  +++ b/arch/mips/boot/compressed/decompress.c
>>  > >  @@ -117,7 +117,7 @@ void decompress_kernel(unsigned long
>>  > > boot_heap_start)
>>  > >   		dtb_size = fdt_totalsize((void *)&__appended_dtb);
>>  > >
>>  > >   		/* last four bytes is always image size in little endian */
>>  > >  -		image_size = le32_to_cpup((void *)&__image_end - 4);
>>  > >  +		image_size = get_unaligned_le32((void *)&__image_end - 4);
>>  >
>>  > gives me following error
>>  >
>>  > arch/mips/boot/compressed/decompress.c:120:16: error: implicit
>>  > declaration of function ‘get_unaligned_le32’
>>  > [-Werror=implicit-function-declaration]
>>  >    image_size = get_unaligned_le32((void *)&__image_end - 4);
>>  >
>>  > I've added
>>  >
>>  > #include <asm/unaligned.h>
>>  >
>>  > which fixes the compile error, but I'm wondering why the patch 
>> compiled
>>  > for you ?
>> 
>>  No idea - but it does compile fine without the include here. 
>> Probably a
>>  defconfig difference.
> 
> # CONFIG_KERNEL_LZO is not set
> # CONFIG_KERNEL_LZ4 is not set
> 
> this makes the difference. Both decompress.c files include 
> asm/unaligned.h.
> 
> I've added the #include, fixed the get_unaligned_le32 in the 
> description
> and applied it to mips-fixes.

Alright, great! Thanks!

Cheers,
-Paul



      reply	other threads:[~2020-12-29 18:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 23:39 [PATCH] MIPS: boot: Fix unaligned access with CONFIG_MIPS_RAW_APPENDED_DTB Paul Cercueil
2020-12-17  2:08 ` Nick Desaulniers
2020-12-17  2:35   ` Paul Cercueil
2020-12-17 11:14 ` Philippe Mathieu-Daudé
2020-12-28 22:25 ` Thomas Bogendoerfer
2020-12-28 22:30   ` Paul Cercueil
2020-12-29 15:08     ` [PATCH] MIPS: boot: Fix unaligned access with?? CONFIG_MIPS_RAW_APPENDED_DTB Thomas Bogendoerfer
2020-12-29 18:20       ` Paul Cercueil [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=GL54MQ.XG61RLIPAFCV@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=od@zcrc.me \
    --cc=stable@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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;
as well as URLs for NNTP newsgroup(s).