linux-next: build failure after merge of the mm-nonmm-unstable tree
Subsystems (2)
Hi all,
After merging the mm-nonmm-unstable tree, today's linux-next build (x86_64 allmodconfig) failed like this:
x86_64-linux-gnu-ld: error: unplaced orphan section __bug_table' from arch/x86/boot/compressed/sev-handle-vc.o'
Caused by commit
e7980cd46155 ("atomic: add alignment check to instrumented atomic operations")
I have reverted that commit and the following one for today.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 5 lines · Stephen Rothwell
After merging the mm-nonmm-unstable tree, today's linux-next build (
x86_64allmodconfig) failed like this:x86_64-linux-gnu-ld: error: unplaced orphan section
__bug_table' fromarch/x86/boot/compressed/sev-handle-vc.o'
I found that I could reproduce the same build failure after applying Peter's patch to v6.19-rc1. So it's not confined to linux-next. I used allnoconfig with CONFIG_LD_ORPHAN_WARN_LEVEL=error and CONFIG_AMD_MEM_ENCRYPT=y because allmodconfig takes forever to build.
The patch in question is this one:
https://lore.kernel.org/lkml/0c18fd08ef19497768070783da28086e01d11a00.1765866665.git.fthain@linux-m68k.org/
I may have found a solution for the problem, but I don't understand this code, so I've Cc'd Ard et al. I don't know whether the __bug_table section is relevant to sev-handle-vc.c. If that section is not desired, I propose to make this change to Peter's patch --
include/linux/instrumented.h +6 -0
@@ -68,7 +68,9 @@ static __always_inline void instrument_atomic_read(const volatile void *v, size_ {kasan_check_read (v, size);kcsan_check_atomic_read (v, size); +#ifndef __DISABLE_EXPORTSWARN_ON_ONCE (IS_ENABLED (CONFIG_DEBUG_ATOMIC ) && ((unsigned long )v & (size -1 ))); +#endif }/**
@@ -83,7 +85,9 @@ static __always_inline void instrument_atomic_write(const volatile void *v, size {kasan_check_write (v, size);kcsan_check_atomic_write (v, size); +#ifndef __DISABLE_EXPORTSWARN_ON_ONCE (IS_ENABLED (CONFIG_DEBUG_ATOMIC ) && ((unsigned long )v & (size -1 ))); +#endif }/**
@@ -98,7 +102,9 @@ static __always_inline void instrument_atomic_read_write(const volatile void *v, {kasan_check_write (v, size);kcsan_check_atomic_read_write (v, size); +#ifndef __DISABLE_EXPORTSWARN_ON_ONCE (IS_ENABLED (CONFIG_DEBUG_ATOMIC ) && ((unsigned long )v & (size -1 ))); +#endif }/**
The next patch in the series needs a similar change, which I've also pushed to my github repo at
https://github.com/fthain/linux/commits/atomic_t
Quoted 14 lines · Finn Thain
Quoted 5 lines · Stephen Rothwell
After merging the mm-nonmm-unstable tree, today's linux-next build (
x86_64allmodconfig) failed like this:x86_64-linux-gnu-ld: error: unplaced orphan section
__bug_table' fromarch/x86/boot/compressed/sev-handle-vc.o'I found that I could reproduce the same build failure after applying Peter's patch to v6.19-rc1. So it's not confined to linux-next. I used allnoconfig with
CONFIG_LD_ORPHAN_WARN_LEVEL=errorandCONFIG_AMD_MEM_ENCRYPT=ybecause allmodconfig takes forever to build.
Quoted 7 lines
The patch in question is this one:
https://lore.kernel.org/lkml/0c18fd08ef19497768070783da28086e01d11a00.1765866665.git.fthain@linux-m68k.org/I may have found a solution for the problem, but I don't understand this code, so I've Cc'd Ard et al. I don't know whether the
__bug_tablesection is relevant tosev-handle-vc.c. If that section is not desired, I propose to make this change to Peter's patch --
I think that the issue here is that we're trying to use WARN in the early boot context. We should probably add CONFIG_DEBUG_ATOMIC to the list of configs we disable for that:
arch/x86/boot/compressed/misc.h +1 -1
@@ -14,6 +14,7 @@#undef CONFIG_ARCH_HAS_LAZY_MMU_MODE#undef CONFIG_KASAN#undef CONFIG_KASAN_GENERIC +#undef CONFIG_DEBUG_ATOMIC --
Thanks,
Sasha
Quoted 33 lines · Sasha Levin
Quoted 15 lines · Finn Thain
Quoted 6 lines · Stephen Rothwell
After merging the mm-nonmm-unstable tree, today's linux-next build (
x86_64allmodconfig) failed like this:x86_64-linux-gnu-ld: error: unplaced orphan section
__bug_table' fromarch/x86/boot/compressed/sev-handle-vc.o'I found that I could reproduce the same build failure after applying Peter's patch to v6.19-rc1. So it's not confined to linux-next. I used allnoconfig with
CONFIG_LD_ORPHAN_WARN_LEVEL=errorandCONFIG_AMD_MEM_ENCRYPT=ybecause allmodconfig takes forever to build.Quoted 7 lines
The patch in question is this one:
https://lore.kernel.org/lkml/0c18fd08ef19497768070783da28086e01d11a00.1765866665.git.fthain@linux-m68k.org/I may have found a solution for the problem, but I don't understand this code, so I've Cc'd Ard et al. I don't know whether the
__bug_tablesection is relevant tosev-handle-vc.c. If that section is not desired, I propose to make this change to Peter's patch --I think that the issue here is that we're trying to use WARN in the early boot context. We should probably add
CONFIG_DEBUG_ATOMICto the list of configs we disable for that:arch/x86/boot/compressed/misc.h +0
-0
arch/x86/boot/compressed/misc.h line 18
Quoted 5 lines
arch/x86/boot/compressed/misc.h +1
-0@@ -14,6 +14,7 @@#undef CONFIG_ARCH_HAS_LAZY_MMU_MODE#undef CONFIG_KASAN#undef CONFIG_KASAN_GENERIC +#undef CONFIG_DEBUG_ATOMIC
Thanks for sending that suggestion. It does fix the problem on x86_64. However, the problem also affects arm, arm64, riscv, riscv64 and loongarch. The fix I proposed (i.e. test __DISABLE_EXPORTS) works on all of the affected architectures because drivers/firmware/efi/libstub/Makefile puts -D__DISABLE_EXPORTS in CFLAGS, just as arch/x86/boot/compressed/Makefile does.
AFAICT, when I put -UCONFIG_DEBUG_ATOMIC in CFLAGS, it doesn't override that macro definition autoconf.h. And there is no equivalent of arch/x86/boot/compressed/misc.h in drivers/firmware/efi/libstub so I can't simply add #undef CONFIG_DEBUG_ATOMIC there.
If __DISABLE_EXPORTS is not the appropriate macro for this purpose, then we need a new macro (e.g. __DISABLE_BUG_TABLE) or else we need a new header, to be included by some unknown set of .c files (that might accidentally #include bug.h) so that this new header could do #undef CONFIG_DEBUG_ATOMIC. My inclination is to implement -D__DISABLE_BUG_TABLE but I'm open to suggestions.
Quoted 48 lines · Finn Thain
Quoted 33 lines · Sasha Levin
Quoted 15 lines · Finn Thain
Quoted 6 lines · Stephen Rothwell
After merging the mm-nonmm-unstable tree, today's linux-next build (
x86_64allmodconfig) failed like this:x86_64-linux-gnu-ld: error: unplaced orphan section
__bug_table' fromarch/x86/boot/compressed/sev-handle-vc.o'I found that I could reproduce the same build failure after applying Peter's patch to v6.19-rc1. So it's not confined to linux-next. I used allnoconfig with
CONFIG_LD_ORPHAN_WARN_LEVEL=errorandCONFIG_AMD_MEM_ENCRYPT=ybecause allmodconfig takes forever to build.Quoted 7 lines
The patch in question is this one:
https://lore.kernel.org/lkml/0c18fd08ef19497768070783da28086e01d11a00.1765866665.git.fthain@linux-m68k.org/I may have found a solution for the problem, but I don't understand this code, so I've Cc'd Ard et al. I don't know whether the
__bug_tablesection is relevant tosev-handle-vc.c. If that section is not desired, I propose to make this change to Peter's patch --I think that the issue here is that we're trying to use WARN in the early boot context. We should probably add
CONFIG_DEBUG_ATOMICto the list of configs we disable for that:arch/x86/boot/compressed/misc.h +0
-0arch/x86/boot/compressed/misc.h line 18
Quoted 5 lines
arch/x86/boot/compressed/misc.h +1
-0@@ -14,6 +14,7 @@#undef CONFIG_ARCH_HAS_LAZY_MMU_MODE#undef CONFIG_KASAN#undef CONFIG_KASAN_GENERIC +#undef CONFIG_DEBUG_ATOMICThanks for sending that suggestion. It does fix the problem on
x86_64. However, the problem also affects arm, arm64, riscv, riscv64 and loongarch. The fix I proposed (i.e. test__DISABLE_EXPORTS) works on all of the affected architectures becausedrivers/firmware/efi/libstub/Makefileputs -D__DISABLE_EXPORTS in CFLAGS, just asarch/x86/boot/compressed/Makefiledoes.
Quoted 5 lines
AFAICT, when I put -UCONFIG_DEBUG_ATOMIC in CFLAGS, it doesn't override that macro definition
autoconf.h. And there is no equivalent ofarch/x86/boot/compressed/misc.hindrivers/firmware/efi/libstubso I can't simply add #undefCONFIG_DEBUG_ATOMICthere.
I'd better correct myself. That header does actually exist:drivers/firmware/efi/libstub/efistub.h
I overlooked it somehow.
Quoted 7 lines
If
__DISABLE_EXPORTSis not the appropriate macro for this purpose, then we need a new macro (e.g.__DISABLE_BUG_TABLE) or else we need a new header, to be included by some unknown set of .c files (that might accidentally #includebug.h) so that this new header could do #undefCONFIG_DEBUG_ATOMIC. My inclination is to implement -D__DISABLE_BUG_TABLE but I'm open to suggestions.
After I sent patches using -D__DISABLE_BUG_TABLE, I figured out that your #undef suggestion has some appeal: by confining the preprocessor tricks to drivers/firmware/efi/libstub/, we might avoid spreading them across include/linux/ which has a certain tidyness to it.
The only problem is fragility. The ordering of #include and #undef directives is critical and complicated. I can't seem to get it right. The following patch produces a build failure.
arch/x86/boot/compressed/misc.h +1 -0
@@ -8,6 +8,7 @@* we just keep it from happening. (This list needs to be extended when new * paravirt and debugging variants are added.) */ +#include <generated/autoconf.h> #undef CONFIG_PARAVIRT#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS
Problem is, you can't do #undef unless you know that #define has already taken place, and you can't #define again if #undef has already taken place...
Anyway, that's just BTW: I don't feel any need to revise the patches I sent.
Quoted 92 lines · Finn Thain
Quoted 48 lines · Finn Thain
Quoted 33 lines · Sasha Levin
Quoted 15 lines · Finn Thain
Quoted 6 lines · Stephen Rothwell
After merging the mm-nonmm-unstable tree, today's linux-next build (
x86_64allmodconfig) failed like this:x86_64-linux-gnu-ld: error: unplaced orphan section
__bug_table' fromarch/x86/boot/compressed/sev-handle-vc.o'I found that I could reproduce the same build failure after applying Peter's patch to v6.19-rc1. So it's not confined to linux-next. I used allnoconfig with
CONFIG_LD_ORPHAN_WARN_LEVEL=errorandCONFIG_AMD_MEM_ENCRYPT=ybecause allmodconfig takes forever to build.Quoted 7 lines
The patch in question is this one:
https://lore.kernel.org/lkml/0c18fd08ef19497768070783da28086e01d11a00.1765866665.git.fthain@linux-m68k.org/I may have found a solution for the problem, but I don't understand this code, so I've Cc'd Ard et al. I don't know whether the
__bug_tablesection is relevant tosev-handle-vc.c. If that section is not desired, I propose to make this change to Peter's patch --I think that the issue here is that we're trying to use WARN in the early boot context. We should probably add
CONFIG_DEBUG_ATOMICto the list of configs we disable for that:arch/x86/boot/compressed/misc.h +0
-0arch/x86/boot/compressed/misc.h line 18
Quoted 5 lines
arch/x86/boot/compressed/misc.h +1
-0@@ -14,6 +14,7 @@#undef CONFIG_ARCH_HAS_LAZY_MMU_MODE#undef CONFIG_KASAN#undef CONFIG_KASAN_GENERIC +#undef CONFIG_DEBUG_ATOMICThanks for sending that suggestion. It does fix the problem on
x86_64. However, the problem also affects arm, arm64, riscv, riscv64 and loongarch. The fix I proposed (i.e. test__DISABLE_EXPORTS) works on all of the affected architectures becausedrivers/firmware/efi/libstub/Makefileputs -D__DISABLE_EXPORTS in CFLAGS, just asarch/x86/boot/compressed/Makefiledoes.Quoted 5 lines
AFAICT, when I put -UCONFIG_DEBUG_ATOMIC in CFLAGS, it doesn't override that macro definition
autoconf.h. And there is no equivalent ofarch/x86/boot/compressed/misc.hindrivers/firmware/efi/libstubso I can't simply add #undefCONFIG_DEBUG_ATOMICthere.I'd better correct myself. That header does actually exist:
drivers/firmware/efi/libstub/efistub.h
I overlooked it somehow.Quoted 7 lines
If
__DISABLE_EXPORTSis not the appropriate macro for this purpose, then we need a new macro (e.g.__DISABLE_BUG_TABLE) or else we need a new header, to be included by some unknown set of .c files (that might accidentally #includebug.h) so that this new header could do #undefCONFIG_DEBUG_ATOMIC. My inclination is to implement -D__DISABLE_BUG_TABLE but I'm open to suggestions.After I sent patches using -D__DISABLE_BUG_TABLE, I figured out that your #undef suggestion has some appeal: by confining the preprocessor tricks to
drivers/firmware/efi/libstub/, we might avoid spreading them acrossinclude/linux/which has a certain tidyness to it.The only problem is fragility. The ordering of #include and #undef directives is critical and complicated. I can't seem to get it right. The following patch produces a build failure.
arch/x86/boot/compressed/misc.h +1
-0@@ -8,6 +8,7 @@* we just keep it from happening. (This list needs to be extended when new * paravirt and debugging variants are added.) */ +#include <generated/autoconf.h> #undef CONFIG_PARAVIRT#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS
Quoted 7 lines
Problem is, you can't do #undef unless you know that #define has already taken place, and you can't #define again if #undef has already taken place...
Anyway, that's just BTW: I don't feel any need to revise the patches I sent.
Hi,
You mean something more than
+#include <generated/autoconf.h>
+#ifdef CONFIG_PARAVIRT
#undef CONFIG_PARAVIRT
+#endif
+#ifdef CONFIG_PARAVIRT_XXL
#undef CONFIG_PARAVIRT_XXL
+#endif
+#ifdef CONFIG_PARAVIRT_SPINLOCKS
#undef CONFIG_PARAVIRT_SPINLOCKS
+#endif
Signature · 1 line
~Randy
Quoted 28 lines · Randy Dunlap
Quoted 16 lines
The following patch produces a build failure.
arch/x86/boot/compressed/misc.h +1
-0@@ -8,6 +8,7 @@* we just keep it from happening. (This list needs to be extended when new * paravirt and debugging variants are added.) */ +#include <generated/autoconf.h> #undef CONFIG_PARAVIRT#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKSQuoted 7 lines
Problem is, you can't do #undef unless you know that #define has already taken place, and you can't #define again if #undef has already taken place...
Anyway, that's just BTW: I don't feel any need to revise the patches I sent.
Hi,
You mean something more than
Review
Quoted 10 lines
(quoted diff) +7
-0+#include <generated/autoconf.h> +#ifdef CONFIG_PARAVIRT #undef CONFIG_PARAVIRT +#endif +#ifdef CONFIG_PARAVIRT_XXL #undef CONFIG_PARAVIRT_XXL +#endif +#ifdef CONFIG_PARAVIRT_SPINLOCKS #undef CONFIG_PARAVIRT_SPINLOCKS +#endif
That's not what I meant. Perhaps I should have said, you can't #undef unless you know that #include has already taken place. That is, if some header does #undef CONFIG_FOO on the assumption that #include <generated/autoconf.h> has already taken place, then it is fragile.
autoconf.h contains no multiple inclusion guard, and it gets included by multiple other headers, so it is prone to 0, 1 or N inclusions. Ordering with respect to #undef CONFIG_FOO is anyone's guess...
FYI, the build failure I was referring to looks like this. It's actually caused by solving the fragility problem I just described above...
LD arch/x86/boot/compressed/vmlinux
x86_64-linux-ld: error: unplaced orphan section .altinstructions' from arch/x86/boot/compressed/ident_map_64.o'
x86_64-linux-ld: error: unplaced orphan section .altinstr_replacement' from arch/x86/boot/compressed/ident_map_64.o'
x86_64-linux-ld: error: unplaced orphan section .altinstr_aux' from arch/x86/boot/compressed/ident_map_64.o'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o: in function `ident_p4d_init':
ident_map_64.c:(.text+0x57f): undefined reference to `__pti_set_user_pgtbl'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o: in function `kernel_ident_mapping_init':
ident_map_64.c:(.text+0x8ab): undefined reference to `__pti_set_user_pgtbl'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o:(.altinstr_aux+0x2): undefined reference to `boot_cpu_data'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o:(.altinstr_aux+0x14): undefined reference to `boot_cpu_data'
x86_64-linux-ld: arch/x86/boot/compressed/ident_map_64.o:(.altinstr_aux+0x26): undefined reference to `boot_cpu_data'
x86_64-linux-ld: arch/x86/boot/compressed/vmlinux: hidden symbol `__pti_set_user_pgtbl' isn't defined
x86_64-linux-ld: final link failed: bad value
make[3]: *** [arch/x86/boot/compressed/Makefile:119: arch/x86/boot/compressed/vmlinux] Error 1 make[2]: *** [arch/x86/boot/Makefile:96: arch/x86/boot/compressed/vmlinux] Error 2
make[1]: *** [arch/x86/Makefile:310: bzImage] Error 2
make: *** [Makefile:248: __sub-make] Error 2
If you wish to try that experiment, you'll probably need something like this:
./scripts/config -e WERROR -e LD_ORPHAN_WARN --set-str LD_ORPHAN_WARN_LEVEL error -e EFI_STUB -e CPU_SUP_AMD -e AMD_MEM_ENCRYPT
Quoted 33 lines · Sasha Levin
Quoted 14 lines · Finn Thain
Quoted 5 lines · Stephen Rothwell
After merging the mm-nonmm-unstable tree, today's linux-next build (
x86_64allmodconfig) failed like this:x86_64-linux-gnu-ld: error: unplaced orphan section
__bug_table' fromarch/x86/boot/compressed/sev-handle-vc.o'I found that I could reproduce the same build failure after applying Peter's patch to v6.19-rc1. So it's not confined to linux-next. I used allnoconfig with
CONFIG_LD_ORPHAN_WARN_LEVEL=errorandCONFIG_AMD_MEM_ENCRYPT=ybecause allmodconfig takes forever to build.Quoted 7 lines
The patch in question is this one:
https://lore.kernel.org/lkml/0c18fd08ef19497768070783da28086e01d11a00.1765866665.git.fthain@linux-m68k.org/I may have found a solution for the problem, but I don't understand this code, so I've Cc'd Ard et al. I don't know whether the
__bug_tablesection is relevant tosev-handle-vc.c. If that section is not desired, I propose to make this change to Peter's patch --I think that the issue here is that we're trying to use WARN in the early boot context. We should probably add
CONFIG_DEBUG_ATOMICto the list of configs we disable for that:arch/x86/boot/compressed/misc.h +0
-0
arch/x86/boot/compressed/misc.h line 18
Quoted 5 lines
arch/x86/boot/compressed/misc.h +1
-0@@ -14,6 +14,7 @@#undef CONFIG_ARCH_HAS_LAZY_MMU_MODE#undef CONFIG_KASAN#undef CONFIG_KASAN_GENERIC +#undef CONFIG_DEBUG_ATOMIC
In spite of the prior art, #undef'ing CONFIG_ options is the worst possible way of dealing with this, as it could result in inconsistencies (as Finn already found). And it is definitely not something that belongs in generic code - the x86 decompressor is somewhat of a lost cause at this point, I'm afraid.
In this case, I'd prefer it if we added a helper, rather than duplicating the same check 3 times. But in this check, testing for __DISABLE_EXPORTS is perfectly reasonable: it is already used in this manner across architectures.
Quoted 3 lines · Ard Biesheuvel
In this case, I'd prefer it if we added a helper, rather than duplicating the same check 3 times.
Yes, and the next patch in that series did add that helper. I didn't want to rewrite Peter's patch and drop his authorship credit, so I added the helper in my own patch... but being that Peter still hasn't sent a signed-off-by tag, I should probably fold those patches together and take the authorship credit/blame myself.
Quoted 3 lines
But in this check, testing for
__DISABLE_EXPORTSis perfectly
reasonable: it is already used in this manner across architectures.
I think Sasha's objection was valid, in that bug table entries are said to be emitted, whereas symbols and interfaces are exported (and imported). But I agree that he may have overlooked the precendent for such use/abuse of that macro e.g. in arch/x86/include/asm/ibt.h.
Ard, what do you think about __DISABLE_BUG_TABLE? Shall I change it back to __DISABLE_EXPORTS if/when I resubmit this series? I'm ambivalent about it.