<feed xmlns='http://www.w3.org/2005/Atom'>
<title>efi-boot-shim.git, branch 15.2</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=15.2</id>
<link rel='self' href='https://git.amelek.net/vyos/efi-boot-shim.git/atom?h=15.2'/>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/'/>
<updated>2020-10-15T23:38:52+00:00</updated>
<entry>
<title>Fix incorrect allocation size for EV_EFI_BOOT_SERVICES_APPLICATION events</title>
<updated>2020-10-15T23:38:52+00:00</updated>
<author>
<name>James Bottomley</name>
<email>James.Bottomley@HansenPartnership.com</email>
</author>
<published>2020-10-15T23:38:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=5ec906ac6ce4596664a6a7f1626895ebca9cd65e'/>
<id>urn:sha1:5ec906ac6ce4596664a6a7f1626895ebca9cd65e</id>
<content type='text'>
sizeof(EFI_IMAGE_LOAD_EVENT) needs to represent the size of the header
so we can add the actual device path size to it to compute the event.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>hexdump.h: fix arithmetic error.</title>
<updated>2020-10-15T23:17:35+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2020-07-30T18:34:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=64a18c4ea6588147a8cc9c140c4cf344cb27e41d'/>
<id>urn:sha1:64a18c4ea6588147a8cc9c140c4cf344cb27e41d</id>
<content type='text'>
When I modified the hexdumper to help debug MokListRT mirroring not
working because of PcdMaxVolatileVariableSize being tiny, I
inadvertently added something that is effectively:

hexdump(..., char *buf, ..., int position)
{
	unsigned long begin = (position % 16);
	unsigned long i;
	...
	for (i = 0; i &lt; begin; i++) {
		...
	}
	...
}

Unfortunately, in c if 0x8 is set in position, that means begin is
0xfffffffffffff8, because signed integer math is horrifying:

include/hexdump.h:99:vhexdumpf() &amp;data[offset]:0x9E77E6BC size-offset:0x14
include/hexdump.h:15:prepare_hex() position:0x9E77E6BC
include/hexdump.h:17:prepare_hex() before:0xFFFFFFFFFFFFFFFC size:0x14
include/hexdump.h:19:prepare_hex() before:0xFFFFFFFFFFFFFFFC after:0x0
include/hexdump.h:21:prepare_hex() buf:0x000000009E77E2BC offset:0 &amp;buf[offset]:0x000000009E77E2BC

Woops.

This could further have been prevented in /some/ cases by simply not
preparing the hexdump buffer when "verbose" is disabled.

This patch makes "pos" be unsigned in all cases, and also checks for
verbose in vhexdumpf() and simply returns if it is 0.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Fix some mokmanager deletion paths</title>
<updated>2020-10-15T23:17:35+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2020-08-17T19:47:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=890563ee7e2a1b6aa9642cf2e4c36b0eec90822c'/>
<id>urn:sha1:890563ee7e2a1b6aa9642cf2e4c36b0eec90822c</id>
<content type='text'>
This fixes several codepaths where MokList and MokListX are supposed to
be deleted, but are not.  It also adds debug logging to much of the
deletion codepath.
</content>
</entry>
<entry>
<title>Fix buffer overrun due DEFAULT_LOADER length miscalculation</title>
<updated>2020-09-09T19:56:39+00:00</updated>
<author>
<name>Javier Martinez Canillas</name>
<email>javierm@redhat.com</email>
</author>
<published>2020-09-08T10:26:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=74b05de7d19fa4f462b6e228a8a03f8ee242b673'/>
<id>urn:sha1:74b05de7d19fa4f462b6e228a8a03f8ee242b673</id>
<content type='text'>
The DEFAULT_LOADER is a UCS-2 string and the StrLen() function returns the
number of UCS-2 encoded characters in the string. But the allocated memory
is in bytes, so only half of the needed memory to store it is allocated.

This leads to a buffer overrun when the StrCpy() function attempts to copy
the DEFAULT_LOADER to the allocated buffer.

Fixes: 354bd9b1931 ("Actually check for errors from set_second_stage()")
Reported-by: Stuart Hayes &lt;stuart_hayes@dell.com&gt;
Signed-off-by: Javier Martinez Canillas &lt;javierm@redhat.com&gt;
</content>
</entry>
<entry>
<title>mirror_one_mok_variable(): round allocation up to a full page</title>
<updated>2020-08-04T16:49:30+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2020-08-04T16:42:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=63f7943dbe0583dd0bf89ee8fe8230d4b7373b91'/>
<id>urn:sha1:63f7943dbe0583dd0bf89ee8fe8230d4b7373b91</id>
<content type='text'>
The code currently computes the size of the MoK variable in ram and
rounds up to a full page, but then actually allocates the exact size,
rather than the rounded up version.  This should be completely safe, but
the intent was to round up to at least the page size boundary, and to
always guarantee rounding up /some/, to ensure extra 0-bytes at the end
of the buffer.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Implement lennysz's suggestions for MokListRT</title>
<updated>2020-07-26T02:14:08+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2020-07-26T02:13:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=65be350308783a8ef537246c8ad0545b4e6ad069'/>
<id>urn:sha1:65be350308783a8ef537246c8ad0545b4e6ad069</id>
<content type='text'>
Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Also use a config table to mirror mok variables.</title>
<updated>2020-07-26T02:14:08+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2020-07-24T02:09:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=fecc2dfb8e408526221091923d9345796b8e294e'/>
<id>urn:sha1:fecc2dfb8e408526221091923d9345796b8e294e</id>
<content type='text'>
Everything was going just fine until I made a vendor_db with 17kB of
sha256 sums in it.  And then the same source tree that had worked fine
without that threw errors and failed all over the place.  I wrote some
code to diagnose the problem, and of course it was a failure in
mirroring MokList to MokListRT.

As Patrick noted in 741c61abba7, some systems have obnoxiously low
amounts of variable storage available:

mok.c:550:import_mok_state() BS+RT variable info:
		     MaximumVariableStorageSize:0x000000000000DFE4
		     RemainingVariableStorageSize:0x000000000000D21C
		     MaximumVariableSize:0x0000000000001FC4

The most annoying part is that on at least this edk2 build,
SetVariable() /does actually appear to set the variable/, but it returns
EFI_INVALID_PARAMETER.  I'm not planning on relying on that behavior.

So... yeah, the largest *volatile* (i.e. RAM only) variable this edk2
build will let you create is less than two pages.  It's only got 7.9G
free, so I guess it's feeling like space is a little tight.

We're also not quite preserving that return code well enough for his
workaround to work.

New plan.  We try to create variables the normal way, but we don't
consider not having enough space to be fatal.  In that case, we create
an EFI_SECURITY_LIST with one sha256sum in it, with a value of all 0,
and try to add that so we're sure there's /something/ there that's
innocuous.  On systems where the first SetVariable() /
QueryVariableInfo() lied to us, the correct variable should be there,
otherwise the one with the zero-hash will be.

We then also build a config table to hold this info and install that.

The config table is a packed array of this struct:

struct mok_variable_config_entry {
       CHAR8 name[256];
       UINT64 data_size;
       UINT8 data[];
};

There will be N+1 entries, and the last entry is all 0 for name and
data_size.  The total allocation size will always be a multiple of 4096.
In the typical RHEL 7.9 case that means it'll be around 5 pages.

It's installed with this guid:

c451ed2b-9694-45d3-baba-ed9f8988a389

Anything that can go wrong will.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
Upstream: not yet, I don't want people to read this before Wednesday.
Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Improve debug output some</title>
<updated>2020-07-26T02:14:08+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2020-07-24T00:29:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=fc4368fed53837e00d303600d8b628cb0392b629'/>
<id>urn:sha1:fc4368fed53837e00d303600d8b628cb0392b629</id>
<content type='text'>
Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
Upstream: pr#213
</content>
</entry>
<entry>
<title>Make openssl accept the right set of KU/EKUs</title>
<updated>2020-07-24T02:22:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2020-07-22T23:54:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=705d47ac2c90b8de07a4ef3e1930de6c4b8fece0'/>
<id>urn:sha1:705d47ac2c90b8de07a4ef3e1930de6c4b8fece0</id>
<content type='text'>
Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
Upstream: pr#211
</content>
</entry>
<entry>
<title>Handle binaries with multiple signatures.</title>
<updated>2020-07-24T02:22:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2020-07-23T20:32:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=76c0447e204c7e4ce918c4887ce8aae0e0816271'/>
<id>urn:sha1:76c0447e204c7e4ce918c4887ce8aae0e0816271</id>
<content type='text'>
This adds support for multiple signatures.  It first tries validating
the binary by hash, first against our dbx lists, then against our db
lists.  If it isn't allowed or rejected at that step, it continues to
the normal routine of checking all the signatures.

At this point it does *not* reject a binary just because a signature is
by a cert on a dbx list, though that will override any db list that
certificate is listed on.  If at any point any assertion about the
binary or signature list being well-formed fails, the binary is
immediately rejected, though we do allow skipping over signatures
which have an unsupported sig-&gt;Hdr.wCertificateType.

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