[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fdf0e86a-5ba3-4d28-8c63-b2019af009f1@schaufler-ca.com>
Date: Wed, 12 Mar 2025 16:12:42 -0700
From: Casey Schaufler <casey@...aufler-ca.com>
To: Ryan Lee <ryan.lee@...onical.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, apparmor@...ts.ubuntu.com,
linux-security-module@...r.kernel.org, selinux@...r.kernel.org
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
John Johansen <john.johansen@...onical.com>, Paul Moore
<paul@...l-moore.com>, James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>, Mickaël Salaün
<mic@...ikod.net>, Günther Noack <gnoack@...gle.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
Ondrej Mosnacek <omosnace@...hat.com>,
Kentaro Takeda <takedakn@...data.co.jp>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
Casey Schaufler <casey@...aufler-ca.com>
Subject: Re: [RFC PATCH 5/6] smack: explicitly skip mediation of O_PATH file
descriptors
On 3/12/2025 2:21 PM, Ryan Lee wrote:
> Now that O_PATH fds are being passed to the file_open hook,
> unconditionally skip mediation of them to preserve existing behavior.
>
> Signed-off-by: Ryan Lee <ryan.lee@...onical.com>
> ---
> security/smack/smack_lsm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 2f65eb392bc0..c05e223bfb33 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -2062,6 +2062,10 @@ static int smack_file_open(struct file *file)
> struct smk_audit_info ad;
> int rc;
>
> + /* Preserve the behavior of O_PATH fd creation not being mediated */
In Smack the single line comment is discouraged. Please use
+ /*
+ * Preserve the behavior of O_PATH fd creation not being mediated
+ */
> + if (file->f_flags & O_PATH)
> + return 0;
> +
> smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
> smk_ad_setfield_u_fs_path(&ad, file->f_path);
> rc = smk_tskacc(tsp, smk_of_inode(inode), MAY_READ, &ad);
Powered by blists - more mailing lists