public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] efivarfs: fix ability to mimic uncommitted variables
@ 2025-01-19 14:59 James Bottomley
  2025-01-19 14:59 ` [PATCH 1/2] efivarfs: prevent setting of zero size on the inodes in the cache James Bottomley
  2025-01-19 14:59 ` [PATCH 2/2] selftests/efivarfs: add check for disallowing file truncation James Bottomley
  0 siblings, 2 replies; 6+ messages in thread
From: James Bottomley @ 2025-01-19 14:59 UTC (permalink / raw)
  To: linux-fsdevel, linux-efi
  Cc: Ard Biesheuvel, Jeremy Kerr, Christian Brauner, Al Viro

The use of simple_setattr in efivarfs means that anyone who can write
to the variable (which is usually only root) can set the cached inode
size to an arbitrary value (including truncating it to zero).  This
value, while not transmitted on to the underlying variable, does show
up on stat and means that anyone who can write to the variable file
can also make any variable mimic an uncommitted one (a variable with
zero size) which is checked by certain programmes that use EFI
variables, like systemd.  This problem can be fixed by not allowing
anything except a successful variable update to change the inode size.

I also added a regression test to make sure the problem behaviour
isn't reintroduced.

James

---

James Bottomley (2):
  efivarfs: prevent setting of zero size on the inodes in the cache
  selftests/efivarfs: add check for disallowing file truncation

 fs/efivarfs/inode.c                          | 17 +++++++++++++++
 tools/testing/selftests/efivarfs/efivarfs.sh | 23 ++++++++++++++++++++
 2 files changed, 40 insertions(+)

-- 
2.35.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-19 16:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-19 14:59 [PATCH 0/2] efivarfs: fix ability to mimic uncommitted variables James Bottomley
2025-01-19 14:59 ` [PATCH 1/2] efivarfs: prevent setting of zero size on the inodes in the cache James Bottomley
2025-01-19 16:32   ` Ard Biesheuvel
2025-01-19 16:48     ` James Bottomley
2025-01-19 16:52       ` Ard Biesheuvel
2025-01-19 14:59 ` [PATCH 2/2] selftests/efivarfs: add check for disallowing file truncation James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox