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: <CAK7LNAQvV7EVdNdZ-oM27ouREohwvf49U+uCfoqB8Dkm7E-7Og@mail.gmail.com>
Date: Tue, 14 Jan 2025 10:23:36 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 04/17] genksyms: fix 6 shift/reduce conflicts and 5
 reduce/reduce conflicts

On Tue, Jan 14, 2025 at 12:03 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> The genksyms parser has ambiguities in its grammar, which are currently
> suppressed by a workaround in scripts/genksyms/Makefile.
>
> Building genksyms with W=1 generates the following warnings:
>
>     YACC    scripts/genksyms/parse.tab.[ch]
>   scripts/genksyms/parse.y: warning: 9 shift/reduce conflicts [-Wconflicts-sr]
>   scripts/genksyms/parse.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr]
>   scripts/genksyms/parse.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
>
> The comment in the parser describes the current problem:
>
>     /* This wasn't really a typedef name but an identifier that
>        shadows one.  */
>
> Consider the following simple C code:
>
>     typedef int foo;
>     void my_func(foo foo) {}
>
> In the function parameter list (foo foo), the first 'foo' is a type
> specifier (typedef'ed as 'int'), while the second 'foo' is an identifier.
>
> However, the lexer cannot distinguish between the two. Since 'foo' is
> already typedef'ed, the lexer returns TYPE for both instances, instead
> of returning IDENT for the second one.
>
> To support shadowed identifiers, IDENT can be reduced to either a

   IDENT -> TYPE


> simple_type_specifier or a direct_abstract_declarator, which creates
> a grammatical ambiguity.
>
> Without analyzing the grammar context, it is very difficult to resolve
> this correctly.
>
> This commit introduces a flag, dont_want_type_specifier, which allows
> the parser to inform the lexer whether an identifier is expected. When
> dont_want_type_specifier is true, the type lookup is suppressed, and
> the lexer returns IDENT regardless of any preceding typedef.
>
> After this commit, only 3 shift/reduce conflicts will remain.
>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>


-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ