diff --git a/nix/devshell.nix b/nix/devshell.nix index fa1d74abf..ca165184f 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -63,7 +63,7 @@ in curl parallel qemu - zig_0_13 # version match setup-dev.sh + zig # version match setup-dev.sh go # for onegadget command @@ -85,7 +85,7 @@ in export PWNDBG_NO_AUTOUPDATE=1 export PWNDBG_NO_UV=1 export PWNDBG_VENV_PATH="${pyEnv}" - export ZIGPATH="${pkgs.lib.getBin pkgs.zig_0_13}/bin/" + export ZIGPATH="${pkgs.lib.getBin pkgs.zig}/bin/" export REPO_ROOT=$(git rev-parse --show-toplevel) ''; }; diff --git a/setup-dev.sh b/setup-dev.sh index ab0d65363..ee3c6aac6 100755 --- a/setup-dev.sh +++ b/setup-dev.sh @@ -94,9 +94,9 @@ download_zig_binary() { # Install zig to current directory # We use zig to compile some test binaries as it is much easier than with gcc - TARGET_ZIG_VERSION="0.13.0" - ZIG_TAR_URL="https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz" - ZIG_TAR_SHA256="d45312e61ebcc48032b77bc4cf7fd6915c11fa16e4aad116b66c9468211230ea" + TARGET_ZIG_VERSION="0.14.1" + ZIG_TAR_URL="https://ziglang.org/download/0.14.1/zig-x86_64-linux-0.14.1.tar.xz" + ZIG_TAR_SHA256="24aeeec8af16c381934a6cd7d95c807a8cb2cf7df9fa40d359aa884195c4716c" if command -v "${ZIGPATH}"/zig &> /dev/null; then ZIG_VERSION=$("$ZIGPATH/zig" version) @@ -124,7 +124,7 @@ download_zig_binary() { # Delete previous installation rm -rf "${ZIGPATH}" - mv /tmp/zig-linux-x86_64-* ${ZIGPATH} &> /dev/null || true + mv /tmp/zig-* ${ZIGPATH} &> /dev/null || true echo "Zig installed to ${ZIGPATH}" } @@ -302,7 +302,7 @@ configure_venv() { if osx; then echo "Not supported on macOS. Please use one of the alternative methods listed at:" - echo "https://github.com/pwndbg/pwndbg?tab=readme-ov-file#installing-gdb" + echo "https://pwndbg.re/pwndbg/dev/contributing/setup-pwndbg-dev/" exit 1 fi diff --git a/setup.sh b/setup.sh index 89d97fe09..7155ed209 100755 --- a/setup.sh +++ b/setup.sh @@ -122,7 +122,7 @@ PYTHON='' if osx; then echo "Not supported on macOS. Please use one of the alternative methods listed at:" - echo "https://github.com/pwndbg/pwndbg?tab=readme-ov-file#installing-gdb" + echo "https://pwndbg.re/pwndbg/dev/contributing/setup-pwndbg-dev/" exit 1 fi diff --git a/tests/binaries/host/glibcs/2.33/libpthread-2.33.so b/tests/binaries/host/glibcs/2.33/libpthread-2.33.so new file mode 100755 index 000000000..c25e1957b Binary files /dev/null and b/tests/binaries/host/glibcs/2.33/libpthread-2.33.so differ diff --git a/tests/binaries/host/glibcs/2.33/libpthread.so.0 b/tests/binaries/host/glibcs/2.33/libpthread.so.0 new file mode 120000 index 000000000..ff0d3c69a --- /dev/null +++ b/tests/binaries/host/glibcs/2.33/libpthread.so.0 @@ -0,0 +1 @@ +libpthread-2.33.so \ No newline at end of file diff --git a/tests/binaries/host/makefile b/tests/binaries/host/makefile index 3a533f851..0e64a01ff 100644 --- a/tests/binaries/host/makefile +++ b/tests/binaries/host/makefile @@ -69,7 +69,7 @@ heap_bugs.out: heap_bugs.c ${ZIGCC} \ ${CFLAGS} \ -Wno-int-to-pointer-cast -Wno-int-conversion -Wno-unused-variable \ - -target native-native-gnu.2.33 \ + -target x86_64-linux-gnu.2.33 \ -Wl,-rpath=${GLIBC_2_33}:\ -Wl,--dynamic-linker=${GLIBC_2_33}/ld-linux-x86-64.so.2 \ -o heap_bugs.out heap_bugs.c @@ -78,7 +78,7 @@ heap_bugs.out: heap_bugs.c #heap_bins.out: heap_bins.c # @echo "[+] Building heap_bins.out" # ${ZIGCC} \ -# -target native-native-gnu.2.33 \ +# -target x86_64-linux-gnu.2.33 \ # -Wl,-rpath=${GLIBC_2_33} \ # -Wl,--dynamic-linker=${GLIBC_2_33}/ld-linux-x86-64.so.2 \ # -g -O0 -o heap_bins.out heap_bins.c diff --git a/tests/binaries/qemu_user/Makefile b/tests/binaries/qemu_user/Makefile index 2e5fdee74..949aeb1f0 100644 --- a/tests/binaries/qemu_user/Makefile +++ b/tests/binaries/qemu_user/Makefile @@ -24,9 +24,9 @@ CFLAGS.aarch64 = $(ALL_FLAGS) --target=aarch64-linux-musl CFLAGS.arm = $(ALL_FLAGS) --target=arm-linux-musleabihf # CFLAGS.riscv32 = $(ALL_FLAGS) --target=riscv32-linux-musl CFLAGS.riscv64 = $(ALL_FLAGS) --target=riscv64-linux-musl -CFLAGS.mips32 = $(ALL_FLAGS) --target=mips-linux-musl # Big-endian MIPS -CFLAGS.mipsel32 = $(ALL_FLAGS) --target=mipsel-linux-musl # Little-endian MIPS -CFLAGS.mips64 = $(ALL_FLAGS) --target=mips64-linux-musl +CFLAGS.mips32 = $(ALL_FLAGS) --target=mips-linux-musleabi # Big-endian MIPS +CFLAGS.mipsel32 = $(ALL_FLAGS) --target=mipsel-linux-musleabi # Little-endian MIPS +CFLAGS.mips64 = $(ALL_FLAGS) --target=mips64-linux-muslabi64 # CFLAGS.loongarch64 = $(ALL_FLAGS) --target=loongarch64-linux-musl # CFLAGS.s390x = $(ALL_FLAGS) --target=s390x-linux-musl -mcpu=z13 CFLAGS.powerpc32 = $(ALL_FLAGS) --target=powerpc-linux-musl diff --git a/tests/library/qemu_user/conftest.py b/tests/library/qemu_user/conftest.py index 773e4ca02..807ce2f1e 100644 --- a/tests/library/qemu_user/conftest.py +++ b/tests/library/qemu_user/conftest.py @@ -43,8 +43,7 @@ COMPILATION_TARGETS: list[COMPILATION_TARGETS_TYPE] = list( # Tuple contains (Zig target,extra_cli_args,qemu_suffix), COMPILE_AND_RUN_INFO: Dict[COMPILATION_TARGETS_TYPE, Tuple[str, Tuple[str, ...], str]] = { "aarch64": ("aarch64-freestanding", (), "aarch64"), - # TODO: when updating to newer version of Zig, this -mcpu option can be removed - "arm": ("arm-freestanding", ("-mcpu=cortex_a7",), "arm"), + "arm": ("arm-freestanding", (), "arm"), "riscv32": ("riscv32-freestanding", (), "riscv32"), "riscv64": ("riscv64-freestanding", (), "riscv64"), "mips32": ("mips-freestanding", (), "mips"), diff --git a/tests/library/qemu_user/tests/test_arm.py b/tests/library/qemu_user/tests/test_arm.py index ae8ed44b4..beba92162 100644 --- a/tests/library/qemu_user/tests/test_arm.py +++ b/tests/library/qemu_user/tests/test_arm.py @@ -91,7 +91,7 @@ def test_arm_simple_branch(qemu_assembly_run): " 0x200f0 mov r0, #0 R0 => 0\n" " 0x200f4 mov r7, #0xf8 R7 => 0xf8\n" " 0x200f8 svc #0 \n" - " 0x200fc andeq r3, r0, r1, asr #32\n" + " 0x200fc andeq r1, r0, r1, asr #18\n" "────────────────────────────────────────────────────────────────────────────────\n" ) @@ -301,7 +301,7 @@ def test_arm_implicit_branch_ldr(qemu_assembly_run): " 0x200c0 mov r7, #0xf8 R7 => 0xf8\n" " 0x200c4 svc #0 \n" " 0x200c8 strheq r0, [r2], -r12\n" - " 0x200cc andeq r3, r0, r1, asr #32\n" + " 0x200cc andeq r1, r0, r1, asr #18\n" "\n" "\n" "\n" @@ -325,7 +325,7 @@ def test_arm_implicit_branch_ldr(qemu_assembly_run): " 0x200c0 mov r7, #0xf8 R7 => 0xf8\n" " 0x200c4 svc #0 \n" " 0x200c8 strheq r0, [r2], -r12\n" - " 0x200cc andeq r3, r0, r1, asr #32\n" + " 0x200cc andeq r1, r0, r1, asr #18\n" "\n" "\n" "\n" @@ -438,7 +438,7 @@ def test_arm_cmp_instructions(qemu_assembly_run): " 0x200d0 mov r0, #0 R0 => 0\n" " 0x200d4 mov r7, #0xf8 R7 => 0xf8\n" " 0x200d8 svc #0 \n" - " 0x200dc andeq r3, r0, r1, asr #32\n" + " 0x200dc andeq r1, r0, r1, asr #18\n" "\n" "\n" "────────────────────────────────────────────────────────────────────────────────\n" diff --git a/tests/library/qemu_user/tests/test_riscv64.py b/tests/library/qemu_user/tests/test_riscv64.py index 8ca9caffb..08a636f8b 100644 --- a/tests/library/qemu_user/tests/test_riscv64.py +++ b/tests/library/qemu_user/tests/test_riscv64.py @@ -303,7 +303,7 @@ def test_riscv64_jump_chain(qemu_assembly_run): " 0x1001166 addi a7, zero, 0x5d A7 => 93 (0x0 + 0x5d)\n" " 0x100116a c.li a0, 0 A0 => 0\n" " 0x100116c ecall \n" - " 0x1001170 c.addiw s6, -0x10\n" + " 0x1001170 c.li s0, 0x10 S0 => 0x10\n" "────────────────────────────────────────────────────────────────────────────────\n" )