2016-10-21 16:24:24

by Oliver Hartkopp

[permalink] [raw]
Subject: 'kbuild' merge before 4.9-rc1 breaks build and boot

Hello Michal,

I waited some days for a fix - but obviously no one else has this
problem so far ...

This merge

"Merge branch 'kbuild' of
git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild"

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=84d69848c97faab0c25aa2667b273404d2e2a64a

creates a bunch of warnings on my system and the built kernel does not
boot (it complains about a missing root fs).

In the build process some .ko files are built fine and some don't:

(..)
MODPOST 176 modules
AS arch/x86/boot/compressed/efi_thunk_64.o
GZIP arch/x86/boot/compressed/vmlinux.bin.gz
CC arch/x86/boot/compressed/misc.o
WARNING: "memset" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
WARNING: "__fentry__" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
WARNING: "memcpy" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
WARNING: "__sw_hweight32" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
WARNING: "_copy_to_user" [sound/usb/snd-usb-audio.ko] has no CRC!
WARNING: "memset" [sound/usb/snd-usb-audio.ko] has no CRC!
WARNING: "__put_user_1" [sound/usb/snd-usb-audio.ko] has no CRC!
WARNING: "__put_user_4" [sound/usb/snd-usb-audio.ko] has no CRC!
WARNING: "__fentry__" [sound/usb/snd-usb-audio.ko] has no CRC!
WARNING: "memcpy" [sound/usb/snd-usb-audio.ko] has no CRC!
WARNING: "__fentry__" [sound/soundcore.ko] has no CRC!
(..)
WARNING: "__fentry__" [arch/x86/crypto/crc32c-intel.ko] has no CRC!
WARNING: "__fentry__" [arch/x86/crypto/crc32-pclmul.ko] has no CRC!
WARNING: "__fentry__" [arch/x86/crypto/aesni-intel.ko] has no CRC!
WARNING: "__fentry__" [arch/x86/crypto/aes-x86_64.ko] has no CRC!
CC arch/x86/crypto/aes-x86_64.mod.o
CC arch/x86/crypto/aesni-intel.mod.o
CC arch/x86/crypto/crc32-pclmul.mod.o
CC arch/x86/crypto/crc32c-intel.mod.o
(..)

When reverting the entire pull with

git diff 84d69848c97faab0c25aa2667b273404d2e2a64a
d4d24d2d0a7ea3b62efd7336bfc2344e29b36bc5 | patch -p1

everything is ok again.

My system is a Debian Stretch.
gcc version 6.2.0 20161010 (Debian 6.2.0-6)

.config is attached - in the case I have an unusual one from your
perspective.

Regards,
Oliver


Attachments:
config-4.9.0-rc1-00148-g6f33d645-dirty (113.45 kB)

2016-10-24 05:22:02

by Oliver Hartkopp

[permalink] [raw]
Subject: Re: 'kbuild' merge before 4.9-rc1 breaks build and boot

Hello Michal,

your latest patch doesn't help on my system:

http://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/commit/?h=rc-fixes&id=989cea5c14be024e879c0055dc6d033680a52610

Regards,
Oliver



On 10/21/2016 06:23 PM, Oliver Hartkopp wrote:
> Hello Michal,
>
> I waited some days for a fix - but obviously no one else has this
> problem so far ...
>
> This merge
>
> "Merge branch 'kbuild' of
> git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild"
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=84d69848c97faab0c25aa2667b273404d2e2a64a
>
>
> creates a bunch of warnings on my system and the built kernel does not
> boot (it complains about a missing root fs).
>
> In the build process some .ko files are built fine and some don't:
>
> (..)
> MODPOST 176 modules
> AS arch/x86/boot/compressed/efi_thunk_64.o
> GZIP arch/x86/boot/compressed/vmlinux.bin.gz
> CC arch/x86/boot/compressed/misc.o
> WARNING: "memset" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> WARNING: "__fentry__" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> WARNING: "memcpy" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> WARNING: "__sw_hweight32" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> WARNING: "_copy_to_user" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "memset" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "__put_user_1" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "__put_user_4" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "__fentry__" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "memcpy" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "__fentry__" [sound/soundcore.ko] has no CRC!
> (..)
> WARNING: "__fentry__" [arch/x86/crypto/crc32c-intel.ko] has no CRC!
> WARNING: "__fentry__" [arch/x86/crypto/crc32-pclmul.ko] has no CRC!
> WARNING: "__fentry__" [arch/x86/crypto/aesni-intel.ko] has no CRC!
> WARNING: "__fentry__" [arch/x86/crypto/aes-x86_64.ko] has no CRC!
> CC arch/x86/crypto/aes-x86_64.mod.o
> CC arch/x86/crypto/aesni-intel.mod.o
> CC arch/x86/crypto/crc32-pclmul.mod.o
> CC arch/x86/crypto/crc32c-intel.mod.o
> (..)
>
> When reverting the entire pull with
>
> git diff 84d69848c97faab0c25aa2667b273404d2e2a64a
> d4d24d2d0a7ea3b62efd7336bfc2344e29b36bc5 | patch -p1
>
> everything is ok again.
>
> My system is a Debian Stretch.
> gcc version 6.2.0 20161010 (Debian 6.2.0-6)
>
> .config is attached - in the case I have an unusual one from your
> perspective.
>
> Regards,
> Oliver

2016-10-27 17:03:18

by Peter Wu

[permalink] [raw]
Subject: Re: 'kbuild' merge before 4.9-rc1 breaks build and boot

Hey Al, Michal,

I can confirm Olivers issue, the current mainline kernel fails to boot
on kernels with CONFIG_MODVERSIONS=y. Bisection points to:

commit 784d5699eddc55878627da20d3fe0c8542e2f1a2
Author: Al Viro <[email protected]>
Date: Mon Jan 11 11:04:34 2016 -0500

x86: move exports to actual definitions

Signed-off-by: Al Viro <[email protected]>

Good builds have a non-zero address in Module.symvers:

0x69acdf38 memcpy vmlinux EXPORT_SYMBOL

Bad builds have a zero address here:

0x00000000 memcpy vmlinux EXPORT_SYMBOL

This was encountered on Arch Linux with GCC 6.2.1 and
Linux v4.9-rc2-40-g9fe68ca. Note that the identified commit above cannot
be reverted cleanly on master.

Kind regards,
Peter

On Fri, Oct 21, 2016 at 06:23:57PM +0200, Oliver Hartkopp wrote:
> Hello Michal,
>
> I waited some days for a fix - but obviously no one else has this problem so
> far ...
>
> This merge
>
> "Merge branch 'kbuild' of
> git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild"
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=84d69848c97faab0c25aa2667b273404d2e2a64a
>
> creates a bunch of warnings on my system and the built kernel does not boot
> (it complains about a missing root fs).
>
> In the build process some .ko files are built fine and some don't:
>
> (..)
> MODPOST 176 modules
> AS arch/x86/boot/compressed/efi_thunk_64.o
> GZIP arch/x86/boot/compressed/vmlinux.bin.gz
> CC arch/x86/boot/compressed/misc.o
> WARNING: "memset" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> WARNING: "__fentry__" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> WARNING: "memcpy" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> WARNING: "__sw_hweight32" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> WARNING: "_copy_to_user" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "memset" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "__put_user_1" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "__put_user_4" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "__fentry__" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "memcpy" [sound/usb/snd-usb-audio.ko] has no CRC!
> WARNING: "__fentry__" [sound/soundcore.ko] has no CRC!
> (..)
> WARNING: "__fentry__" [arch/x86/crypto/crc32c-intel.ko] has no CRC!
> WARNING: "__fentry__" [arch/x86/crypto/crc32-pclmul.ko] has no CRC!
> WARNING: "__fentry__" [arch/x86/crypto/aesni-intel.ko] has no CRC!
> WARNING: "__fentry__" [arch/x86/crypto/aes-x86_64.ko] has no CRC!
> CC arch/x86/crypto/aes-x86_64.mod.o
> CC arch/x86/crypto/aesni-intel.mod.o
> CC arch/x86/crypto/crc32-pclmul.mod.o
> CC arch/x86/crypto/crc32c-intel.mod.o
> (..)
>
> When reverting the entire pull with
>
> git diff 84d69848c97faab0c25aa2667b273404d2e2a64a
> d4d24d2d0a7ea3b62efd7336bfc2344e29b36bc5 | patch -p1
>
> everything is ok again.
>
> My system is a Debian Stretch.
> gcc version 6.2.0 20161010 (Debian 6.2.0-6)
>
> ..config is attached - in the case I have an unusual one from your
> perspective.
>
> Regards,
> Oliver

2016-11-07 19:10:20

by Vince Weaver

[permalink] [raw]
Subject: Re: 'kbuild' merge before 4.9-rc1 breaks build and boot

On Thu, 27 Oct 2016, Peter Wu wrote:

> I can confirm Olivers issue, the current mainline kernel fails to boot
> on kernels with CONFIG_MODVERSIONS=y. Bisection points to:
>
> commit 784d5699eddc55878627da20d3fe0c8542e2f1a2
> Author: Al Viro <[email protected]>
> Date: Mon Jan 11 11:04:34 2016 -0500
> > WARNING: "memset" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > WARNING: "__fentry__" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > WARNING: "memcpy" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > WARNING: "__sw_hweight32" [sound/usb/snd-usbmidi-lib.ko] has no CRC!

Has any progress been made with this problem?

I'm also encountering it on my debian-unstable box on any kernel more
recent than 4.9-rc1 (up to and including 4.9-rc4). I am glad someone
managed to isolate it as I was unable to get a clean bisect.

Vince

2016-11-07 21:39:47

by Peter Wu

[permalink] [raw]
Subject: Re: 'kbuild' merge before 4.9-rc1 breaks build and boot

On Mon, Nov 07, 2016 at 02:10:12PM -0500, Vince Weaver wrote:
> On Thu, 27 Oct 2016, Peter Wu wrote:
>
> > I can confirm Olivers issue, the current mainline kernel fails to boot
> > on kernels with CONFIG_MODVERSIONS=y. Bisection points to:
> >
> > commit 784d5699eddc55878627da20d3fe0c8542e2f1a2
> > Author: Al Viro <[email protected]>
> > Date: Mon Jan 11 11:04:34 2016 -0500
> > > WARNING: "memset" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > > WARNING: "__fentry__" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > > WARNING: "memcpy" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > > WARNING: "__sw_hweight32" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
>
> Has any progress been made with this problem?
>
> I'm also encountering it on my debian-unstable box on any kernel more
> recent than 4.9-rc1 (up to and including 4.9-rc4). I am glad someone
> managed to isolate it as I was unable to get a clean bisect.
>
> Vince

The original kbuild issue went in via
merge commit 84d69848c97faab0c25aa2667b273404d2e2a64a which notes:

- EXPORT_SYMBOL for asm source by Al Viro.

This does bring a regression, because genksyms no longer generates
checksums for these symbols (CONFIG_MODVERSIONS). Nick Piggin is
working on a patch to fix this.

Plus, we are talking about functions like strcpy(), which rarely
change prototypes.

Adding Nicholas in the cc, hopefully he can give a status update.

Kind regards,
Peter

2016-11-08 01:50:31

by Nicholas Piggin

[permalink] [raw]
Subject: Re: 'kbuild' merge before 4.9-rc1 breaks build and boot

On Mon, 7 Nov 2016 22:39:07 +0100
Peter Wu <[email protected]> wrote:

> On Mon, Nov 07, 2016 at 02:10:12PM -0500, Vince Weaver wrote:
> > On Thu, 27 Oct 2016, Peter Wu wrote:
> >
> > > I can confirm Olivers issue, the current mainline kernel fails to boot
> > > on kernels with CONFIG_MODVERSIONS=y. Bisection points to:
> > >
> > > commit 784d5699eddc55878627da20d3fe0c8542e2f1a2
> > > Author: Al Viro <[email protected]>
> > > Date: Mon Jan 11 11:04:34 2016 -0500
> > > > WARNING: "memset" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > > > WARNING: "__fentry__" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > > > WARNING: "memcpy" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > > > WARNING: "__sw_hweight32" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> >
> > Has any progress been made with this problem?
> >
> > I'm also encountering it on my debian-unstable box on any kernel more
> > recent than 4.9-rc1 (up to and including 4.9-rc4). I am glad someone
> > managed to isolate it as I was unable to get a clean bisect.
> >
> > Vince
>
> The original kbuild issue went in via
> merge commit 84d69848c97faab0c25aa2667b273404d2e2a64a which notes:
>
> - EXPORT_SYMBOL for asm source by Al Viro.
>
> This does bring a regression, because genksyms no longer generates
> checksums for these symbols (CONFIG_MODVERSIONS). Nick Piggin is
> working on a patch to fix this.
>
> Plus, we are talking about functions like strcpy(), which rarely
> change prototypes.
>
> Adding Nicholas in the cc, hopefully he can give a status update.

I think Michal has everything needed now for the kbuild bits. The arch
specific patches can go via arch trees quite easily (there is no hard
dependency either way). This is the kbuild bit:

https://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/commit/?h=rc-fixes&id=4efca4ed05cbdfd13ec3e8cb623fb77d6e4ab187

And it also needs this incremental bit not in Michal's tree yet:

---
scripts/Makefile.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 3e223c2..05c6bb4 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -332,7 +332,7 @@ cmd_gensymtypes_S = \
(echo "\#include <linux/kernel.h>" ; \
echo "\#include <asm/asm-prototypes.h>" ; \
$(CPP) $(a_flags) $< | \
- grep ^___EXPORT_SYMBOL | \
+ grep ___EXPORT_SYMBOL | \
sed 's/___EXPORT_SYMBOL \([a-zA-Z0-9_]*\),.*/EXPORT_SYMBOL(\1);/' ) | \
$(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
$(GENKSYMS) $(if $(1), -T $(2)) \
--
2.9.3

2016-11-20 18:26:57

by Peter Wu

[permalink] [raw]
Subject: Re: 'kbuild' merge before 4.9-rc1 breaks build and boot

Hi Nicholas,

Current git master (v4.9-rc5-364-g77079b1) with the latest kbuild fixes
is still failing to load modules when built with CONFIG_MODVERSIONS=y on
x86_64 using GCC 6.2.1.

It can still be reproduced with make defconfig, then enabling
CONFIG_MODVERSIONS=y. The build output contains:

WARNING: "memcpy" [net/netfilter/nf_nat.ko] has no CRC!
WARNING: "memmove" [net/netfilter/nf_nat.ko] has no CRC!
WARNING: "_copy_to_user" [fs/efivarfs/efivarfs.ko] has no CRC!
WARNING: "memcpy" [fs/efivarfs/efivarfs.ko] has no CRC!
WARNING: "_copy_from_user" [fs/efivarfs/efivarfs.ko] has no CRC!

$ grep 000000 Module.symvers
0x00000000 phys_base vmlinux EXPORT_SYMBOL
0x00000000 memmove vmlinux EXPORT_SYMBOL
0x00000000 __copy_user_nocache vmlinux EXPORT_SYMBOL
0x00000000 __get_user_4 vmlinux EXPORT_SYMBOL
0x00000000 __put_user_4 vmlinux EXPORT_SYMBOL
0x00000000 __memcpy vmlinux EXPORT_SYMBOL
0x00000000 memset vmlinux EXPORT_SYMBOL
0x00000000 __sw_hweight64 vmlinux EXPORT_SYMBOL
0x00000000 __sw_hweight32 vmlinux EXPORT_SYMBOL
0x00000000 memcpy_mcsafe_unrolled vmlinux EXPORT_SYMBOL_GPL
0x00000000 memcpy vmlinux EXPORT_SYMBOL
0x00000000 copy_user_enhanced_fast_string vmlinux EXPORT_SYMBOL
0x00000000 clear_page vmlinux EXPORT_SYMBOL
0x00000000 __put_user_2 vmlinux EXPORT_SYMBOL
0x00000000 __get_user_2 vmlinux EXPORT_SYMBOL
0x00000000 copy_page vmlinux EXPORT_SYMBOL
0x00000000 copy_user_generic_string vmlinux EXPORT_SYMBOL
0x00000000 _copy_to_user vmlinux EXPORT_SYMBOL
0x00000000 __memmove vmlinux EXPORT_SYMBOL
0x00000000 empty_zero_page vmlinux EXPORT_SYMBOL
0x00000000 __get_user_8 vmlinux EXPORT_SYMBOL
0x00000000 __put_user_8 vmlinux EXPORT_SYMBOL
0x00000000 _copy_from_user vmlinux EXPORT_SYMBOL
0x00000000 native_load_gs_index vmlinux EXPORT_SYMBOL
0x00000000 __memset vmlinux EXPORT_SYMBOL
0x00000000 __put_user_1 vmlinux EXPORT_SYMBOL
0x00000000 __get_user_1 vmlinux EXPORT_SYMBOL
0x00000000 copy_user_generic_unrolled vmlinux EXPORT_SYMBOL

Kind regards,
Peter

On Tue, Nov 08, 2016 at 12:33:34PM +1100, Nicholas Piggin wrote:
> On Mon, 7 Nov 2016 22:39:07 +0100
> Peter Wu <[email protected]> wrote:
>
> > On Mon, Nov 07, 2016 at 02:10:12PM -0500, Vince Weaver wrote:
> > > On Thu, 27 Oct 2016, Peter Wu wrote:
> > >
> > > > I can confirm Olivers issue, the current mainline kernel fails to boot
> > > > on kernels with CONFIG_MODVERSIONS=y. Bisection points to:
> > > >
> > > > commit 784d5699eddc55878627da20d3fe0c8542e2f1a2
> > > > Author: Al Viro <[email protected]>
> > > > Date: Mon Jan 11 11:04:34 2016 -0500
> > > > > WARNING: "memset" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > > > > WARNING: "__fentry__" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > > > > WARNING: "memcpy" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > > > > WARNING: "__sw_hweight32" [sound/usb/snd-usbmidi-lib.ko] has no CRC!
> > >
> > > Has any progress been made with this problem?
> > >
> > > I'm also encountering it on my debian-unstable box on any kernel more
> > > recent than 4.9-rc1 (up to and including 4.9-rc4). I am glad someone
> > > managed to isolate it as I was unable to get a clean bisect.
> > >
> > > Vince
> >
> > The original kbuild issue went in via
> > merge commit 84d69848c97faab0c25aa2667b273404d2e2a64a which notes:
> >
> > - EXPORT_SYMBOL for asm source by Al Viro.
> >
> > This does bring a regression, because genksyms no longer generates
> > checksums for these symbols (CONFIG_MODVERSIONS). Nick Piggin is
> > working on a patch to fix this.
> >
> > Plus, we are talking about functions like strcpy(), which rarely
> > change prototypes.
> >
> > Adding Nicholas in the cc, hopefully he can give a status update.
>
> I think Michal has everything needed now for the kbuild bits. The arch
> specific patches can go via arch trees quite easily (there is no hard
> dependency either way). This is the kbuild bit:
>
> https://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/commit/?h=rc-fixes&id=4efca4ed05cbdfd13ec3e8cb623fb77d6e4ab187
>
> And it also needs this incremental bit not in Michal's tree yet:
>
> ---
> scripts/Makefile.build | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 3e223c2..05c6bb4 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -332,7 +332,7 @@ cmd_gensymtypes_S = \
> (echo "\#include <linux/kernel.h>" ; \
> echo "\#include <asm/asm-prototypes.h>" ; \
> $(CPP) $(a_flags) $< | \
> - grep ^___EXPORT_SYMBOL | \
> + grep ___EXPORT_SYMBOL | \
> sed 's/___EXPORT_SYMBOL \([a-zA-Z0-9_]*\),.*/EXPORT_SYMBOL(\1);/' ) | \
> $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
> $(GENKSYMS) $(if $(1), -T $(2)) \
> --
> 2.9.3
>

2016-11-21 05:50:01

by Nicholas Piggin

[permalink] [raw]
Subject: Re: 'kbuild' merge before 4.9-rc1 breaks build and boot

On Sun, 20 Nov 2016 19:26:23 +0100
Peter Wu <[email protected]> wrote:

> Hi Nicholas,
>
> Current git master (v4.9-rc5-364-g77079b1) with the latest kbuild fixes
> is still failing to load modules when built with CONFIG_MODVERSIONS=y on
> x86_64 using GCC 6.2.1.
>
> It can still be reproduced with make defconfig, then enabling
> CONFIG_MODVERSIONS=y. The build output contains:
>
> WARNING: "memcpy" [net/netfilter/nf_nat.ko] has no CRC!
> WARNING: "memmove" [net/netfilter/nf_nat.ko] has no CRC!
> WARNING: "_copy_to_user" [fs/efivarfs/efivarfs.ko] has no CRC!
> WARNING: "memcpy" [fs/efivarfs/efivarfs.ko] has no CRC!
> WARNING: "_copy_from_user" [fs/efivarfs/efivarfs.ko] has no CRC!

Hi Peter,

Sorry it's taken some time, bear with us. The arch specific patches need
to be merged now. Adam, what is the status of your patch? Please submit
to x86 maintainers if you haven't already.

Thanks,
Nick

2016-11-21 06:41:09

by Adam Borowski

[permalink] [raw]
Subject: [PATCH resend] kbuild: provide include/asm/asm-prototypes.h for x86

Nicholas Piggin wrote:
> Architectures will need to have an include/asm/asm-prototypes.h that
> defines or #include<>s C-style prototypes for exported asm functions.
> We can do an asm-generic version for the common ones like memset so
> there's not a lot of pointless duplication there.

Signed-off-by: Adam Borowski <[email protected]>
Tested-by: Kalle Valo <[email protected]>
---
arch/x86/include/asm/asm-prototypes.h | 12 ++++++++++++
include/asm-generic/asm-prototypes.h | 7 +++++++
2 files changed, 19 insertions(+)
create mode 100644 arch/x86/include/asm/asm-prototypes.h
create mode 100644 include/asm-generic/asm-prototypes.h

diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h
new file mode 100644
index 0000000..ae87224
--- /dev/null
+++ b/arch/x86/include/asm/asm-prototypes.h
@@ -0,0 +1,12 @@
+#include <asm/ftrace.h>
+#include <asm/uaccess.h>
+#include <asm/string.h>
+#include <asm/page.h>
+#include <asm/checksum.h>
+
+#include <asm-generic/asm-prototypes.h>
+
+#include <asm/page.h>
+#include <asm/pgtable.h>
+#include <asm/special_insns.h>
+#include <asm/preempt.h>
diff --git a/include/asm-generic/asm-prototypes.h b/include/asm-generic/asm-prototypes.h
new file mode 100644
index 0000000..df13637
--- /dev/null
+++ b/include/asm-generic/asm-prototypes.h
@@ -0,0 +1,7 @@
+#include <linux/bitops.h>
+extern void *__memset(void *, int, __kernel_size_t);
+extern void *__memcpy(void *, const void *, __kernel_size_t);
+extern void *__memmove(void *, const void *, __kernel_size_t);
+extern void *memset(void *, int, __kernel_size_t);
+extern void *memcpy(void *, const void *, __kernel_size_t);
+extern void *memmove(void *, const void *, __kernel_size_t);
--
2.10.2

Nicholas Piggin wrote:
> On Sun, 20 Nov 2016 19:26:23 +0100 Peter Wu <[email protected]> wrote:
>
>> Current git master (v4.9-rc5-364-g77079b1) with the latest kbuild fixes
>> is still failing to load modules when built with CONFIG_MODVERSIONS=y on
>> x86_64 using GCC 6.2.1.
>>
>> It can still be reproduced with make defconfig, then enabling
>> CONFIG_MODVERSIONS=y. The build output contains:
>>
>> WARNING: "memcpy" [net/netfilter/nf_nat.ko] has no CRC!
>> WARNING: "memmove" [net/netfilter/nf_nat.ko] has no CRC!
>> WARNING: "_copy_to_user" [fs/efivarfs/efivarfs.ko] has no CRC!
>> WARNING: "memcpy" [fs/efivarfs/efivarfs.ko] has no CRC!
>> WARNING: "_copy_from_user" [fs/efivarfs/efivarfs.ko] has no CRC!
>
> Sorry it's taken some time, bear with us. The arch specific patches need
> to be merged now. Adam, what is the status of your patch? Please submit
> to x86 maintainers if you haven't already.

I've re-checked against 4.9-rc6.

It'd probably fit better with kbuild parts, but it's up to you to decide;
I'm sending to x86 guys as you wish.


Meow!

2016-11-21 07:27:32

by Nicholas Piggin

[permalink] [raw]
Subject: Re: [PATCH resend] kbuild: provide include/asm/asm-prototypes.h for x86

Hi Adam,

Thanks. I'd suggest doing x86: or x86/kbuild: prefix for the patch. Also
possibly consider describing what the patch does at a higher level in your
subject line, e.g.:

x86/kbuild: enable modversions for symbols exported from asm

Also, it wouldn't hurt to add a little changelog of your own. Describe
problem then solution, e.g.,

Commit 4efca4ed ("kbuild: modversions for EXPORT_SYMBOL() for asm") adds
modversion support for symbols exported from asm files. Architectures
must include C-style declarations for those symbols in asm/asm-prototypes.h
in order for them to be versioned.

Add these declarations for x86, and an architecture-independent file that
can be used for common symbols.

(if you want to use that as-is or rewrite it, no problem).

You can add Acked-by: Nicholas Piggin <[email protected]>

Also it's not a big deal, but if you redo the patch, you could consider
splitting it into two (first add the generic header, then the x86 header),
but both can go via the x86 tree.

Thanks,
Nick

On Mon, 21 Nov 2016 07:39:45 +0100
Adam Borowski <[email protected]> wrote:

> Nicholas Piggin wrote:
> > Architectures will need to have an include/asm/asm-prototypes.h that
> > defines or #include<>s C-style prototypes for exported asm functions.
> > We can do an asm-generic version for the common ones like memset so
> > there's not a lot of pointless duplication there.
>
> Signed-off-by: Adam Borowski <[email protected]>
> Tested-by: Kalle Valo <[email protected]>
> ---
> arch/x86/include/asm/asm-prototypes.h | 12 ++++++++++++
> include/asm-generic/asm-prototypes.h | 7 +++++++
> 2 files changed, 19 insertions(+)
> create mode 100644 arch/x86/include/asm/asm-prototypes.h
> create mode 100644 include/asm-generic/asm-prototypes.h
>
> diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h
> new file mode 100644
> index 0000000..ae87224
> --- /dev/null
> +++ b/arch/x86/include/asm/asm-prototypes.h
> @@ -0,0 +1,12 @@
> +#include <asm/ftrace.h>
> +#include <asm/uaccess.h>
> +#include <asm/string.h>
> +#include <asm/page.h>
> +#include <asm/checksum.h>
> +
> +#include <asm-generic/asm-prototypes.h>
> +
> +#include <asm/page.h>
> +#include <asm/pgtable.h>
> +#include <asm/special_insns.h>
> +#include <asm/preempt.h>
> diff --git a/include/asm-generic/asm-prototypes.h b/include/asm-generic/asm-prototypes.h
> new file mode 100644
> index 0000000..df13637
> --- /dev/null
> +++ b/include/asm-generic/asm-prototypes.h
> @@ -0,0 +1,7 @@
> +#include <linux/bitops.h>
> +extern void *__memset(void *, int, __kernel_size_t);
> +extern void *__memcpy(void *, const void *, __kernel_size_t);
> +extern void *__memmove(void *, const void *, __kernel_size_t);
> +extern void *memset(void *, int, __kernel_size_t);
> +extern void *memcpy(void *, const void *, __kernel_size_t);
> +extern void *memmove(void *, const void *, __kernel_size_t);

2016-11-21 08:01:31

by Peter Wu

[permalink] [raw]
Subject: Re: [PATCH resend] kbuild: provide include/asm/asm-prototypes.h for x86

On Mon, Nov 21, 2016 at 06:27:14PM +1100, Nicholas Piggin wrote:
> Hi Adam,
>
> Thanks. I'd suggest doing x86: or x86/kbuild: prefix for the patch. Also
> possibly consider describing what the patch does at a higher level in your
> subject line, e.g.:
>
> x86/kbuild: enable modversions for symbols exported from asm
>
> Also, it wouldn't hurt to add a little changelog of your own. Describe
> problem then solution, e.g.,
>
> Commit 4efca4ed ("kbuild: modversions for EXPORT_SYMBOL() for asm") adds
> modversion support for symbols exported from asm files. Architectures
> must include C-style declarations for those symbols in asm/asm-prototypes.h
> in order for them to be versioned.
>
> Add these declarations for x86, and an architecture-independent file that
> can be used for common symbols.
>
> (if you want to use that as-is or rewrite it, no problem).
>
> You can add Acked-by: Nicholas Piggin <[email protected]>

Hi Adam, Nicholas,

Thanks for the patch! I have confirmed that this fixes the defconfig and
the normal .config build I use for debugging, so:

Tested-by: Peter Wu <[email protected]>

It might also be worth to mention in the changelog the user impact,
namely that kernels may fail to load modules at all when
CONFIG_MODVERSIONS=y.

Kind regards,
Peter

> Also it's not a big deal, but if you redo the patch, you could consider
> splitting it into two (first add the generic header, then the x86 header),
> but both can go via the x86 tree.
>
> Thanks,
> Nick
>
> On Mon, 21 Nov 2016 07:39:45 +0100
> Adam Borowski <[email protected]> wrote:
>
> > Nicholas Piggin wrote:
> > > Architectures will need to have an include/asm/asm-prototypes.h that
> > > defines or #include<>s C-style prototypes for exported asm functions.
> > > We can do an asm-generic version for the common ones like memset so
> > > there's not a lot of pointless duplication there.
> >
> > Signed-off-by: Adam Borowski <[email protected]>
> > Tested-by: Kalle Valo <[email protected]>
> > ---
> > arch/x86/include/asm/asm-prototypes.h | 12 ++++++++++++
> > include/asm-generic/asm-prototypes.h | 7 +++++++
> > 2 files changed, 19 insertions(+)
> > create mode 100644 arch/x86/include/asm/asm-prototypes.h
> > create mode 100644 include/asm-generic/asm-prototypes.h
> >
> > diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h
> > new file mode 100644
> > index 0000000..ae87224
> > --- /dev/null
> > +++ b/arch/x86/include/asm/asm-prototypes.h
> > @@ -0,0 +1,12 @@
> > +#include <asm/ftrace.h>
> > +#include <asm/uaccess.h>
> > +#include <asm/string.h>
> > +#include <asm/page.h>
> > +#include <asm/checksum.h>
> > +
> > +#include <asm-generic/asm-prototypes.h>
> > +
> > +#include <asm/page.h>
> > +#include <asm/pgtable.h>
> > +#include <asm/special_insns.h>
> > +#include <asm/preempt.h>
> > diff --git a/include/asm-generic/asm-prototypes.h b/include/asm-generic/asm-prototypes.h
> > new file mode 100644
> > index 0000000..df13637
> > --- /dev/null
> > +++ b/include/asm-generic/asm-prototypes.h
> > @@ -0,0 +1,7 @@
> > +#include <linux/bitops.h>
> > +extern void *__memset(void *, int, __kernel_size_t);
> > +extern void *__memcpy(void *, const void *, __kernel_size_t);
> > +extern void *__memmove(void *, const void *, __kernel_size_t);
> > +extern void *memset(void *, int, __kernel_size_t);
> > +extern void *memcpy(void *, const void *, __kernel_size_t);
> > +extern void *memmove(void *, const void *, __kernel_size_t);
>

2016-11-21 14:54:24

by Adam Borowski

[permalink] [raw]
Subject: [PATCH reworded] x86/kbuild: enable modversions for symbols exported from asm

Commit 4efca4ed ("kbuild: modversions for EXPORT_SYMBOL() for asm") adds
modversion support for symbols exported from asm files. Architectures
must include C-style declarations for those symbols in asm/asm-prototypes.h
in order for them to be versioned.

Add these declarations for x86, and an architecture-independent file that
can be used for common symbols.

User impact: kernels may fail to load modules at all when
CONFIG_MODVERSIONS=y.

Signed-off-by: Adam Borowski <[email protected]>
Tested-by: Kalle Valo <[email protected]>
Acked-by: Nicholas Piggin <[email protected]>
Tested-by: Peter Wu <[email protected]>
---
arch/x86/include/asm/asm-prototypes.h | 12 ++++++++++++
include/asm-generic/asm-prototypes.h | 7 +++++++
2 files changed, 19 insertions(+)
create mode 100644 arch/x86/include/asm/asm-prototypes.h
create mode 100644 include/asm-generic/asm-prototypes.h

diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h
new file mode 100644
index 0000000..ae87224
--- /dev/null
+++ b/arch/x86/include/asm/asm-prototypes.h
@@ -0,0 +1,12 @@
+#include <asm/ftrace.h>
+#include <asm/uaccess.h>
+#include <asm/string.h>
+#include <asm/page.h>
+#include <asm/checksum.h>
+
+#include <asm-generic/asm-prototypes.h>
+
+#include <asm/page.h>
+#include <asm/pgtable.h>
+#include <asm/special_insns.h>
+#include <asm/preempt.h>
diff --git a/include/asm-generic/asm-prototypes.h b/include/asm-generic/asm-prototypes.h
new file mode 100644
index 0000000..df13637
--- /dev/null
+++ b/include/asm-generic/asm-prototypes.h
@@ -0,0 +1,7 @@
+#include <linux/bitops.h>
+extern void *__memset(void *, int, __kernel_size_t);
+extern void *__memcpy(void *, const void *, __kernel_size_t);
+extern void *__memmove(void *, const void *, __kernel_size_t);
+extern void *memset(void *, int, __kernel_size_t);
+extern void *memcpy(void *, const void *, __kernel_size_t);
+extern void *memmove(void *, const void *, __kernel_size_t);
--
2.10.2

Now with a better description, provided by Nick Piggin (thanks!), and a
remark about user impact.

This version doesn't split the patch between x86 vs generic parts, would you
guys prefer that?

2016-11-21 15:07:00

by Peter Wu

[permalink] [raw]
Subject: Re: [PATCH reworded] x86/kbuild: enable modversions for symbols exported from asm

On Mon, Nov 21, 2016 at 03:52:20PM +0100, Adam Borowski wrote:
> Commit 4efca4ed ("kbuild: modversions for EXPORT_SYMBOL() for asm") adds
> modversion support for symbols exported from asm files. Architectures
> must include C-style declarations for those symbols in asm/asm-prototypes.h
> in order for them to be versioned.
>
> Add these declarations for x86, and an architecture-independent file that
> can be used for common symbols.
>
> User impact: kernels may fail to load modules at all when
> CONFIG_MODVERSIONS=y.
>
> Signed-off-by: Adam Borowski <[email protected]>
> Tested-by: Kalle Valo <[email protected]>
> Acked-by: Nicholas Piggin <[email protected]>
> Tested-by: Peter Wu <[email protected]>

Typo: oeter@.. -> peter@..

> ---
> arch/x86/include/asm/asm-prototypes.h | 12 ++++++++++++
> include/asm-generic/asm-prototypes.h | 7 +++++++
> 2 files changed, 19 insertions(+)
> create mode 100644 arch/x86/include/asm/asm-prototypes.h
> create mode 100644 include/asm-generic/asm-prototypes.h
>
> diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h
> new file mode 100644
> index 0000000..ae87224
> --- /dev/null
> +++ b/arch/x86/include/asm/asm-prototypes.h
> @@ -0,0 +1,12 @@
> +#include <asm/ftrace.h>
> +#include <asm/uaccess.h>
> +#include <asm/string.h>
> +#include <asm/page.h>
> +#include <asm/checksum.h>
> +
> +#include <asm-generic/asm-prototypes.h>
> +
> +#include <asm/page.h>
> +#include <asm/pgtable.h>
> +#include <asm/special_insns.h>
> +#include <asm/preempt.h>
> diff --git a/include/asm-generic/asm-prototypes.h b/include/asm-generic/asm-prototypes.h
> new file mode 100644
> index 0000000..df13637
> --- /dev/null
> +++ b/include/asm-generic/asm-prototypes.h
> @@ -0,0 +1,7 @@
> +#include <linux/bitops.h>
> +extern void *__memset(void *, int, __kernel_size_t);
> +extern void *__memcpy(void *, const void *, __kernel_size_t);
> +extern void *__memmove(void *, const void *, __kernel_size_t);
> +extern void *memset(void *, int, __kernel_size_t);
> +extern void *memcpy(void *, const void *, __kernel_size_t);
> +extern void *memmove(void *, const void *, __kernel_size_t);
> --
> 2.10.2
>
> Now with a better description, provided by Nick Piggin (thanks!), and a
> remark about user impact.
>
> This version doesn't split the patch between x86 vs generic parts, would you
> guys prefer that?

>From an observer POV: based on the git log include/asm-generic/
arch/x86/include/asm/, a split up seems quite common.

By the way, to make the description and discussion closer, you might
want to structure your mail like this:

[patch description]
---
[discussion]
---
[actual patch]

When applying the patch, the text after the first "---" is automatically
dropped.

Thanks!

Kind regards,
Peter

2016-11-21 16:54:35

by Oliver Hartkopp

[permalink] [raw]
Subject: Re: [PATCH reworded] x86/kbuild: enable modversions for symbols exported from asm



On 11/21/2016 03:52 PM, Adam Borowski wrote:
> Commit 4efca4ed ("kbuild: modversions for EXPORT_SYMBOL() for asm") adds
> modversion support for symbols exported from asm files. Architectures
> must include C-style declarations for those symbols in asm/asm-prototypes.h
> in order for them to be versioned.
>
> Add these declarations for x86, and an architecture-independent file that
> can be used for common symbols.
>
> User impact: kernels may fail to load modules at all when
> CONFIG_MODVERSIONS=y.

late but great :-)

Thanks for fixing this!

Tested-by: Oliver Hartkopp <[email protected]>

(if you like)

Regards,
Oliver

>
> Signed-off-by: Adam Borowski <[email protected]>
> Tested-by: Kalle Valo <[email protected]>
> Acked-by: Nicholas Piggin <[email protected]>
> Tested-by: Peter Wu <[email protected]>
> ---
> arch/x86/include/asm/asm-prototypes.h | 12 ++++++++++++
> include/asm-generic/asm-prototypes.h | 7 +++++++
> 2 files changed, 19 insertions(+)
> create mode 100644 arch/x86/include/asm/asm-prototypes.h
> create mode 100644 include/asm-generic/asm-prototypes.h
>
> diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h
> new file mode 100644
> index 0000000..ae87224
> --- /dev/null
> +++ b/arch/x86/include/asm/asm-prototypes.h
> @@ -0,0 +1,12 @@
> +#include <asm/ftrace.h>
> +#include <asm/uaccess.h>
> +#include <asm/string.h>
> +#include <asm/page.h>
> +#include <asm/checksum.h>
> +
> +#include <asm-generic/asm-prototypes.h>
> +
> +#include <asm/page.h>
> +#include <asm/pgtable.h>
> +#include <asm/special_insns.h>
> +#include <asm/preempt.h>
> diff --git a/include/asm-generic/asm-prototypes.h b/include/asm-generic/asm-prototypes.h
> new file mode 100644
> index 0000000..df13637
> --- /dev/null
> +++ b/include/asm-generic/asm-prototypes.h
> @@ -0,0 +1,7 @@
> +#include <linux/bitops.h>
> +extern void *__memset(void *, int, __kernel_size_t);
> +extern void *__memcpy(void *, const void *, __kernel_size_t);
> +extern void *__memmove(void *, const void *, __kernel_size_t);
> +extern void *memset(void *, int, __kernel_size_t);
> +extern void *memcpy(void *, const void *, __kernel_size_t);
> +extern void *memmove(void *, const void *, __kernel_size_t);
>