Skip to content

Commit

Permalink
parisc: Fix unaligned-access crash in bootloader
Browse files Browse the repository at this point in the history
Kernel v5.14 has various changes to optimize unaligned memory accesses,
e.g. commit 0652035 ("asm-generic: unaligned: remove byteshift helpers").

Those changes triggered an unalignment-exception and thus crashed the
bootloader on parisc because the unaligned "output_len" variable now suddenly
was read word-wise while it was read byte-wise in the past.

Fix this issue by declaring the external output_len variable as char which then
forces the compiler to generate byte-accesses.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: Arnd Bergmann <arnd@kernel.org>
Cc: John David Anglin <dave.anglin@bell.net>
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
Fixes: 8c031ba ("parisc: Unbreak bootloader due to gcc-7 optimizations")
Fixes: 0652035 ("asm-generic: unaligned: remove byteshift helpers")
Cc: <stable@vger.kernel.org> # v5.14+
  • Loading branch information
Helge Deller committed Sep 3, 2021
1 parent e5a2cac commit c42813b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/parisc/boot/compressed/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
extern char input_data[];
extern int input_len;
/* output_len is inserted by the linker possibly at an unaligned address */
extern __le32 output_len __aligned(1);
extern char output_len;
extern char _text, _end;
extern char _bss, _ebss;
extern char _startcode_end;
Expand Down

0 comments on commit c42813b

Please sign in to comment.