[PATCH v2] KEYS: Protect pkey method checks against type removal

Jarkko Sakkinen jarkko at kernel.org
Thu Nov 5 03:28:36 UTC 2026


On Thu, Nov 05, 2026 at 10:24:39AM +0800, Yuansheng Yang wrote:
> > >  	if (copy_to_user(_res, &res, sizeof(res)) == 0 &&
> > >  	    clear_user(_res->__spare, sizeof(_res->__spare)) == 0)
> > >  		ret = 0;
> >
> > Why up_read is not here?
> 
> To avoid holding key->sem across user memory faults. After asym_query(),
> res is a local copy. Copying it out no longer needs the lock.

Hmm... OK, thank makes sense.

I'll think I'll hold for +1 version and see how this organizes and
provide feedback what might still need to be addressed.

I think the timing is good for the patch exactly because it can
land before turning this over so in that regard this is all fine.

Br, jarkko



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