From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=172.234.252.31 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796502547; b=gap3sk5x1A3ZFcXTkWxJYVJQIresdGBaATMVwbuj/YPNYlCdT2AYK4wb4gnuZJnhkvmb i41wnXKTmbmyaNqM6ec8veU6VdGIwjGxubi4/gBoK0cF2Trkr25ypgun0nInGDpZjfwHx BTyDJgBoRNX88ZrOhZsoP82nVeLRs+WuCLn+QALzZtO3xmby+mbovhG3KR+BtRwF5NapZ 4T9tNkAYkfUFs+Sw5z0HmRBx6W5jXE0j1RN5ZDU2bWL61LSRDHKCcLE6AzJvse5Oh+orS g8HntQvlIxe3EAhPhKA0SUZOZ/rpeoRolz5i7nSoF7ZrKN08Z4qVZ+23zPwGkXELvGw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796502547; h=DMARC-Filter:Received: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=0VXaafv/WAbpwZnaG1dTLoY/UsHA9iTYUUDNQ+0vXYPX7tnacdqW6ZePbLAHmfEYKEyx K/TxyiGCRlkEVxiSWTA25eass3LvuJfOyub8DJYBflkFn739MGJo96voiPby7j+76+1W8 9B9YNQzdecVwjteq/EmxRQc5KL7Sn0A9GNKaEsCcWDlXDNCmagRCoyR7TsnsWMnfc9Vhj iK5J0lgqaTnxj7ZdQBPZ3QInyt5CmKTJ0t0rbIrCfBMtoWhmv4DHA9TG+pByl+nrU00nq VA0CiD79T9edKqRbCII/EA0AAraKVVDqtQ0UdTRL0clnRheBLAiXlKMNkVA6xG/rLqg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=kernel.org; spf=pass smtp.mailfrom=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=172.234.252.31 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2692A606A333 for ; Sat, 5 Dec 2026 20:29:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2692A606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.org 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: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 9FD5D40EFC; Sat, 5 Dec 2026 20:29:06 +0000 (UTC) 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-m68k@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