Skip to content

[PW_SID:1148650] sysctl: add module aliases - #2506

Closed
linux-riscv-bot wants to merge 14 commits into
workflowfrom
pw1148650
Closed

[PW_SID:1148650] sysctl: add module aliases#2506
linux-riscv-bot wants to merge 14 commits into
workflowfrom
pw1148650

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 1148650 applied to workflow

Name: sysctl: add module aliases
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1148650
Version: 3

Linux RISC-V bot and others added 14 commits August 20, 2026 16:08
….h>'

Fix an include loop error in preparation for sysctl.h to include module.h:

    CC [M]  arch/x86/events/amd/uncore.o
  In file included from .../include/linux/fs.h:44,         <<<
                   from .../include/linux/compat.h:17,
                   from .../arch/x86/include/asm/ia32.h:7,
                   from .../arch/x86/include/asm/elf.h:10,
                   from .../include/linux/elf.h:6,
                   from .../include/linux/module.h:20,     <<<
                   from .../include/linux/sysctl.h:245,    <<<
                   from .../include/linux/key.h:17,        <<<
                   from .../include/linux/cred.h:13,       <<<
                   from .../include/linux/sched/signal.h:10,
                   from .../include/linux/ptrace.h:7,
                   from .../include/uapi/asm-generic/bpf_perf_event.h:4,
                   from ./arch/x86/include/generated/uapi/asm/
                        bpf_perf_event.h:1,
                   from .../include/uapi/linux/bpf_perf_event.h:11,
                   from .../include/linux/perf_event.h:18,
                   from .../arch/x86/events/amd/uncore.c:8:
  .../include/linux/mnt_idmapping.h: In function ‘mapped_fsuid’:
  .../include/linux/mnt_idmapping.h:231:59: error: implicit declaration
    of function ‘current_fsuid’ [-Wimplicit-function-declaration]

Reason:
 - cred.h includes key.h *before* defining current_fsuid();
 - key.h includes sysctl.h;
 - sysctl.h includes module.h;
 - module.h includes fs.h via elf.h > asm/elf.h > asm/ia32.h > compat.h;
 - fs.h includes mnt_idmapping.h, which uses *undefined* current_fsuid().

Note that fs.h does include cred.h (which defines current_fsuid()) right
before mnt_idmapping.h (which uses it), but it is not parsed because the
include guard of cred.h is defined earlier.

Address this by removing sysctl.h from key.h, which does not need it,
and adding it to files that actually need it.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add a config option for the 'sysctl:' module aliases feature.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
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.

That symbol will be handled by file2alias.c (modpost) with the changes in
mod_devicetable.h and devicetable-offsets.c.

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.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add a MODULE_SYSCTL_TABLE call into register_sysctl() for existing callers
to automatically use it.

Add optional 'template arguments' to support a dynamic table/path defined
at run-time based on a 'template' table/path available at build-time.

Split the update of callers with template arguments into another commit for
clarity, disabling them for now.

Note: there is no register_sysctl_sz() wrapper, as it is used in even more
dynamic cases (e.g., table generated at run-time not based on a template).

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…ents

Update callers with dynamic table/path to use template arguments.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…L_TABLE

Add a MODULE_SYSCTL_TABLE call into register_net_sysctl{_sz}() for existing
callers to automatically use it.

Add optional 'template arguments' to support a dynamic table/path defined
at run-time based on a 'template' available at build-time.

Split the update of callers with template arguments into separate commits,
disabling the macro for now.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…arguments

Update most callers with dynamic table/path to use template arguments.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…th template arguments

Reduce register_net_sysctl_sz(net, path, table, ARRAY_SIZE(table_tmpl)) to
register_net_sysctl(net, path, table, table_tmpl) which does it internally.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
… arguments

The sysctl table definition and registration must be in the same file,
in order for the macro to work.

Add plumbing to register ipv6_{route,icmp}_table in their own files.
With this, ipv6_{route,icmp}_sysctl_table_size() can be removed.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Handle the last (edge) case:
- nf_log.c: ignore sysctl table with template set at run-time.

And re-enable the macro.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The 'struct ctl_table.procname' field (sysctl filename) cannot be accessed
by scripts since it is defined in kernel headers (see "don't include kernel
headers into userspace" in file2alias.c) and its offset may be randomized.

Unrandomize '.procname' as the first field so its offset is always zero and
match the 'struct ctl_table' symbol address, which can be found by scripts.

Originally-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Move the arch-based addend_*_rel() calls into addend_rel() to be reused.

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Update file2alias.c to handle 'mod_devicetable' symbols with type 'sysctl'.

The key operation is to iterate over relocation entries, so add the helper
for_each_reloc() with a function callback, and the functions to:

1) Find the sysctl path and table in the 'sysctl' module symbol.

2) Find the sysctl table's entries and their '.procname' field,
   adding a module alias 'sysctl:*/<path>/<procname>' for each.

Originally-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 147.87 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 2432.93 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 3100.18 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 34.51 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 30.30 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.50 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 91.27 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
kdoc
Desc: Detects for kdoc errors
Duration: 0.86 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[RFC,v3,02/13] proc: add config option SYSCTL_MODULE_ALIASES"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 145.12 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[RFC,v3,02/13] proc: add config option SYSCTL_MODULE_ALIASES"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1190.83 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 146.39 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1178.00 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1478.59 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 28.90 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 29.99 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 5.05 seconds
Result: ERROR
Output:

WARNING: Non-standard signature: Originally-by:
#16: 
Originally-by: Mauricio Faria de Oliveira <mfo@canonical.com>

CHECK: spaces preferred around that '/' (ctx:VxV)
#33: FILE: scripts/mod/file2alias.c:1534:
+// Looks like: sysctl:*/path/procname
                             ^

ERROR: that open brace { should be on the previous line
#52: FILE: scripts/mod/file2alias.c:1553:
+static void for_each_reloc(struct elf_info *elf, unsigned int shndx,
+			   bool (*fn)(struct elf_info *elf, Elf_Shdr *sechdr,
+				      Elf_Sym *sym, Elf_Addr r_offset,
+				      Elf_Addr r_addend, void *data),
+			   void *data)
+{

CHECK: No space is necessary after a cast
#60: FILE: scripts/mod/file2alias.c:1561:
+	const Elf_Rela *start = (void *) elf->hdr + sechdr->sh_offset;

CHECK: No space is necessary after a cast
#61: FILE: scripts/mod/file2alias.c:1562:
+	const Elf_Rela *stop = (void *) start + sechdr->sh_size;

CHECK: No space is necessary after a cast
#65: FILE: scripts/mod/file2alias.c:1566:
+	for (rela = start; rela < stop; rela = (Elf_Rela *)((void *) rela + size)) {

CHECK: No space is necessary after a cast
#100: FILE: scripts/mod/file2alias.c:1601:
+	struct sysctl_entries *sysctl_entries = (struct sysctl_entries *) data;

CHECK: Blank lines aren't necessary after an open brace '{'
#112: FILE: scripts/mod/file2alias.c:1613:
+	if ((r_offset - sysctl_entries->table_offset) % sysctl_entries->entry_size == 0) {
+

CHECK: No space is necessary after a cast
#149: FILE: scripts/mod/file2alias.c:1650:
+	struct sysctl_pointers *sysctl_pointers = (struct sysctl_pointers *) data;

CHECK: Alignment should match open parenthesis
#153: FILE: scripts/mod/file2alias.c:1654:
+	if (!sysctl_pointers->path_sym &&
+	     sysctl_pointers->path_offset == r_offset) {

CHECK: Alignment should match open parenthesis
#248: FILE: scripts/mod/file2alias.c:1749:
+			   sym_get_data_addend(info, sysctl_pointers.path_sym,
+						sysctl_pointers.path_r_addend);

total: 1 errors, 1 warnings, 9 checks, 319 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 0ec64cc00dbd ("modpost: handle MODULE_SYSCTL_TABLE symbols") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
CHECK: Alignment should match open parenthesis
CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: No space is necessary after a cast
CHECK: spaces preferred around that '/' (ctx:VxV)
ERROR: that open brace { should be on the previous line
WARNING: Non-standard signature: Originally-by:


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 89.95 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
kdoc
Desc: Detects for kdoc errors
Duration: 0.94 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot force-pushed the workflow branch 16 times, most recently from 526685e to 690fa3a Compare August 26, 2026 23:58
@linux-riscv-bot
linux-riscv-bot deleted the pw1148650 branch August 27, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants