lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAT9kO0RnNai5CuNgP3wgG+XQ2RqcSb2uAqP85P0PMN2tg@mail.gmail.com>
Date:   Fri, 15 Sep 2023 02:07:09 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Nicolas Schier <nicolas@...sle.eu>
Cc:     Arnd Bergmann <arnd@...db.de>, Arnd Bergmann <arnd@...nel.org>,
        Jonathan Corbet <corbet@....net>,
        Sakari Ailus <sakari.ailus@....fi>,
        Javier Martinez Canillas <javierm@...hat.com>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        linux-kbuild@...r.kernel.org, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Documentation: kbuild: explain handling optional dependencies

On Thu, Sep 14, 2023 at 5:34 AM Nicolas Schier <nicolas@...sle.eu> wrote:
>
> On Wed, Sep 13, 2023 at 09:55:36PM +0200 Arnd Bergmann wrote:
> > On Wed, Sep 13, 2023, at 21:48, Nicolas Schier wrote:
> > > On Wed, Sep 13, 2023 at 01:37:52PM +0200 Arnd Bergmann wrote:
> > >
> > >>  Documentation/kbuild/kconfig-language.rst | 26 +++++++++++++++++++++++
> > >>  1 file changed, 26 insertions(+)
> > >>
> > >> diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentation/kbuild/kconfig-language.rst
> > >> index 858ed5d80defe..89dea587a469a 100644
> > >> --- a/Documentation/kbuild/kconfig-language.rst
> > >> +++ b/Documentation/kbuild/kconfig-language.rst
> > >> @@ -573,6 +573,32 @@ above, leading to:
> > >>    bool "Support for foo hardware"
> > >>    depends on ARCH_FOO_VENDOR || COMPILE_TEST
> > >>
> > >> +Optional dependencies
> > >> +~~~~~~~~~~~~~~~~~~~~~
> > >> +
> > >> +Some drivers are able to optionally use a feature from another module
> > >> +or build cleanly with that module disabled, but cause a link failure
> > >> +when trying to use that loadable module from a built-in driver.
> > >> +
> > >> +The most common way to express this optional dependency in Kconfig logic
> > >> +uses the slighly counterintuitive
> > >
> > > slighly -> slightly
> >
> > Fixed, thanks
> >
> > > For better RST compliance: could you explicitly start the code block e.g. by
> > > appending '::' as in "... counterintuitive::"?
> >
> > Ok, done.
> >
> > >> +
> > >> +  config FOO
> > >> +  bool "Support for foo hardware"
> > >> +  depends on BAR || !BAR
> > >
> > > are you sure that this is enough?  While testing, I needed to explicitly use
> > > =y|=n:
> > >
> > >     depends on BAR=y || BAR=n
> > >
> > > to prevent FOO to be selectable iff BAR=m.
> >
> > I see my problem, I made a different mistake here. Your version
> > is correct for a 'bool' symbol as I had here, but the intention
> > of this was to make it work for tristate symbols, which are the
> > interesting case. I've fixed it up this way now, hope it now makes
> > sense to you:
> >
> > --- a/Documentation/kbuild/kconfig-language.rst
> > +++ b/Documentation/kbuild/kconfig-language.rst
> > @@ -581,19 +581,19 @@ or build cleanly with that module disabled, but cause a link failure
> >  when trying to use that loadable module from a built-in driver.
> >
> >  The most common way to express this optional dependency in Kconfig logic
> > -uses the slighly counterintuitive
> > +uses the slightly counterintuitive::
> >
> >    config FOO
> > -       bool "Support for foo hardware"
> > +       tristate "Support for foo hardware"
> >         depends on BAR || !BAR
>
> ah, thanks, tristate kconfig symbols are really more interesting.


Both FOO and BAR MUST be tristate
to make this documentation sensible.


If FOO is bool type, "depends on BAR || !BAR"
becomes a no-op.

As you notice, FOO and BAR become independent of
each other.


You may wonder why.

Here, another unclear rule applies:

'depends on m' for a bool option is promoted to
'depends on y'.

https://github.com/torvalds/linux/blob/v6.5/scripts/kconfig/symbol.c#L214





-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ