LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 46478 - -fsanitize=thread and -fsanitize=kernel-address produce unwanted .eh_frame and .init_array.* sections
Summary: -fsanitize=thread and -fsanitize=kernel-address produce unwanted .eh_frame an...
Status: RESOLVED FIXED
Alias: None
Product: compiler-rt
Classification: Unclassified
Component: compiler-rt (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks: 4068
  Show dependency tree
 
Reported: 2020-06-27 08:20 PDT by Kees Cook
Modified: 2021-04-27 20:19 PDT (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kees Cook 2020-06-27 08:20:06 PDT
Building the Linux kernel with -fsanitize=thread produces unwanted .eh_frame and .init_array.0 sections, even with -fno-unwind-tables and -fno-asynchronous-unwind-tables.
Comment 1 Kees Cook 2020-06-27 14:09:10 PDT
More details:
https://lore.kernel.org/lkml/202006270840.E0BC752A72@keescook/
Comment 2 Kees Cook 2020-06-28 19:11:19 PDT
-fsanitize=kernel-address also causes this problem.
Comment 3 Nick Desaulniers 2021-04-27 17:36:16 PDT
Related? https://reviews.llvm.org/D100251
Comment 4 Fangrui Song 2021-04-27 20:19:41 PDT
The .eh_frame issue was fixed by https://reviews.llvm.org/D100251 (target: 13.0.0).

For .init_array.0, -fsanitize={address,memory,thread,...} instrumentations create a module constructor which is placed in .init_array.0 .
For memory/thread, the module constructor just calls an init function which is really small.
For address, the module constructor needs to register global variables (even under -fsanitize=kernel-address), which cannot be simply ignored.

It is likely that the kernel doesn't need .init_array.0 for memory/thread, but introducing a new option seems overkill to me.
Ignoring it with the current /DISCARD/ : { ... *(.init_array.*) } works quite well.