Re: [RFC PATCH 1/2] apparmor: mediate file-generated signals

From: Christian Brauner

Date: Fri Nov 20 2026 - 05:49:44 EST


On Sat, Nov 07, 2026 at 11:49:27PM +0800, Shi Lecun wrote:
> +static void apparmor_file_set_fowner(struct file *file)
> +{
> + struct aa_file_ctx *ctx = file_ctx(file);
> + const struct cred *old;
> +
> + lockdep_assert_held(&file_f_owner(file)->lock);
> + old = ctx->fown_cred;
> + ctx->fown_cred = get_current_cred();
> + put_cred(old);
> +}

Note that Josef's cred-ids series makes struct fown_struct hold a
reference to the credentials of whoever set the owner.

So you can just use fown->cred in apparmor_file_send_sigiotask() and
drop the file_set_fowner hook and the cred you stash in the file blob.