mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morris <jmorris@namei.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, KP Singh <kpsingh@google.com>
Subject: [GIT PULL] security: Fix the default value of fs_context_parse_param hook
Date: Fri, 8 May 2020 09:45:11 +1000 (AEST)	[thread overview]
Message-ID: <alpine.LRH.2.21.2005080942390.15191@namei.org> (raw)

Please pull this fix from KP Singh (several folks are reporting issues 
around this):

The following changes since commit c45e8bccecaf633480d378daff11e122dfd5e96d:

  Merge tag 'for-5.7/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm (2020-04-30 16:45:08 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git for-v5.7

for you to fetch changes up to 54261af473be4c5481f6196064445d2945f2bdab:

  security: Fix the default value of fs_context_parse_param hook (2020-04-30 20:29:34 -0700)

----------------------------------------------------------------
KP Singh (1):
      security: Fix the default value of fs_context_parse_param hook

 include/linux/lsm_hook_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

---

commit 54261af473be4c5481f6196064445d2945f2bdab
Author: KP Singh <kpsingh@google.com>
Date:   Thu Apr 30 17:52:40 2020 +0200

    security: Fix the default value of fs_context_parse_param hook
    
    security_fs_context_parse_param is called by vfs_parse_fs_param and
    a succussful return value (i.e 0) implies that a parameter will be
    consumed by the LSM framework. This stops all further parsing of the
    parmeter by VFS. Furthermore, if an LSM hook returns a success, the
    remaining LSM hooks are not invoked for the parameter.
    
    The current default behavior of returning success means that all the
    parameters are expected to be parsed by the LSM hook and none of them
    end up being populated by vfs in fs_context
    
    This was noticed when lsm=bpf is supplied on the command line before any
    other LSM. As the bpf lsm uses this default value to implement a default
    hook, this resulted in a failure to parse any fs_context parameters and
    a failure to mount the root filesystem.
    
    Fixes: 98e828a0650f ("security: Refactor declaration of LSM hooks")
    Reported-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
    Signed-off-by: KP Singh <kpsingh@google.com>
    Signed-off-by: James Morris <jmorris@namei.org>

diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
index 9cd4455528e5..1bdd027766d4 100644
--- a/include/linux/lsm_hook_defs.h
+++ b/include/linux/lsm_hook_defs.h
@@ -55,7 +55,7 @@ LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm)
 LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm)
 LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc,
 	 struct fs_context *src_sc)
-LSM_HOOK(int, 0, fs_context_parse_param, struct fs_context *fc,
+LSM_HOOK(int, -ENOPARAM, fs_context_parse_param, struct fs_context *fc,
 	 struct fs_parameter *param)
 LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb)
 LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb)

             reply	other threads:[~2020-05-07 23:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 23:45 James Morris [this message]
2020-05-08  2:45 ` pr-tracker-bot

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=alpine.LRH.2.21.2005080942390.15191@namei.org \
    --to=jmorris@namei.org \
    --cc=kpsingh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®