[PATCH livepatch-build-tools] livepatch-build: allow different build ID length

Frediano Ziglio posted 1 patch 3 months, 1 week ago
Failed in applying to current master (apply log)
livepatch-build | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
[PATCH livepatch-build-tools] livepatch-build: allow different build ID length
Posted by Frediano Ziglio 3 months, 1 week ago
The size of the build ID for a PE file can be different from
ELF one, specifically 16 bytes instead of 20.
Allows to embed arbitrary build ID lengths.
The Xen ABI for retrieving the build ID allows arbitrary
lengths too (for instance see "xl info").

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 livepatch-build | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/livepatch-build b/livepatch-build
index f3ca939..11cbeec 100755
--- a/livepatch-build
+++ b/livepatch-build
@@ -192,6 +192,11 @@ strip_metadata_symbols ()
     strip "${STRIP_CMD_OPTS[@]}" "$FILE"
 }
 
+function gnu_section()
+{
+    perl -e '$d = pack("H*", $ARGV[0]); print pack("VVVZ*", 4, length($d), 3, "GNU").$d' "$1"
+}
+
 function create_patch()
 {
     echo "Extracting new and modified ELF sections..."
@@ -245,10 +250,10 @@ function create_patch()
     fi
 
     # Create a dependency section
-    perl -e "print pack 'VVVZ*H*', 4, 20, 3, 'GNU', '${DEPENDS}'" > depends.bin
+    gnu_section "$DEPENDS" > depends.bin
 
     # Create a Xen dependency section
-    perl -e "print pack 'VVVZ*H*', 4, 20, 3, 'GNU', '${XEN_DEPENDS}'" > xen_depends.bin
+    gnu_section "$XEN_DEPENDS" > xen_depends.bin
 
     echo "Creating patch module..."
     if [ -z "$PRELINK" ]; then
-- 
2.50.1
Re: [PATCH livepatch-build-tools] livepatch-build: allow different build ID length
Posted by Ross Lagerwall 3 months ago
On Thu, Jul 24, 2025 at 1:59 PM Frediano Ziglio
<frediano.ziglio@cloud.com> wrote:
>
> The size of the build ID for a PE file can be different from
> ELF one, specifically 16 bytes instead of 20.
> Allows to embed arbitrary build ID lengths.
> The Xen ABI for retrieving the build ID allows arbitrary
> lengths too (for instance see "xl info").
>
> Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>

Thanks