Reimplement RLIMIT_MEMLOCK on top of ucounts
The rlimit counter is tied to uid in the user_namespace. This allows rlimit values to be specified in userns even if they are already globally exceeded by the user. However, the value of the previous user_namespaces cannot be exceeded. Changelog v11: * Fix issue found by lkp robot. v8: * Fix issues found by lkp-tests project. v7: * Keep only ucounts for RLIMIT_MEMLOCK checks instead of struct cred. v6: * Fix bug in hugetlb_file_setup() detected by trinity. Reported-by:kernel test robot <oliver.sang@intel.com> Reported-by:
kernel test robot <lkp@intel.com> Signed-off-by:
Alexey Gladkov <legion@kernel.org> Link: https://lkml.kernel.org/r/970d50c70c71bfd4496e0e8d2a0a32feebebb350.1619094428.git.legion@kernel.org Signed-off-by:
Eric W. Biederman <ebiederm@xmission.com>
Showing
- fs/hugetlbfs/inode.c 8 additions, 8 deletionsfs/hugetlbfs/inode.c
- include/linux/hugetlb.h 2 additions, 2 deletionsinclude/linux/hugetlb.h
- include/linux/mm.h 2 additions, 2 deletionsinclude/linux/mm.h
- include/linux/sched/user.h 0 additions, 1 deletioninclude/linux/sched/user.h
- include/linux/shmem_fs.h 1 addition, 1 deletioninclude/linux/shmem_fs.h
- include/linux/user_namespace.h 1 addition, 0 deletionsinclude/linux/user_namespace.h
- ipc/shm.c 13 additions, 13 deletionsipc/shm.c
- kernel/fork.c 1 addition, 0 deletionskernel/fork.c
- kernel/ucount.c 1 addition, 0 deletionskernel/ucount.c
- kernel/user.c 0 additions, 1 deletionkernel/user.c
- kernel/user_namespace.c 1 addition, 0 deletionskernel/user_namespace.c
- mm/memfd.c 2 additions, 2 deletionsmm/memfd.c
- mm/mlock.c 14 additions, 8 deletionsmm/mlock.c
- mm/mmap.c 2 additions, 2 deletionsmm/mmap.c
- mm/shmem.c 5 additions, 5 deletionsmm/shmem.c
Please register or sign in to comment