Thread View: linux.kernel.netdev
7 messages
7 total messages
Started by Joel Granados
Thu, 26 Nov 2026 11:47
[PATCH RFC 0/9] sysctl: Replace ARRAY kmemdup with overlay mechanism for NS registration
Author: Joel Granados
Date: Thu, 26 Nov 2026 11:47
Date: Thu, 26 Nov 2026 11:47
119 lines
15775 bytes
15775 bytes
This is meant to replace the sysctl array duplication mechanism used by
callers that register sysctls for individual namespaces.
Instead of duplicating a sysctl array and keeping it in memory for the
life of a namespace, use it (the array) as a template and keep only the
necessary delta in a sysctl_context struct inside ctl_table_header. The
sysctl_context can then be used to overlay the ctl_table just before
calling its proc_handler.
The last 5 commits are just examples of how the conversions at the call
sites would look. The idea is to upstream the core first and then merge
each individual calling site through its own subsystem tree.
Motivation
==========
* Reducing memory footprint for namespace registrations
On a 64 bit ARCH, memory consumption is reduced by at least 53% (this
is a back-of-envelope approximation): from (56 * ARRAY_SIZE *
count(namespaces)) bytes to (26 * ARRAY_SIZE * count(namespaces))
bytes [2]; we save more, if a subset of the context is used.
* ctl_table const qualification
Namespace ctl_table arrays that are currently modified during
registration can be const qualified (moved to .rodata) as they no
longer require pre-registration changes.
What was done
=============
* struct sysctl_context:
Embedded in struct ctl_table_header, holds flat arrays indexed by
entry position: void **data, **extra1, **extra2; umode_t
*mode. They point to what should be overlaid.
* overlay flags:
struct ctl_table gets a u8 flags member in an existing hole (no size
change) with SYSCTL_OVERLAY_{DATA,EXTRA1,EXTRA2,MODE}. They control
what gets overlaid
* sysctl template overlay:
Add a template registration function to initialize the sysctl
context. Overlay data from context before calling any proc_handler.
Template registration can only be done with a ctl_table_tmpl type.
Comment on void*
================
The sysctl_context uses 3 void** because it reflects struct ctl_table.
Yes, we should get rid of these untyped pointers. No, this is not the
series that will remove them. Yes, there are already proposals out there
that are working towards this [1]. Yes, the plan is for sysctl_context's
void pointers to change once struct ctl_table's do. I thought that
resolving the pointers had to go first, but I think these two efforts
can coexist if handled separately.
Recent approaches
=================
* Alexey Gladkov's "sysctl_field" descriptors:
cover.1787770053.git.legion@kernel.org, cover.1790439358.git.legion@kernel.org
Which build a temp ctl_table from typed accessors before calling the
proc_handler
* My own header-context RFC:
20260924-lklm-sysctl-headerctx-template-v1-0-b25e51c66ba7@kernel.org
computed .data as base + delta in the core.
This series takes the idea of building a temp ctl_table entry before
calling proc_handler, which is a commonality in these two, and drops
everything else: no network types in sysctl core, no namespace specific
enum in sysctl core, no delta arithmetic.
To and Cc
=========
I always find it challenging to know who wants to receive these e-mails.
I added you here because you have recently commented on the issue or
are in the maintainer path. Let me know if you don't want to be included
in the future.
Any comments are greatly appreciated
Best
Based on v7.4-rc2
[1] https://lore.kernel.org/all/cover.1794844686.git.wen.yang@linux.dev
https://lore.kernel.org/all/cover.1793204511.git.wen.yang@linux.dev
[2] sizeof(struct ctl_table) -> 56 bytes
3*sizeof(void*) + sizeof(umode_t) -> 26 bytes
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
Joel Granados (9):
sysctl: Add struct ctl_table_tmpl as a distinct template type
sysctl: Add flags to struct ctl_table
sysctl: Add overlay mechanism for flagged ctl_table members
sysctl: Add sysctl template registration
net: sysctl: Add sysctl registration to networking
ipv4: Register ipv4_net_table as a template
ipc: Register ipc_sysctls as a template
ipc: Register mq_sysctls as a template
ucount: Register user_table as a template
fs/proc/proc_sysctl.c | 362 ++++++++++++++++++++++++++++++++++++++------
include/linux/sysctl.h | 66 ++++++++
include/net/net_namespace.h | 14 ++
ipc/ipc_sysctl.c | 24 ++-
ipc/mq_sysctl.c | 20 +--
kernel/ucount.c | 14 +-
net/ipv4/sysctl_net_ipv4.c | 163 +++++++++++++++++---
net/sysctl_net.c | 25 +++
8 files changed, 594 insertions(+), 94 deletions(-)
---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261123-lklm-sysctl-ctx-flatarray-c4b4ea101d93
Best regards,
--
Joel Granados <joel.granados@kernel.org>
[PATCH RFC 2/9] sysctl: Add flags to struct ctl_table
Author: Joel Granados
Date: Thu, 26 Nov 2026 11:47
Date: Thu, 26 Nov 2026 11:47
60 lines
13161 bytes
13161 bytes
Add a u8 flags member. It takes one byte of the two-byte hole after
mode, so struct ctl_table stays the same size. Even though we are adding
it to house the overlay flags for the ctl_table_tmpl template, it can be
used as a general way to modify the registration and read/write
operation of the ctl path.
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
fs/proc/proc_sysctl.c | 1 +
include/linux/sysctl.h | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 6c0859c6656356f39010e9d47debc0487b751a32..1c5ccb29707d83bacad06198c0dcab39c8b7b347 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1343,6 +1343,7 @@ static struct ctl_dir *sysctl_mkdir_p(struct ctl_dir *dir, const char *path)
* data - a pointer to data for use by proc_handler
* maxlen - the maximum size in bytes of the data
* mode - the file permissions for the /proc/sys file
+ * flags - Used in registration and write/read ops
* type - Defines the target type (described in struct definition)
* proc_handler - the text handler routine (described below)
*
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 4faa3bc189e7afbc270f4ba14b04b32a3f2d1413..3654fd31e3cc4f9217ae61b0bb4d6f4c677ea237 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -22,6 +22,7 @@
#ifndef _LINUX_SYSCTL_H
#define _LINUX_SYSCTL_H
+#include <linux/bits.h>
#include <linux/build_bug.h>
#include <linux/list.h>
#include <linux/rcupdate.h>
@@ -219,12 +220,19 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)
#define DEFINE_CTL_TABLE_POLL(name) \
struct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name)
+/* Overlay types. Describes what is overlain when registering a template */
+#define SYSCTL_OVERLAY_DATA BIT(0)
+#define SYSCTL_OVERLAY_EXTRA1 BIT(1)
+#define SYSCTL_OVERLAY_EXTRA2 BIT(2)
+#define SYSCTL_OVERLAY_MODE BIT(3)
+
/* A sysctl table is an array of struct ctl_table: */
struct ctl_table {
const char *procname; /* Text ID for /proc/sys */
void *data;
int maxlen;
umode_t mode;
+ u8 flags; /* Used in registration and write/read ops */
proc_handler *proc_handler; /* Callback for text formatting */
struct ctl_table_poll *poll;
void *extra1;
--
2.50.1
[PATCH RFC 3/9] sysctl: Add overlay mechanism for flagged ctl_table members
Author: Joel Granados
Date: Thu, 26 Nov 2026 11:47
Date: Thu, 26 Nov 2026 11:47
276 lines
21119 bytes
21119 bytes
Add the ctl_table overlay mechanism and use it whenever the overlay
flags signal the existence of an alternate value. The new
sysctl_context structure holds four arrays of overlay values each
indexed by an entry's position in its ctl_table array.
sysctl_overlay() builds the entry the core acts on. An un-flagged entry
passes through untouched. For a flagged entry it copies the entry to a
stack buffer and overlays each flagged member with data from
sysctl_context. sysctl_overlay() runs in proc_sys_call_handler(),
proc_sys_permission() and proc_sys_make_inode().
The arrays are written once at registration, before the header becomes
visible, and read under the header's use count, so they need no locking.
An error is returned when a flagged value is not found in the
sysctl_context.
This is a prep commit, there is no context registration yet, so there is
no change in functionality.
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
fs/proc/proc_sysctl.c | 97 ++++++++++++++++++++++++++++++++++++++++++++------
include/linux/sysctl.h | 18 ++++++++++
2 files changed, 104 insertions(+), 11 deletions(-)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 1c5ccb29707d83bacad06198c0dcab39c8b7b347..5b5db9fcc3c63444e79b76d94891af70ec8ecc0a 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -205,6 +205,7 @@ static void init_header(struct ctl_table_header *head,
head->parent = NULL;
head->node = node;
INIT_HLIST_HEAD(&head->inodes);
+ memset(&head->ctx, 0, sizeof(head->ctx));
if (node) {
const struct ctl_table *entry __maybe_unused;
@@ -446,13 +447,64 @@ static int sysctl_perm(struct ctl_table_header *head, const struct ctl_table *ta
return test_perm(mode, op);
}
+/*
+ * Replace .data, .extra{1,2} or .mode when flagged. An unflagged entry is
+ * returned as it is.
+ */
+static const struct ctl_table *sysctl_overlay(struct ctl_table_header *head,
+ const struct ctl_table *entry,
+ struct ctl_table *buf)
+{
+ const struct sysctl_context *ctx = &head->ctx;
+ size_t idx;
+
+ if (!(entry->flags & SYSCTL_OVERLAY_MASK))
+ return entry;
+
+ /* The entry and the header arrive as a pair; anything else is a bug. */
+ idx = entry - head->ctl_table;
+ if (WARN_ON_ONCE(idx >= (size_t)head->ctl_table_size))
+ return ERR_PTR(-EINVAL);
+ *buf = *entry;
+
+ if (entry->flags & SYSCTL_OVERLAY_DATA) {
+ if (!ctx->data || !ctx->data[idx])
+ return ERR_PTR(-EINVAL);
+ buf->data = ctx->data[idx];
+ }
+ if (entry->flags & SYSCTL_OVERLAY_EXTRA1) {
+ if (!ctx->extra1 || !ctx->extra1[idx])
+ return ERR_PTR(-EINVAL);
+ buf->extra1 = ctx->extra1[idx];
+ }
+ if (entry->flags & SYSCTL_OVERLAY_EXTRA2) {
+ if (!ctx->extra2 || !ctx->extra2[idx])
+ return ERR_PTR(-EINVAL);
+ buf->extra2 = ctx->extra2[idx];
+ }
+ if (entry->flags & SYSCTL_OVERLAY_MODE) {
+ if (!ctx->mode || !ctx->mode[idx])
+ return ERR_PTR(-EINVAL);
+ buf->mode = ctx->mode[idx];
+ }
+
+ return buf;
+}
+
static struct inode *proc_sys_make_inode(struct super_block *sb,
struct ctl_table_header *head, const struct ctl_table *table)
{
struct ctl_table_root *root = head->root;
+ const struct ctl_table *view;
+ struct ctl_table overlaid;
struct inode *inode;
struct proc_inode *ei;
+ /* The mode comes from the overlaid entry; sysctl_entry keeps @table. */
+ view = sysctl_overlay(head, table, &overlaid);
+ if (IS_ERR(view))
+ return ERR_CAST(view);
+
inode = new_inode(sb);
if (!inode)
return ERR_PTR(-ENOMEM);
@@ -474,8 +526,8 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
spin_unlock(&sysctl_lock);
simple_inode_init_ts(inode);
- inode->i_mode = table->mode;
- if (!S_ISDIR(table->mode)) {
+ inode->i_mode = view->mode;
+ if (!S_ISDIR(view->mode)) {
inode->i_mode |= S_IFREG;
inode->i_op = &proc_sys_inode_operations;
inode->i_fop = &proc_sys_file_operations;
@@ -556,6 +608,7 @@ static ssize_t proc_sys_call_handler(struct kiocb *iocb, struct iov_iter *iter,
struct inode *inode = file_inode(iocb->ki_filp);
struct ctl_table_header *head = grab_header(inode);
const struct ctl_table *table = PROC_I(inode)->sysctl_entry;
+ struct ctl_table overlaid;
size_t count = iov_iter_count(iter);
char *kbuf;
ssize_t error;
@@ -567,6 +620,12 @@ static ssize_t proc_sys_call_handler(struct kiocb *iocb, struct iov_iter *iter,
* At this point we know that the sysctl was not unregistered
* and won't be until we finish.
*/
+ table = sysctl_overlay(head, table, &overlaid);
+ if (IS_ERR(table)) {
+ error = PTR_ERR(table);
+ goto out;
+ }
+
error = -EPERM;
if (sysctl_perm(head, table, write ? MAY_WRITE : MAY_READ))
goto out;
@@ -797,6 +856,7 @@ static int proc_sys_permission(const struct mnt_idmap *idmap,
*/
struct ctl_table_header *head;
const struct ctl_table *table;
+ struct ctl_table overlaid;
int error;
/* Executable files are not allowed under /proc/sys/ */
@@ -810,8 +870,14 @@ static int proc_sys_permission(const struct mnt_idmap *idmap,
table = PROC_I(inode)->sysctl_entry;
if (!table) /* global root - r-xr-xr-x */
error = mask & MAY_WRITE ? -EACCES : 0;
- else /* Use the permissions on the sysctl table entry */
- error = sysctl_perm(head, table, mask & ~MAY_NOT_BLOCK);
+ else {
+ /* ->permissions may inspect the entry, so overlay it first. */
+ table = sysctl_overlay(head, table, &overlaid);
+ if (IS_ERR(table))
+ error = PTR_ERR(table);
+ else
+ error = sysctl_perm(head, table, mask & ~MAY_NOT_BLOCK);
+ }
sysctl_head_finish(head);
return error;
@@ -841,16 +907,23 @@ static int proc_sys_getattr(const struct mnt_idmap *idmap,
struct inode *inode = d_inode(path->dentry);
struct ctl_table_header *head = grab_header(inode);
const struct ctl_table *table = PROC_I(inode)->sysctl_entry;
+ struct ctl_table overlaid;
+ int error = 0;
if (IS_ERR(head))
return PTR_ERR(head);
generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
- if (table)
- stat->mode = (stat->mode & S_IFMT) | table->mode;
+ if (table) {
+ table = sysctl_overlay(head, table, &overlaid);
+ if (IS_ERR(table))
+ error = PTR_ERR(table);
+ else
+ stat->mode = (stat->mode & S_IFMT) | table->mode;
+ }
sysctl_head_finish(head);
- return 0;
+ return error;
}
static const struct file_operations proc_sys_file_operations = {
@@ -1118,13 +1191,13 @@ static int sysctl_check_table_array(const char *path, const struct ctl_table *ta
if (table->maxlen != sizeof(u8))
err |= sysctl_err(path, table, "array not allowed");
- if (table->extra1) {
+ if (table->extra1 && !(table->flags & SYSCTL_OVERLAY_EXTRA1)) {
extra = *(unsigned int *) table->extra1;
if (extra > 255U)
err |= sysctl_err(path, table,
"range value too large for proc_dou8vec_minmax");
}
- if (table->extra2) {
+ if (table->extra2 && !(table->flags & SYSCTL_OVERLAY_EXTRA2)) {
extra = *(unsigned int *) table->extra2;
if (extra > 255U)
err |= sysctl_err(path, table,
@@ -1159,7 +1232,8 @@ static int sysctl_check_table(const char *path, struct ctl_table_header *header)
(entry->proc_handler == proc_dointvec_ms_jiffies) ||
(entry->proc_handler == proc_doulongvec_minmax) ||
(entry->proc_handler == proc_doulongvec_ms_jiffies_minmax)) {
- if (!entry->data)
+ /* Can be NULL when overlaid */
+ if (!entry->data && !(entry->flags & SYSCTL_OVERLAY_DATA))
err |= sysctl_err(path, entry, "No data");
if (!entry->maxlen)
err |= sysctl_err(path, entry, "No maxlen");
@@ -1169,7 +1243,8 @@ static int sysctl_check_table(const char *path, struct ctl_table_header *header)
if (!entry->proc_handler)
err |= sysctl_err(path, entry, "No proc_handler");
- if ((entry->mode & (S_IRUGO|S_IWUGO)) != entry->mode)
+ if (!(entry->flags & SYSCTL_OVERLAY_MODE) &&
+ (entry->mode & (S_IRUGO|S_IWUGO)) != entry->mode)
err |= sysctl_err(path, entry, "bogus .mode 0%o",
entry->mode);
}
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 3654fd31e3cc4f9217ae61b0bb4d6f4c677ea237..11ee0cdeef0ffe8daa4cc8756a820bf2b002c9ad 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -225,6 +225,8 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)
#define SYSCTL_OVERLAY_EXTRA1 BIT(1)
#define SYSCTL_OVERLAY_EXTRA2 BIT(2)
#define SYSCTL_OVERLAY_MODE BIT(3)
+#define SYSCTL_OVERLAY_MASK (SYSCTL_OVERLAY_DATA | SYSCTL_OVERLAY_EXTRA1 | \
+ SYSCTL_OVERLAY_EXTRA2 | SYSCTL_OVERLAY_MODE)
/* A sysctl table is an array of struct ctl_table: */
struct ctl_table {
@@ -253,6 +255,20 @@ struct ctl_node {
struct ctl_table_header *header;
};
+/**
+ * struct sysctl_context - per-registration values for template entries
+ * @data: replaces ctl_table.data of entries flagged SYSCTL_OVERLAY_DATA
+ * @extra1: replaces ctl_table.extra1 of entries flagged SYSCTL_OVERLAY_EXTRA1
+ * @extra2: replaces ctl_table.extra2 of entries flagged SYSCTL_OVERLAY_EXTRA2
+ * @mode: replaces ctl_table.mode of entries flagged SYSCTL_OVERLAY_MODE
+ */
+struct sysctl_context {
+ void **data;
+ void **extra1;
+ void **extra2;
+ umode_t *mode;
+};
+
/**
* struct ctl_table_header - maintains dynamic lists of struct ctl_table trees
* @ctl_table: pointer to the first element in ctl_table array
@@ -262,6 +278,7 @@ struct ctl_node {
* something is removed from inodes
* @nreg: When nreg drops to 0 the ctl_table_header will be unregistered.
* @rcu: Delays the freeing of the inode. Introduced with "unfuck proc_sysctl ->d_compare()"
+ * @ctx: per-registration values for flagged entries, see struct sysctl_context
*
* @type: Enumeration to differentiate between ctl target types:
* type.SYSCTL_TABLE_TYPE_DEFAULT: ctl target with no special considerations
@@ -286,6 +303,7 @@ struct ctl_table_header {
struct ctl_dir *parent;
struct ctl_node *node;
struct hlist_head inodes; /* head for proc_inode->sysctl_inodes */
+ struct sysctl_context ctx;
enum {
SYSCTL_TABLE_TYPE_DEFAULT,
SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY,
--
2.50.1
[PATCH RFC 6/9] ipv4: Register ipv4_net_table as a template
Author: Joel Granados
Date: Thu, 26 Nov 2026 11:47
Date: Thu, 26 Nov 2026 11:47
1124 lines
51319 bytes
51319 bytes
Flag the members of ipv4_net_table that differ per namespace and
register it through register_net_sysctl_tmpl():
* SYSCTL_OVERLAY_DATA on the 127 entries with a .data pointer,
* SYSCTL_OVERLAY_EXTRA2 on tcp_reordering, whose bound is the
namespace's tcp_max_reordering,
* SYSCTL_OVERLAY_MODE on tcp_allowed_congestion_control,
* dataless entry that becomes read-only outside init_net
Rename ipv4_net_table_dup() to ipv4_net_table_overlay(), build the
overlay for init_net as well, free it once the call returns and stop
freeing ctl_table_arg in ipv4_sysctl_exit_net().
A namespace then keeps the context arrays in its header instead of a
copy of the whole table. init_net needs an overlay too because the core
refuses a flagged entry that has no context value.
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
net/ipv4/sysctl_net_ipv4.c | 163 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 143 insertions(+), 20 deletions(-)
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index bf193e7ec51684a78387d30c959b5ad235c6865d..876bbec562e539520f0642e9567cd498a3678f8d 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -633,6 +633,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.tcp_death_row.sysctl_max_tw_buckets,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec
},
{
@@ -640,6 +641,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_echo_ignore_all,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE
@@ -649,6 +651,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_echo_enable_probe,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE
@@ -658,6 +661,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE
@@ -667,6 +671,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE
@@ -676,6 +681,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE
@@ -685,6 +691,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_errors_extension_mask,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &icmp_errors_extension_mask_all,
@@ -694,6 +701,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_ratelimit,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_ms_jiffies,
},
{
@@ -701,6 +709,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_ratemask,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec
},
{
@@ -708,6 +717,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_msgs_per_sec,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
},
@@ -716,6 +726,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_msgs_burst,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
},
@@ -724,6 +735,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.ping_group_range.range,
.maxlen = sizeof(gid_t)*2,
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = ipv4_ping_group_range,
},
#ifdef CONFIG_NET_L3_MASTER_DEV
@@ -732,6 +744,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_raw_l3mdev_accept,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -742,6 +755,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_ecn,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &tcp_ecn_mode_max,
@@ -751,6 +765,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_ecn_option,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_THREE,
@@ -760,6 +775,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_ecn_option_beacon,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_THREE,
@@ -769,6 +785,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_ecn_fallback,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -778,6 +795,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_ip_dynaddr,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -785,6 +803,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_ip_early_demux,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -792,6 +811,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_udp_early_demux,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -799,6 +819,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_early_demux,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -806,6 +827,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_nexthop_compat_mode,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -815,6 +837,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_ip_default_ttl,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = &ip_ttl_min,
.extra2 = &ip_ttl_max,
@@ -824,6 +847,7 @@ static const struct ctl_table ipv4_net_table[] = {
.maxlen = 0,
.data = &init_net,
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = ipv4_local_port_range,
},
{
@@ -831,6 +855,7 @@ static const struct ctl_table ipv4_net_table[] = {
.maxlen = sizeof(u32),
.data = &init_net.ipv4.sysctl_ip_local_port_step_width,
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_douintvec,
},
{
@@ -838,6 +863,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_local_reserved_ports,
.maxlen = 65536,
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_do_large_bitmap,
},
{
@@ -845,6 +871,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_ip_no_pmtu_disc,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -852,6 +879,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_ip_fwd_use_pmtu,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -859,6 +887,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_ip_fwd_update_priority,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = ipv4_fwd_update_priority,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -868,6 +897,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_ip_nonlocal_bind,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -875,6 +905,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_ip_autobind_reuse,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -884,6 +915,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_fwmark_reflect,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -891,6 +923,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_fwmark_accept,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
#ifdef CONFIG_NET_L3_MASTER_DEV
@@ -899,6 +932,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_l3mdev_accept,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -909,6 +943,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_mtu_probing,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -916,6 +951,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_base_mss,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec,
},
{
@@ -923,6 +959,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_min_snd_mss,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = &tcp_min_snd_mss_min,
.extra2 = &tcp_min_snd_mss_max,
@@ -932,6 +969,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_mtu_probe_floor,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = &tcp_min_snd_mss_min,
.extra2 = &tcp_min_snd_mss_max,
@@ -941,6 +979,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_probe_threshold,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec,
},
{
@@ -948,6 +987,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_probe_interval,
.maxlen = sizeof(u32),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_douintvec_minmax,
.extra2 = &u32_max_div_HZ,
},
@@ -956,6 +996,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_igmp_llm_reports,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -963,6 +1004,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_igmp_max_memberships,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec
},
{
@@ -970,6 +1012,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_igmp_max_msf,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec
},
#ifdef CONFIG_IP_MULTICAST
@@ -978,6 +1021,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_igmp_qrv,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE
},
@@ -986,6 +1030,7 @@ static const struct ctl_table ipv4_net_table[] = {
.procname = "tcp_congestion_control",
.data = &init_net.ipv4.tcp_congestion_control,
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.maxlen = TCP_CA_NAME_MAX,
.proc_handler = proc_tcp_congestion_control,
},
@@ -999,6 +1044,7 @@ static const struct ctl_table ipv4_net_table[] = {
.procname = "tcp_allowed_congestion_control",
.maxlen = TCP_CA_BUF_MAX,
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_MODE,
.proc_handler = proc_allowed_congestion_control,
},
{
@@ -1006,6 +1052,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_keepalive_time,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_jiffies,
},
{
@@ -1013,6 +1060,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_keepalive_probes,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1020,6 +1068,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_keepalive_intvl,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_jiffies,
},
{
@@ -1027,6 +1076,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_syn_retries,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = &tcp_syn_retries_min,
.extra2 = &tcp_syn_retries_max
@@ -1036,6 +1086,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_synack_retries,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
#ifdef CONFIG_SYN_COOKIES
@@ -1044,6 +1095,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_syncookies,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
#endif
@@ -1052,6 +1104,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_migrate_req,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE
@@ -1061,6 +1114,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_reordering,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA | SYSCTL_OVERLAY_EXTRA2,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE,
.extra2 = &init_net.ipv4.sysctl_tcp_max_reordering,
@@ -1070,6 +1124,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_retries1,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra2 = &tcp_retr1_max
},
@@ -1078,6 +1133,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_retries2,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1085,6 +1141,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_orphan_retries,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1092,6 +1149,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_fin_timeout,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_jiffies,
},
{
@@ -1099,6 +1157,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_notsent_lowat,
.maxlen = sizeof(unsigned int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_douintvec,
},
{
@@ -1106,6 +1165,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_tw_reuse,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_TWO,
@@ -1115,6 +1175,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_tw_reuse_delay,
.maxlen = sizeof(unsigned int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_douintvec_minmax,
.extra1 = SYSCTL_ONE,
.extra2 = &tcp_tw_reuse_delay_max,
@@ -1124,6 +1185,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_max_syn_backlog,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec
},
{
@@ -1131,11 +1193,13 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_fastopen,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec,
},
{
.procname = "tcp_fastopen_key",
.mode = 0600,
+ .flags = SYSCTL_OVERLAY_DATA,
.data = &init_net.ipv4.sysctl_tcp_fastopen,
/* maxlen to print the list of keys in hex (*2), with dashes
* separating doublewords and a comma in between keys.
@@ -1150,6 +1214,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_fastopen_blackhole_timeout,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_tfo_blackhole_detect_timeout,
.extra1 = SYSCTL_ZERO,
},
@@ -1159,6 +1224,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_fib_multipath_use_neigh,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -1168,6 +1234,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_fib_multipath_hash_policy,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_fib_multipath_hash_policy,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_THREE,
@@ -1177,6 +1244,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_fib_multipath_hash_fields,
.maxlen = sizeof(u32),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_fib_multipath_hash_fields,
.extra1 = SYSCTL_ONE,
.extra2 = &fib_multipath_hash_fields_all_mask,
@@ -1186,6 +1254,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net,
.maxlen = sizeof(u32),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_fib_multipath_hash_seed,
},
#endif
@@ -1194,6 +1263,7 @@ static const struct ctl_table ipv4_net_table[] = {
.maxlen = sizeof(int),
.data = &init_net.ipv4.sysctl_ip_prot_sock,
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = ipv4_privileged_ports,
},
#ifdef CONFIG_NET_L3_MASTER_DEV
@@ -1202,6 +1272,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_udp_l3mdev_accept,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -1212,6 +1283,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_sack,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1219,6 +1291,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_window_scaling,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1226,6 +1299,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_timestamps,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1233,6 +1307,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_early_retrans,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_FOUR,
@@ -1242,6 +1317,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_recovery,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1249,6 +1325,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_thin_linear_timeouts,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1256,6 +1333,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_slow_start_after_idle,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1263,6 +1341,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_retrans_collapse,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1270,6 +1349,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_stdurg,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1277,6 +1357,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_rfc1337,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1284,6 +1365,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_abort_on_overflow,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1291,6 +1373,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_fack,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1298,6 +1381,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_max_reordering,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE,
},
@@ -1306,6 +1390,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_dsack,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1313,6 +1398,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_app_win,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &tcp_app_win_max,
@@ -1322,6 +1408,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_adv_win_scale,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = &tcp_adv_win_scale_min,
.extra2 = &tcp_adv_win_scale_max,
@@ -1331,6 +1418,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_frto,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1338,6 +1426,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_nometrics_save,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1345,6 +1434,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_no_ssthresh_metrics_save,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -1354,6 +1444,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_moderate_rcvbuf,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1361,6 +1452,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_rcvbuf_low_rtt,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_INT_MAX,
@@ -1370,6 +1462,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_tso_win_divisor,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1377,6 +1470,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_workaround_signed_windows,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1384,6 +1478,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_limit_output_bytes,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec
},
{
@@ -1391,6 +1486,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_challenge_ack_limit,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec
},
{
@@ -1398,6 +1494,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_min_tso_segs,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ONE,
},
@@ -1406,6 +1503,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_tso_rtt_log,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra2 = &tcp_tso_rtt_log_max,
},
@@ -1414,6 +1512,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_min_rtt_wlen,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &one_day_secs
@@ -1423,6 +1522,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_autocorking,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -1432,6 +1532,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_invalid_ratelimit,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_ms_jiffies,
},
{
@@ -1439,6 +1540,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_pacing_ss_ratio,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE_THOUSAND,
@@ -1448,6 +1550,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_pacing_ca_ratio,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE_THOUSAND,
@@ -1457,6 +1560,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_wmem,
.maxlen = sizeof(init_net.ipv4.sysctl_tcp_wmem),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE,
},
@@ -1465,6 +1569,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_rmem,
.maxlen = sizeof(init_net.ipv4.sysctl_tcp_rmem),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = &tcp_min_rcvbuf,
},
@@ -1473,6 +1578,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_comp_sack_delay_ns,
.maxlen = sizeof(unsigned long),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_doulongvec_minmax,
},
{
@@ -1480,6 +1586,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_comp_sack_rtt_percent,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE,
.extra2 = SYSCTL_ONE_THOUSAND,
@@ -1489,6 +1596,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_comp_sack_slack_ns,
.maxlen = sizeof(unsigned long),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_doulongvec_minmax,
},
{
@@ -1496,6 +1604,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_comp_sack_nr,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
},
@@ -1504,6 +1613,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_backlog_ack_defer,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -1513,6 +1623,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_reflect_tos,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -1521,6 +1632,7 @@ static const struct ctl_table ipv4_net_table[] = {
.procname = "tcp_ehash_entries",
.data = &init_net.ipv4.sysctl_tcp_child_ehash_entries,
.mode = 0444,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_tcp_ehash_entries,
},
{
@@ -1528,6 +1640,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_child_ehash_entries,
.maxlen = sizeof(unsigned int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_douintvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &tcp_child_ehash_entries_max,
@@ -1536,6 +1649,7 @@ static const struct ctl_table ipv4_net_table[] = {
.procname = "udp_hash_entries",
.data = &init_net.ipv4.sysctl_udp_child_hash_entries,
.mode = 0444,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_udp_hash_entries,
},
{
@@ -1543,6 +1657,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_udp_child_hash_entries,
.maxlen = sizeof(unsigned int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_douintvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &udp_child_hash_entries_max,
@@ -1552,6 +1667,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_udp_rmem_min,
.maxlen = sizeof(init_net.ipv4.sysctl_udp_rmem_min),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE
},
@@ -1560,6 +1676,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_udp_wmem_min,
.maxlen = sizeof(init_net.ipv4.sysctl_udp_wmem_min),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE
},
@@ -1568,6 +1685,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_fib_notify_on_flag_change,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_TWO,
@@ -1577,6 +1695,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_plb_enabled,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -1586,6 +1705,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_plb_idle_rehash_rounds,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra2 = &tcp_plb_max_rounds,
},
@@ -1594,6 +1714,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_plb_rehash_rounds,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra2 = &tcp_plb_max_rounds,
},
@@ -1602,6 +1723,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_plb_suspend_rto_sec,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
},
{
@@ -1609,6 +1731,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_plb_cong_thresh,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &tcp_plb_max_cong_thresh,
@@ -1618,6 +1741,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_syn_linear_timeouts,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &tcp_syn_linear_timeouts_max,
@@ -1627,6 +1751,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_shrink_window,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -1636,6 +1761,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_pingpong_thresh,
.maxlen = sizeof(u8),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ONE,
},
@@ -1644,6 +1770,7 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_rto_min_us,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE,
},
@@ -1652,13 +1779,19 @@ static const struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_tcp_rto_max_ms,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE_THOUSAND,
.extra2 = &tcp_rto_max_max,
},
};
-static const struct ctl_table *ipv4_net_table_dup(struct net *net)
+/*
+ * Fill in, for @net, the members of ipv4_net_table that are flagged
+ * SYSCTL_OVERLAY_*. The copy only lives for the registration call; the
+ * table itself is shared by every namespace.
+ */
+static struct ctl_table *ipv4_net_table_overlay(struct net *net)
{
size_t table_size = ARRAY_SIZE(ipv4_net_table);
struct ctl_table *table;
@@ -1674,7 +1807,7 @@ static const struct ctl_table *ipv4_net_table_dup(struct net *net)
* the current struct net
*/
table[i].data += (void *)net - (void *)&init_net;
- } else {
+ } else if (!net_eq(net, &init_net)) {
/* Entries without data pointer are global;
* Make them read-only in non-init_net ns
*/
@@ -1689,20 +1822,17 @@ static const struct ctl_table *ipv4_net_table_dup(struct net *net)
static __net_init int ipv4_sysctl_init_net(struct net *net)
{
- size_t table_size = ARRAY_SIZE(ipv4_net_table);
- const struct ctl_table *table;
+ struct ctl_table *table;
- table = ipv4_net_table;
- if (!net_eq(net, &init_net)) {
- table = ipv4_net_table_dup(net);
- if (!table)
- goto err_alloc;
- }
+ table = ipv4_net_table_overlay(net);
+ if (!table)
+ goto err_alloc;
- net->ipv4.ipv4_hdr = register_net_sysctl_sz(net, "net/ipv4", table,
- table_size);
+ net->ipv4.ipv4_hdr = register_net_sysctl_tmpl(net, "net/ipv4",
+ ipv4_net_table, table);
+ kfree(table);
if (!net->ipv4.ipv4_hdr)
- goto err_reg;
+ goto err_alloc;
net->ipv4.sysctl_local_reserved_ports = kzalloc(65536 / 8, GFP_KERNEL);
if (!net->ipv4.sysctl_local_reserved_ports)
@@ -1714,20 +1844,13 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
err_ports:
unregister_net_sysctl_table(net->ipv4.ipv4_hdr);
-err_reg:
- if (!net_eq(net, &init_net))
- kfree(table);
err_alloc:
return -ENOMEM;
}
static __net_exit void ipv4_sysctl_exit_net(struct net *net)
{
- const struct ctl_table *table;
-
- table = net->ipv4.ipv4_hdr->ctl_table_arg;
unregister_net_sysctl_table(net->ipv4.ipv4_hdr);
- kfree(table);
kfree(net->ipv4.sysctl_local_reserved_ports);
}
--
2.50.1
[PATCH RFC 7/9] ipc: Register ipc_sysctls as a template
Author: Joel Granados
Date: Thu, 26 Nov 2026 11:47
Date: Thu, 26 Nov 2026 11:47
138 lines
15822 bytes
15822 bytes
Flag SYSCTL_OVERLAY_DATA on every entry of ipc_sysctls that has a .data
pointer and register the table through __register_sysctl_table_tmpl(),
passing the rebased copy that setup_ipc_sysctls() already builds as the
overlay. Free the copy once the call returns and stop freeing
ctl_table_arg in retire_ipc_sysctls(). auto_msgmni has no .data and
stays unflagged.
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
ipc/ipc_sysctl.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index d038d944257f60b3a35b72492c73c41774a73da4..42a249cb58747e75fa76aa94570e5ad23cf8b003 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -79,6 +79,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.shm_ctlmax,
.maxlen = sizeof(init_ipc_ns.shm_ctlmax),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_doulongvec_minmax,
},
{
@@ -86,6 +87,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.shm_ctlall,
.maxlen = sizeof(init_ipc_ns.shm_ctlall),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_doulongvec_minmax,
},
{
@@ -93,6 +95,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.shm_ctlmni,
.maxlen = sizeof(init_ipc_ns.shm_ctlmni),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &ipc_mni,
@@ -102,6 +105,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.shm_rmid_forced,
.maxlen = sizeof(init_ipc_ns.shm_rmid_forced),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_ipc_dointvec_minmax_orphans,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
@@ -111,6 +115,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.msg_ctlmax,
.maxlen = sizeof(init_ipc_ns.msg_ctlmax),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_INT_MAX,
@@ -120,6 +125,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.msg_ctlmni,
.maxlen = sizeof(init_ipc_ns.msg_ctlmni),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &ipc_mni,
@@ -138,6 +144,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.msg_ctlmnb,
.maxlen = sizeof(init_ipc_ns.msg_ctlmnb),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_INT_MAX,
@@ -147,6 +154,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.sem_ctls,
.maxlen = 4*sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_ipc_sem_dointvec,
},
#ifdef CONFIG_CHECKPOINT_RESTORE
@@ -155,6 +163,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.ids[IPC_SEM_IDS].next_id,
.maxlen = sizeof(init_ipc_ns.ids[IPC_SEM_IDS].next_id),
.mode = 0444,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_INT_MAX,
@@ -164,6 +173,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.ids[IPC_MSG_IDS].next_id,
.maxlen = sizeof(init_ipc_ns.ids[IPC_MSG_IDS].next_id),
.mode = 0444,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_INT_MAX,
@@ -173,6 +183,7 @@ static const struct ctl_table ipc_sysctls[] = {
.data = &init_ipc_ns.ids[IPC_SHM_IDS].next_id,
.maxlen = sizeof(init_ipc_ns.ids[IPC_SHM_IDS].next_id),
.mode = 0444,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_INT_MAX,
@@ -290,11 +301,12 @@ bool setup_ipc_sysctls(struct ipc_namespace *ns)
tbl[i].data = NULL;
}
- ns->ipc_sysctls = __register_sysctl_table(&ns->ipc_set, "kernel", tbl,
- ARRAY_SIZE(ipc_sysctls));
- }
- if (!ns->ipc_sysctls) {
+ ns->ipc_sysctls = __register_sysctl_table_tmpl(&ns->ipc_set, "kernel",
+ CTL_TABLE_TMPL(ipc_sysctls),
+ tbl, ARRAY_SIZE(ipc_sysctls));
kfree(tbl);
+ }
+ if (!ns->ipc_sysctls) {
retire_sysctl_set(&ns->ipc_set);
return false;
}
@@ -304,12 +316,8 @@ bool setup_ipc_sysctls(struct ipc_namespace *ns)
void retire_ipc_sysctls(struct ipc_namespace *ns)
{
- const struct ctl_table *tbl;
-
- tbl = ns->ipc_sysctls->ctl_table_arg;
unregister_sysctl_table(ns->ipc_sysctls);
retire_sysctl_set(&ns->ipc_set);
- kfree(tbl);
}
static int __init ipc_sysctl_init(void)
--
2.50.1
[PATCH RFC 8/9] ipc: Register mq_sysctls as a template
Author: Joel Granados
Date: Thu, 26 Nov 2026 11:47
Date: Thu, 26 Nov 2026 11:47
89 lines
13813 bytes
13813 bytes
Flag SYSCTL_OVERLAY_DATA on all five entries of mq_sysctls and register
the table through __register_sysctl_table_tmpl(), passing the rebased
copy that setup_mq_sysctls() already builds as the overlay. Free the
copy once the call returns and stop freeing ctl_table_arg in
retire_mq_sysctls().
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
ipc/mq_sysctl.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c
index 0dd12e1c9f53ef07092ca3b638335a438d273a8c..d98c90595fabedc30fa565c8e0ca16ec3399bcf4 100644
--- a/ipc/mq_sysctl.c
+++ b/ipc/mq_sysctl.c
@@ -26,6 +26,7 @@ static const struct ctl_table mq_sysctls[] = {
.data = &init_ipc_ns.mq_queues_max,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec,
},
{
@@ -33,6 +34,7 @@ static const struct ctl_table mq_sysctls[] = {
.data = &init_ipc_ns.mq_msg_max,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = &msg_max_limit_min,
.extra2 = &msg_max_limit_max,
@@ -42,6 +44,7 @@ static const struct ctl_table mq_sysctls[] = {
.data = &init_ipc_ns.mq_msgsize_max,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = &msg_maxsize_limit_min,
.extra2 = &msg_maxsize_limit_max,
@@ -51,6 +54,7 @@ static const struct ctl_table mq_sysctls[] = {
.data = &init_ipc_ns.mq_msg_default,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = &msg_max_limit_min,
.extra2 = &msg_max_limit_max,
@@ -60,6 +64,7 @@ static const struct ctl_table mq_sysctls[] = {
.data = &init_ipc_ns.mq_msgsize_default,
.maxlen = sizeof(int),
.mode = 0644,
+ .flags = SYSCTL_OVERLAY_DATA,
.proc_handler = proc_dointvec_minmax,
.extra1 = &msg_maxsize_limit_min,
.extra2 = &msg_maxsize_limit_max,
@@ -143,12 +148,13 @@ bool setup_mq_sysctls(struct ipc_namespace *ns)
tbl[i].data = NULL;
}
- ns->mq_sysctls = __register_sysctl_table(&ns->mq_set,
- "fs/mqueue", tbl,
- ARRAY_SIZE(mq_sysctls));
- }
- if (!ns->mq_sysctls) {
+ ns->mq_sysctls = __register_sysctl_table_tmpl(&ns->mq_set,
+ "fs/mqueue",
+ CTL_TABLE_TMPL(mq_sysctls),
+ tbl, ARRAY_SIZE(mq_sysctls));
kfree(tbl);
+ }
+ if (!ns->mq_sysctls) {
retire_sysctl_set(&ns->mq_set);
return false;
}
@@ -158,10 +164,6 @@ bool setup_mq_sysctls(struct ipc_namespace *ns)
void retire_mq_sysctls(struct ipc_namespace *ns)
{
- const struct ctl_table *tbl;
-
- tbl = ns->mq_sysctls->ctl_table_arg;
unregister_sysctl_table(ns->mq_sysctls);
retire_sysctl_set(&ns->mq_set);
- kfree(tbl);
}
--
2.50.1
[PATCH RFC 9/9] ucount: Register user_table as a template
Author: Joel Granados
Date: Thu, 26 Nov 2026 11:47
Date: Thu, 26 Nov 2026 11:47
58 lines
12681 bytes
12681 bytes
Add SYSCTL_OVERLAY_DATA to UCOUNT_ENTRY() so every entry of user_table
carries it, and register the table through
__register_sysctl_table_tmpl(), passing the copy that
setup_userns_sysctls() already fills by position as the overlay. Free
the copy once the call returns and stop freeing ctl_table_arg in
retire_userns_sysctls().
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
kernel/ucount.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/ucount.c b/kernel/ucount.c
index 94b70502dc9ded4de4a946b73141119efc3a26fe..bf021247f5ee5999f3c298e318c25dc2164a8c9b 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -69,6 +69,7 @@ static long ue_int_max = INT_MAX;
.procname = name, \
.maxlen = sizeof(long), \
.mode = 0644, \
+ .flags = SYSCTL_OVERLAY_DATA, \
.proc_handler = proc_doulongvec_minmax, \
.extra1 = &ue_zero, \
.extra2 = &ue_int_max, \
@@ -109,11 +110,12 @@ bool setup_userns_sysctls(struct user_namespace *ns)
for (i = 0; i < UCOUNT_COUNTS; i++) {
tbl[i].data = &ns->ucount_max[i];
}
- ns->sysctls = __register_sysctl_table(&ns->set, "user", tbl,
- ARRAY_SIZE(user_table));
- }
- if (!ns->sysctls) {
+ ns->sysctls = __register_sysctl_table_tmpl(&ns->set, "user",
+ CTL_TABLE_TMPL(user_table),
+ tbl, ARRAY_SIZE(user_table));
kfree(tbl);
+ }
+ if (!ns->sysctls) {
retire_sysctl_set(&ns->set);
return false;
}
@@ -124,12 +126,8 @@ bool setup_userns_sysctls(struct user_namespace *ns)
void retire_userns_sysctls(struct user_namespace *ns)
{
#ifdef CONFIG_SYSCTL
- const struct ctl_table *tbl;
-
- tbl = ns->sysctls->ctl_table_arg;
unregister_sysctl_table(ns->sysctls);
retire_sysctl_set(&ns->set);
- kfree(tbl);
#endif
}
--
2.50.1
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads