BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mauricio Faria de Oliveira" <mfo@igalia.com>
Cc: mptcp@lists.linux.dev, bpf@vger.kernel.org,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH RFC v3 03/13] sysctl, mod_devicetable: add macro MODULE_SYSCTL_TABLE
Date: Wed, 19 Aug 2026 18:32:13 +0000	[thread overview]
Message-ID: <20260819183214.05BD91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819-sysctl-module-aliases-v3-3-aab90569365d@igalia.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] MODULE_SYSCTL_TABLE exports pointers to modpost, violating the devicetable design pattern and breaking module alias extraction.
- [Medium] Silent truncation of sysctl table size for large arrays.
- [Low] Brittle symbol name generation requires manual user workaround for struct field arguments.
- [Low] The commit message incorrectly documents the names of the control macros.
--

--- Patch [3]: [PATCH RFC v3 03/13] sysctl, mod_devicetable: add macro MODULE_SYSCTL_TABLE ---
commit 65937d6d2c35e0f567f1295d6273adbf6b625450
Author: Mauricio Faria de Oliveira <mfo@igalia.com>

sysctl, mod_devicetable: add macro MODULE_SYSCTL_TABLE

The MODULE_SYSCTL_TABLE macro emits a struct module_sysctl_table variable
with pointers to a sysctl table's path and entries, and table/entry sizes.

> The option macros MODULE_SYSCTL_TABLE_{DISABLE,UNIQUE_ID} can be used on
> a per-file basis to disable the macro and change the symbol name pattern.

[Severity: Low]
This isn't a bug, but the commit message documents these macros as
MODULE_SYSCTL_TABLE_DISABLE and MODULE_SYSCTL_TABLE_UNIQUE_ID, while the
code actually implements SYSCTL_MODULE_ALIASES_DISABLE and
SYSCTL_MODULE_ALIASES_UNIQUE_ID. Could the commit message be updated to
match the code?

> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index a397213bedace..818a4a53448db 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -78,4 +78,11 @@ struct cpu_feature {
>  	__u16	feature;
>  };
>  
> +struct module_sysctl_table {
> +	kernel_ulong_t path;
> +	kernel_ulong_t table;

[Severity: High]
Will modpost be able to resolve these pointers? file2alias.c parses raw
section data from unlinked ELF objects to extract module aliases. Because
path and table are pointers rather than inline string arrays or structures,
modpost will read raw unresolved offsets instead of actual data.

This would break alias extraction on most architectures since file2alias.c
lacks a generalized relocation engine to resolve pointers across ELF sections.

> +	__u16 table_size;
> +	__u16 entry_size;
> +};
> +
>  #endif /* LINUX_MOD_DEVICETABLE_H */

[ ... ]

> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index e5d7226ab6f5a..0adc056ff54d8 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h

[ ... ]

> +#if defined(SYSCTL_MODULE_ALIASES_UNIQUE_ID)
> +#define __MODULE_SYSCTL_TABLE_NAME(table)					\
> +	__mod_device_table(sysctl, __UNIQUE_ID(sysctl))
> +#else
> +#define __MODULE_SYSCTL_TABLE_NAME(table)					\
> +	__mod_device_table(sysctl, table)
> +#endif

[Severity: Low]
Does this symbol name generation unnecessarily force manual workarounds? By
default, if table is passed as a struct member (like my_module.table), this
creates an invalid C identifier containing a dot. Would it be simpler to just
use __UNIQUE_ID unconditionally to avoid syntax errors?

> +
> +#define MODULE_SYSCTL_TABLE(path, table)					\
> +	static struct module_sysctl_table __used				\
> +		__MODULE_SYSCTL_TABLE_NAME(table) = {				\
> +			(kernel_ulong_t) path,					\
> +			(kernel_ulong_t) table,					\
> +			(u16) sizeof(table) + __must_be_array(table),		\

[Severity: Medium]
Could casting sizeof(table) to a u16 cause a silent truncation for very large
sysctl tables? 

While no current single static sysctl table in the kernel exceeds 65,535
bytes, casting size_t to a 16-bit integer creates a structural limit that
will silently report the wrong size if a table ever exceeds roughly 1,024
elements.

> +			(u16) sizeof(const struct ctl_table)			\
> +		}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260819-sysctl-module-aliases-v3-0-aab90569365d@igalia.com?part=3

  reply	other threads:[~2026-08-19 18:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 18:16 [PATCH RFC v3 00/13] sysctl: add module aliases Mauricio Faria de Oliveira
2026-08-19 18:16 ` [PATCH RFC v3 01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>' Mauricio Faria de Oliveira
2026-08-19 18:20   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 02/13] proc: add config option SYSCTL_MODULE_ALIASES Mauricio Faria de Oliveira
2026-08-19 18:24   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 03/13] sysctl, mod_devicetable: add macro MODULE_SYSCTL_TABLE Mauricio Faria de Oliveira
2026-08-19 18:32   ` sashiko-bot [this message]
2026-08-19 18:16 ` [PATCH RFC v3 04/13] sysctl: add register_sysctl() wrapper for MODULE_SYSCTL_TABLE Mauricio Faria de Oliveira
2026-08-19 18:34   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 05/13] sysctl, parport: update register_sysctl() callers with template arguments Mauricio Faria de Oliveira
2026-08-19 18:24   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 06/13] sysctl, net: add register_net_sysctl{_sz}() wrappers for MODULE_SYSCTL_TABLE Mauricio Faria de Oliveira
2026-08-19 18:25   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 07/13] sysctl, net: update register_net_sysctl{_sz}() callers with template arguments Mauricio Faria de Oliveira
2026-08-19 18:33   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 08/13] sysctl, net: update register_net_sysctl_sz(ARRAY_SIZE(table_tmpl)) " Mauricio Faria de Oliveira
2026-08-19 18:26   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 09/13] sysctl, ipv6: update register_net_sysctl{_sz}() callers " Mauricio Faria de Oliveira
2026-08-19 18:24   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 10/13] sysctl, net: update register_net_sysctl_sz() edge case Mauricio Faria de Oliveira
2026-08-19 18:24   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 11/13] sysctl: unrandomize struct ctl_table.procname Mauricio Faria de Oliveira
2026-08-19 18:26   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 12/13] modpost: move addend_*_rel() calls into addend_rel() Mauricio Faria de Oliveira
2026-08-19 18:26   ` sashiko-bot
2026-08-19 18:16 ` [PATCH RFC v3 13/13] modpost: handle MODULE_SYSCTL_TABLE symbols Mauricio Faria de Oliveira
2026-08-19 18:35   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260819183214.05BD91F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=bpf@vger.kernel.org \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=mfo@igalia.com \
    --cc=mptcp@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox