Re: [PATCH v4 2/2] KEYS: Reject keyring creation with overridden credentials

From: Jarkko Sakkinen

Date: Sat Nov 28 2026 - 05:23:22 EST


On Fri, Nov 27, 2026 at 09:11:08PM -0500, Guicai Ma wrote:
> On Fri, Nov 27, 2026 at 02:14:32PM +0200, Jarkko Sakkinen wrote:
> > If the current task is running with overridden credentials calling
> > commit_creds() is forbidden and triggers a BUG_ON().
> >
> > Reject keyring creation with -EPERM when credentials are overridden.
>
> Tested on the same arm64/KVM KASAN/lockdep setup on top of patch 1/2.
> Under override_creds(), lookup_user_key() with KEY_LOOKUP_CREATE now
> returns -EPERM for KEY_SPEC_{SESSION,PROCESS,THREAD,USER}_KEYRING
> without hitting commit_creds().
>
> Reviewed-by: Guicai Ma <maguicai@xxxxxxxxxx>
> Tested-by: Guicai Ma <maguicai@xxxxxxxxxx>

Thanks a bunch!

Br, Jarkko