selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC v2 0/2] selinux: parse sids earlier to avoid doing memory allocations under spinlock
@ 2022-01-20 21:49 Scott Mayhew
  2022-01-20 21:49 ` [PATCH RFC v2 1/2] selinux: Fix selinux_sb_mnt_opts_compat() Scott Mayhew
  2022-01-20 21:49 ` [PATCH RFC v2 2/2] selinux: try to use preparsed sid before calling parse_sid() Scott Mayhew
  0 siblings, 2 replies; 16+ messages in thread
From: Scott Mayhew @ 2022-01-20 21:49 UTC (permalink / raw)
  To: selinux, linux-nfs, linux-kernel

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 | 181 ++++++++++++++++++++++++++++-----------
 1 file changed, 129 insertions(+), 52 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-02-01 16:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 21:49 [PATCH RFC v2 0/2] selinux: parse sids earlier to avoid doing memory allocations under spinlock Scott Mayhew
2022-01-20 21:49 ` [PATCH RFC v2 1/2] selinux: Fix selinux_sb_mnt_opts_compat() Scott Mayhew
2022-01-24 21:27   ` Paul Moore
2022-01-25 17:30     ` Scott Mayhew
2022-01-25 17:45       ` Paul Moore
2022-01-25 18:51         ` Scott Mayhew
2022-01-25 22:32           ` Paul Moore
2022-01-26 20:41             ` Scott Mayhew
2022-01-28  1:53               ` Paul Moore
2022-01-27  9:54   ` Ondrej Mosnacek
2022-01-28  2:25     ` Paul Moore
2022-01-31 12:46       ` Ondrej Mosnacek
2022-01-31 16:16         ` Paul Moore
2022-02-01 14:38           ` Ondrej Mosnacek
2022-02-01 16:19             ` Paul Moore
2022-01-20 21:49 ` [PATCH RFC v2 2/2] selinux: try to use preparsed sid before calling parse_sid() Scott Mayhew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).