Re: CONFIG_DEBUG_INFO_BTF and CONFIG_GCC_PLUGIN_RANDSTRUCT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 31, 2020 at 12:58 PM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> On Tue, Mar 31, 2020 at 12:50:07PM -0700, Andrii Nakryiko wrote:
> > On Tue, Mar 31, 2020 at 11:12 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> > >
> > > On Tue, Mar 31, 2020 at 12:41:04AM +0200, Daniel Borkmann wrote:
> > > > On 3/30/20 7:20 PM, Kees Cook wrote:
> > > > > On Mon, Mar 30, 2020 at 06:17:32PM +0200, Jann Horn wrote:
> > > > > > On Mon, Mar 30, 2020 at 5:59 PM Alexei Starovoitov
> > > > > > <alexei.starovoitov@xxxxxxxxx> wrote:
> > > > > > > On Mon, Mar 30, 2020 at 8:14 AM Jann Horn <jannh@xxxxxxxxxx> wrote:
> > > > > > > >
> > > > > > > > I noticed that CONFIG_DEBUG_INFO_BTF seems to partly defeat the point
> > > > > > > > of CONFIG_GCC_PLUGIN_RANDSTRUCT.
> > > > > > >
> > > > > > > Is it a theoretical stmt or you have data?
> > > > > > > I think it's the other way around.
> > > > > > > gcc-plugin breaks dwarf and breaks btf.
> > > > > > > But I only looked at gcc patches without applying them.
> > > > > >
> > > > > > Ah, interesting - I haven't actually tested it, I just assumed
> > > > > > (perhaps incorrectly) that the GCC plugin would deal with DWARF info
> > > > > > properly.
> > > > >
> > > > > Yeah, GCC appears to create DWARF before the plugin does the
> > > > > randomization[1], so it's not an exposure, but yes, struct randomization
> > > > > is pretty completely incompatible with a bunch of things in the kernel
> > > > > (by design). I'm happy to add negative "depends" in the Kconfig if it
> > > > > helps clarify anything.
> > > >
> > > > Is this expected to get fixed at some point wrt DWARF? Perhaps would make
> > >
> > > No, gcc closed the issue as "won't fix".
> > >
> > > > sense then to add a negative "depends" for both DWARF and BTF if the option
> > > > GCC_PLUGIN_RANDSTRUCT is set given both would be incompatible/broken.
> > >
> > > I hadn't just to keep wider randconfig build test coverage. That said, I
> > > could make it be: depends COMPILE_TEST || !DWARF ...
> > >
> > > I can certainly do that.
> >
> > I've asked Slava in [0] to disable all three known configs that break
> > DWARF and subsequently BTF, I hope it's ok to just do it in one patch.
> > Currently all these appear to result in invalid BTF due to various
> > DWARF modifications:
> >
> >   - DEBUG_INFO_REDUCED (see [1])
> >   - DEBUG_INFO_SPLIT (see [0]
> >   - GCC_PLUGIN_RANDSTRUCT (this discussion).
> >
> >   [0] https://lore.kernel.org/bpf/CAEf4BzadnfAwfa1D0jZb=01Ou783GpK_U7PAYeEJca-L9kdnVA@xxxxxxxxxxxxxx/
> >   [1] https://lore.kernel.org/bpf/CAEf4BzZri8KpwLcoPgjiVx_=QmJ2W9UzBkDqSO2rUWMzWogkKg@xxxxxxxxxxxxxx/
>
> Sure! That'd by fine by me. I'd just like it to be a "|| COMPILE_TEST"
> for GCC_PLUGIN_RANDSTRUCT. Feel free to CC me for an Ack. :)
>

+cc Slava

I'm unsure what COMPILE_TEST dependency (or is it anti-dependency?)
has to do with BTF generation and reading description in Kconfig
didn't clarify it for me. Can you please elaborate just a bit? Thanks!

> -Kees
>
> >
> >
> > >
> > > -Kees
> > >
> > > [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84052
> > >
> > > --
> > > Kees Cook
>
> --
> Kees Cook



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux