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: <CAGXu5jJDZjaSLE9uPZVWCqrtSMh1-x8H=X+3ptSYrL5QZdo8xA@mail.gmail.com>
Date:   Wed, 17 Oct 2018 15:37:15 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Randy Dunlap <rdunlap@...radead.org>
Cc:     Jani Nikula <jani.nikula@...ux.intel.com>,
        Jonathan Corbet <corbet@....net>,
        "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH] docs: Introduce deprecated APIs list

On Wed, Oct 17, 2018 at 10:08 AM, Randy Dunlap <rdunlap@...radead.org> wrote:
> On 10/17/18 3:00 AM, Jani Nikula wrote:
>> On Tue, 16 Oct 2018, Randy Dunlap <rdunlap@...radead.org> wrote:
>>> On 10/16/18 7:17 PM, Kees Cook wrote:
>>>> As discussed in the "API replacement/deprecation" thread[1], this
>>>> makes an effort to document what things shouldn't get (re)added to the
>>>> kernel, by introducing Documentation/process/deprecated.rst. It also
>>>> adds the overflow kerndoc to ReST output, and tweaks the struct_size()
>>>> documentation to parse correctly.
>>>>
>>>> [1] https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2018-September/005282.html
>>>>
>>>> Signed-off-by: Kees Cook <keescook@...omium.org>
>>>> ---
>>>>  Documentation/driver-api/basics.rst  |  3 +
>>>>  Documentation/process/deprecated.rst | 99 ++++++++++++++++++++++++++++
>>>>  Documentation/process/index.rst      |  1 +
>>>>  include/linux/overflow.h             |  2 +-
>>>>  4 files changed, 104 insertions(+), 1 deletion(-)
>>>>  create mode 100644 Documentation/process/deprecated.rst
>>>
>>>
>>>> diff --git a/include/linux/overflow.h b/include/linux/overflow.h
>>>> index 40b48e2133cb..2f224f43dd06 100644
>>>> --- a/include/linux/overflow.h
>>>> +++ b/include/linux/overflow.h
>>>> @@ -291,7 +291,7 @@ static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c)
>>>>  }
>>>>
>>>>  /**
>>>> - * struct_size() - Calculate size of structure with trailing array.
>>>> + * function struct_size() - Calculate size of structure with trailing array.
>>>
>>> That syntax is not explained nor documented in Documentation/doc-guide/kernel-doc.rst.
>>>
>>> Is the root problem that the function name begins with "struct"?
>>> Please explain in the patch description.
>>
>> Indeed, shouldn't be needed.

I actually thought the problem was with it not knowing how to deal
with struct_size() being a macro instead of a real function.

> Well, this is just a guess (no testing), but in scripts/kernel-doc (at line
> 1907 in 4.19-rc8), we can see:
>
>         if ($identifier =~ m/^struct/) {
>             $decl_type = 'struct';
>         } elsif ($identifier =~ m/^union/) {
>             $decl_type = 'union';
>         } elsif ($identifier =~ m/^enum/) {
>             $decl_type = 'enum';
>         } elsif ($identifier =~ m/^typedef/) {
>             $decl_type = 'typedef';
>         } else {
>             $decl_type = 'function';
>         }
>
> I wouldn't be surprised if a function named "struct_size" looks like a
> type struct.  Maybe it needs to be more strict, with either a space or
> word boundary at the end of each type string.  E.g.:
>
>         if ($identifier =~ m/^struct\b/) {
>             $decl_type = 'struct';
>         } elsif ($identifier =~ m/^union\b/) {
>             $decl_type = 'union';
>         } elsif ($identifier =~ m/^enum\b/) {
>             $decl_type = 'enum';
>         } elsif ($identifier =~ m/^typedef\b/) {
>             $decl_type = 'typedef';
>         } else {
>             $decl_type = 'function';
>         }

But I see it's actually the prefix! :P

Using the above code fixes it for me. Can you send this fix with my
Tested-by, and I'll spin a v2 of my "deprecated.rst" patch without the
overflow.h change?

-Kees

-- 
Kees Cook
Pixel Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ