[PATCH v2 1/2] KEYS: use synchronous task work for changing parent credentials

Jarkko Sakkinen jarkko at kernel.org
Thu Aug 15 18:10:22 UTC 2024


On Mon Aug 5, 2024 at 2:54 PM EEST, Jann Horn wrote:
> keyctl_session_to_parent() involves posting task work to the parent task,
> with work function key_change_session_keyring.
> Because the task work in the parent runs asynchronously, no errors can be
> returned back to the caller of keyctl_session_to_parent(), and therefore
> the work function key_change_session_keyring() can't be allowed to fail due
> to things like memory allocation failure or permission checks - all
> allocations and checks have to happen in the child.
>
> This is annoying for two reasons:
>
>  - It is the only reason why cred_alloc_blank() and
>    security_transfer_creds() are necessary.
>  - It means we can't do synchronous permission checks.

I agree with this premise. Also I think the code change is reasonable.

I'd like to see a comment from David tho.

BR, Jarkko



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