From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796502546; b=Mdrl4ACZA0vQoOXZSgth4jJ3+0eVKVlu7xTCdz5gsG49V4skohtjmtzbJa0CfhTNjyki nOwrh4dMBu8ocJOdWm6qZWHLZPEq3JXuYlQFTZ2WcCAwzFLgMSK2tVZwo+g8ukQqUm78Y LJ2k5PsLYmQ6JFVOTOtJLzffAccnGHEE3RnJzv2fjbQg6r+b41sQvZNNNxBX+A6EiQSvd i6Z4eCm2wzomZHK7czSpHNySgxe+iSbUXOorjkwyZuwYjokKSCzkG5DYz7aMAa3/YjCuC 37Ijom9Jj9O0GrE/g9mAMJc/nGGj9ATYNTs57IFmHzfDlZof8DEIlw6o4zVzaK/ZgEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796502546; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=gS+Swzf7BAbDeOfNsPlZ8foydsy2JdCI6jh6+yzaSbM=; b=DAw8eNOS2khnrbE4T0c3UR9r2mlWuqlD/eCE8Y8gU37hLaNZt1Zu17ZPDnYw8jJgezCs dqJ92dsRmpNU27dTvigv5xaX0l+BRccRCfXtZWij1tt6v6HJndnXq0eso+bXnu1KjLhqn +tncorJ+y3QJasUIAXqifx5PXFtAP3StN2S1iZbmvx2jWAgrb7DsMjTHpVmTbc2jyPGj1 J0HVfTPIdKTXCPiStlh9X5vIlV8j4C+HkIqSS/uGf0IePyOhalTVVVx2Y9tEDNIDirvH5 woDKPSyRONHhUITXRDcYNKcHx/qTB5B+UDxrJnqvC1FeWROMW8+2ynKQWliLDhi7nZA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="f3R2U/5q"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C083D606A334; Sat, 5 Dec 2026 20:29:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=f3R2U/5q Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B4D51F00936; Sat, 5 Dec 2026 20:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796502546; bh=gS+Swzf7BAbDeOfNsPlZ8foydsy2JdCI6jh6+yzaSbM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=f3R2U/5que7s4rTu5wRzwDJg9vMgcCfGhzVjLYaMltes6SRxMsWKLANKlxv/5bB93 KkAa9LKhTzeMUFjM+IrLErD2amgxXXcnu46piMWarEglWQRxXYtEg2IYwMK8W8OlbJ U80aLEqHZgPYJ2RPqD0uTRfSGydKLbpspjWCRk1+d1zkGc/S9XoP3rVCGlUGY7BQnO MtsDmlur3YCzeBxKTF7dUsXR9SphR7/aDyOHfd7P6Rfd1I2fWfJiW+dB0TdixPrQdx /DVh5jtqeoTWUhxmPbyM7wbTqVLpNFCFHEpWaW2rKyeV/kWQj13hhtS1vJNeNmmfjN XZpHEgQEDHA7g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v7 4/7] modpost: emit module descriptors as assembly Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?TG9yZW56byBTdG9ha2VzIChBUk0p?= , "Linus Torvalds" , "Nathan Chancellor" , "Nicolas Schier" , "Nick Desaulniers" , "Bill Wendling" , "Justin Stitt" , "Geert Uytterhoeven" , "Luis Chamberlain" , "Petr Pavlu" , "Daniel Gomez" , "Sami Tolvanen" , "Aaron Tomlin" , "Josh Poimboeuf" , "Peter Zijlstra" , "Miguel Ojeda" , "Boqun Feng" , "Gary Guo" , =?utf-8?b?QmrDtnJuIFJveSBCYXJvbg==?= , "Benno Lossin" , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Danilo Krummrich" , "Daniel Almeida" , "Tamir Duberstein" , "Alexandre Courbot" , =?utf-8?b?T251ciDDlnprYW4=?= , "Nicolas Schier" , "Kees Cook" Cc: linux-kbuild@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-modules@vger.kernel.org In-Reply-To: <20261204-build-speedup-v7-4-19a89034d8d1@kernel.org> References: <20261204-build-speedup-v7-0-19a89034d8d1@kernel.org> <20261204-build-speedup-v7-4-19a89034d8d1@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 20:29:05 +0000 X-Mailing-List: linux-modules@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] modpost: overlong module name triggers fatal() abort in add_asm_this_module() - [Low] cpupower: debug kernel Makefile clean target omits *.mod.S files - [Low] modpost: buf_escaped() invokes buf_printf() per character -- commit 7d565296db2d42a69262e66c5af6b91f8029de16 Author: Lorenzo Stoakes (ARM) modpost: emit module descriptors as assembly This commit changes modpost to emit .mod.S assembly files instead of .mod.c files, deriving structure layouts from a new scripts/mod/module-offsets.h header. It also updates Kbuild, .gitignore, clean rules, and scripts/tags.sh for the new .mod.S files. > diff --git a/Makefile b/Makefile > index 809ae80d5d70a..b41f613e42e40 100644 > --- a/Makefile > +++ b/Makefile [ ... ] > @@ -2259,7 +2259,7 @@ clean: $(clean-dirs) > -o -name '*.dt.yaml' -o -name 'dtbs-list' \ > -o -name '*.dwo' -o -name '*.lst' \ > -o -name '*.su' -o -name '*.mod' \ > - -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ > + -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' -o -name '*.mod.S= ' \ > -o -name '*.lex.c' -o -name '*.tab.[ch]' \ > -o -name '*.asn1.[ch]' \ > -o -name '*.symtypes' -o -name 'modules.order' \ [Severity: Low] Should the clean target in tools/power/cpupower/debug/kernel/Makefile also remove *.mod.S? That Makefile builds an external module via Kbuild but runs its own rm command on clean (deleting *.mod.c without *.mod.S), so make clean will leave cpufreq-test_tsc.mod.S behind. [ ... ] > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index b23b2bd727a81..7d908bfcd002b 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c [ ... ] > +/* Append the body of an assembler string literal, escaped as needed. */ > +static void buf_escaped(struct buffer *buf, const char *str) > { > - struct buffer buf =3D { }; > - struct module_alias *alias, *next; > - char fname[PATH_MAX]; > - int ret; > + unsigned char chr; > =20 > - add_header(&buf, mod); > - add_exported_symbols(&buf, mod); > - add_versions(&buf, mod); > - add_extended_versions(&buf, mod); > - add_depends(&buf, mod); > + while ((chr =3D *str++)) { > + if (chr =3D=3D '"' || chr =3D=3D '\\') > + buf_printf(buf, "\\%c", chr); > + else if (isprint(chr)) > + buf_printf(buf, "%c", chr); > + else > + buf_printf(buf, "\\%03o", chr); > + } > +} [Severity: Low] Can buf_escaped() batch contiguous printable runs with buf_write() instead of calling buf_printf() per byte? buf_printf() is a non-static variadic helper that runs vsnprintf() on every call. Because add_asm_aliases(), add_asm_ksymtab(), and add_asm_extended_versions() route every alias and symbol string through buf_escaped(), an allmodconfig build incurs millions of single-byte calls. [ ... ] > +/* Zero fill up to the offset. */ > +static void asm_skip_to(struct buffer *buf, unsigned int *pos, > + unsigned int offset) > +{ > + if (offset < *pos) > + fatal("__this_module field at offset %u overlaps the previous one\n", > + offset); > + if (offset > *pos) > + buf_printf(buf, "\t.skip %u\n", offset - *pos); > + > + *pos =3D offset; > +} [ ... ] > +/* Emit one field of __this_module, returning its size. */ > +static unsigned int add_asm_this_module_field(struct buffer *buf, > + const struct this_module_field *field) > +{ > + if (field->is_name) { > + buf_printf(buf, "\t.ascii \"%s\"\n", field->value); > + return strlen(field->value); > + } > + > + buf_printf(buf, "\t" MOD_PTR_DIRECTIVE " %s\n", field->value); > + return MOD_SIZEOF_LONG; > +} [Severity: Low] Can an overlong module name abort modpost via fatal() in asm_skip_to() instead of letting check_modname_len()'s mod_error() stay non-fatal? When a module basename is too long, check_modname_len() records a non-fatal mod_error() so modpost can report remaining diagnostics, but main() still calls write_mod_S_file(). add_asm_this_module_field() emits the unbounded name and returns its full strlen(), pushing pos past the next field offset. asm_skip_to() then exits immediately with a misleading field-overlap fatal error (and skips checking any later modules). Clamping or skipping the name when it is >=3D MOD_NAME_LEN would preserve the non-fatal behavior. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-build-spee= dup-v7-0-19a89034d8d1@kernel.org?part=3D4