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 <[email protected]>
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/[email protected]?part=4
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.