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

Christian Brauner brauner at kernel.org
Fri Nov 20 10:48:48 UTC 2026


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.



More information about the Linux-security-module-archive mailing list