Skip to content

selinux: parse sids earlier to avoid doing memory allocations under spinlock

Scott Mayhew linux-nfs lkml selinux 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyIn review
  2. v2 RFC2 patches 13 repliesSuperseded
  3. v1 RFC1 patch 0 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2selinux: Fix selinux_sb_mnt_opts_compat()security/selinux/hooks.c+41 -340 replies
2/2selinux: try to use preparsed sid before calling parse_sid()security/selinux/hooks.c+59 -290 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/2] selinux: parse sids earlier to avoid doing memory allocations under spinlock

selinux_sb_mnt_opts_compat() is called under the sb_lock spinlock and shouldn't be performing any memory allocations.

The first patch fixes this by parsing the sids at the same time the context mount options are being parsed from the mount options string and storing the parsed sids in the selinux_mnt_opts struct.

The second patch adds logic to selinux_set_mnt_opts() and selinux_sb_remount() that checks to see if a sid has already been parsed before calling parse_sid(), and adds the parsed sids to the data being copied in selinux_fs_context_dup().

Scott Mayhew (2):
selinux: Fix selinux_sb_mnt_opts_compat()
selinux: try to use preparsed sid before calling parse_sid()

 security/selinux/hooks.c | 147 ++++++++++++++++++++++++---------------
 1 file changed, 92 insertions(+), 55 deletions(-)
Signature · 1 line
2.31.1