ipc/sysctl: Allow to change ipc/mq sysctls inside ipc namespace

Right now ipc and mq limits count as per ipc namespace, but only real
root can change them.  The default values of these limits can only be
reduced.  Since only root can change the values, it is impossible to
reduce these limits in the rootless container.

We can allow limit changes within ipc namespace because mq parameters
are limited by RLIMIT_MSGQUEUE and ipc parameters are not limited to
anything other than cgroups.

Alexey Gladkov (3):
      sysctl: Allow change system v ipc sysctls inside ipc namespace
      docs: Add information about ipc sysctls limitations
      sysctl: Allow to change limits for posix messages queues

Eric W. Biederman (1):
      ipc/ipc_sysctl: Add missing include of linux/cred.h

 Documentation/admin-guide/sysctl/kernel.rst | 14 ++++++++---
 ipc/ipc_sysctl.c                            | 37 +++++++++++++++++++++++++++--
 ipc/mq_sysctl.c                             | 36 ++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 5 deletions(-)
ipc/ipc_sysctl: Add missing include of linux/cred.h

The kernel test robot recently reported[1][2] that in configurations
without CONFIG_COMPAT set the recent changes to ipc_permissions would
result in code that would not compile, as definitions present in
linux/cred.h were missing.

Include linux/cred.h explicitly in ipc/ipc_sysctl.c so that it builds
in all kernel configurations.

[1] https://lkml.kernel.org/r/202209301555.UK7B8MPo-lkp@intel.com
[2] https://lkml.kernel.org/r/202209301537.wYdDBROB-lkp@intel.com
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 54e1011bd95a ("sysctl: Allow change system v ipc sysctls inside ipc namespace")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 file changed