Skip to content

selinux: fix race when removing selinuxfs entries

Ondrej Mosnacek linux-fsdevel selinux 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 5 repliesIn review
  2. v11 patch 3 repliesSuperseded

Changes in v2 from the cover letter

- switch to hopefully proper and actually working solution instead of the horrible mess I produced last time...
v1: https://lore.kernel.org/selinux/[email protected]/T/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4d_walk: optionally lock also parent inodefs/dcache.c+33 -102 replies
2/4d_walk: add leave callbackfs/dcache.c+16 -80 replies
3/4dcache: introduce d_genocide_safe()fs/dcache.c include/linux/dcache.h+33 -00 replies
4/4selinux: use d_genocide_safe() in selinuxfssecurity/selinux/selinuxfs.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] selinux: fix race when removing selinuxfs entries

After hours and hours of getting familiar with dcache and debugging, I think I finally found a solution that works and hopefully stands a chance of being committed.

The series still doesn't address the lack of atomicity of the policy reload transition, but this is part of a wider problem and can be resolved later. Let's fix at least the userspace-triggered lockup first.

Changes since v1:
- switch to hopefully proper and actually working solution instead of the horrible mess I produced last time...
v1: https://lore.kernel.org/selinux/[email protected]/T/

Ondrej Mosnacek (4):
d_walk: optionally lock also parent inode
d_walk: add leave callback
dcache: introduce d_genocide_safe()
selinux: use d_genocide_safe() in selinuxfs

 fs/dcache.c                  | 87 +++++++++++++++++++++++++++++++-----
 include/linux/dcache.h       |  1 +
 security/selinux/selinuxfs.c |  2 +-
 3 files changed, 77 insertions(+), 13 deletions(-)
Signature · 1 line
2.21.0