Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: masahiroy@kernel.org
Cc: gregkh@suse.de, linux-arm-kernel@lists.infradead.org,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	nathan@kernel.org, nicolas@fjasle.eu, rusty@rustcorp.com.au,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Subject: Re: [PATCH 0/3] modpost: work around unaligned data access
Date: Wed, 25 Dec 2024 17:26:56 +0100	[thread overview]
Message-ID: <20241225162656.26005-1-glaubitz@physik.fu-berlin.de> (raw)
In-Reply-To: <20241225153343.134590-1-masahiroy@kernel.org>

Hi Masahiro,

> The latest binutils stopped aligning section data in relocatable ELF.
> It saves small number of bytes that were previously inserted between
> sections. However, modpost crashes due to unaligned access:
>   https://sourceware.org/bugzilla/show_bug.cgi?id=32435
>   https://sourceware.org/bugzilla/show_bug.cgi?id=32493
>
> Similar to kernel space, unaligned data access in userspace can be
> problematic on some architectures.
>
> Simple example on ARM:
>
>  $ CC=arm-linux-gnueabihf-gcc
>  $ echo 'int foo(int *p) { return *p + *(p + 1); }' | ${CC} -O2 -x c - -c -o foo.o
>  $ echo 'int foo(int *p); int main(void) { char str[16] = "helloworld"; return foo((int *)(str + 1)); }' | ${CC} -x c - -c -o main.o
>  $ ${CC} -static -o unalign-test main.o foo.o
>  $ qemu-armhf unalign-test
>  qemu: uncaught target signal 7 (Bus error) - core dumped
>  Bus error (core dumped)
>
> In this case, the 'ldrd' instruction causes a bus error due to an
> unaligned access. If the -O2 flag is omitted, this issue does not occur.
>
> To avoid potential unaligned access, use the get_unaligned() approach
> as seen in the kernel space.

I have just applied this series against Linus' tree and I can confirm that it fixes the
unalignment access anymore on sparc64. There is no more "Bus error" and the build succeeds.

Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

  parent reply	other threads:[~2024-12-25 16:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-25 15:33 [PATCH 0/3] modpost: work around unaligned data access Masahiro Yamada
2024-12-25 15:33 ` [PATCH 1/3] modpost: fix the missed iteration for the max bit in do_input() Masahiro Yamada
2024-12-25 15:33 ` [PATCH 2/3] modpost: refactor do_vmbus_entry() Masahiro Yamada
2024-12-25 15:33 ` [PATCH 3/3] modpost: work around unaligned data access error Masahiro Yamada
2024-12-25 16:26 ` John Paul Adrian Glaubitz [this message]
2024-12-26 13:55   ` [PATCH 0/3] modpost: work around unaligned data access Masahiro Yamada
2024-12-27 13:31     ` John Paul Adrian Glaubitz

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=20241225162656.26005-1-glaubitz@physik.fu-berlin.de \
    --to=glaubitz@physik.fu-berlin.de \
    --cc=gregkh@suse.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=rusty@rustcorp.com.au \
    /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