Re: [PATCH v3 0/5] sysctl: add typed field descriptors

From: Joel Granados

Date: Mon Oct 19 2026 - 08:17:18 EST


On Mon, Oct 12, 2026 at 03:43:03PM +0200, Alexey Gladkov wrote:
> On Sat, Sep 26, 2026 at 06:22:07PM +0200, Alexey Gladkov wrote:
> > Hi,
> >
> > Some sysctl users copy an otherwise static ctl_table for each namespace or
> > device, then replace data and limit pointers before registration. Besides
> > the per-instance allocation, these fixups often depend on table indices:
> > reordering an entry without updating the fixup can silently bind it to the
> > wrong data or limits.
> >
> > This series lets such users describe a table once with static, read-only
> > sysctl_field entries. Each field names a data type and an offset into an
> > object selected by a sysctl_context at registration time. The offset
> > helpers check the member type at build time. Limits and custom handlers
> > remain optional properties of a field; the field type does not encode a
> > choice of handler or whether limits are present. A subsystem that needs
> > more than a namespace can embed sysctl_context in its own registration
> > context.
> >
> > The sysctl core keeps the context with the table header and materializes
> > a ctl_table entry when an existing handler, permission check or BPF hook
> > needs one. Legacy ctl_table registrations retain their own path, and
> > subsystems can convert tables independently. The IPC, mqueue and ucount
> > conversions here remove table copies without changing their backing data.
> >
> > Changes since v2:
> >
> > - Drop sysctl_uint_vals, as requested by Joel. Existing limit constants
> > suffice for these conversions.
> > - Drop the *_MINMAX field types. A field's type now describes its data,
> > while optional min/max pointers supply bounds to the selected handler.
> > - Keep __register_sysctl_table() and __register_sysctl_fields() as separate
> > registration paths, sharing only allocation and tree insertion helpers.
> > - Address the sashiko findings: avoid calling mode_fn under sysctl_lock,
> > validate the effective maxlen against the context object, and reject
> > NO_DATA fields paired with standard handlers that require data.
> >
> > This is the first part of the conversion. Network sysctls and other
> > subsystem-specific users will follow in separate series for review by
> > their maintainers.
> >
> >
> > Alexey Gladkov (5):
> > proc: sysctl: address table entries by index
> > sysctl: add typed field descriptors
> > sysctl: ipc: use typed fields for IPC namespace sysctls
> > sysctl: mq: use typed fields for IPC namespace sysctls
> > sysctl: use typed fields for ucount limits
>
> Gentle reminder about the patchset.

I have not forgotten. It's on my (very large after PTO) TODO list :)
thx for the reminder.

best

>
> > fs/proc/inode.c | 2 +-
> > fs/proc/internal.h | 2 +-
> > fs/proc/proc_sysctl.c | 681 +++++++++++++++++++++++++++++------------
> > include/linux/sysctl.h | 138 ++++++++-
> > ipc/ipc_sysctl.c | 189 +++++-------
> > ipc/mq_sysctl.c | 104 +++----
> > kernel/ucount.c | 64 ++--
> > 7 files changed, 772 insertions(+), 408 deletions(-)
> >
> >
> > base-commit: 587858367581b9c55c3690f4e63382ad622719d4
> > --
> > 2.55.0
> >
>
> --
> Rgrds, legion
>

Attachment: signature.asc
Description: PGP signature