Re: [PATCH v2 00/14] treewide: prefer __section from compiler_attributes.h
From: Nick Desaulniers
Date: Wed Aug 28 2019 - 18:44:49 EST
On Wed, Aug 28, 2019 at 3:00 AM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
> On Tue, Aug 27, 2019 at 10:40 PM Nick Desaulniers
> <ndesaulniers@xxxxxxxxxx> wrote:
> > GCC unescapes escaped string section names while Clang does not. Because
> > __section uses the `#` stringification operator for the section name, it
> > doesn't need to be escaped.
> > This fixes an Oops observed in distro's that use systemd and not
> > net.core.bpf_jit_enable=1, when their kernels are compiled with Clang.
> > Instead, we should:
> > 1. Prefer __section(.section_name_no_quotes).
> > 2. Only use __attribute__((__section(".section"))) when creating the
> > section name via C preprocessor (see the definition of __define_initcall
> > in arch/um/include/shared/init.h).
Case 2 referenced below.
> > This antipattern was found with:
> > $ grep -e __section\(\" -e __section__\(\" -r
> Hi Nick,
> thanks for the v2 of your patch-series.
> I just checked v2 on top of Linux v5.3-rc6...
> arch/um/include/shared/init.h: __attribute__((__section__(".initcall"
> level ".init"))) = fn
> ??? ^^
Right, thanks for checking. That case is a section dynamically built
via preprocessor, so that's the case I'm referring to in case 2.
> > See the discussions in:
> > https://bugs.llvm.org/show_bug.cgi?id=42950
> > https://marc.info/?l=linux-netdev&m=156412960619946&w=2
> List CBL issue tracker to discussions:
Will do in v3!