From 424d3f5083ac08100b9aea233b8133ecf54694b8 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Sun, 26 Sep 2021 16:51:36 +0300 Subject: tests: add testcase for PT_PHDR VirtAddr corruption A PT_PHDR corruption was previously reported and fixed in [1]: the issue was that the VirtAddr field of the PT_PHDR program header would get overwritten with the file offset of the program header table rather than the virtual address. A testcase for this was also added in [2]. However, the tescase is not included in the Makefile.am regression testsuite and also tries to run a x86_64 prebuilt binary unconditionally, which would not work on other architectures. To fix this, create a standalone testcase for the PT_PHDR VirtAddr field corruption and include it in Makefile.am. In order to reproduce [1], a binary with the following characteristics is needed: - the ELF file type must be ET_DYN - the ELF file must contain a PT_PHDR program header - the file offset and the VirtAddr field of the PT_PHDR program header must be different [1] https://github.com/NixOS/patchelf/pull/243 [2] https://github.com/NixOS/patchelf/commit/8f94e116f3c63afe224f1ec48ccad6f068f835df Signed-off-by: Ovidiu Panait --- tests/PR243-reproducer.sh | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100755 tests/PR243-reproducer.sh (limited to 'tests/PR243-reproducer.sh') diff --git a/tests/PR243-reproducer.sh b/tests/PR243-reproducer.sh deleted file mode 100755 index 5fa4d55..0000000 --- a/tests/PR243-reproducer.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -ex -# PR243-reproducer.sh -curl -OLf https://github.com/NixOS/patchelf/files/6501509/ld-linux-x86-64.so.2.tar.gz -curl -OLf https://github.com/NixOS/patchelf/files/6501457/repro.tar.gz -tar fx repro.tar.gz -tar fx ld-linux-x86-64.so.2.tar.gz -chmod +x repro -cp repro repro.orig -../src/patchelf --set-interpreter ./ld-linux-x86-64.so.2 ./repro -patchelf --print-interpreter repro.orig -readelf -a repro > /dev/null -./repro -- cgit v1.2.3