livepatch-build: allow different build ID length
PATCH 1/1 livepatch-build: allow different build ID length
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 <[email protected]>
--- livepatch-build | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
livepatch-build +7 -2
@@ -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
Signature · 1 line
2.50.1
Quoted 8 lines · Frediano Ziglio
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 <[email protected]>
Reviewed-by Ross Lagerwall <[email protected]>
Thanks