Re: a bug in genksysms/CONFIG_MODVERSIONS w/ __attribute__((foo))?
- To: Ben Hutchings <ben@decadent.org.uk>
- Cc: Nicholas Piggin <npiggin@gmail.com>, Masahiro Yamada <yamada.masahiro@socionext.com>, Ard Biesheuvel <ard.biesheuvel@linaro.org>, Arnd Bergmann <arnd@arndb.de>, LKML <linux-kernel@vger.kernel.org>, Michal Marek <michal.lkml@markovi.net>, Nick Desaulniers <ndesaulniers@google.com>, Linus Torvalds <torvalds@linux-foundation.org>, Will Deacon <will@kernel.org>, Debian kernel maintainers <debian-kernel@lists.debian.org>
- Subject: Re: a bug in genksysms/CONFIG_MODVERSIONS w/ __attribute__((foo))?
- From: Greg KH <gregkh@linuxfoundation.org>
- Date: Tue, 27 Aug 2019 19:09:31 +0200
- Message-id: <[🔎] 20190827170931.GA26908@kroah.com>
- In-reply-to: <[🔎] daacccf8e36132b6a747fa4b42626a8812906eaa.camel@decadent.org.uk>
- References: <CAKwvOdnJAApaUhTQs7w_VjSeYBQa0c-TNxRB4xPLi0Y0sOQMMQ@mail.gmail.com> <CAKwvOdkbY_XatVfRbZQ88p=nnrahZbvdjJ0OkU9m73G89_LRzg@mail.gmail.com> <1566899033.o5acyopsar.astroid@bobo.none> <[🔎] CAK7LNARHacanVT6XjRDkFJDETWX6qHfUJCFhskCVG6aDL-bt1g@mail.gmail.com> <[🔎] 1566908344.dio7j9zb2h.astroid@bobo.none> <[🔎] daacccf8e36132b6a747fa4b42626a8812906eaa.camel@decadent.org.uk>
On Tue, Aug 27, 2019 at 04:34:15PM +0100, Ben Hutchings wrote:
> On Tue, 2019-08-27 at 22:42 +1000, Nicholas Piggin wrote:
> > Masahiro Yamada's on August 27, 2019 8:49 pm:
> > > Hi.
> > >
> > > On Tue, Aug 27, 2019 at 6:59 PM Nicholas Piggin <npiggin@gmail.com> wrote:
> > > > Nick Desaulniers's on August 27, 2019 8:57 am:
> > > > > On Mon, Aug 26, 2019 at 2:22 PM Nick Desaulniers
> > > > > <ndesaulniers@google.com> wrote:
> > > > > > I'm looking into a linkage failure for one of our device kernels, and
> > > > > > it seems that genksyms isn't producing a hash value correctly for
> > > > > > aggregate definitions that contain __attribute__s like
> > > > > > __attribute__((packed)).
> > > > > >
> > > > > > Example:
> > > > > > $ echo 'struct foo { int bar; };' | ./scripts/genksyms/genksyms -d
> > > > > > Defn for struct foo == <struct foo { int bar ; } >
> > > > > > Hash table occupancy 1/4096 = 0.000244141
> > > > > > $ echo 'struct __attribute__((packed)) foo { int bar; };' |
> > > > > > ./scripts/genksyms/genksyms -d
> > > > > > Hash table occupancy 0/4096 = 0
> > > > > >
> > > > > > I assume the __attribute__ part isn't being parsed correctly (looks
> > > > > > like genksyms is a lex/yacc based C parser).
> > > > > >
> > > > > > The issue we have in our out of tree driver (*sadface*) is basically a
> > > > > > EXPORT_SYMBOL'd function whose signature contains a packed struct.
> > > > > >
> > > > > > Theoretically, there should be nothing wrong with exporting a function
> > > > > > that requires packed structs, and this is just a bug in the lex/yacc
> > > > > > based parser, right? I assume that not having CONFIG_MODVERSIONS
> > > > > > coverage of packed structs in particular could lead to potentially
> > > > > > not-fun bugs? Or is using packed structs in exported function symbols
> > > > > > with CONFIG_MODVERSIONS forbidden in some documentation somewhere I
> > > > > > missed?
> > > > >
> > > > > Ah, looks like I'm late to the party:
> > > > > https://lwn.net/Articles/707520/
> > > >
> > > > Yeah, would be nice to do something about this.
> > >
> > > modversions is ugly, so it would be great if we could dump it.
> > >
> > > > IIRC (without re-reading it all), in theory distros would be okay
> > > > without modversions if they could just provide their own explicit
> > > > versioning. They take care about ABIs, so they can version things
> > > > carefully if they had to change.
>
> Debian doesn't currently have any other way of detecting ABI changes
> (other than eyeballing diffs).
>
> I know there have been proposals of using libabigail for this instead,
> but I'm not sure how far those progressed.
Google has started using libabigail to track api changes in AOSP, here's
a patch that updates the ABI file after changing it:
https://android-review.googlesource.com/c/kernel/common/+/1108662
Note, there are issues with it, and some rough edges, but I think it can
work.
But, it means nothing at module load time, this is only at build-check
time. At least modversions would prevent module loading in some cases.
thanks,
greg k-h
Reply to: