Linux Security Modules development
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: "Serge Hallyn (AMD)" <sergeh@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>,
	Paul Moore <paul@paul-moore.com>,
	linux-fsdevel@vger.kernel.org,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH 01/13] cred: gather the rules for acting on a task by uid
Date: Fri, 23 Oct 2026 13:03:07 +0000	[thread overview]
Message-ID: <20261023-cred-ids-reply-serge-5b0e9c47d21a@toxicpanda.com> (raw)
In-Reply-To: <attYWxUJXfZX0MyN@shallyn-amd>

On Fri, Oct 23, 2026 at 07:51:39AM -0500, Serge Hallyn (AMD) wrote:
> Overall I like this, thanks.

Thanks for taking a look.

> > +	default:
> > +		return false;
>
> What do you think about putting a BUG HERE?  It's not actually
> your intent for this ever to be called with 'which' not being
> a valid value, right?

Right, that's never supposed to happen, the callers all pass one of the
three by name. I'd rather not BUG() though. It fails closed as it is, so
the worst a bogus value does is get somebody an EPERM, which isn't worth
taking the box down for.

I agree it shouldn't be silent. I think VFS_WARN_ON_ONCE() fits, it's a
WARN_ON_ONCE() with CONFIG_DEBUG_VFS and compiles away to nothing
without it, so whoever adds a fourth value and forgets the switch hears
about it in testing and nobody else pays for it. It's in use outside of
fs/ already, kernel/nstree.c and kernel/nscommon.c have it.

Christian, if that's fine with you could you fold the below into patch
1? Nothing later in the series touches kernel/cred.c so it shouldn't
conflict with anything. Or I can send a v2, whichever is easier. Thanks,

Josef

diff --git a/kernel/cred.c b/kernel/cred.c
index c067ef72b563..9a3ea6a1b96a 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -19,6 +19,7 @@
 #include <linux/binfmts.h>
 #include <linux/cn_proc.h>
 #include <linux/uidgid.h>
+#include <linux/vfsdebug.h>
 
 #if 0
 #define kdebug(FMT, ...)						\
@@ -692,6 +693,7 @@ bool cred_ids_allow_control(const struct cred *subj, enum cred_ids which,
 		gid = subj->fsgid;
 		break;
 	default:
+		VFS_WARN_ON_ONCE(1);
 		return false;
 	}
 

  reply	other threads:[~2026-10-23 13:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 17:31 [PATCH 00/13] cred: gather the "same uid" checks between tasks in one place Josef Bacik
2026-10-18 17:31 ` [PATCH 01/13] cred: gather the rules for acting on a task by uid Josef Bacik
2026-10-18 17:35   ` sashiko-bot
2026-10-23 12:51   ` Serge Hallyn (AMD)
2026-10-23 13:03     ` Josef Bacik [this message]
2026-10-18 17:31 ` [PATCH 02/13] cred: add KUnit tests for the id rules Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 03/13] signal: use cred_ids_allow_signal() Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 04/13] fcntl: use cred_ids_allow_sigio() Josef Bacik
2026-10-18 17:37   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 05/13] sched: use cred_ids_allow_sched() Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 06/13] MIPS: " Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 07/13] sys: use cred_ids_allow_sched() for setpriority() Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 08/13] sys: use cred_ids_allow_control() for prlimit() Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 09/13] block: use cred_ids_allow_ioprio() Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 10/13] cgroup/v1: use cred_ids_allow_move() Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 11/13] fs/resctrl: " Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 12/13] ptrace: use cred_ids_allow_control() Josef Bacik
2026-10-18 17:34   ` sashiko-bot
2026-10-18 17:31 ` [PATCH 13/13] keys: " Josef Bacik
2026-10-18 17:34   ` sashiko-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=20261023-cred-ids-reply-serge-5b0e9c47d21a@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=sergeh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox