-
-
Save romainthomas/2332cddd164cf8bfa3fc65cd61496c9a to your computer and use it in GitHub Desktop.
Patchelf tests diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/tests/args-from-file.sh b/tests/args-from-file.sh | |
| index 107031e..00a2276 100755 | |
| --- a/tests/args-from-file.sh | |
| +++ b/tests/args-from-file.sh | |
| @@ -13,4 +14,4 @@ printf "%s" "$SOME_PATH" >> "${SCRATCH}"/add-rpath | |
| ../src/patchelf --print-rpath "${SCRATCH}"/main | grep "$SOME_PATH" | |
| # should print error message and fail | |
| -../src/patchelf --set-rpath @"${SCRATCH}"/does-not-exist "${SCRATCH}"/main 2>&1 | grep "getting info about" | |
| +../src/patchelf --set-rpath @"${SCRATCH}"/does-not-exist "${SCRATCH}"/main 2>&1 | grep "No such file or directory" | |
| diff --git a/tests/modify-execstack.sh b/tests/modify-execstack.sh | |
| index 01e45d8..2d0a159 100755 | |
| --- a/tests/modify-execstack.sh | |
| +++ b/tests/modify-execstack.sh | |
| @@ -61,8 +62,8 @@ if ! ${PATCHELF} --print-execstack simple | grep -q 'execstack: -'; then | |
| fi | |
| if ! diff simple backup; then | |
| - echo "[simple] change against backup after clear after set" | |
| - exit 1 | |
| + echo "[simple] change against backup after clear after set (LIEF: on purpose)" | |
| + #exit 1 | |
| fi | |
| @@ -114,8 +115,7 @@ if ! ${PATCHELF} --print-execstack simple-execstack | grep -q 'execstack: X'; th | |
| fi | |
| if ! diff simple-execstack backup; then | |
| - echo "[simple-execstack] change against backup after set after clear" | |
| - exit 1 | |
| + echo "[simple-execstack] change against backup after set after clear (LIEF: on purpose)" | |
| fi | |
| @@ -167,8 +167,7 @@ if ! ${PATCHELF} --print-execstack libsimple.so | grep -q 'execstack: -'; then | |
| fi | |
| if ! diff libsimple.so backup; then | |
| - echo "[libsimple.so] change against backup after clear after set" | |
| - exit 1 | |
| + echo "[libsimple.so] change against backup after clear after set (LIEF: on purpose))" | |
| fi | |
| @@ -220,6 +219,5 @@ if ! ${PATCHELF} --print-execstack libsimple-execstack.so | grep -q 'execstack: | |
| fi | |
| if ! diff libsimple-execstack.so backup; then | |
| - echo "[libsimple-execstack.so] change against backup after set after clear" | |
| - exit 1 | |
| + echo "[libsimple-execstack.so] change against backup after set after clear (LIEF: on purpose)" | |
| fi | |
| diff --git a/tests/set-interpreter-same.sh b/tests/set-interpreter-same.sh | |
| index b174628..91a4577 100755 | |
| --- a/tests/set-interpreter-same.sh | |
| +++ b/tests/set-interpreter-same.sh | |
| @@ -17,8 +17,9 @@ before_checksum=$(sha256sum "${SCRATCH}/simple") | |
| after_checksum=$(sha256sum "${SCRATCH}/simple") | |
| if [ "$before_checksum" != "$after_checksum" ]; then | |
| + # Expected by LIEF | |
| echo "--set-interpreter should be NOP, but the file has been changed." | |
| - exit 1 | |
| + #exit 1 | |
| fi | |
| "${SCRATCH}/simple" | |
| @@ -46,8 +47,9 @@ before_checksum=$(sha256sum "${SCRATCH}/simple") | |
| after_checksum=$(sha256sum "${SCRATCH}/simple") | |
| if [ "$before_checksum" != "$after_checksum" ]; then | |
| + # Expected by LIEF | |
| echo "--set-interpreter should be NOP, but the file has been changed." | |
| - exit 1 | |
| + #exit 1 | |
| fi | |
| if "${SCRATCH}/simple"; then | |
| diff --git a/tests/shared-rpath.sh b/tests/shared-rpath.sh | |
| index 1fa46b9..7694b0e 100755 | |
| --- a/tests/shared-rpath.sh | |
| +++ b/tests/shared-rpath.sh | |
| @@ -28,12 +27,14 @@ echo "#### Rename the rpath to something larger than the original" | |
| echo "#### Checking symbol is still there" | |
| ${NM} -D liblarge-rpath.so | grep a_symbol_name | |
| -echo "#### Checking there are no Xs" | |
| -[ "$(has_x liblarge-rpath.so)" -eq 0 ] || exit 1 | |
| +#echo "#### Checking there are no Xs" | |
| +#[ "$(has_x liblarge-rpath.so)" -eq 0 ] || exit 1 | |
| current_cnt="$(${STRINGS} liblarge-rpath.so | grep -c a_symbol_name)" | |
| echo "#### Number of a_symbol_name strings in the modified library: $current_cnt" | |
| -[ "$current_cnt" -eq "$previous_cnt" ] || exit 1 | |
| +# This is expected with LIEF: we relocate the .dynstr section and the original | |
| +# one is not cleared | |
| +#[ "$current_cnt" -eq "$previous_cnt" ] || exit 1 | |
| echo "#### Rename the rpath to something shorter than the original" | |
| # Pathelf should detect that the rpath string is shared with the symbol name string and avoid | |
| @@ -45,8 +46,8 @@ ${NM} -D libshort-rpath.so | grep a_symbol_name | |
| echo "#### Number of a_symbol_name strings in the modified library: $current_cnt" | |
| current_cnt="$(${STRINGS} libshort-rpath.so | grep -c a_symbol_name)" | |
| -[ "$current_cnt" -eq "$previous_cnt" ] || exit 1 | |
| +#[ "$current_cnt" -eq "$previous_cnt" ] || exit 1 | |
| echo "#### Now liblarge-rpath.so should have its own rpath, so it should be allowed to taint it" | |
| "${PATCHELF}" --set-rpath a_very_big_rpath_that_is_larger_than_original__even_larger --output liblarge-rpath2.so liblarge-rpath.so | |
| -[ "$(has_x liblarge-rpath2.so)" -eq 1 ] || exit 1 | |
| +#[ "$(has_x liblarge-rpath2.so)" -eq 1 ] || exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment