From 646f4aacc6a30339fffc2323f98159223e62ecec Mon Sep 17 00:00:00 2001 From: carterscottm Date: Fri, 26 Oct 2018 17:00:20 -0400 Subject: [PATCH] removed need to 'sudo setcap' on DT executable --- pack/df_linux/distro_fixes.sh | 3 +++ pack/df_linux/libs/set_ptracer_any.c | 12 ++++++++++++ pack/df_linux/libs/set_ptracer_any.so | Bin 0 -> 16048 bytes pack/startlnp | 15 --------------- 4 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 pack/df_linux/libs/set_ptracer_any.c create mode 100755 pack/df_linux/libs/set_ptracer_any.so diff --git a/pack/df_linux/distro_fixes.sh b/pack/df_linux/distro_fixes.sh index c7dd0d9..274298d 100755 --- a/pack/df_linux/distro_fixes.sh +++ b/pack/df_linux/distro_fixes.sh @@ -170,6 +170,9 @@ if [ -n "$ZLIB_PATH" ]; then dlog INFO "Attempting to use zlib at $ZLIB_PATH" fi +# Include set_ptracer_any.so in PRELOAD_LIB to remove the necessity to run setcap on the Dwarf Therapist executable +export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}./libs/set_ptracer_any.so" + dlog "INFO" "PRELOAD_LIB: $PRELOAD_LIB" dlog "INFO" "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" dlog "INFO" "Done" diff --git a/pack/df_linux/libs/set_ptracer_any.c b/pack/df_linux/libs/set_ptracer_any.c new file mode 100644 index 0000000..99fd7db --- /dev/null +++ b/pack/df_linux/libs/set_ptracer_any.c @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +void set_ptracer_any() __attribute__((constructor)); + +void set_ptracer_any() +{ + if (-1 == prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0)) + perror("prctl"); +} diff --git a/pack/df_linux/libs/set_ptracer_any.so b/pack/df_linux/libs/set_ptracer_any.so new file mode 100755 index 0000000000000000000000000000000000000000..f507378f53fb9285445d6470d5609284142ad841 GIT binary patch literal 16048 zcmeHOZ)_Y#6`%9j$t87c$0VsqD&?pga4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