[PATCH v6 04/11] LSM: syscalls for current process attributes

Arnd Bergmann arnd at arndb.de
Fri Mar 3 18:41:02 UTC 2023


On Wed, Feb 22, 2023, at 21:08, Casey Schaufler wrote:

> +/**
> + * sys_lsm_set_self_attr - Set current task's security module attribute
> + * @ctx: the LSM contexts
> + * @size: size of @ctx
> + * @flags: which attribute to set
> + *
> + * Sets the calling task's LSM context. On success this function
> + * returns 0. If the attribute specified cannot be set a negative
> + * value indicating the reason for the error is returned.
> + */
> +SYSCALL_DEFINE3(lsm_set_self_attr, struct lsm_ctx __user *, ctx, 
> size_t __user,
> +		size, u64, flags)
> +{
> +	return security_setselfattr(flags, ctx, size);
> +}
> +
> +SYSCALL_DEFINE3(lsm_get_self_attr, struct lsm_ctx __user *, ctx,
> +		size_t __user *, size, u64, flags)
> +{
> +	return security_getselfattr(flags, ctx, size);
> +}

As with the other patch I commented on, I think it's better to use a
32-bit 'flags' argument here, to make this work for compat tasks.

      Arnd



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