[PATCH] D80805: [KernelAddressSanitizer] Make globals constructors compatible with kernel

Marco Elver via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 10:25:46 PDT 2020


melver added a comment.

In D80805#2068575 <https://reviews.llvm.org/D80805#2068575>, @glider wrote:

> In D80805#2063679 <https://reviews.llvm.org/D80805#2063679>, @melver wrote:
>
> > In D80805#2063225 <https://reviews.llvm.org/D80805#2063225>, @glider wrote:
> >
> > > Could you please add an IR test for this?
> >
> >
> > Was planning to -- sorry, I should have mentioned: before I go add tests, does this look sane to you?
>
>
> I thought we didn't have support for `__attribute__((constructor))` in the kernel? Does GCC emit constructors for globals with KASAN?


I don't think this has much to do with __attribute__((constructor)), since that's never used explicitly. But implicit constructors are emitted. GCC emits them with KASAN. The disassembled constructors for globals to initialize KASAN with both GCC and Clang are now pretty much identical (apart from symbol names).

The kernel calls them here: https://elixir.bootlin.com/linux/latest/source/init/main.c#L1046


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80805/new/

https://reviews.llvm.org/D80805





More information about the llvm-commits mailing list