Skip to content

Fix incorrect overlayfs mmap() and mprotect() LSM access controls

Paul Moore linux-erofs linux-fsdevel linux-security-module linux-unionfs selinux 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 11 repliesIn review
  2. v32 patches 4 repliesSuperseded
  3. v2 RFC2 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches7 repliesSuperseded

Changes in v4 from the cover letter

- added fs prep patch (Amir)
- added CONFIG_SECURITY conditional code (Amir) v3:
- fix the LSM hook stubs (kernel robot, Ryan Lee)
- fix the lsm_backing_file_cache allocation size (Ryan Lee)
- minor style, simplicity tweaks to the SELinux patch v2:
- remove the user O_PATH file patch from Amir
- add the backing_file LSM blob and lifecycle hooks
- update the SELinux code to reflect the other changes v1:
- initial version

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3fs: prepare for adding LSM blob to backing_filefs/file_table.c+20 -21 reply
2/3lsm: add backing_file LSM hooksfs/backing-file.c fs/erofs/ishare.c fs/file_table.c +13 more+206 -174 replies
3/3selinux: fix overlayfs mmap() and mprotect() access checkssecurity/selinux/hooks.c security/selinux/include/objsec.h+196 -716 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchAmir GoldsteinSerge HallynChristian Brauner
1/3R-b
2/3R-b R-b R-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 0/3] Fix incorrect overlayfs mmap() and mprotect() LSM access controls

Another week, another revision to this patchset. The v3 revision can be found at the lore[1] link below.

The revision still takes the same basic approach introduced in v2, with the most significant change in v4 being the change to make the backing file LSM blob conditional on CONFIG_SECURITY. This requires a number of other changes to ensure that all accesses of the LSM blob go through a set of accessor functions which can be converted into dummy functions when !CONFIG_SECURITY.

While the changes between v3 and v4 were fairly straight forward, there were enough of them that it felt wrong to preserve the ACKs from previous revisions. It would be appreciated if those of you who had previously ACK'd a patch could take a second look and renew your ACK (or comment on the problem preventing you from ACK'ing).

Thanks all.

[1] https://lore.kernel.org/linux-security-module/[email protected]/

--
CHANGELOG:
v4:
- added fs prep patch (Amir)
- added CONFIG_SECURITY conditional code (Amir) v3:
- fix the LSM hook stubs (kernel robot, Ryan Lee)
- fix the lsm_backing_file_cache allocation size (Ryan Lee)
- minor style, simplicity tweaks to the SELinux patch v2:
- remove the user O_PATH file patch from Amir
- add the backing_file LSM blob and lifecycle hooks
- update the SELinux code to reflect the other changes v1:
- initial version

--
Amir Goldstein (1):
fs: prepare for adding LSM blob to backing_file

Paul Moore (2):
lsm: add backing_file LSM hooks
selinux: fix overlayfs mmap() and mprotect() access checks

 fs/backing-file.c                 |   18 +-
 fs/erofs/ishare.c                 |   10 +
 fs/file_table.c                   |   43 ++++-
 fs/fuse/passthrough.c             |    2 
 fs/internal.h                     |    3 
 fs/overlayfs/dir.c                |    2 
 fs/overlayfs/file.c               |    2 
 include/linux/backing-file.h      |    4 
 include/linux/fs.h                |   13 +
 include/linux/lsm_audit.h         |    2 
 include/linux/lsm_hook_defs.h     |    5 
 include/linux/lsm_hooks.h         |    1 
 include/linux/security.h          |   22 ++
 security/lsm.h                    |    1 
 security/lsm_init.c               |    9 +
 security/security.c               |  102 +++++++++++
 security/selinux/hooks.c          |  256 +++++++++++++++++++++---------
 security/selinux/include/objsec.h |   11 +
 18 files changed, 419 insertions(+), 87 deletions(-)