On Mon, Aug 10, 2026 at 03:01:01PM +0200, Joel Granados wrote: > What? > ===== > We do two things: > 1. Reject netns-unsafe: Replace warning and file permission change with > an error (reject registration) when an "unsafe" net sysctl > registration is detected. > 2. Const qualify: Const qualify network templated ctl_table arrays and > unconditional kmemdup'ed ctl_table arrays. > > Why? > ==== > The main motivation for this is to continue with the const qualification > of the ctl_table arrays [1]. The permission change inside > ensure_safe_net_sysctl disallows cons qualifiaction as it basically > modifies the entries before running the sysctl registration. > > ent->mode &= ~0222; > > On reject netns-unsafe? > ======================= > * I believe that there is currently now way that the permission change > gets executed [2] > * I found one case where the warning message was posted to lore > (vsock_sysctl_register) [3], but it made its to mainline as part of > the second case in [2]. > * We should error anyway because writing to the global sysctl value > through a child netns is indicative of a bug [4]. > > On Const qualification? > ======================= > We can separate the places where network registers sysctl tables into > three groups: > 1. Static global: The unchanged global static arrays are passed along to > sysctl register. > 2. Always kmemdup: The global static arrays are always kmemdup'ed before > passing them along to sysctl register. > 3. Dynamic global: The global static array is changed in place before > passing it along to sysctl register. > > This series handles case 1 and 2. It leaves 3 for a later point as > const qualifying those global ctl_tables is more involved. > > I would be very thankful if you point me to anything that I have missed > in my analysis that shows that this cannot/shouldn't be done.
For the series: Reviewed-by: Simon Horman <[email protected]>

