On Tue, 21 Jun 2022 at 23:21, Kees Cook <keescook@xxxxxxxxxxxx> wrote: > > On Tue, Jun 21, 2022 at 11:12:17PM +0200, Ard Biesheuvel wrote: > > On Tue, 21 Jun 2022 at 23:00, Kees Cook <keescook@xxxxxxxxxxxx> wrote: > > > > > > On Tue, Jun 21, 2022 at 05:36:18PM +0200, Ard Biesheuvel wrote: > > > > Avoid the efivars layer and simply call the newly introduced EFI > > > > varstore helpers instead. This simplifies the code substantially, and > > > > also allows us to remove some hacks in the shared efivars layer that > > > > were added for efi-pstore specifically. > > > > > > > > Since we don't store the name of the associated EFI variable into each > > > > pstore record when enumerating them, we have to guess the variable name > > > > it was constructed from at deletion time, since we no longer keep a > > > > shadow copy of the variable store. To make this a bit more exact, store > > > > the CRC-32 of the ASCII name into the pstore record's ECC region so we > > > > can use it later to make an educated guess regarding the name of the EFI > > > > variable. > > > > > > I wonder if pstore_record should have a "private" field for backends to > > > use? That seems like it solve the need for overloading the ecc field, > > > and allow for arbitrarily more information to be stored (i.e. store full > > > efi var name instead of an easily-colliding crc32?) > > > > > > > We could easily add that - we'd just have to decide how to free the > > memory it points to. > > I assume the pstore core could do that since it manages the record > lifetime already? > So if priv is non-NULL when it frees the record, it passes it to kfree() ?