All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Mayhew <smayhew@redhat.com>
To: selinux@vger.kernel.org, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH RFC v2 0/2] selinux: parse sids earlier to avoid doing memory allocations under spinlock
Date: Thu, 20 Jan 2022 16:49:46 -0500	[thread overview]
Message-ID: <20220120214948.3637895-1-smayhew@redhat.com> (raw)

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


             reply	other threads:[~2022-01-20 21:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 21:49 Scott Mayhew [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220120214948.3637895-1-smayhew@redhat.com \
    --to=smayhew@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.