SELinux Security Module development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH 4/7] SELinux: hooks for secctx_to_lsmprop and update_lsmprop
Date: Fri, 14 Aug 2026 01:55:32 +0000	[thread overview]
Message-ID: <20260814015533.144011F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813204854.19211-5-casey@schaufler-ca.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The hook selinux_update_lsmprop unconditionally returns 0, short-circuiting call_int_hook and preventing other LSMs from updating their properties.
--

--- Patch [4]: [PATCH 4/7] SELinux: hooks for secctx_to_lsmprop and update_lsmprop ---
commit a4558827a3696626337a00d0c47bdfbeb141eefe
Author: Casey Schaufler <casey@schaufler-ca.com>

SELinux: hooks for secctx_to_lsmprop and update_lsmprop

This commit implements the secctx_to_lsmprop and update_lsmprop hooks for
the SELinux module. These additions allow SELinux to interact with the new
lsm_prop structures for context and property updates.

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 0f704380a8c81..66f32dfadf9b3 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -6926,6 +6926,15 @@ static int selinux_ismaclabel(const char *name)
>  	return (strcmp(name, XATTR_SELINUX_SUFFIX) == 0);
>  }
>  
> +static int selinux_update_lsmprop(struct lsm_prop *dest, struct lsm_prop *src,
> +				  int lsmid)
> +{
> +	if (lsmid == LSM_ID_SELINUX || lsmid == LSM_ID_UNDEF)
> +		dest->selinux.secid = src->selinux.secid;
> +
> +	return 0;

[Severity: High]
Does returning 0 unconditionally here break LSM stacking?

If security_update_lsmprop() is called with an lsmid targeted at another
module (e.g., LSM_ID_SMACK), the SELinux hook will execute first. Because 0
differs from the hook's default return value (-EOPNOTSUPP), call_int_hook()
will break the loop and return 0 immediately.

The target LSM's hook will never be reached, and it will silently fail to
update its properties.

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813204854.19211-1-casey@schaufler-ca.com?part=4

  reply	other threads:[~2026-08-14  1:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260813204854.19211-1-casey.ref@schaufler-ca.com>
2026-08-13 20:48 ` [PATCH 0/7] Change skb secmarks to x-array indexes Casey Schaufler
2026-08-13 20:48   ` [PATCH 1/7] net, smack: Create a function to set secmarks Casey Schaufler
2026-08-14  1:06     ` sashiko-bot
2026-08-13 20:48   ` [PATCH 2/7] LSM: Implement x array functions for secmarks Casey Schaufler
2026-08-14  1:26     ` sashiko-bot
2026-08-13 20:48   ` [PATCH 3/7] LSM: Two hooks for manipulating struct lsm_prop Casey Schaufler
2026-08-14  1:38     ` sashiko-bot
2026-08-13 20:48   ` [PATCH 4/7] SELinux: hooks for secctx_to_lsmprop and update_lsmprop Casey Schaufler
2026-08-14  1:55     ` sashiko-bot [this message]
2026-08-13 20:48   ` [PATCH 5/7] Smack: " Casey Schaufler
2026-08-14  2:08     ` sashiko-bot
2026-08-13 20:48   ` [PATCH 6/7] Apparmor: " Casey Schaufler
2026-08-14  2:23     ` sashiko-bot
2026-08-13 20:48   ` [PATCH 7/7] net, lsm: Change skb secmarks to x-array indexes Casey Schaufler
2026-08-14  2:39     ` sashiko-bot
2026-08-31 22:37 [PATCH 0/7] " Casey Schaufler
2026-08-31 22:37 ` [PATCH 4/7] SELinux: hooks for secctx_to_lsmprop and update_lsmprop Casey Schaufler
2026-08-31 22:55   ` 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=20260814015533.144011F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox