<feed xmlns='http://www.w3.org/2005/Atom'>
<title>efi-boot-shim.git/include/test.mk, branch rolling</title>
<subtitle> (mirror of https://github.com/vyos/efi-boot-shim.git)
</subtitle>
<id>https://git.amelek.net/vyos/efi-boot-shim.git/atom?h=rolling</id>
<link rel='self' href='https://git.amelek.net/vyos/efi-boot-shim.git/atom?h=rolling'/>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/'/>
<updated>2025-02-04T00:00:39+00:00</updated>
<entry>
<title>test.mk: don't use a temporary random.bin</title>
<updated>2025-02-04T00:00:39+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2025-01-22T21:33:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=e42c31963a5a1ed2edf8a40df81ccfe697c32981'/>
<id>urn:sha1:e42c31963a5a1ed2edf8a40df81ccfe697c32981</id>
<content type='text'>
Sometimes using a temp file to make test-random.h breaks builds because
clean and test get made in parallel.

Since debugging parallel make is anything but easy, it's better to just
not use the intermediate file.  This patch makes it use a pipe instead.
Because we live in the worst possible world, we have to support RHEL 9,
in which xxd does not support "-n prefix", and so we have to build the
header variable definition lines in shell.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Test (and fix) ImageAddress()</title>
<updated>2023-06-23T21:13:13+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2023-04-28T15:55:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=569270d8603d68308ad8bf8ef4cad4b09101d35e'/>
<id>urn:sha1:569270d8603d68308ad8bf8ef4cad4b09101d35e</id>
<content type='text'>
This adds a test case for our address sanitation checking function
ImageAddresS().  In doing so it addresses two issues:

- previously we allowed the address after the last byte of the image to
  be computed (may need to revert this or fix some callers, we'll see...)
- bespoke overflow checking and using + directly instead of using
  __builtin_add_overflow()

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Make sbat_var.S parse right with buggy gcc/binutils</title>
<updated>2022-12-07T15:45:23+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2022-12-05T22:57:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=657b2483ca6e9fcf2ad8ac7ee577ff546d24c3aa'/>
<id>urn:sha1:657b2483ca6e9fcf2ad8ac7ee577ff546d24c3aa</id>
<content type='text'>
In https://github.com/rhboot/shim/issues/533 , iokomin noticed that
gas in binutils before 2.36 appears to be incorrectly concatenating
string literals in '.asciz' directives, including an extra NUL character
in between the strings, and this will cause us to incorrectly parse the
.sbatlevel section in shim binaries.

This patch adds test cases that will cause the build to fail if this has
happened, as well as changing sbat_var.S to to use '.ascii' and '.byte'
to construct the data, rather than using '.asciz'.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Make SBAT variable payload introspectable</title>
<updated>2022-08-03T18:54:57+00:00</updated>
<author>
<name>Chris Coulson</name>
<email>chris.coulson@canonical.com</email>
</author>
<published>2022-05-31T21:21:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=0eb07e11b20680200d3ce9c5bc59299121a75388'/>
<id>urn:sha1:0eb07e11b20680200d3ce9c5bc59299121a75388</id>
<content type='text'>
Given a set of EFI variables and boot assets, it should be possible
to compute what the value of PCR 7 will be on the next boot.

As shim manages the contents of the SbatLevel variable and this is
measured to PCR 7, export the payloads that shim contains in a new
COFF section (.sbatlevel) so that it can be introspected by code
outside of shim.

The new section works a bit like .vendor_cert - it contains a header
and then the payload. In this case, the header contains no size fields
because the strings are NULL terminated. Shim uses this new section
internally in set_sbat_uefi_variable.

The .sbatlevel section starts with a 4 byte version field which is
not used by shim but may be useful for external auditors if the
format of the section contents change in the future.

Signed-off-by: Chris Coulson &lt;chris.coulson@canonical.com&gt;
</content>
</entry>
<entry>
<title>tests: also look for system headers in multi-arch directories</title>
<updated>2022-05-04T18:55:35+00:00</updated>
<author>
<name>Steve McIntyre</name>
<email>steve@einval.com</email>
</author>
<published>2022-04-28T11:32:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=31094e5a08cbad78054c2da53d55b50e8742bcd4'/>
<id>urn:sha1:31094e5a08cbad78054c2da53d55b50e8742bcd4</id>
<content type='text'>
On Debian(-derived) systems low-level system headers are under
/usr/include/&lt;multi-arch path&gt;, so look there too.

Otherwise we see stuff like:

gcc -O2 -fno-diagnostics-color -ggdb -std=gnu11 -isystem &lt;foo&gt;/shim.git/include/system -I&lt;foo&gt;/shim.git/gnu-efi/inc -I&lt;foo&gt;/shim.git/gnu-efi/inc/ia32 -I&lt;foo&gt;/shim.git/gnu-efi/inc/protocol -Iinclude -iquote . -isystem /usr/include -isystem /usr/lib/gcc/i686-linux-gnu/11/include -mno-mmx -mno-sse -mno-red-zone -nostdinc -maccumulate-outgoing-args  -m32 -DMDE_CPU_IA32 -DPAGE_SIZE=4096   -fshort-wchar -fno-builtin -rdynamic -fno-inline -fno-eliminate-unused-debug-types -fno-eliminate-unused-debug-symbols -gpubnames -grecord-gcc-switches  -Wall -Wextra -Wno-missing-field-initializers -Wsign-compare -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-unused-variable -Wno-pointer-sign -Werror -Werror=nonnull -Werror=nonnull-compare  -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI -DPAGE_SIZE=4096 -DSHIM_UNIT_TEST -DDEFAULT_DEBUG_PRINT_STATE=0 -isystem include-fixed -o test-csv csv.c test-csv.c test.c libefi-test.a -lefivar
In file included from /usr/include/bits/errno.h:26,
                 from /usr/include/errno.h:28,
                 from /usr/include/efivar/efivar.h:24,
                 from include/test.h:51,
                 from shim.h:68,
                 from csv.c:6:
/usr/include/linux/errno.h:1:10: fatal error: asm/errno.h: No such file or directory
    1 | #include &lt;asm/errno.h&gt;
      |          ^~~~~~~~~~~~~
compilation terminated.
In file included from /usr/include/bits/errno.h:26,
                 from /usr/include/errno.h:28,
                 from /usr/include/efivar/efivar.h:24,
                 from include/test.h:51,
                 from shim.h:68,
                 from test-csv.c:9:
/usr/include/linux/errno.h:1:10: fatal error: asm/errno.h: No such file or directory
    1 | #include &lt;asm/errno.h&gt;
      |          ^~~~~~~~~~~~~
compilation terminated.
In file included from /usr/include/bits/errno.h:26,
                 from /usr/include/errno.h:28,
                 from /usr/include/efivar/efivar.h:24,
                 from include/test.h:51,
                 from shim.h:68,
                 from test.c:7:
/usr/include/linux/errno.h:1:10: fatal error: asm/errno.h: No such file or directory
    1 | #include &lt;asm/errno.h&gt;
      |          ^~~~~~~~~~~~~
compilation terminated.

Signed-off-by: Steve McIntyre &lt;steve@einval.com&gt;
</content>
</entry>
<entry>
<title>tests: add "include-fixed" GCC directory to include directories</title>
<updated>2021-09-10T20:06:22+00:00</updated>
<author>
<name>Jonas Witschel</name>
<email>diabonas@archlinux.org</email>
</author>
<published>2021-09-09T15:53:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=c1a84dc0a695782e55a97173e4f9f8a98432f9e1'/>
<id>urn:sha1:c1a84dc0a695782e55a97173e4f9f8a98432f9e1</id>
<content type='text'>
On Arch Linux, the GCC version of "limits.h" is in the "include-fixed" instead
of the "include" directory. It needs to be included in the include directories
list, otherwise attempting to compile the test suite fails with the following
error:

In file included from /usr/include/efivar/efivar-dp.h:22,
                 from /usr/include/efivar/efivar.h:238,
                 from include/test.h:51,
                 from shim.h:68,
                 from csv.c:6:
/usr/include/limits.h:124:16: fatal error: limits.h: No such file or directory
  124 | # include_next &lt;limits.h&gt;
      |                ^~~~~~~~~~
compilation terminated.
</content>
</entry>
<entry>
<title>tests: Add a unit test for mok mirroring</title>
<updated>2021-09-07T21:05:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-07-23T18:36:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=397f820b8c091ca5e3023b6dbd2f26fb256a19f0'/>
<id>urn:sha1:397f820b8c091ca5e3023b6dbd2f26fb256a19f0</id>
<content type='text'>
Test that our mok mirroring doesn't ever try to delete any variable that
it has previously created, and that it properly mirrors at least
MokList, MokListX, and SbatLevel, at least when variables actually work.

These tests will fail (rather a lot) without 7f64fd6da9458b73c4.

Currently valgrind shows a memory leak in this code which is not
introduced in this patch series.  Since all of our memory is freed on
Exit() or when kernel does ExitBootServices(), this doesn't have any
significant repercussions.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>tests: add a mock implementation of {Get,Set}Variable and tests for it</title>
<updated>2021-09-07T21:05:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-07-22T19:45:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=2c9eebcf6ddd198c5ba49d784c4536d05023c28b'/>
<id>urn:sha1:2c9eebcf6ddd198c5ba49d784c4536d05023c28b</id>
<content type='text'>
Some tests will need variables, and so we need a mock implementation of
the various calls relating to them.

This patch adds implementations for the EFI Runtime Services calls
GetVariable(), SetVariable(), GetNextVariableName(), and
QueryVariableInfo().  Additionally, it enforces tunable limits on
storage for variables, and (with only a little work) the limits can be
different for SetVariable() vs what is returned by QueryVariableInfo().
That is, it can lie to you like real systems do.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>tests: Add a 'test-coverage' make target for gcov</title>
<updated>2021-09-07T21:05:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-08-04T14:42:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=6a95bea8d508f3937e46b1eec2b5def8d5135d78'/>
<id>urn:sha1:6a95bea8d508f3937e46b1eec2b5def8d5135d78</id>
<content type='text'>
This adds a make target that builds the tests with gcov so we can
identify coverage gaps in the test suite.

It also makes a special test-lto invocation, so that a developer can run
these tests with the somewhat different optimization results LTO will
have.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>tests: link all tests against libefivar</title>
<updated>2021-09-07T21:05:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-07-23T18:31:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=97350bd6e02ceb0818e8bc0a2b2bc6adaf9c2092'/>
<id>urn:sha1:97350bd6e02ceb0818e8bc0a2b2bc6adaf9c2092</id>
<content type='text'>
When writing new tests, if we get to the point where we have to use
libefivar for something, it's very common that I accidentally link it in
twice.  When that happens, I typically spend an unfortunate amount of
time staring at FLTO's mangled names before I figure out what I've done
wrong.

This patch makes all the tests link against libefivar, thereby
avoiding the issue.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
</feed>
