jump label: fix passing kbuild_cflags when checking for asm goto support
PATCH 1/1 jump label: fix passing kbuild_cflags when checking for asm goto support
The latest change of asm goto support check added passing of KBUILD_CFLAGS to compiler. When these flags reference gcc plugins, there is a race condition between the build of these plugins and their use in this asm goto support check.
This change moves the check before all these references are added to KBUILD_CFLAGS. This is correct because subsequent KBUILD_CFLAGS modifications are not relevant to this check.
--- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Makefile +6 -6
@@ -653,6 +653,12 @@ KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) +# check for 'asm goto' +ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) + KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO + KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO +endif + include scripts/Makefile.gcc-plugins ifdef CONFIG_READABLE_ASM
@@ -798,12 +804,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D) -# check for 'asm goto' -ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) - KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO - KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO -endif - include scripts/Makefile.kasan include scripts/Makefile.extrawarn include scripts/Makefile.ubsan
Signature · 1 line
glebfm
Quoted 8 lines · On Fri, 10 Mar 2017 19:24:18 +0300 Gleb Fotengauer-Malinovskiy…
The latest change of asm goto support check added passing of
KBUILD_CFLAGSto compiler. When these flags reference gcc plugins, there is a race condition between the build of these plugins and their use in this asm goto support check.This change moves the check before all these references are added to
KBUILD_CFLAGS. This is correct because subsequentKBUILD_CFLAGSmodifications are not relevant to this check.
What exactly breaks when the race happens?
-- Steve
Quoted 41 lines
Reported-by Anton V. Boyarshinov <[email protected]>Fixes 35f860f9ba6a ("jump label: pass kbuild_cflags when checking for asm goto support")Cc [email protected] # v4.10Signed-off-by Gleb Fotengauer-Malinovskiy <[email protected]>Signed-off-by Dmitry V. Levin <[email protected]>--- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)Makefile +6
-6@@ -653,6 +653,12 @@ KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) +# check for 'asm goto' +ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) + KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO + KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO +endif + include scripts/Makefile.gcc-plugins ifdef CONFIG_READABLE_ASM@@ -798,12 +804,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D) -# check for 'asm goto' -ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) - KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO - KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO -endif - include scripts/Makefile.kasan include scripts/Makefile.extrawarn include scripts/Makefile.ubsan
Quoted 8 lines · Steven Rostedt
Quoted 5 lines · On Fri, 10 Mar 2017 19:24:18 +0300 Gleb Fotengauer-Malinovskiy…
The latest change of asm goto support check added passing of
KBUILD_CFLAGSto compiler. When these flags reference gcc plugins, there is a race condition between the build of these plugins and their use in this asm goto support check.
Quoted 5 lines
Quoted 3 lines
This change moves the check before all these references are added to
KBUILD_CFLAGS. This is correct because subsequentKBUILD_CFLAGSmodifications are not relevant to this check.What exactly breaks when the race happens?
Actually, this is not quite a race. When you run "make bzImage" followed by "make modules", the kernel is always built with HAVE_JUMP_LABEL disabled, while the modules are built depending on CONFIG_JUMP_LABEL. If HAVE_JUMP_LABEL macro happens to be different, modules are built with undefined references:
ERROR: "static_key_slow_inc" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/nft_meta.ko] undefined!
ERROR: "static_key_slow_inc" [net/netfilter/nft_meta.ko] undefined!
ERROR: "nf_hooks_needed" [net/netfilter/ipvs/ip_vs.ko] undefined!
ERROR: "nf_hooks_needed" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_count" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_slow_inc" [net/ipv6/ipv6.ko] undefined!
ERROR: "nf_hooks_needed" [net/decnet/decnet.ko] undefined!
Signature · 1 line
glebfm
Quoted 21 lines · On Fri, 10 Mar 2017 20:39:52 +0300 Gleb Fotengauer-Malinovskiy…
Quoted 8 lines · Steven Rostedt
Quoted 5 lines · On Fri, 10 Mar 2017 19:24:18 +0300 Gleb Fotengauer-Malinovskiy…
The latest change of asm goto support check added passing of
KBUILD_CFLAGSto compiler. When these flags reference gcc plugins, there is a race condition between the build of these plugins and their use in this asm goto support check.Quoted 5 lines
Quoted 3 lines
This change moves the check before all these references are added to
KBUILD_CFLAGS. This is correct because subsequentKBUILD_CFLAGSmodifications are not relevant to this check.What exactly breaks when the race happens?
Actually, this is not quite a race. When you run "make bzImage" followed by "make modules", the kernel is always built with
HAVE_JUMP_LABELdisabled, while the modules are built depending onCONFIG_JUMP_LABEL. IfHAVE_JUMP_LABELmacro happens to be different, modules are built with undefined references:
Quoted 10 lines
ERROR: "
static_key_slow_inc" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/nft_meta.ko] undefined!
ERROR: "static_key_slow_inc" [net/netfilter/nft_meta.ko] undefined!
ERROR: "nf_hooks_needed" [net/netfilter/ipvs/ip_vs.ko] undefined!
ERROR: "nf_hooks_needed" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_count" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_slow_inc" [net/ipv6/ipv6.ko] undefined!
ERROR: "nf_hooks_needed" [net/decnet/decnet.ko] undefined!
Can you add the above info in the change log and repost?
Thanks,
-- Steve
PATCH v2 1/1 jump label: fix passing kbuild_cflags when checking for asm goto support
The latest change of asm goto support check added passing of KBUILD_CFLAGS to compiler. When these flags reference gcc plugins that are not built yet, the check fails.
When one runs "make bzImage" followed by "make modules", the kernel is always built with HAVE_JUMP_LABEL disabled, while the modules are built depending on CONFIG_JUMP_LABEL. If HAVE_JUMP_LABEL macro happens to be different, modules are built with undefined references, e.g.:
ERROR: "static_key_slow_inc" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/nft_meta.ko] undefined!
ERROR: "static_key_slow_inc" [net/netfilter/nft_meta.ko] undefined!
ERROR: "nf_hooks_needed" [net/netfilter/ipvs/ip_vs.ko] undefined!
ERROR: "nf_hooks_needed" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_count" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_slow_inc" [net/ipv6/ipv6.ko] undefined!
This change moves the check before all these references are added to KBUILD_CFLAGS. This is correct because subsequent KBUILD_CFLAGS modifications are not relevant to this check.
---
v2: update description of the problem fixed by this patch
Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Makefile +6 -6
@@ -653,6 +653,12 @@ KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) +# check for 'asm goto' +ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) + KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO + KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO +endif + include scripts/Makefile.gcc-plugins ifdef CONFIG_READABLE_ASM
@@ -798,12 +804,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D) -# check for 'asm goto' -ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) - KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO - KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO -endif - include scripts/Makefile.kasan include scripts/Makefile.extrawarn include scripts/Makefile.ubsan
Signature · 1 line
glebfm
Andrew, want to take this through your tree?
Thanks,
-- Steve
Quoted 63 lines · On Fri, 10 Mar 2017 20:55:36 +0300 Gleb Fotengauer-Malinovskiy…
The latest change of asm goto support check added passing of
KBUILD_CFLAGSto compiler. When these flags reference gcc plugins that are not built yet, the check fails.When one runs "make bzImage" followed by "make modules", the kernel is always built with
HAVE_JUMP_LABELdisabled, while the modules are built depending onCONFIG_JUMP_LABEL. IfHAVE_JUMP_LABELmacro happens to be different, modules are built with undefined references, e.g.:ERROR: "
static_key_slow_inc" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/nft_meta.ko] undefined!
ERROR: "static_key_slow_inc" [net/netfilter/nft_meta.ko] undefined!
ERROR: "nf_hooks_needed" [net/netfilter/ipvs/ip_vs.ko] undefined!
ERROR: "nf_hooks_needed" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_count" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_slow_inc" [net/ipv6/ipv6.ko] undefined!This change moves the check before all these references are added to
KBUILD_CFLAGS. This is correct because subsequentKBUILD_CFLAGSmodifications are not relevant to this check.Reported-by Anton V. Boyarshinov <[email protected]>Fixes 35f860f9ba6a ("jump label: pass kbuild_cflags when checking for asm goto support")Cc [email protected] # v4.10Signed-off-by Gleb Fotengauer-Malinovskiy <[email protected]>Signed-off-by Dmitry V. Levin <[email protected]>---
v2: update description of the problem fixed by this patchMakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)Makefile +6
-6@@ -653,6 +653,12 @@ KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) +# check for 'asm goto' +ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) + KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO + KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO +endif + include scripts/Makefile.gcc-plugins ifdef CONFIG_READABLE_ASM@@ -798,12 +804,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D) -# check for 'asm goto' -ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) - KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO - KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO -endif - include scripts/Makefile.kasan include scripts/Makefile.extrawarn include scripts/Makefile.ubsan
Quoted 23 lines · Gleb Fotengauer-Malinovskiy
The latest change of asm goto support check added passing of
KBUILD_CFLAGSto compiler. When these flags reference gcc plugins that are not built yet, the check fails.When one runs "make bzImage" followed by "make modules", the kernel is always built with
HAVE_JUMP_LABELdisabled, while the modules are built depending onCONFIG_JUMP_LABEL. IfHAVE_JUMP_LABELmacro happens to be different, modules are built with undefined references, e.g.:ERROR: "
static_key_slow_inc" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/nft_meta.ko] undefined!
ERROR: "static_key_slow_inc" [net/netfilter/nft_meta.ko] undefined!
ERROR: "nf_hooks_needed" [net/netfilter/ipvs/ip_vs.ko] undefined!
ERROR: "nf_hooks_needed" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_count" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_slow_inc" [net/ipv6/ipv6.ko] undefined!This change moves the check before all these references are added to
KBUILD_CFLAGS. This is correct because subsequentKBUILD_CFLAGSmodifications are not relevant to this check.
Quoted 6 lines
Reported-by Anton V. Boyarshinov <[email protected]>Fixes 35f860f9ba6a ("jump label: pass kbuild_cflags when checking for asm goto support")Cc [email protected] # v4.10Signed-off-by Gleb Fotengauer-Malinovskiy <[email protected]>Signed-off-by Dmitry V. Levin <[email protected]>---
PATCH v2 1/1 jump label: fix passing kbuild_cflags when checking for asm goto support
In reply to Gleb Fotengauer-MalinovskiyThe latest change of asm goto support check added passing of KBUILD_CFLAGS to compiler. When these flags reference gcc plugins that are not built yet, the check fails.
When one runs "make bzImage" followed by "make modules", the kernel is always built with HAVE_JUMP_LABEL disabled, while the modules are built depending on CONFIG_JUMP_LABEL. If HAVE_JUMP_LABEL macro happens to be different, modules are built with undefined references, e.g.:
ERROR: "static_key_slow_inc" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/nft_meta.ko] undefined!
ERROR: "static_key_slow_inc" [net/netfilter/nft_meta.ko] undefined!
ERROR: "nf_hooks_needed" [net/netfilter/ipvs/ip_vs.ko] undefined!
ERROR: "nf_hooks_needed" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_count" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_slow_inc" [net/ipv6/ipv6.ko] undefined!
This change moves the check before all these references are added to KBUILD_CFLAGS. This is correct because subsequent KBUILD_CFLAGS modifications are not relevant to this check.
---
v2: update description of the problem fixed by this patch
Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Makefile +6 -6
@@ -653,6 +653,12 @@ KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) +# check for 'asm goto' +ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) + KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO + KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO +endif + include scripts/Makefile.gcc-plugins ifdef CONFIG_READABLE_ASM
@@ -798,12 +804,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D) -# check for 'asm goto' -ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) - KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO - KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO -endif - include scripts/Makefile.kasan include scripts/Makefile.extrawarn include scripts/Makefile.ubsan
Signature · 1 line
glebfm
2017-03-21 2:15 GMT+09:00 Gleb Fotengauer-Malinovskiy <[email protected]>:
Quoted 29 lines
The latest change of asm goto support check added passing of
KBUILD_CFLAGSto compiler. When these flags reference gcc plugins that are not built yet, the check fails.When one runs "make bzImage" followed by "make modules", the kernel is always built with
HAVE_JUMP_LABELdisabled, while the modules are built depending onCONFIG_JUMP_LABEL. IfHAVE_JUMP_LABELmacro happens to be different, modules are built with undefined references, e.g.:ERROR: "
static_key_slow_inc" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/xt_TEE.ko] undefined!
ERROR: "static_key_slow_dec" [net/netfilter/nft_meta.ko] undefined!
ERROR: "static_key_slow_inc" [net/netfilter/nft_meta.ko] undefined!
ERROR: "nf_hooks_needed" [net/netfilter/ipvs/ip_vs.ko] undefined!
ERROR: "nf_hooks_needed" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_count" [net/ipv6/ipv6.ko] undefined!
ERROR: "static_key_slow_inc" [net/ipv6/ipv6.ko] undefined!This change moves the check before all these references are added to
KBUILD_CFLAGS. This is correct because subsequentKBUILD_CFLAGSmodifications are not relevant to this check.Reported-by Anton V. Boyarshinov <[email protected]>Fixes 35f860f9ba6a ("jump label: pass kbuild_cflags when checking for asm goto support")Cc [email protected] # v4.10Signed-off-by Gleb Fotengauer-Malinovskiy <[email protected]>Signed-off-by Dmitry V. Levin <[email protected]>Acked-by David Lin <[email protected]>
Quoted 3 lines
---
v2: update description of the problem fixed by this patch
I assume this PING is addressed to me.
First, Steven asked Andrew to pick up this,
but I have not seen it in linux-next yet. So,
Applied to linux-kbuild/fixes. Thanks!
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 7 lines · On Wed, 22 Mar 2017 02:48:44 +0900 Masahiro Yamada…
I assume this PING is addressed to me.
First, Steven asked Andrew to pick up this,
but I have not seen it in linux-next yet. So,Applied to linux-kbuild/fixes. Thanks!
Thanks Masahiro!
-- Steve