Version 259.1
This commit is contained in:
parent
2e10d7da1e
commit
985170fdc6
4 changed files with 2 additions and 170 deletions
|
|
@ -1,112 +0,0 @@
|
|||
From 75890d949f92c412c0936b8536b2e0dc8f7dfb40 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Rosbrook <enr0n@ubuntu.com>
|
||||
Date: Fri, 19 Dec 2025 11:01:49 -0500
|
||||
Subject: [PATCH] ukify: omit .osrel section when --os-release= is empty
|
||||
|
||||
The primary motivation for this is to allow users of ukify to build
|
||||
UKI-like objects, without having them later be detected as a UKI by
|
||||
tools like kernel-install and bootctl.
|
||||
|
||||
The common code used by these tools to determine if a PE binary is a UKI
|
||||
checks that both .osrel and .linux sections are present. Hence, adding
|
||||
a mechansim to skip .osrel provides a way to avoid being labeled a UKI.
|
||||
---
|
||||
man/ukify.xml | 5 ++++-
|
||||
src/ukify/test/test_ukify.py | 15 +++++++++++----
|
||||
src/ukify/ukify.py | 10 +++++++++-
|
||||
3 files changed, 24 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/man/ukify.xml b/man/ukify.xml
|
||||
index 829761642d..7462c5c92f 100644
|
||||
--- a/man/ukify.xml
|
||||
+++ b/man/ukify.xml
|
||||
@@ -365,7 +365,10 @@
|
||||
<listitem><para>The os-release description (the <literal>.osrel</literal> section). The argument
|
||||
may be a literal string, or <literal>@</literal> followed by a path name. If not specified, the
|
||||
<citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry> file
|
||||
- will be picked up from the host system.</para>
|
||||
+ will be picked up from the host system. If explicitly set to an empty string, the ".osrel" section
|
||||
+ is omitted from the UKI (this is not recommended in most cases, and causes the resulting artifact
|
||||
+ to not be recognized as a UKI by other tools like <command>kernel-install</command>
|
||||
+ and <command>bootctl</command>).</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v253"/></listitem>
|
||||
</varlistentry>
|
||||
diff --git a/src/ukify/test/test_ukify.py b/src/ukify/test/test_ukify.py
|
||||
index f75ef0c891..224a38569f 100755
|
||||
--- a/src/ukify/test/test_ukify.py
|
||||
+++ b/src/ukify/test/test_ukify.py
|
||||
@@ -641,7 +641,7 @@ def test_efi_signing_pesign(kernel_initrd, tmp_path):
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
-def test_inspect(kernel_initrd, tmp_path, capsys):
|
||||
+def test_inspect(kernel_initrd, tmp_path, capsys, osrel=True):
|
||||
if kernel_initrd is None:
|
||||
pytest.skip('linux+initrd not found')
|
||||
if not shutil.which('sbsign'):
|
||||
@@ -653,7 +653,7 @@ def test_inspect(kernel_initrd, tmp_path, capsys):
|
||||
|
||||
output = f'{tmp_path}/signed2.efi'
|
||||
uname_arg='1.2.3'
|
||||
- osrel_arg='Linux'
|
||||
+ osrel_arg='Linux' if osrel else ''
|
||||
cmdline_arg='ARG1 ARG2 ARG3'
|
||||
|
||||
args = [
|
||||
@@ -680,8 +680,12 @@ def test_inspect(kernel_initrd, tmp_path, capsys):
|
||||
|
||||
text = capsys.readouterr().out
|
||||
|
||||
- expected_osrel = f'.osrel:\n size: {len(osrel_arg)}'
|
||||
- assert expected_osrel in text
|
||||
+ if osrel:
|
||||
+ expected_osrel = f'.osrel:\n size: {len(osrel_arg)}'
|
||||
+ assert expected_osrel in text
|
||||
+ else:
|
||||
+ assert '.osrel:' not in text
|
||||
+
|
||||
expected_cmdline = f'.cmdline:\n size: {len(cmdline_arg)}'
|
||||
assert expected_cmdline in text
|
||||
expected_uname = f'.uname:\n size: {len(uname_arg)}'
|
||||
@@ -694,6 +698,9 @@ def test_inspect(kernel_initrd, tmp_path, capsys):
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
+def test_inspect_no_osrel(kernel_initrd, tmp_path, capsys):
|
||||
+ test_inspect(kernel_initrd, tmp_path, capsys, osrel=False)
|
||||
+
|
||||
@pytest.mark.skipif(not slow_tests, reason='slow')
|
||||
def test_pcr_signing(kernel_initrd, tmp_path):
|
||||
if kernel_initrd is None:
|
||||
diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py
|
||||
index c98f8e2a5d..b7542c7eca 100755
|
||||
--- a/src/ukify/ukify.py
|
||||
+++ b/src/ukify/ukify.py
|
||||
@@ -1477,6 +1477,9 @@ def make_uki(opts: UkifyConfig) -> None:
|
||||
'.profile',
|
||||
}
|
||||
|
||||
+ if not opts.os_release:
|
||||
+ to_import.remove('.osrel')
|
||||
+
|
||||
for profile in opts.join_profiles:
|
||||
pe = pefile.PE(profile, fast_load=True)
|
||||
prev_len = len(uki.sections)
|
||||
@@ -2412,7 +2415,12 @@ def finalize_options(opts: argparse.Namespace) -> None:
|
||||
|
||||
opts.os_release = resolve_at_path(opts.os_release)
|
||||
|
||||
- if not opts.os_release and opts.linux:
|
||||
+ if opts.os_release == '':
|
||||
+ # If --os-release= with an empty string was passed, treat that as
|
||||
+ # explicitly disabling the .osrel section, and do not fallback to the
|
||||
+ # system's os-release files.
|
||||
+ pass
|
||||
+ elif opts.os_release is None and opts.linux:
|
||||
p = Path('/etc/os-release')
|
||||
if not p.exists():
|
||||
p = Path('/usr/lib/os-release')
|
||||
--
|
||||
2.52.0
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
From e57e599e6b11039ab6484e5622b3deae20bfd678 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <johannes.goede@oss.qualcomm.com>
|
||||
Date: Mon, 12 Jan 2026 14:56:36 +0100
|
||||
Subject: [PATCH] stub: Fix NULL pointer deref when there are no initrds
|
||||
|
||||
When n_all_initrds == 0, then all_initrds is unmodified from its initial
|
||||
value of:
|
||||
|
||||
_cleanup_free_ struct iovec *all_initrds = NULL;
|
||||
|
||||
and in the else block of the "if (n_all_initrds > 1)" the NULL is
|
||||
dereferenced:
|
||||
|
||||
final_initrd = all_initrds[0];
|
||||
|
||||
Leading to the stub crashing due to a NULL pointer deref.
|
||||
|
||||
Fix this by initializing final_initrd to all 0s and only
|
||||
running the else block if (n_all_initrds == 1).
|
||||
---
|
||||
src/boot/stub.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/boot/stub.c b/src/boot/stub.c
|
||||
index 06ecbc7d18..65950262c6 100644
|
||||
--- a/src/boot/stub.c
|
||||
+++ b/src/boot/stub.c
|
||||
@@ -1302,9 +1302,9 @@ static EFI_STATUS run(EFI_HANDLE image) {
|
||||
|
||||
/* Combine the initrds into one */
|
||||
_cleanup_pages_ Pages initrd_pages = {};
|
||||
- struct iovec final_initrd;
|
||||
+ struct iovec final_initrd = {};
|
||||
if (n_all_initrds > 1) {
|
||||
- /* There will always be a base initrd, if this counter is higher, we need to combine them */
|
||||
+ /* If there is more then 1 initrd we need to combine them */
|
||||
err = combine_initrds(all_initrds, n_all_initrds, &initrd_pages, &final_initrd.iov_len);
|
||||
if (err != EFI_SUCCESS)
|
||||
return err;
|
||||
@@ -1313,7 +1313,7 @@ static EFI_STATUS run(EFI_HANDLE image) {
|
||||
|
||||
/* Given these might be large let's free them explicitly before we pass control to Linux */
|
||||
initrds_free(&initrds);
|
||||
- } else
|
||||
+ } else if (n_all_initrds == 1)
|
||||
final_initrd = all_initrds[0];
|
||||
|
||||
struct iovec kernel = IOVEC_MAKE(
|
||||
--
|
||||
2.52.0
|
||||
|
||||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (systemd-259.tar.gz) = ef46b13661df43e3cfbeee1bc22f0b1eb902e8ebe39c19868c465efd08b35a199c2a2cd9d8021a6bc4d692fa0c6e0eab3f13eecd6ce24dde81d3945464a25b50
|
||||
SHA512 (systemd-259.1.tar.gz) = 7cbeca5dad6413a876809200583854ddc706b7a69deff958eb1ca1afb726cf4dec014006c10d1945c450b754811d4b95a80fe1778cb3136997f6d11b11c0560e
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ Url: https://systemd.io
|
|||
# But don't do that on OBS, otherwise the version subst fails, and will be
|
||||
# like 257-123-gabcd257.1 instead of 257-123-gabcd
|
||||
%if %{without obs}
|
||||
Version: %{?version_override}%{!?version_override:259}
|
||||
Version: %{?version_override}%{!?version_override:259.1}
|
||||
%else
|
||||
Version: %{?version_override}%{!?version_override:%(cat meson.version)}
|
||||
%endif
|
||||
|
|
@ -153,11 +153,6 @@ Patch: 38769.patch
|
|||
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=2415701
|
||||
Patch: 0002-machined-continue-without-resolve.hook-socket.patch
|
||||
|
||||
# 2 patches for https://fedoraproject.org/wiki/Changes/Automatic_DTB_selection_for_aarch64_EFI_systems
|
||||
# Upstream commit: https://github.com/systemd/systemd/commit/75890d949f92c412c0936b8536b2e0dc8f7dfb40
|
||||
Patch: 0003-ukify-omit-.osrel-section-when-os-release-is-empty.patch
|
||||
# Upstream PR: https://github.com/systemd/systemd/pull/40329
|
||||
Patch: 0004-stub-Fix-NULL-pointer-deref-when-there-are-no-initrd.patch
|
||||
%endif
|
||||
|
||||
%ifarch %{ix86} x86_64 aarch64 riscv64
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue