Advertisement
s243a

BarryK: cap_sys_mount-2.patch

Mar 2nd, 2021
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. #See: https://bkhome.org/news/202012/kernel-510-lockdown-success.html
  2.  
  3. diff -Naur linux-5.10P1/fs/cachefiles/daemon.c linux-5.10P2/fs/cachefiles/daemon.c
  4. --- linux-5.10P1/fs/cachefiles/daemon.c 2020-12-07 06:25:12.000000000 +0800
  5. +++ linux-5.10P2/fs/cachefiles/daemon.c 2020-12-14 11:22:48.633880384 +0800
  6. @@ -87,7 +87,7 @@
  7. _enter("");
  8.  
  9. /* only the superuser may do this */
  10. - if (!capable(CAP_SYS_ADMIN))
  11. + if (!capable(CAP_SYS_MOUNT))
  12. return -EPERM;
  13.  
  14. /* the cachefiles device may only be open once at a time */
  15. diff -Naur linux-5.10P1/fs/ext4/ioctl.c linux-5.10P2/fs/ext4/ioctl.c
  16. --- linux-5.10P1/fs/ext4/ioctl.c 2020-12-07 06:25:12.000000000 +0800
  17. +++ linux-5.10P2/fs/ext4/ioctl.c 2020-12-14 11:25:08.440551087 +0800
  18. @@ -605,7 +605,7 @@
  19. struct ext4_sb_info *sbi = EXT4_SB(sb);
  20. __u32 flags;
  21.  
  22. - if (!capable(CAP_SYS_ADMIN))
  23. + if (!capable(CAP_SYS_MOUNT))
  24. return -EPERM;
  25.  
  26. if (get_user(flags, (__u32 __user *)arg))
  27. diff -Naur linux-5.10P1/fs/namespace.c linux-5.10P2/fs/namespace.c
  28. --- linux-5.10P1/fs/namespace.c 2020-12-07 06:25:12.000000000 +0800
  29. +++ linux-5.10P2/fs/namespace.c 2020-12-14 11:27:05.200554488 +0800
  30. @@ -1690,7 +1690,7 @@
  31. */
  32. static inline bool may_mount(void)
  33. {
  34. - return ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN);
  35. + return ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_MOUNT);
  36. }
  37.  
  38. #ifdef CONFIG_MANDATORY_FILE_LOCKING
  39. diff -Naur linux-5.10P1/fs/super.c linux-5.10P2/fs/super.c
  40. --- linux-5.10P1/fs/super.c 2020-12-07 06:25:12.000000000 +0800
  41. +++ linux-5.10P2/fs/super.c 2020-12-14 11:28:35.303890430 +0800
  42. @@ -485,9 +485,9 @@
  43. bool mount_capable(struct fs_context *fc)
  44. {
  45. if (!(fc->fs_type->fs_flags & FS_USERNS_MOUNT))
  46. - return capable(CAP_SYS_ADMIN);
  47. + return capable(CAP_SYS_MOUNT);
  48. else
  49. - return ns_capable(fc->user_ns, CAP_SYS_ADMIN);
  50. + return ns_capable(fc->user_ns, CAP_SYS_MOUNT);
  51. }
  52.  
  53. /**
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement