From 4970ae7f0eadd11aa39c10147e5b865479373a34 Mon Sep 17 00:00:00 2001 From: Kyle Zeng Date: Wed, 24 Apr 2024 12:27:01 -0700 Subject: [PATCH] fix complete setup --- README.md | 1 + glibc_run.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 64faa41..42f6c2e 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ cd how2heap # the next command will prepare the target binary so it runs with # the expected libc version +make ./glibc_run.sh 2.30 ./malloc_playground -d -p # now you can play with the binary with glibc-2.30 diff --git a/glibc_run.sh b/glibc_run.sh index fe59994..7eaef3c 100755 --- a/glibc_run.sh +++ b/glibc_run.sh @@ -104,8 +104,8 @@ function prep_in_docker () { echo "building the how2heap_docker image!" docker build -t how2heap_docker . - docker run --rm -it -v $HOW2HEAP_PATH:/root/how2heap how2heap_docker make clean >/dev/null - docker run --rm -it -v $HOW2HEAP_PATH:/root/how2heap how2heap_docker make >/dev/null + docker run --rm -it -u $(id -u ${USER}):$(id -g ${USER}) -v $HOW2HEAP_PATH:/root/how2heap how2heap_docker make clean >/dev/null + docker run --rm -it -u $(id -u ${USER}):$(id -g ${USER}) -v $HOW2HEAP_PATH:/root/how2heap how2heap_docker make >/dev/null } GLIBC_VERSION=$1 @@ -196,16 +196,16 @@ if [ -z "$(ls -A $OUTPUT_DIR)" ]; then fi target_interpreter="$OUTPUT_DIR/$(ls $OUTPUT_DIR | grep ld)" -if [[ $GLIBC_MAJOR != $SYSTEM_GLIBC_MAJOR ]] || [[ $GLIBC_MINOR != $SYSTEM_GLIBC_MINOR ]]; then - set_interpreter $target_interpreter - set_rpath -fi - if [ "$DOCKER" == 'X' ]; then prep_in_docker $GLIBC_VERSION fi +if [[ $GLIBC_MAJOR != $SYSTEM_GLIBC_MAJOR ]] || [[ $GLIBC_MINOR != $SYSTEM_GLIBC_MINOR ]]; then + set_interpreter $target_interpreter + set_rpath +fi + if [ "$GDB" == 'X' ]; then if [[ $GLIBC_VERSION != $SYSTEM_GLIBC_VERSION ]]; then