Skip to content

efivarfs: fix ability to mimic uncommitted variables

James Bottomley linux-efi linux-fsdevel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2efivarfs: prevent setting of zero size on the inodes in the cachefs/efivarfs/inode.c+17 -03 replies
2/2selftests/efivarfs: add check for disallowing file truncationtools/testing/selftests/efivarfs/efivarfs.sh+23 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] efivarfs: fix ability to mimic uncommitted variables

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(+)
Signature · 1 line
2.35.3