Re: [RFC PATCH v2 9/9] Smack: Brutalist io_uring support with debug
From: Casey Schaufler <casey@schaufler-ca.com>
Date: 2021-08-31 15:05:13
Also in:
io-uring, linux-fsdevel, selinux
On 8/31/2021 7:44 AM, Paul Moore wrote:
On Wed, Aug 11, 2021 at 4:49 PM Paul Moore [off-list ref] wrote:quoted
From: Casey Schaufler <casey@schaufler-ca.com> Add Smack privilege checks for io_uring. Use CAP_MAC_OVERRIDE for the override_creds case and CAP_MAC_ADMIN for creating a polling thread. These choices are based on conjecture regarding the intent of the surrounding code. Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> [PM: make the smack_uring_* funcs static] Signed-off-by: Paul Moore <paul@paul-moore.com> --- v2: - made the smack_uring_* funcs static v1: - initial draft --- security/smack/smack_lsm.c | 64 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+)diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 223a6da0e6dc..7fb094098f38 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c@@ -4691,6 +4691,66 @@ static int smack_dentry_create_files_as(struct dentry *dentry, int mode, return 0; } +#ifdef CONFIG_IO_URING +/** + * smack_uring_override_creds - Is io_uring cred override allowed? + * @new: the target creds + * + * Check to see if the current task is allowed to override it's credentials + * to service an io_uring operation. + */ +static int smack_uring_override_creds(const struct cred *new) +{ + struct task_smack *tsp = smack_cred(current_cred()); + struct task_smack *nsp = smack_cred(new); + +#if 1 + if (tsp->smk_task == nsp->smk_task) + pr_info("%s: Smack matches %s\n", __func__, + tsp->smk_task->smk_known); + else + pr_info("%s: Smack override check %s to %s\n", __func__, + tsp->smk_task->smk_known, nsp->smk_task->smk_known); +#endifCasey, with the idea of posting a v3 towards the end of the merge window next week, without the RFC tag and with the intention of merging it into -next during the first/second week of the -rcX phase, do you have any objections to me removing the debug code (#if 1 ... #endif) from your patch? Did you have any other changes?
I have no other changes. And yes, the debug code should be stripped. Thank you.
-- paul moore www.paul-moore.com