On Wed, Aug 11, 2021 at 4:49 PM Paul Moore <paul@xxxxxxxxxxxxxx> wrote: > > From: Casey Schaufler <casey@xxxxxxxxxxxxxxxx> > > 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@xxxxxxxxxxxxxxxx> > [PM: make the smack_uring_* funcs static] > Signed-off-by: Paul Moore <paul@xxxxxxxxxxxxxx> > > --- > 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); > +#endif Casey, 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? -- paul moore www.paul-moore.com