Skip to content

Commit 87c9366

Browse files
jmberg-intelrichardweinberger
authored andcommitted
Revert "um: Enable CONFIG_CONSTRUCTORS"
This reverts commit 786b238 ("um: Enable CONFIG_CONSTRUCTORS"). There are two issues with this commit, uncovered by Anton in tests on some (Debian) systems: 1) I completely forgot to call any constructors if CONFIG_CONSTRUCTORS isn't set. Don't recall now if it just wasn't needed on my system, or if I never tested this case. 2) With that fixed, it works - with CONFIG_CONSTRUCTORS *unset*. If I set CONFIG_CONSTRUCTORS, it fails again, which isn't totally unexpected since whatever wanted to run is likely to have to run before the kernel init etc. that calls the constructors in this case. Basically, some constructors that gcc emits (libc has?) need to run very early during init; the failure mode otherwise was that the ptrace fork test already failed: ---------------------- $ ./linux mem=512M Core dump limits : soft - 0 hard - NONE Checking that ptrace can change system call numbers...check_ptrace : child exited with exitcode 6, while expecting 0; status 0x67f Aborted ---------------------- Thinking more about this, it's clear that we simply cannot support CONFIG_CONSTRUCTORS in UML. All the cases we need now (gcov, kasan) involve not use of the __attribute__((constructor)), but instead some constructor code/entry generated by gcc. Therefore, we cannot distinguish between kernel constructors and system constructors. Thus, revert this commit. Cc: [email protected] [5.4+] Fixes: 786b238 ("um: Enable CONFIG_CONSTRUCTORS") Reported-by: Anton Ivanov <[email protected]> Signed-off-by: Johannes Berg <[email protected]> Acked-by: Anton Ivanov <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 40814b9 commit 87c9366

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

arch/um/include/asm/common.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@
8282
__preinit_array_end = .;
8383
}
8484
.init_array : {
85-
/* dummy - we call this ourselves */
8685
__init_array_start = .;
86+
*(.init_array)
8787
__init_array_end = .;
8888
}
8989
.fini_array : {

arch/um/kernel/dyn.lds.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ SECTIONS
103103
be empty, which isn't pretty. */
104104
. = ALIGN(32 / 8);
105105
.preinit_array : { *(.preinit_array) }
106+
.init_array : { *(.init_array) }
106107
.fini_array : { *(.fini_array) }
107108
.data : {
108109
INIT_TASK_DATA(KERNEL_STACK_SIZE)

init/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZED
5454

5555
config CONSTRUCTORS
5656
bool
57+
depends on !UML
5758

5859
config IRQ_WORK
5960
bool

kernel/gcov/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ menu "GCOV-based kernel profiling"
44
config GCOV_KERNEL
55
bool "Enable gcov-based kernel profiling"
66
depends on DEBUG_FS
7-
select CONSTRUCTORS
7+
select CONSTRUCTORS if !UML
88
default n
99
---help---
1010
This option enables gcov-based code profiling (e.g. for code coverage

0 commit comments

Comments
 (0)