|
| 1 | +From 5480f56002399069f74f30ce3ef620ec44ecf527 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Kai Lueke <kailuke@microsoft.com> |
| 3 | +Date: Thu, 20 Nov 2025 23:43:55 +0900 |
| 4 | +Subject: [PATCH 3/7] sysext: Use correct image name for extension release |
| 5 | + checks |
| 6 | + |
| 7 | +For the extension release check the image name is needed and was derived |
| 8 | +from the backing file of the loop device. However, this can have a |
| 9 | +different name when symlinks were resolved. The surprising behavior was |
| 10 | +that it worked when the target name started with the extension name and |
| 11 | +_ because that's what's supported to chop off version suffixes. However, |
| 12 | +we should not have such strict requirements for the target name and also |
| 13 | +allow - as version separator and entirely different names/prefixes, the |
| 14 | +same way as we also do for directories instead of raw images. |
| 15 | + |
| 16 | +Do not use the image name derived from the backing file of the loop |
| 17 | +device but directly the extension name we have at hand. |
| 18 | +--- |
| 19 | + src/shared/discover-image.c | 5 +++++ |
| 20 | + src/sysext/sysext.c | 5 +++++ |
| 21 | + 2 files changed, 10 insertions(+) |
| 22 | + |
| 23 | +diff --git a/src/shared/discover-image.c b/src/shared/discover-image.c |
| 24 | +index 91f4407b0e..480ffd221c 100644 |
| 25 | +--- a/src/shared/discover-image.c |
| 26 | ++++ b/src/shared/discover-image.c |
| 27 | +@@ -1822,6 +1822,11 @@ int image_read_metadata(Image *i, const ImagePolicy *image_policy) { |
| 28 | + if (r < 0) |
| 29 | + return r; |
| 30 | + |
| 31 | ++ /* Do not use the image name derived from the backing file of the loop device */ |
| 32 | ++ r = free_and_strdup(&m->image_name, i->name); |
| 33 | ++ if (r < 0) |
| 34 | ++ return r; |
| 35 | ++ |
| 36 | + r = dissected_image_acquire_metadata( |
| 37 | + m, |
| 38 | + /* userns_fd= */ -EBADF, |
| 39 | +diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c |
| 40 | +index 5d432b42da..72da02cd89 100644 |
| 41 | +--- a/src/sysext/sysext.c |
| 42 | ++++ b/src/sysext/sysext.c |
| 43 | +@@ -1819,6 +1819,11 @@ static int merge_subprocess( |
| 44 | + if (r < 0) |
| 45 | + return r; |
| 46 | + |
| 47 | ++ /* Do not use the image name derived from the backing file of the loop device */ |
| 48 | ++ r = free_and_strdup(&m->image_name, img->name); |
| 49 | ++ if (r < 0) |
| 50 | ++ return r; |
| 51 | ++ |
| 52 | + r = dissected_image_load_verity_sig_partition( |
| 53 | + m, |
| 54 | + d->fd, |
| 55 | +-- |
| 56 | +2.51.1 |
| 57 | + |
0 commit comments