lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 29 Dec 2020 16:08:10 +0100
From:   Thomas Bogendoerfer <tsbogend@...ha.franken.de>
To:     Paul Cercueil <paul@...pouillou.net>
Cc:     Nathan Chancellor <natechancellor@...il.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>, od@...c.me,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com, stable@...r.kernel.org
Subject: Re: [PATCH] MIPS: boot: Fix unaligned access with??
 CONFIG_MIPS_RAW_APPENDED_DTB

On Mon, Dec 28, 2020 at 10:30:36PM +0000, Paul Cercueil wrote:
> Le lun. 28 déc. 2020 à 23:25, Thomas Bogendoerfer
> <tsbogend@...ha.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@...r.kernel.org> # v4.7
> > >  Signed-off-by: Paul Cercueil <paul@...pouillou.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.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ