On Mon, Aug 19, 2024 at 06:09:06PM +0100, Catalin Marinas wrote: > On Thu, Aug 15, 2024 at 04:09:26PM +0100, Dave P Martin wrote: > > On Thu, Aug 15, 2024 at 02:18:15PM +0100, Joey Gouly wrote: > > > That's a lot of words to say, or ask, do you agree with the approach of only > > > saving POR_EL0 in the signal frame if num_allocated_pkeys() > 1? > > > > > > Thanks, > > > Joey > > > > ...So..., given all the above, it is perhaps best to go back to > > dumping POR_EL0 unconditionally after all, unless we have a mechanism > > to determine whether pkeys are in use at all. > > Ah, I can see why checking for POR_EL0_INIT is useful. Only checking for > the allocated keys gets confusing with pkey 0. > > Not sure what the deal is with pkey 0. Is it considered allocated by > default or unallocatable? If the former, it implies that pkeys are > already in use (hence the additional check for POR_EL0_INIT). In > principle the hardware allows us to use permissions where the pkeys do > not apply but we'd run out of indices and PTE bits to encode them, so I > think by default we should assume that pkey 0 is pre-allocated. > > You can consider pkey 0 allocated by default. You can actually pkey_free(0), there's nothing stopping that. > So I agree that it's probably best to save it unconditionally. Alright, will leave it as is! Thanks, Joey