Skip to content

Commit 153f2d1

Browse files
pvts-matPlaidCat
authored andcommitted
efivarfs: basic description
1 parent 87b459b commit 153f2d1

File tree

1 file changed

+187
-0
lines changed

1 file changed

+187
-0
lines changed

kselftests/efivarfs/README.rst

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
About
2+
=====
3+
4+
The ``efivarfs`` is a file system allowing for displaying, modifying,
5+
creating and removing the UEFI (Unified Extensible Firmware Interface)
6+
variables.
7+
8+
https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface
9+
10+
::
11+
12+
UEFI defines variables through which an operating system can interact with the
13+
firmware. UEFI boot variables are used by the boot loader and used by the
14+
operating system only for early system start-up. UEFI runtime variables allow an
15+
operating system to manage certain settings of the firmware like the UEFI boot
16+
manager or managing the keys for UEFI Secure Boot protocol etc.
17+
18+
The collection defines a single test: ``efivarfs:efivarfs.sh``.
19+
20+
Requirements and applicability
21+
==============================
22+
23+
The test requires ``CONFIG_EFIVAR_FS`` option to be enabled in the
24+
Kernel. It's ``y`` in all Rocky versions:
25+
26+
.. code:: shell
27+
28+
grep CONFIG_EFIVAR_FS kernel-src-tree-{ciqlts8_6,ciqlts8_8,ciqlts9_2,ciqlts9_4}/configs/*
29+
30+
::
31+
32+
kernel-src-tree-ciqlts8_6/configs/kernel-aarch64-debug.config:CONFIG_EFIVAR_FS=y
33+
kernel-src-tree-ciqlts8_6/configs/kernel-aarch64.config:CONFIG_EFIVAR_FS=y
34+
kernel-src-tree-ciqlts8_6/configs/kernel-x86_64-debug.config:CONFIG_EFIVAR_FS=y
35+
kernel-src-tree-ciqlts8_6/configs/kernel-x86_64.config:CONFIG_EFIVAR_FS=y
36+
kernel-src-tree-ciqlts8_8/configs/kernel-aarch64-debug.config:CONFIG_EFIVAR_FS=y
37+
kernel-src-tree-ciqlts8_8/configs/kernel-aarch64.config:CONFIG_EFIVAR_FS=y
38+
kernel-src-tree-ciqlts8_8/configs/kernel-x86_64-debug.config:CONFIG_EFIVAR_FS=y
39+
kernel-src-tree-ciqlts8_8/configs/kernel-x86_64.config:CONFIG_EFIVAR_FS=y
40+
kernel-src-tree-ciqlts9_2/configs/kernel-aarch64-64k-debug-rhel.config:CONFIG_EFIVAR_FS=y
41+
kernel-src-tree-ciqlts9_2/configs/kernel-aarch64-64k-rhel.config:CONFIG_EFIVAR_FS=y
42+
kernel-src-tree-ciqlts9_2/configs/kernel-aarch64-debug-rhel.config:CONFIG_EFIVAR_FS=y
43+
kernel-src-tree-ciqlts9_2/configs/kernel-aarch64-rhel.config:CONFIG_EFIVAR_FS=y
44+
kernel-src-tree-ciqlts9_2/configs/kernel-x86_64-debug-rhel.config:CONFIG_EFIVAR_FS=y
45+
kernel-src-tree-ciqlts9_2/configs/kernel-x86_64-rhel.config:CONFIG_EFIVAR_FS=y
46+
kernel-src-tree-ciqlts9_4/configs/kernel-aarch64-64k-debug-rhel.config:CONFIG_EFIVAR_FS=y
47+
kernel-src-tree-ciqlts9_4/configs/kernel-aarch64-64k-rhel.config:CONFIG_EFIVAR_FS=y
48+
kernel-src-tree-ciqlts9_4/configs/kernel-aarch64-debug-rhel.config:CONFIG_EFIVAR_FS=y
49+
kernel-src-tree-ciqlts9_4/configs/kernel-aarch64-rhel.config:CONFIG_EFIVAR_FS=y
50+
kernel-src-tree-ciqlts9_4/configs/kernel-aarch64-rt-debug-rhel.config:CONFIG_EFIVAR_FS=y
51+
kernel-src-tree-ciqlts9_4/configs/kernel-aarch64-rt-rhel.config:CONFIG_EFIVAR_FS=y
52+
kernel-src-tree-ciqlts9_4/configs/kernel-x86_64-debug-rhel.config:CONFIG_EFIVAR_FS=y
53+
kernel-src-tree-ciqlts9_4/configs/kernel-x86_64-rhel.config:CONFIG_EFIVAR_FS=y
54+
kernel-src-tree-ciqlts9_4/configs/kernel-x86_64-rt-debug-rhel.config:CONFIG_EFIVAR_FS=y
55+
kernel-src-tree-ciqlts9_4/configs/kernel-x86_64-rt-rhel.config:CONFIG_EFIVAR_FS=y
56+
57+
However, because the base cloud images for the ``x86_64`` architecture
58+
all use BIOS by default, the ``efivarfs`` can't really be tested on
59+
these systems without some serious booting reconfiguration. The
60+
``/sys/firmware/efi/efivars`` path where the ``efivarfs`` is typically
61+
mounted (and where ``efivarfs:efivarfs.sh`` test *expects* it to be
62+
mounted) is missing, and the test is skipped:
63+
64+
::
65+
66+
# selftests: efivarfs: efivarfs.sh
67+
# skip all tests: efivarfs is not mounted on /sys/firmware/efi/efivars
68+
ok 1 selftests: efivarfs: efivarfs.sh # SKIP
69+
70+
In contrast, the cloud base images for ``aarch64`` use UEFI and
71+
``efivarfs`` is mounted at ``/sys/firmware/efi/efivars`` on startup by
72+
default.
73+
74+
.. code:: shell
75+
76+
mount
77+
78+
::
79+
80+
81+
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
82+
83+
84+
.. code:: shell
85+
86+
ls -l /sys/firmware/efi/efivars
87+
88+
::
89+
90+
-rw-r--r--. 1 root root 66 May 15 21:40 Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c
91+
-rw-r--r--. 1 root root 85 May 15 21:40 Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c
92+
-rw-r--r--. 1 root root 92 May 15 21:40 Boot0002-8be4df61-93ca-11d2-aa0d-00e098032b8c
93+
-rw-r--r--. 1 root root 92 May 15 21:40 Boot0003-8be4df61-93ca-11d2-aa0d-00e098032b8c
94+
-rw-r--r--. 1 root root 132 May 15 21:40 Boot0004-8be4df61-93ca-11d2-aa0d-00e098032b8c
95+
-rw-r--r--. 1 root root 6 May 15 21:40 BootCurrent-8be4df61-93ca-11d2-aa0d-00e098032b8c
96+
-rw-r--r--. 1 root root 8 May 15 21:40 BootOptionSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c
97+
-rw-r--r--. 1 root root 14 May 15 21:40 BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c
98+
-rw-r--r--. 1 root root 8 May 15 21:40 certdb-d9bee56e-75dc-49d9-b4d7-b534210f637a
99+
-rw-r--r--. 1 root root 8 May 15 21:40 certdbv-d9bee56e-75dc-49d9-b4d7-b534210f637a
100+
-rw-r--r--. 1 root root 82 May 15 21:40 ConIn-8be4df61-93ca-11d2-aa0d-00e098032b8c
101+
-rw-r--r--. 1 root root 571 May 15 21:40 ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c
102+
-rw-r--r--. 1 root root 67 May 15 21:40 ConOut-8be4df61-93ca-11d2-aa0d-00e098032b8c
103+
-rw-r--r--. 1 root root 571 May 15 21:40 ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c
104+
-rw-r--r--. 1 root root 67 May 15 21:40 ErrOut-8be4df61-93ca-11d2-aa0d-00e098032b8c
105+
-rw-r--r--. 1 root root 571 May 15 21:40 ErrOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c
106+
-rw-r--r--. 1 root root 18 May 15 21:40 Key0000-8be4df61-93ca-11d2-aa0d-00e098032b8c
107+
-rw-r--r--. 1 root root 18 May 15 21:40 Key0001-8be4df61-93ca-11d2-aa0d-00e098032b8c
108+
-rw-r--r--. 1 root root 8 May 15 21:40 Lang-8be4df61-93ca-11d2-aa0d-00e098032b8c
109+
-rw-r--r--. 1 root root 17 May 15 21:40 LangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c
110+
-rw-r--r--. 1 root root 1729 May 15 21:40 MokListRT-605dab50-e046-4300-abb6-3dd810dd8b23
111+
-rw-r--r--. 1 root root 5 May 15 21:40 MokListTrustedRT-605dab50-e046-4300-abb6-3dd810dd8b23
112+
-rw-r--r--. 1 root root 80 May 15 21:40 MokListXRT-605dab50-e046-4300-abb6-3dd810dd8b23
113+
-rw-r--r--. 1 root root 8 May 15 21:40 MTC-eb704011-1402-11d3-8e77-00a0c969723b
114+
-rw-r--r--. 1 root root 12 May 15 21:40 OsIndicationsSupported-8be4df61-93ca-11d2-aa0d-00e098032b8c
115+
-rw-r--r--. 1 root root 7 May 15 21:40 PlatformLang-8be4df61-93ca-11d2-aa0d-00e098032b8c
116+
-rw-r--r--. 1 root root 22 May 15 21:40 PlatformLangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c
117+
-rw-r--r--. 1 root root 114 May 15 21:40 PlatformRecovery0000-8be4df61-93ca-11d2-aa0d-00e098032b8c
118+
-rw-r--r--. 1 root root 22 May 15 21:40 SbatLevelRT-605dab50-e046-4300-abb6-3dd810dd8b23
119+
-rw-r--r--. 1 root root 5 May 15 21:40 SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c
120+
-rw-r--r--. 1 root root 5 May 15 21:40 SetupMode-8be4df61-93ca-11d2-aa0d-00e098032b8c
121+
-rw-r--r--. 1 root root 68 May 15 21:40 SignatureSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c
122+
-rw-r--r--. 1 root root 6 May 15 21:40 Timeout-8be4df61-93ca-11d2-aa0d-00e098032b8c
123+
-rw-r--r--. 1 root root 5 May 15 21:40 VarErrorFlag-04b37fe8-f6ae-480b-bdd5-37d98c5e89aa
124+
-rw-r--r--. 1 root root 5 May 15 21:40 VendorKeys-8be4df61-93ca-11d2-aa0d-00e098032b8c
125+
126+
The ``efivarfs:efivarfs.sh`` test should run fine, with a message
127+
similar to this:
128+
129+
::
130+
131+
# selftests: efivarfs: efivarfs.sh
132+
# --------------------
133+
# running test_create
134+
# --------------------
135+
# ./efivarfs.sh: line 52: /sys/firmware/efi/efivars/test_create-210be57c-9849-4fc7-a635-e6382d1aec27: Operation not permitted
136+
# [PASS]
137+
# --------------------
138+
# running test_create_empty
139+
# --------------------
140+
# [PASS]
141+
# --------------------
142+
# running test_create_read
143+
# --------------------
144+
# [PASS]
145+
# --------------------
146+
# running test_delete
147+
# --------------------
148+
# [PASS]
149+
# --------------------
150+
# running test_zero_size_delete
151+
# --------------------
152+
# [PASS]
153+
# --------------------
154+
# running test_open_unlink
155+
# --------------------
156+
# [PASS]
157+
# --------------------
158+
# running test_valid_filenames
159+
# --------------------
160+
# [PASS]
161+
# --------------------
162+
# running test_invalid_filenames
163+
# --------------------
164+
# [PASS]
165+
ok 1 selftests: efivarfs: efivarfs.sh
166+
167+
No variability of the test's results was observed across the history of
168+
around 80 runs in total, on all versions {``ciqlts8_6``, ``ciqlts8_8``,
169+
``ciqlts9_2``, ``ciqlts9_4``}; the test is stable.
170+
171+
Related files
172+
=============
173+
174+
``Documentation/filesystems/efivarfs.rst``
175+
------------------------------------------
176+
177+
Official, short documentation of the ``efivarfs`` filesystem.
178+
179+
``tools/testing/selftests/efivarfs/efivarfs.sh``
180+
------------------------------------------------
181+
182+
The script realizing the collection's only test. Each of the subtests
183+
(eg. ``test_open_unlink``) have its corresponding bash function with the
184+
same name defined there. The ``test_create_read`` subtest requires the
185+
compiled ``create-read`` binary and ``test_open_unlink`` requires
186+
``open-unlink``. The rest is realized using standard shell file
187+
operations.

0 commit comments

Comments
 (0)