[PW_SID:1148650] sysctl: add module aliases - #2506
Conversation
….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>
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
a8f5ad9 to
99d3d81
Compare
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 1: "[RFC,v3,01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>'" |
|
Patch 2: "[RFC,v3,02/13] proc: add config option SYSCTL_MODULE_ALIASES" |
|
Patch 2: "[RFC,v3,02/13] proc: add config option SYSCTL_MODULE_ALIASES" |
99d3d81 to
31073c9
Compare
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
|
Patch 13: "[RFC,v3,13/13] modpost: handle MODULE_SYSCTL_TABLE symbols" |
526685e to
690fa3a
Compare
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