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: <20250113150253.3097820-9-masahiroy@kernel.org>
Date: Tue, 14 Jan 2025 00:00:46 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
	Masahiro Yamada <masahiroy@...nel.org>
Subject: [PATCH 08/17] genksyms: restrict direct-declarator to take one parameter-type-list

Similar to the previous commit, this change makes the parser logic a
little more accurate.

Currently, genksyms accepts the following invalid code:

    struct foo {
            int (*callback)(int)(int)(int);
    };

A direct-declarator should not recursively absorb multiple
( parameter-type-list ) constructs.

In the example above, (*callback) should be followed by at most one
(int).

Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---

 scripts/genksyms/parse.y | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y
index 03cdd8d53c13..33a6aab53b69 100644
--- a/scripts/genksyms/parse.y
+++ b/scripts/genksyms/parse.y
@@ -331,12 +331,16 @@ nested_declarator:
 	;
 
 direct_nested_declarator:
+	direct_nested_declarator1
+	| direct_nested_declarator1 '(' parameter_declaration_clause ')'
+		{ $$ = $4; }
+	;
+
+direct_nested_declarator1:
 	IDENT	{ $$ = $1; dont_want_type_specifier = false; }
-	| direct_nested_declarator '(' parameter_declaration_clause ')'
+	| direct_nested_declarator1 '(' error ')'
 		{ $$ = $4; }
-	| direct_nested_declarator '(' error ')'
-		{ $$ = $4; }
-	| direct_nested_declarator BRACKET_PHRASE
+	| direct_nested_declarator1 BRACKET_PHRASE
 		{ $$ = $2; }
 	| '(' nested_declarator ')'
 		{ $$ = $3; }
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ