mirror of
https://github.com/NixOS/patchelf.git
synced 2025-10-21 23:10:49 +08:00
add PR243 reproducer
This commit is contained in:
13
tests/PR243-reproducer.sh
Executable file
13
tests/PR243-reproducer.sh
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -ex
|
|
||||||
cat << EOF > hello.c
|
|
||||||
#include <stdio.h>
|
|
||||||
int main() {
|
|
||||||
printf("Hello, World!");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
gcc hello.c -o hello -no-pie
|
|
||||||
interpreter=$(../src/patchelf --print-interpreter ./hello)
|
|
||||||
cp ./hello ./hello.orig
|
|
||||||
../src/patchelf --set-interpreter $interpreter ./hello
|
|
||||||
../src/patchelf --replace-needed libc.so.6 $interpreter ./hello
|
|
||||||
./hello.orig
|
|
||||||
./hello
|
|
Reference in New Issue
Block a user