Compare commits

..

1 Commits

Author SHA1 Message Date
John Reiser 65b3dd7e52 risc-v 64-bit stubs build successfully in developer environment
This is the "bottom half" to add support for riscv64 to UPX.
Need update to stubtools for: gcc objcopy objdump ld
   Now using local cross tools /usr/bin/riscv64-linux-gnu-* on Ubuntu 24.04.
Need fix for riscv64-linux.elf-fold.h being 224 KB.
TODO: extend p_lx_elf.cpp  linker.cpp
TODO: implement nrv2d_d.S nrv2e_d.S lzma_d.S
TODO: testing  (using qemu-riscv64 and gdb-multiarch on Ubuntu 24.04)

        https://github.com/upx/upx/discussions/793

	modified:   src/stub/Makefile
	modified:   src/stub/scripts/xstrip.py
	modified:   src/stub/src/amd64-linux.elf-main2.c
	modified:   src/stub/src/arch/amd64/macros.S
	new file:   src/stub/src/arch/riscv/64/Makefile
	new file:   src/stub/src/arch/riscv/64/Makefile.extra
	new file:   src/stub/src/arch/riscv/64/macros.S
	new file:   src/stub/src/arch/riscv/64/nrv2b_d.S
	new file:   src/stub/src/arch/riscv/64/regs.h
	new file:   src/stub/src/riscv64-expand.S
	new file:   src/stub/src/riscv64-linux.elf-entry.S
	new file:   src/stub/src/riscv64-linux.elf-fold.S
	new file:   src/stub/src/riscv64-linux.elf-fold.lds
	new file:   src/stub/src/riscv64-linux.elf-help_umf.S
	new file:   src/stub/src/riscv64-linux.elf-main2.c
	modified:   src/stub/src/upxfd_linux.c
2025-11-01 08:59:05 -07:00
66 changed files with 2151 additions and 1476 deletions
-1
View File
@@ -20,7 +20,6 @@ Checks: >
-bugprone-suspicious-memory-comparison,
-bugprone-suspicious-string-compare,
-bugprone-switch-missing-default-case,
-bugprone-unintended-char-ostream-output,
clang-analyzer-*,
-clang-analyzer-optin.performance.Padding,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
+58 -79
View File
@@ -22,8 +22,8 @@ env:
UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO: 1
UPX_DEBUG_TEST_LIBC_QSORT: 1
ZSTD_CLEVEL: 17
# 2025-10-11
ZIG_DIST_VERSION: 0.15.2
# 2025-08-19
ZIG_DIST_VERSION: 0.15.1
jobs:
job-rebuild-and-verify-stubs:
@@ -39,14 +39,13 @@ jobs:
dpkg --add-architecture i386
apt-get update && apt-get upgrade -y
# install system packages
apt-get install -y --no-install-recommends bash ca-certificates curl git libmpc3 make perl-base python3-minimal tar time xz-utils libc6:i386 zlib1g:i386
apt-get install -y gcc-riscv64-linux-gnu
apt-get install -y --no-install-recommends bash ca-certificates curl git libmpc3 make perl-base tar time xz-utils libc6:i386 zlib1g:i386
# install python2-minimal packages from Debian-11
mkdir ../deps; cd ../deps; mkdir packages
### install python2-minimal packages from Debian-11
## curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8+deb11u1_amd64.deb
## curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.18-8+deb11u1_amd64.deb
## dpkg -i ./*python2*.deb && rm ./*python2*.deb && ldconfig
## ln -s -v python2.7 /usr/bin/python2
curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8+deb11u1_amd64.deb
curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.18-8+deb11u1_amd64.deb
dpkg -i ./*python2*.deb && rm ./*python2*.deb && ldconfig
ln -s -v python2.7 /usr/bin/python2
# manually unpack and install compat libs from Ubuntu-16.04
curl -sS -L -O https://archive.kernel.org/ubuntu-archive/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.6-1_amd64.deb
for f in ./*.deb; do dpkg -x $f ./packages; done
@@ -54,7 +53,6 @@ jobs:
rm -rf ./*.deb ./packages && ldconfig
# install upx-stubtools
curl -sS -L https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz | tar -xJ
- run: dpkg -l
- name: Check out code
run: |
git config --global --add safe.directory '*' # needed when running in a container
@@ -104,7 +102,7 @@ jobs:
- run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true
- run: sudo dmidecode -q || true
- run: sudo dmidecode || true
- uses: actions/checkout@v6
- uses: actions/checkout@v5
with: { submodules: true }
- run: make build/extra/gcc/all
- run: make build/extra/clang/all
@@ -119,7 +117,7 @@ jobs:
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run install tests
run: |
@@ -131,15 +129,11 @@ jobs:
jobs="gcc/debug gcc/release clang/debug clang/release"
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest_sigsegv.sh' ::: $jobs
ls -ld ./build/*/*/*/upx-* || true
rm -rf ./build/*/*/*/upx-*
- name: Run ctest tests
run: |
jobs="gcc/debug gcc/release clang/debug clang/release"
echo "===== parallel jobs: $jobs"
CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs
ls -ld ./build/*/*/*/XTesting/*/* || true
rm -rf ./build/*/*/*/XTesting/*/*
- name: Mimic ctest tests with Valgrind
run: |
export UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS=ON # valgrind is SLOW
@@ -148,8 +142,6 @@ jobs:
jobs="gcc/debug gcc/release clang/release"
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs
ls -ld ./build/*/*/*/upx-* || true
rm -rf ./build/*/*/*/upx-*
job-linux-cmake: # uses cmake + make
if: true
@@ -189,7 +181,7 @@ jobs:
sudo apt-get install -y wine wine32:i386 wine64
ls -l /usr/bin/wine*
mkdir -p -v ~/.wine && wineboot --init
- uses: actions/checkout@v6
- uses: actions/checkout@v5
with: { submodules: true }
- name: Check out test suite
run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite
@@ -230,7 +222,7 @@ jobs:
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run install tests
run: |
@@ -246,8 +238,6 @@ jobs:
test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release"
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest_sigsegv.sh' ::: $jobs
ls -ld ./build/*/*/*/upx-* || true
rm -rf ./build/*/*/*/upx-*
- name: Run ctest tests
run: |
jobs="gcc/debug gcc/release clang/debug clang/release"
@@ -256,8 +246,6 @@ jobs:
command -v wine >/dev/null && jobs="$jobs cross-windows-mingw64/debug cross-windows-mingw64/release"
echo "===== parallel jobs: $jobs"
CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs
ls -ld ./build/*/*/*/XTesting/*/* || true
rm -rf ./build/*/*/*/XTesting/*/*
- name: Mimic ctest tests with Valgrind
if: true # note: valgrind is SLOW
run: |
@@ -269,8 +257,6 @@ jobs:
test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release"
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs
ls -ld ./build/*/*/*/upx-* || true
rm -rf ./build/*/*/*/upx-*
fi
- name: Run file system tests
run: |
@@ -296,8 +282,6 @@ jobs:
test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release"
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/upx_testsuite_1.sh' ::: $jobs
ls -ld ./build/*/*/*/tmp-upx-testsuite* || true
rm -rf ./build/*/*/*/tmp-upx-testsuite*
job-macos-cmake: # uses cmake + make
if: true
@@ -308,10 +292,10 @@ jobs:
include:
# NOTE: Xcode updates regularly tend to break Homebrew clang/gcc; often some ld64 issue; use "xcode_version" as needed; or try "-Wl,-ld_classic"
# NOTE: macos does not have "env -C"; only with brew coreutils
- { os: macos-13, gcc: gcc-12, gxx: g++-12, testsuite: true }
- { os: macos-14, gcc: gcc-13, gxx: g++-13, testsuite: true }
- { os: macos-15, gcc: gcc-14, gxx: g++-14, testsuite: true }
- { os: macos-26, gcc: gcc-15, gxx: g++-15, testsuite: true }
- { os: macos-15-intel, gcc: gcc-14, gxx: g++-14, testsuite: true }
# { os: macos-15, gcc: gcc-14, gxx: g++-14, testsuite: true }
- { os: macos-15, testsuite: true }
name: ${{ format('{0} {1}{2}', matrix.os, matrix.xcode_version && 'xcode-' || '', matrix.xcode_version) }}
runs-on: ${{ matrix.os }}
steps:
@@ -336,9 +320,9 @@ jobs:
echo "UPX_DEBUG_FORCE_PACK_MACOS=1" >> $GITHUB_ENV
case "${{ matrix.os }}" in
# TODO FIXME: UPX on macos-13+ is broken => disable run-packed for now
macos-[12][3456]*) echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV ;;
macos-1[345]) echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV ;;
esac
- uses: actions/checkout@v6
- uses: actions/checkout@v5
with: { submodules: true }
- name: Check out test suite
if: ${{ matrix.testsuite }}
@@ -380,14 +364,13 @@ jobs:
(cd tmp/artifact && gtar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run install tests
run: |
(cd build/extra/clang/release && DESTDIR="$PWD/Install with cmake" cmake --install .)
(cd build/extra/clang/release && DESTDIR="$PWD/Install with make" make install)
- name: Run ctest tests
if: ${{ matrix.testsuite }}
run: |
for f in ./build/extra/*/*/upx; do file $f; done
jobs="clang/debug clang/release"
@@ -395,7 +378,6 @@ jobs:
echo "===== parallel jobs: $jobs"
CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs
- name: Mimic ctest tests
if: ${{ matrix.testsuite }}
run: |
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
jobs="clang/debug clang/release"
@@ -403,7 +385,7 @@ jobs:
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs
- name: Run file system tests
if: ${{ matrix.testsuite }}
if: ${{ matrix.testsuite }} # for coreutils readlink
run: |
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
export upx_test_file="$PWD"/build/extra/clang/release/upx
@@ -428,18 +410,20 @@ jobs:
fail-fast: false
matrix:
include:
- { name: windows-11-arm64, os: windows-11-arm, vsversion: 2022, vsarch: arm64 }
- { name: windows-11-arm64ec, os: windows-11-arm, vsversion: 2022, vsarch: arm64, use_arm64ec: true }
# { name: windows-11-arm64x, os: windows-11-arm, vsversion: 2022, vsarch: arm64, use_arm64x: true }
- { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, vsarch: amd64 }
- { name: windows-2022-i386, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 }
- { name: windows-2025-amd64, os: windows-2025, vsversion: 2022, vsarch: amd64 }
- { name: windows-2025-i386, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 }
# { name: windows-2019-amd64, os: windows-2019, vsversion: 2019, vsarch: amd64 }
- { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, vsarch: amd64 }
- { name: windows-2022-arm64, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64 }
# { name: windows-2022-arm64ec, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, use_arm64ec: true }
- { name: windows-2022-i386, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 }
- { name: windows-2025-amd64, os: windows-2025, vsversion: 2022, vsarch: amd64 }
- { name: windows-2025-arm64, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64 }
- { name: windows-2025-arm64ec, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64, use_arm64ec: true }
- { name: windows-2025-i386, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 }
name: ${{ format('{0}', matrix.name) }}
runs-on: ${{ matrix.os }}
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v6
- uses: actions/checkout@v5
with: { submodules: true }
- name: Check out test suite
run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite
@@ -447,21 +431,16 @@ jobs:
with: { vsversion: '${{ matrix.vsversion }}', arch: '${{ matrix.vsarch }}' }
- name: Set platform
run: |
if [[ "${{ matrix.use_arm64ec }}" == "true" ]]; then true;
if [[ "${{ matrix.vsarch }}" == amd64 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A x64" >> $GITHUB_ENV
elif [[ "${{ matrix.use_arm64ec }}" == "true" ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64EC" >> $GITHUB_ENV
echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
elif [[ "${{ matrix.use_arm64x }}" == "true" ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64X" >> $GITHUB_ENV
echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
elif [[ "${{ matrix.vsarch }}" == *amd64 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A x64" >> $GITHUB_ENV
elif [[ "${{ matrix.vsarch }}" == *arm64 ]]; then true;
elif [[ "${{ matrix.vsarch }}" == amd64_arm64 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64" >> $GITHUB_ENV
echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
elif [[ "${{ matrix.vsarch }}" == *x86 ]]; then true;
elif [[ "${{ matrix.vsarch }}" == amd64_x86 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A Win32" >> $GITHUB_ENV
else
exit 1
fi
- run: make build/debug
- run: make build/release
@@ -480,45 +459,50 @@ jobs:
cmake --install build/debug --config Debug --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/debug" --strip
cmake --install build/release --config Release --prefix "$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithPrefixAndStrip/release" --strip
(cd build && cp -ai --parents */*/upx.exe "../tmp/artifact/$N")
#(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
(cd tmp/artifact && tar --sort=name --gzip -cf "$N.tar.gz" "$N" && rm -rf "./$N" && ls -la && gzip -tq "$N.tar.gz")
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run ctest tests
if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: |
ctest --test-dir build/debug --parallel 8 -C Debug
ctest --test-dir build/release --parallel 8 -C Release
- name: Mimic ctest tests
if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: |
env -C build/debug/Debug upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh
env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh
- name: Run test suite build/release
if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: |
export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)"
env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/upx_testsuite_1.sh
job-windows-bh-toolchains: # build "by hand" using cmd.exe
job-windows-toolchains: # build "by hand" using cmd.exe
if: github.repository_owner == 'upx'
needs: [ job-rebuild-and-verify-stubs ]
strategy:
fail-fast: false
matrix:
include:
- { name: amd64-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64 }
- { name: arm64-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64 }
- { name: arm64ec-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64ec' }
# { name: arm64x-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64x' }
- { name: i386-win32-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 }
name: ${{ format('windows-bh {0}', matrix.name) }}
# { name: amd64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64 }
- { name: amd64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64 }
# { name: arm64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_arm64 }
- { name: arm64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64 }
- { name: arm64ec-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64ec' }
# { name: arm64x-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64x' }
# { name: i386-win32-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_x86 }
- { name: i386-win32-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 }
name: ${{ format('windows {0}', matrix.name) }}
runs-on: ${{ matrix.os }}
env:
C: ${{ matrix.name }}
B: release
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v6
- uses: actions/checkout@v5
with: { submodules: true }
- name: Prepare sources and Check out test suite
run: |
@@ -572,14 +556,13 @@ jobs:
- run: shopt -s globstar; file build/**/upx* || true
- name: Make artifact
run: |
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-windows-bh-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g')
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-windows-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g')
mkdir -p "tmp/artifact/$N/$B"
cp -ai build/$C/$B/upx/upx*.exe "tmp/artifact/$N/$B"
#(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
(cd tmp/artifact && tar --sort=name --gzip -cf "$N.tar.gz" "$N" && rm -rf "./$N" && ls -la && gzip -tq "$N.tar.gz")
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Mimic ctest tests
if: ${{ matrix.vsarch != 'amd64_arm64' }}
@@ -623,8 +606,6 @@ jobs:
- { zig_target: powerpc64-linux-musl, qemu: qemu-ppc64, zig_pic: -fPIE }
- { zig_target: powerpc64le-linux-musl, qemu: qemu-ppc64le }
- { zig_target: powerpc64le-linux-musl, qemu: qemu-ppc64le, zig_pic: -fPIE }
- { zig_target: riscv64-linux-musl, qemu: qemu-riscv64, tt: UPX-UNSUPPORTED }
- { zig_target: riscv64-linux-musl, qemu: qemu-riscv64, tt: UPX-UNSUPPORTED, zig_pic: -fPIE }
- { zig_target: x86_64-linux-gnu.2.3.4, qemu: qemu-x86_64 } # can use QEMU because of gcompat
- { zig_target: x86_64-linux-gnu.2.17, qemu: qemu-x86_64 } # can use QEMU because of gcompat
- { zig_target: x86_64-linux-musl, qemu: qemu-x86_64 }
@@ -633,9 +614,9 @@ jobs:
- { zig_target: x86_64-windows-gnu }
name: ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }}
runs-on: ubuntu-latest
container: ${{ matrix.container || 'alpine:3.23' }}
container: ${{ matrix.container || 'alpine:3.22' }}
env:
container: ${{ matrix.container || 'alpine:3.23' }}
container: ${{ matrix.container || 'alpine:3.22' }}
UPX_CONFIG_HAVE_WORKING_BUILD_RPATH: ''
# for zig-cc wrapper scripts (see below):
ZIG_CPPFLAGS: -DUPX_DOCTEST_CONFIG_MULTITHREADING
@@ -654,7 +635,7 @@ jobs:
git config --global --add safe.directory '*' # needed when running in a container
mkdir -p ~/.parallel && : > ~/.parallel/$(echo 6305-4721 | tr 0-7 leticlwi)
- run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true
- uses: actions/checkout@v6
- uses: actions/checkout@v5
with: { submodules: true }
- name: ${{ format('Install Zig {0}', env.ZIG_DIST_VERSION) }}
run: |
@@ -668,16 +649,14 @@ jobs:
# TODO FIXME: problem with self-packed upx and musl+gcompat: "Not a valid dynamic program"
echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV
fi
test -z "${{ matrix.tt }}" || echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
# install zig; note that ~/.local/bin is included in the default $PATH on Ubuntu
mkdir -p -v ~/.local/bin
cd ~/.local/bin
ZIG_DIST_VERSION=${ZIG_DIST_VERSION/#zig-/}
ZIG_DIST_NAME=zig-linux-x86_64-${ZIG_DIST_VERSION}
ZIG_DIST_NAME=zig-x86_64-linux-${ZIG_DIST_VERSION}
#curl -sS -L -O https://ziglang.org/builds/${ZIG_DIST_NAME}.tar.xz
#curl -sS -L -O https://ziglang.org/download/0.14.1/${ZIG_DIST_NAME}.tar.xz
curl -sS -L -O https://ziglang.org/download/0.15.2/${ZIG_DIST_NAME}.tar.xz
curl -sS -L -O https://ziglang.org/download/0.15.1/${ZIG_DIST_NAME}.tar.xz
ls -l ${ZIG_DIST_NAME}.tar.xz
file ${ZIG_DIST_NAME}.tar.xz || true
tar -xoJf ${ZIG_DIST_NAME}.tar.xz
@@ -752,7 +731,7 @@ jobs:
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run install tests
if: ${{ contains(matrix.zig_target, '-linux') }}
+4 -4
View File
@@ -57,14 +57,14 @@ endif()
# test config options (see below)
# IMPORTANT NOTE: self-pack test can only work if the host executable format is supported by UPX!
option(UPX_CONFIG_DISABLE_SELF_PACK_TEST "Do not test packing UPX with itself." OFF)
option(UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS "Do not run exhaustive tests." OFF)
option(UPX_CONFIG_DISABLE_SELF_PACK_TEST "Do not test packing UPX with itself" OFF)
option(UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS "Do not run exhaustive tests" OFF)
#***********************************************************************
# init
#***********************************************************************
set(UPX_VERSION_STRING "5.1.0") # this should match src/version.h
set(UPX_VERSION_STRING "5.0.3") # this should match src/version.h
upx_cmake_include_hook(2_init)
@@ -289,7 +289,7 @@ if(Threads_FOUND)
if(NOT result)
# failed; under MinGW be sure to use the posix-threads and NOT the win32-threads version
if(UPX_CONFIG_REQUIRE_THREADS OR (UPX_CONFIG_EXPECT_THREADS AND NOT UPX_CONFIG_DISABLE_THREADS))
message(WARNING "Threads FAILED ${f}: ${output}") # output from try_compile()
message(WARNING "Threads FAILED ${f}: ${output}") # output from try_compile
endif()
set(Threads_FOUND OFF)
break()
-2
View File
@@ -104,5 +104,3 @@ check-whitespace clang-format run-testsuite run-testsuite-all run-testsuite-debu
$(MAKE) -C src $@
endif
endif
# vim:set ts=8 sw=8 noet:
+1 -1
View File
@@ -2,7 +2,7 @@
User visible changes for UPX
==================================================================
Changes in 5.1.0 (XX XXX XXXX):
Changes in 5.0.3 (XX XXX XXXX):
* bug fixes - see https://github.com/upx/upx/milestone/21
Changes in 5.0.2 (20 Jul 2025):
+2 -3
View File
@@ -61,9 +61,8 @@ SHORT DOCUMENTATION
'upx program.exe' will compress a program or DLL. For best compression
results try 'upx --best program.exe' or 'upx --brute program.exe'.
Please see the file doc/upx-doc.txt for the full documentation. The files
NEWS and doc/BUGS.txt also contain various tidbits of information, as
does the output of 'upx --help'.
Please see the file UPX.DOC for the full documentation. The files
NEWS and BUGS also contain various tidbits of information.
THE FUTURE
+1 -21
View File
@@ -81,15 +81,6 @@ Developer quick start
4b) $ wget https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz
# Extract to $HOME/bin/bin-upx or $HOME/local/bin/bin-upx.
# See directions in: https://github.com/upx/upx-stubtools
# Some of the pre-built tools need i386 libz. On Ubuntu:
# # dpkg --add-architecture i386
# # apt-get update
# # apt-get install zlib1g-dev
# aarch64-linux-gnu/4.9.2/cc1 needs libmpfr.so.4. Make a symlink:
# # ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
4c) $ make clean; make # verify that you can re-build stubs
4d) $ popd # my-upx
5) $ cd upx # my-upx/upx
@@ -101,18 +92,7 @@ Developer quick start
# If stuck, then reset via "rm -rf vendor; git submodule update --init".
7) $ mkdir -p build/debug build/release
8) $ pushd build/debug # my-upx/upx/build/debug
9a) Install GNU g++ so that it is used when invoking "c++" compiler.
On Ubuntu 24.04 with
cmake: cmake version 3.28.3
g++: Ubuntu clang version 18.1.3 (1ubuntu1)
/lib/llvm-18/lib/cmake/llvm/HandleLLVMOptions.cmake:
add_flag_if_supported("-fno-lifetime-dse" CMAKE_CXX_FLAGS)
then cmake invoking c++ uses -fno-lifetime-dse but gets
c++: error: unknown argument: '-fno-lifetime-dse'
Commenting out the "add_flag_if_supported' line still uses that unknown argument.
Installing g++ avoids the problem.
9b) $ cmake ../.. # configure cmake
9) $ cmake ../.. # configure cmake
10) $ cmake --build . --verbose # optional "--verbose"
# This relies on stub/*.h, which YOU must re-build if necessary.
# When in doubt, then use "cd src/stub; make clean; make".
Generated
+1 -1
View File
@@ -55,7 +55,7 @@
.\" ========================================================================
.\"
.IX Title "UPX 1"
.TH UPX 1 2025-10-24 "upx 5.1.0" " "
.TH UPX 1 2025-07-21 "upx 5.0.3" " "
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
+1 -4
View File
@@ -281,7 +281,6 @@ build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/c
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-ucl/$$(notdir $$@)
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zlib/$$(notdir $$@)
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zstd/$$(notdir $$@)
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: PHONY
# OLD names [deprecated]
build/extra/scan-build/debug: build/analyze/clang-analyzer/debug PHONY
@@ -378,8 +377,6 @@ UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPT
SUBMODULES = doctest lzma-sdk ucl valgrind zlib
$(foreach 1,$(SUBMODULES),$(if $(wildcard vendor/$1/[CL]*),,\
$(error ERROR: missing git submodule '$1'; run 'git submodule update --init')))
$(error ERROR: missing git submodule '$1'; run 'git submodule update --init')))
endif # UPX_MAKEFILE_EXTRA_MK_INCLUDED
# vim:set ts=8 sw=8 noet:
+1 -2
View File
@@ -11,13 +11,12 @@ diff --git a/lib/libcxx/include/__config b/lib/libcxx/include/__config
index fec323f..a16d145 100644
--- a/lib/libcxx/include/__config
+++ b/lib/libcxx/include/__config
@@ -637,9 +637,12 @@ typedef __char32_t char32_t;
@@ -637,9 +637,11 @@ typedef __char32_t char32_t;
# define _DECLARE_C99_LDBL_MATH 1
# endif
+# if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
+# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
+# elif defined(_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION)
// If we are getting operator new from the MSVC CRT, then allocation overloads
// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
-# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
+2 -4
View File
@@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 \
&& apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
aria2 bash bash-completion ca-certificates coreutils curl diffutils findutils git grep gzip \
less libmpc3 make ncurses-term perl-base python3 sed sudo tar time util-linux wget xz-utils \
less libmpc3 make ncurses-term perl-base sed sudo tar time util-linux wget xz-utils \
libc6:i386 zlib1g:i386 \
# the following packages are not required for rebuilding the stubs, but
# they do make the image *much* more convenient and also allow building
@@ -19,14 +19,12 @@ RUN dpkg --add-architecture i386 \
g++ gawk gdb gh gojq ht htop hyperfine jq just ksh \
lftp libzstd-dev lsb-release lsd lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \
p7zip parallel patch patchelf patchutils pax-utils proot \
python3-pyasn1 python3-pycryptodome python3-pycurl python3-tomli python3-tomli-w \
python3 python3-pyasn1 python3-pycryptodome python3-pycurl python3-tomli python3-tomli-w \
python3-yaml python3-zstd \
re2c ripgrep rsync screen socat strace universal-ctags unzip valgrind yash yq \
zip zlib1g-dev zoxide zsh zstd \
# extra packages for compiling with "gcc -m32" and "gcc -mx32":
g++-multilib gcc-multilib \
&& apt-get install -y \
gcc-riscv64-linux-gnu \
&& true
# install python2-minimal packages from Debian-11; REQUIRED
+385 -436
View File
@@ -1,432 +1,396 @@
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/upx-stubtools-20240405-v1 latest e35ec64e37eb 3 minutes ago 1.62 GB
Image ID: e35ec64e37eb
Tags: [localhost/upx-stubtools-20240405-v1:latest]
Size: 1.616GB
Image Layers
├── ID: 073ec47a8c22 Size: 80.63MB Top Layer of: [docker.io/library/ubuntu:24.04]
├── ID: cc32efc504cb Size: 1.168GB
├── ID: 0ad248142047 Size: 9.477MB
├── ID: 1b5f23a7b45a Size: 457.2kB
├── ID: fde08588dc3b Size: 320.1MB
├── ID: 028612b01bc7 Size: 37.45MB
└── ID: a8359823a285 Size: 44.03kB Top Layer of: [localhost/upx-stubtools-20240405-v1:latest]
Packages:
+++-===================================-=================================-============-================================================================================
+++-=============================-=================================-============-================================================================================
Desired=Unknown/Install/Remove/Purge/Hold
ii 7zip 23.01+dfsg-11 amd64 7-Zip file archiver with a high compression ratio
ii apt 2.8.3 amd64 commandline package manager
ii aria2 1.37.0+debian-1build3 amd64 High speed download utility
ii base-files 13ubuntu10.3 amd64 Debian base system miscellaneous files
ii base-passwd 3.6.3build1 amd64 Debian base system master password and group files
ii bash 5.2.21-2ubuntu4 amd64 GNU Bourne Again SHell
ii bash-completion 1:2.11-8 all programmable completion for the bash shell
ii bat 0.24.0-1build1 amd64 cat(1) clone with syntax highlighting and git integration
ii bfs 3.1.2-1build1 amd64 Breadth-first version of find(1)
ii binutils 2.42-4ubuntu2.6 amd64 GNU assembler, linker and binary utilities
ii binutils-common:amd64 2.42-4ubuntu2.6 amd64 Common files for the GNU assembler, linker and binary utilities
ii binutils-riscv64-linux-gnu 2.42-4ubuntu2.6 amd64 GNU binary utilities, for riscv64-linux-gnu target
ii binutils-x86-64-linux-gnu 2.42-4ubuntu2.6 amd64 GNU binary utilities, for x86-64-linux-gnu target
ii bsdextrautils 2.39.3-9ubuntu6.3 amd64 extra utilities from 4.4BSD-Lite
ii bsdutils 1:2.39.3-9ubuntu6.3 amd64 basic utilities from 4.4BSD-Lite
ii btop 1.3.0-1 amd64 Modern and colorful command line resource monitor that shows usage and stats
ii bubblewrap 0.9.0-1ubuntu0.1 amd64 utility for unprivileged chroot and namespace manipulation
ii busybox 1:1.36.1-6ubuntu3.1 amd64 Tiny utilities for small and embedded systems
ii bzip2 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor - utilities
ii bzip3 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - utilities
ii ca-certificates 20240203 all Common CA certificates
ii cabextract 1.11-2 amd64 Microsoft Cabinet file unpacker
ii ccache 4.9.1-1 amd64 Compiler cache for fast recompilation of C/C++ code
ii chrpath 0.16-2build1 amd64 Tool to edit the rpath in ELF binaries
ii cmake 3.28.3-1build7 amd64 cross-platform, open-source make system
ii cmake-data 3.28.3-1build7 all CMake data files (modules, templates and documentation)
ii coreutils 9.4-3ubuntu6.1 amd64 GNU core utilities
ii cpio 2.15+dfsg-1ubuntu2 amd64 GNU cpio -- a program to manage archives of files
ii cpp 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp)
ii cpp-13 13.3.0-6ubuntu2~24.04 amd64 GNU C preprocessor
ii cpp-13-riscv64-linux-gnu 13.3.0-6ubuntu2~24.04cross1 amd64 GNU C preprocessor for riscv64-linux-gnu
ii cpp-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C preprocessor for x86_64-linux-gnu
ii cpp-riscv64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp) for the riscv64 architecture
ii cpp-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp) for the amd64 architecture
ii curl 8.5.0-2ubuntu10.6 amd64 command line tool for transferring data with URL syntax
ii dash 0.5.12-6ubuntu5 amd64 POSIX-compliant shell
ii debconf 1.5.86ubuntu1 all Debian configuration management system
ii debianutils 5.17build1 amd64 Miscellaneous utilities specific to Debian
ii diffstat 1.66-1build1 amd64 produces graph of changes introduced by a diff file
ii diffutils 1:3.10-1build1 amd64 File comparison utilities
ii direnv 2.32.1-2ubuntu0.24.04.3 amd64 Utility to set directory specific environment variables
ii dmidecode 3.5-3ubuntu0.1 amd64 SMBIOS/DMI table decoder
ii dpkg 1.22.6ubuntu6.5 amd64 Debian package management system
ii e2fsprogs 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system utilities
ii elfutils 0.190-1.1ubuntu0.1 amd64 collection of utilities to handle ELF objects
ii execstack 0.0.20131005-1.1ubuntu1 amd64 ELF GNU_STACK program header editing utility
ii eza 0.18.2-1 amd64 Modern replacement for ls
ii fd-find 9.0.0-1 amd64 Simple, fast and user-friendly alternative to find
ii file 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers
ii findutils 4.9.0-5build1 amd64 utilities for finding files--find, xargs
ii fish 3.7.0-1 amd64 friendly interactive shell
ii fish-common 3.7.0-1 all friendly interactive shell (architecture-independent files)
ii fzf 0.44.1-1ubuntu0.3 amd64 general-purpose command-line fuzzy finder
ii g++ 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler
ii g++-13 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler
ii g++-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler (multilib support)
ii g++-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler for x86_64-linux-gnu architecture
ii g++-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler for the amd64 architecture
ii gawk 1:5.2.1-2build3 amd64 GNU awk, a pattern scanning and processing language
ii gcc 4:13.2.0-7ubuntu1 amd64 GNU C compiler
ii gcc-13 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler
ii gcc-13-base:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-13-cross-base 13.3.0-6ubuntu2~24.04cross1 all GCC, the GNU Compiler Collection (library base package)
ii gcc-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler (multilib support)
ii gcc-13-riscv64-linux-gnu 13.3.0-6ubuntu2~24.04cross1 amd64 GNU C compiler for the riscv64-linux-gnu architecture
ii gcc-13-riscv64-linux-gnu-base:amd64 13.3.0-6ubuntu2~24.04cross1 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler for the x86_64-linux-gnu architecture
ii gcc-14-base:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-14-base:i386 14.2.0-4ubuntu2~24.04 i386 GCC, the GNU Compiler Collection (base package)
ii gcc-14-cross-base 14.2.0-4ubuntu2~24.04cross1 all GCC, the GNU Compiler Collection (library base package)
ii gcc-riscv64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the riscv64 architecture
ii gcc-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the amd64 architecture
ii gdb 15.0.50.20240403-0ubuntu1 amd64 GNU Debugger
ii gh 2.45.0-1ubuntu0.3 amd64 GitHub CLI, GitHubs official command line tool
ii git 1:2.43.0-1ubuntu7.3 amd64 fast, scalable, distributed revision control system
ii git-man 1:2.43.0-1ubuntu7.3 all fast, scalable, distributed revision control system (manual pages)
ii gojq 0.12.13-1ubuntu0.24.04.3 amd64 pure Go implementation of jq (program)
ii gpgv 2.4.4-2ubuntu17.3 amd64 GNU privacy guard - signature verification tool
ii grep 3.11-4build1 amd64 GNU grep, egrep and fgrep
ii groff-base 1.23.0-3build2 amd64 GNU troff text-formatting system (base system components)
ii gzip 1.12-1ubuntu3.1 amd64 GNU compression utilities
ii hostname 3.23+nmu2ubuntu2 amd64 utility to set/show the host name or domain name
ii ht 2.1.0+repack1-5 amd64 Viewer/editor/analyser (mostly) for executables
ii htop 3.3.0-4build1 amd64 interactive processes viewer
ii hyperfine 1.18.0-2build1 amd64 Command-line benchmarking tool
ii init-system-helpers 1.66ubuntu1 all helper tools for all init systems
ii jq 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor
ii just 1.21.0-1 amd64 Save and run project-specific commands
ii ksh 20240113 all transitional package
ii ksh93u+m 1.0.8-1 amd64 AT&T KornShell
ii less 590-2ubuntu2.1 amd64 pager program similar to more
ii lftp 4.9.2-2ubuntu1.1 amd64 Sophisticated command-line FTP/HTTP/BitTorrent client programs
ii lib32asan8 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector (32bit)
ii lib32atomic1 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions (32bit)
ii lib32gcc-13-dev 13.3.0-6ubuntu2~24.04 amd64 GCC support library (32 bit development files)
ii lib32gcc-s1 14.2.0-4ubuntu2~24.04 amd64 GCC support library (32 bit Version)
ii lib32gomp1 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library (32bit)
ii lib32itm1 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library (32bit)
ii lib32quadmath0 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library (32bit)
ii lib32stdc++-13-dev 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii lib32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (32 bit Version)
ii lib32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (32bit)
ii libacl1:amd64 2.3.2-1build1.1 amd64 access control list - shared library
ii libapparmor1:amd64 4.0.1really4.0.1-0ubuntu0.24.04.4 amd64 changehat AppArmor library
ii libapt-pkg6.0t64:amd64 2.8.3 amd64 package management runtime library
ii libarchive13t64:amd64 3.7.2-2ubuntu0.5 amd64 Multi-format archive and compression library (shared library)
ii libaria2-0:amd64 1.37.0+debian-1build3 amd64 C++ library interface to aria2
ii libasan8-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all AddressSanitizer -- a fast memory error detector
ii libasan8:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector
ii libasm1t64:amd64 0.190-1.1ubuntu0.1 amd64 library with a programmable assembler interface
ii libassuan0:amd64 2.5.6-1build1 amd64 IPC library for the GnuPG components
ii libatomic1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all support library providing __atomic built-in functions
ii libatomic1:amd64 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions
ii libattr1:amd64 1:2.5.2-1build1.1 amd64 extended attribute handling - shared library
ii libaudit-common 1:3.1.2-2.1build1.1 all Dynamic library for security auditing - common files
ii libaudit1:amd64 1:3.1.2-2.1build1.1 amd64 Dynamic library for security auditing
ii libbabeltrace1:amd64 1.5.11-3build3 amd64 Babeltrace conversion libraries
ii libbinutils:amd64 2.42-4ubuntu2.6 amd64 GNU binary utilities (private shared library)
ii libblkid1:amd64 2.39.3-9ubuntu6.3 amd64 block device ID library
ii libbrotli1:amd64 1.1.0-2build2 amd64 library implementing brotli encoder and decoder (shared libraries)
ii libbsd0:amd64 0.12.1-1build1.1 amd64 utility functions from BSD systems - shared library
ii libbz2-1.0:amd64 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor library - runtime
ii libbzip3-0:amd64 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - runtime
ii libc-bin 2.39-0ubuntu8.6 amd64 GNU C Library: Binaries
ii libc-dev-bin 2.39-0ubuntu8.6 amd64 GNU C Library: Development binaries
ii libc6-dbg:amd64 2.39-0ubuntu8.6 amd64 GNU C Library: detached debugging symbols
ii libc6-dev-i386 2.39-0ubuntu8.6 amd64 GNU C Library: 32-bit development libraries for AMD64
ii libc6-dev-riscv64-cross 2.39-0ubuntu8cross1 all GNU C Library: Development Libraries and Header Files (for cross-compiling)
ii libc6-dev-x32 2.39-0ubuntu8.6 amd64 GNU C Library: X32 ABI Development Libraries for AMD64
ii libc6-dev:amd64 2.39-0ubuntu8.6 amd64 GNU C Library: Development Libraries and Header Files
ii libc6-i386 2.39-0ubuntu8.6 amd64 GNU C Library: 32-bit shared libraries for AMD64
ii libc6-riscv64-cross 2.39-0ubuntu8cross1 all GNU C Library: Shared libraries (for cross-compiling)
ii libc6-x32 2.39-0ubuntu8.6 amd64 GNU C Library: X32 ABI Shared libraries for AMD64
ii libc6:amd64 2.39-0ubuntu8.6 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.39-0ubuntu8.6 i386 GNU C Library: Shared libraries
ii libcap-ng0:amd64 0.8.4-2build2 amd64 alternate POSIX capabilities library
ii libcap2:amd64 1:2.66-5ubuntu2.2 amd64 POSIX 1003.1e capabilities (library)
ii libcares2:amd64 1.27.0-1.0ubuntu1 amd64 asynchronous name resolver
ii libcc1-0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC cc1 plugin for GDB
ii libcom-err2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 common error description library
ii libcrypt-dev:amd64 1:4.4.36-4build1 amd64 libcrypt development files
ii libcrypt1:amd64 1:4.4.36-4build1 amd64 libcrypt shared library
ii libctf-nobfd0:amd64 2.42-4ubuntu2.6 amd64 Compact C Type Format library (runtime, no BFD dependency)
ii libctf0:amd64 2.42-4ubuntu2.6 amd64 Compact C Type Format library (runtime, BFD dependency)
ii libcurl3t64-gnutls:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour)
ii libcurl4t64:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour)
ii libdb5.3t64:amd64 5.3.28+dfsg2-7 amd64 Berkeley v5.3 Database Libraries [runtime]
ii libdebconfclient0:amd64 0.271ubuntu3 amd64 Debian Configuration Management System (C-implementation library)
ii libdebuginfod-common 0.190-1.1ubuntu0.1 all configuration to enable the Debian debug info server
ii libdebuginfod1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to interact with debuginfod (development files)
ii libdw1t64:amd64 0.190-1.1ubuntu0.1 amd64 library that provides access to the DWARF debug information
ii libelf1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to read and write ELF files
ii liberror-perl 0.17029-2 all Perl module for error/exception handling in an OO-ish way
ii libexpat1:amd64 2.6.1-2ubuntu0.3 amd64 XML parsing C library - runtime library
ii libext2fs2t64:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system libraries
ii libffi8:amd64 3.4.6-1build1 amd64 Foreign Function Interface library runtime
ii libgcc-13-dev-riscv64-cross 13.3.0-6ubuntu2~24.04cross1 all GCC support library (development files)
ii libgcc-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC support library (development files)
ii libgcc-s1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all GCC support library (riscv64)
ii libgcc-s1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC support library
ii libgcc-s1:i386 14.2.0-4ubuntu2~24.04 i386 GCC support library
ii libgcrypt20:amd64 1.10.3-2build1 amd64 LGPL Crypto library - runtime library
ii libgdbm-compat4t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (legacy support runtime version)
ii libgdbm6t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (runtime version)
ii libgit2-1.7:amd64 1.7.2+ds-1ubuntu3 amd64 low-level Git library
ii libglib2.0-0t64:amd64 2.80.0-6ubuntu3.4 amd64 GLib library of C routines
ii libgmp10:amd64 2:6.3.0+dfsg-2ubuntu6.1 amd64 Multiprecision arithmetic library
ii libgnutls30t64:amd64 3.8.3-1.1ubuntu3.4 amd64 GNU TLS library - main runtime library
ii libgomp1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all GCC OpenMP (GOMP) support library
ii libgomp1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library
ii libgpg-error0:amd64 1.47-3build2.1 amd64 GnuPG development runtime library
ii libgprofng0:amd64 2.42-4ubuntu2.6 amd64 GNU Next Generation profiler (runtime library)
ii libgssapi-krb5-2:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - krb5 GSS-API Mechanism
ii libhiredis1.1.0:amd64 1.2.0-6ubuntu3 amd64 minimalistic C client library for Redis
ii libhogweed6t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (public-key cryptos)
ii libhttp-parser2.9:amd64 2.9.4-6build1 amd64 parser for HTTP messages written in C
ii libhwasan0:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector
ii libicu74:amd64 74.2-1ubuntu3.1 amd64 International Components for Unicode
ii libidn2-0:amd64 2.3.7-2build1.1 amd64 Internationalized domain names (IDNA2008/TR46) library
ii libio-pty-perl 1:1.20-1build2 amd64 Perl module for pseudo tty IO
ii libipc-run-perl 20231003.0-1 all Perl module for running processes
ii libipt2 2.0.6-1build1 amd64 Intel Processor Trace Decoder Library
ii libisl23:amd64 0.26-3build1.1 amd64 manipulating sets and relations of integer points bounded by linear constraints
ii libitm1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all GNU Transactional Memory Library
ii libitm1:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library
ii libjansson4:amd64 2.14-2build2 amd64 C library for encoding, decoding and manipulating JSON data
ii libjq1:amd64 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor - shared library
ii libjsoncpp25:amd64 1.9.5-6build1 amd64 library for reading and writing JSON for C++
ii libk5crypto3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Crypto Library
ii libkeyutils1:amd64 1.6.3-3build1 amd64 Linux Key Management Utilities (library)
ii libkrb5-3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries
ii libkrb5support0:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Support library
ii libldap2:amd64 2.6.7+dfsg-1~exp1ubuntu8.2 amd64 OpenLDAP libraries
ii liblsan0:amd64 14.2.0-4ubuntu2~24.04 amd64 LeakSanitizer -- a memory leak detector (runtime)
ii libluajit-5.1-2:amd64 2.1.0+git20231223.c525bcb+dfsg-1 amd64 Just in time compiler for Lua - library version
ii libluajit-5.1-common 2.1.0+git20231223.c525bcb+dfsg-1 all Just in time compiler for Lua - common files
ii liblz4-1:amd64 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - runtime
ii liblzma5:amd64 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression library
ii liblzo2-2:amd64 2.10-2build4 amd64 data compression library
ii libmagic-mgc 1:5.45-3build1 amd64 File type determination library using "magic" numbers (compiled magic file)
ii libmagic1t64:amd64 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers - library
ii libmd0:amd64 1.1.0-2build1.1 amd64 message digest functions from BSD systems - shared library
ii libmount1:amd64 2.39.3-9ubuntu6.3 amd64 device mounting library
ii libmpc3:amd64 1.3.1-1build1.1 amd64 multiple precision complex floating-point library
ii libmpfr6:amd64 4.2.1-1build1.1 amd64 multiple precision floating-point computation
ii libmsgpackc2:amd64 4.0.0-3build1 amd64 binary-based efficient object serialization library
ii libmspack0t64:amd64 0.11-1.1build1 amd64 library for Microsoft compression formats (shared library)
ii libncurses6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling
ii libncursesw6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling (wide character support)
ii libnettle8t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (symmetric and one-way cryptos)
ii libnghttp2-14:amd64 1.59.0-1ubuntu0.2 amd64 library implementing HTTP/2 protocol (shared library)
ii libnl-3-200:amd64 3.7.0-0.3build1.1 amd64 library for dealing with netlink sockets
ii libnl-genl-3-200:amd64 3.7.0-0.3build1.1 amd64 library for dealing with netlink sockets - generic netlink
ii libnpth0t64:amd64 1.6-3.1build1 amd64 replacement for GNU Pth using system threads
ii libonig5:amd64 6.9.9-1build1 amd64 regular expressions library
ii libp11-kit0:amd64 0.25.3-4ubuntu2.1 amd64 library for loading and coordinating access to PKCS#11 modules - runtime
ii libpam-modules-bin 1.5.3-5ubuntu5.5 amd64 Pluggable Authentication Modules for PAM - helper binaries
ii libpam-modules:amd64 1.5.3-5ubuntu5.5 amd64 Pluggable Authentication Modules for PAM
ii libpam-runtime 1.5.3-5ubuntu5.5 all Runtime support for the PAM library
ii libpam0g:amd64 1.5.3-5ubuntu5.5 amd64 Pluggable Authentication Modules library
ii libpcre2-32-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library - 32 bit runtime files
ii libpcre2-8-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library- 8 bit runtime files
ii libperl5.38t64:amd64 5.38.2-3.2ubuntu0.2 amd64 shared Perl library
ii libpipeline1:amd64 1.5.7-2 amd64 Unix process pipeline manipulation library
ii libpopt0:amd64 1.19+dfsg-1build1 amd64 lib for parsing cmdline parameters
ii libproc2-0:amd64 2:4.0.4-4ubuntu3.2 amd64 library for accessing process information from /proc
ii libpsl5t64:amd64 0.21.2-1.1build1 amd64 Library for Public Suffix List (shared libraries)
ii libpython2.7-minimal:amd64 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7)
ii libpython3-stdlib:amd64 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii libpython3.12-minimal:amd64 3.12.3-1ubuntu0.8 amd64 Minimal subset of the Python language (version 3.12)
ii libpython3.12-stdlib:amd64 3.12.3-1ubuntu0.8 amd64 Interactive high-level object-oriented language (standard library, version 3.12)
ii libpython3.12t64:amd64 3.12.3-1ubuntu0.8 amd64 Shared Python runtime library (version 3.12)
ii libquadmath0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library
ii libreadline8t64:amd64 8.2-4build1 amd64 GNU readline and history libraries, run-time libraries
ii librhash0:amd64 1.4.3-3build1 amd64 shared library for hash functions computing
ii librtmp1:amd64 2.4+20151223.gitfa8646d.1-2build7 amd64 toolkit for RTMP streams (shared library)
ii libsasl2-2:amd64 2.1.28+dfsg1-5ubuntu3.1 amd64 Cyrus SASL - authentication abstraction library
ii libsasl2-modules-db:amd64 2.1.28+dfsg1-5ubuntu3.1 amd64 Cyrus SASL - pluggable authentication modules (DB)
ii libseccomp2:amd64 2.5.5-1ubuntu3.1 amd64 high level interface to Linux seccomp filter
ii libselinux1:amd64 3.5-2ubuntu2.1 amd64 SELinux runtime shared libraries
ii libsemanage-common 3.5-1build5 all Common files for SELinux policy management libraries
ii libsemanage2:amd64 3.5-1build5 amd64 SELinux policy management library
ii libsensors-config 1:3.6.0-9build1 all lm-sensors configuration files
ii libsensors5:amd64 1:3.6.0-9build1 amd64 library to read temperature/voltage/fan sensors
ii libsepol2:amd64 3.5-2build1 amd64 SELinux library for manipulating binary security policies
ii libsframe1:amd64 2.42-4ubuntu2.6 amd64 Library to handle the SFrame format (runtime library)
ii libsigsegv2:amd64 2.14-1ubuntu2 amd64 Library for handling page faults in a portable way
ii libsmartcols1:amd64 2.39.3-9ubuntu6.3 amd64 smart column output alignment library
ii libsource-highlight-common 3.1.9-4.3build1 all architecture-independent files for source highlighting library
ii libsource-highlight4t64:amd64 3.1.9-4.3build1 amd64 source highlighting library
ii libsqlite3-0:amd64 3.45.1-1ubuntu2.5 amd64 SQLite 3 shared library
ii libss2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 command-line interface parsing library
ii libssh-4:amd64 0.10.6-2ubuntu0.2 amd64 tiny C SSH library (OpenSSL flavor)
ii libssh2-1t64:amd64 1.11.0-4.1build2 amd64 SSH2 client-side library
ii libssl3t64:amd64 3.0.13-0ubuntu3.6 amd64 Secure Sockets Layer toolkit - shared libraries
ii libstdc++-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii libstdc++6-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all GNU Standard C++ Library v3 (riscv64)
ii libstdc++6:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3
ii libsystemd0:amd64 255.4-1ubuntu8.11 amd64 systemd utility library
ii libtalloc2:amd64 2.4.2-1build2 amd64 hierarchical pool based memory allocator
ii libtasn1-6:amd64 4.19.0-3ubuntu0.24.04.1 amd64 Manage ASN.1 structures (runtime)
ii libtermkey1:amd64 0.22-1 amd64 library for processing keyboard input
ii libtime-duration-perl 1.21-2 all module for rounded or exact English expression of durations
ii libtimedate-perl 2.3300-2 all collection of modules to manipulate date/time information
ii libtinfo6:amd64 6.4+20240113-1ubuntu2 amd64 shared low-level terminfo library for terminal handling
ii libtree-sitter0:amd64 0.20.8-2 amd64 incremental parsing system for programming tools
ii libtsan2:amd64 14.2.0-4ubuntu2~24.04 amd64 ThreadSanitizer -- a Valgrind-based detector of data races (runtime)
ii libubsan1-riscv64-cross 14.2.0-4ubuntu2~24.04cross1 all UBSan -- undefined behaviour sanitizer (runtime)
ii libubsan1:amd64 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (runtime)
ii libuchardet0:amd64 0.0.8-1build1 amd64 universal charset detection library - shared library
ii libudev1:amd64 255.4-1ubuntu8.11 amd64 libudev shared library
ii libunibilium4:amd64 2.1.0-3 amd64 simple, self-contained terminfo library
ii libunistring5:amd64 1.1-2build1.1 amd64 Unicode string library for C
ii libunwind8:amd64 1.6.2-3build1.1 amd64 library to determine the call-chain of a program - runtime
ii liburing2:amd64 2.5-1build1 amd64 Linux kernel io_uring access library - shared library
ii libutempter0:amd64 1.2.1-3build1 amd64 privileged helper for utmp/wtmp updates (runtime)
ii libuuid1:amd64 2.39.3-9ubuntu6.3 amd64 Universally Unique ID library
ii libuv1t64:amd64 1.48.0-1.1build1 amd64 asynchronous event notification library - runtime library
ii libvterm0:amd64 0.3.3-2build1 amd64 abstract terminal library
ii libwrap0:amd64 7.6.q-33 amd64 Wietse Venema's TCP wrappers library
ii libx11-6:amd64 2:1.8.7-1build1 amd64 X11 client-side library
ii libx11-data 2:1.8.7-1build1 all X11 client-side library
ii libx32asan8 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector (x32)
ii libx32atomic1 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions (x32)
ii libx32gcc-13-dev 13.3.0-6ubuntu2~24.04 amd64 GCC support library (x32 development files)
ii libx32gcc-s1 14.2.0-4ubuntu2~24.04 amd64 GCC support library (x32)
ii libx32gomp1 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library (x32)
ii libx32itm1 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library (x32)
ii libx32quadmath0 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library (x32)
ii libx32stdc++-13-dev 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii libx32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (x32)
ii libx32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (x32)
ii libxau6:amd64 1:1.0.9-1build6 amd64 X11 authorisation library
ii libxcb1:amd64 1.15-1ubuntu2 amd64 X C Binding
ii libxdmcp6:amd64 1:1.1.3-0ubuntu6 amd64 X11 Display Manager Control Protocol library
ii libxml2:amd64 2.9.14+dfsg-1.3ubuntu3.6 amd64 GNOME XML library
ii libxxhash0:amd64 0.8.2-2build1 amd64 shared library for xxhash
ii libyaml-0-2:amd64 0.2.5-1build1 amd64 Fast YAML 1.1 parser and emitter library
ii libzstd-dev:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- development files
ii libzstd1:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm
ii linux-libc-dev-riscv64-cross 6.8.0-25.25cross1 all Linux Kernel Headers for development (for cross-compiling)
ii linux-libc-dev:amd64 6.8.0-87.88 amd64 Linux Kernel Headers for development
ii login 1:4.13+dfsg1-4ubuntu3.2 amd64 system login tools
ii logsave 1.47.0-2.4~exp1ubuntu4.1 amd64 save the output of a command in a log file
ii lsb-release 12.0-2 all Linux Standard Base version reporting utility (minimal implementation)
ii lsd 1.0.0-2 amd64 ls command with a lot of pretty colors and some other stuff
ii lua-luv:amd64 1.48.0-2-2build1 amd64 libuv bindings for Lua
ii lz4 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - tool
ii lzip 1.24.1-1build1 amd64 lossless data compressor based on the LZMA algorithm
ii lzop 1.04-2build3 amd64 fast compression program
ii make 4.3-4.1build2 amd64 utility for directing compilation
ii man-db 2.12.0-4build2 amd64 tools for reading manual pages
ii mawk 1.3.4.20240123-1build1 amd64 Pattern scanning and text processing language
ii media-types 10.1.0 all List of standard media types and their usual file extension
ii minify 2.20.17-1 amd64 CLI implementation of the Go minify library package
ii mksh 59c-37 amd64 MirBSD Korn Shell
ii moreutils 0.69-1 amd64 additional Unix utilities
ii mount 2.39.3-9ubuntu6.3 amd64 tools for mounting and manipulating filesystems
ii musl:amd64 1.2.4-2 amd64 standard C library
ii ncurses-base 6.4+20240113-1ubuntu2 all basic terminal type definitions
ii ncurses-bin 6.4+20240113-1ubuntu2 amd64 terminal-related programs and man pages
ii ncurses-term 6.4+20240113-1ubuntu2 all additional terminal type definitions
ii neovim 0.9.5-6ubuntu2 amd64 heavily refactored vim fork
ii neovim-runtime 0.9.5-6ubuntu2 all heavily refactored vim fork (runtime files)
ii netbase 6.4 all Basic TCP/IP networking system
ii ninja-build 1.11.1-2 amd64 small build system closest in spirit to Make
ii openssl 3.0.13-0ubuntu3.6 amd64 Secure Sockets Layer toolkit - cryptographic utility
ii p7zip 16.02+transitional.1 all transitional package
ii parallel 20231122+ds-1 all build and execute command lines from standard input in parallel
ii passwd 1:4.13+dfsg1-4ubuntu3.2 amd64 change and administer password and group data
ii patch 2.7.6-7build3 amd64 Apply a diff file to an original
ii patchelf 0.18.0-1.1build1 amd64 modify properties of ELF executables
ii patchutils 0.4.2-1build3 amd64 Utilities to work with patches
ii pax-utils 1.3.7-1 amd64 Security-focused ELF files checking tool
ii perl 5.38.2-3.2ubuntu0.2 amd64 Larry Wall's Practical Extraction and Report Language
ii perl-base 5.38.2-3.2ubuntu0.2 amd64 minimal Perl system
ii perl-modules-5.38 5.38.2-3.2ubuntu0.2 all Core Perl modules
ii procps 2:4.0.4-4ubuntu3.2 amd64 /proc file system utilities
ii proot 5.1.0-1.3 amd64 emulate chroot, bind mount and binfmt_misc for non-root users
ii python2.7-minimal 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7)
ii python3 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii python3-argcomplete 3.1.4-1ubuntu0.1 all bash tab completion for argparse (for Python 3)
ii python3-minimal 3.12.3-0ubuntu2 amd64 minimal subset of the Python language (default python3 version)
ii python3-pyasn1 0.4.8-4 all ASN.1 library for Python (Python 3 module)
ii python3-pycryptodome 3.20.0+dfsg-1 amd64 cryptographic Python library (Python 3)
ii python3-pycurl 7.45.3-1build2 amd64 Python bindings to libcurl (Python 3)
ii python3-pyelftools 0.30-1 all pure-python3 library for parsing ELF and DWARF
ii python3-toml 0.10.2-1 all library for Tom's Obvious, Minimal Language - Python 3.x
ii python3-tomli 2.0.1-2 all lil' TOML parser for Python
ii python3-tomli-w 1.0.0-2 all lil' TOML writer for Python
ii python3-xmltodict 0.13.0-1ubuntu0.24.04.1 all Makes working with XML feel like you are working with JSON (Python 3)
ii python3-yaml 6.0.1-2build2 amd64 YAML parser and emitter for Python3
ii python3-zstd 1.5.5.1-1build1 amd64 python bindings to Yann Collet ZSTD compression library
ii python3.12 3.12.3-1ubuntu0.8 amd64 Interactive high-level object-oriented language (version 3.12)
ii python3.12-minimal 3.12.3-1ubuntu0.8 amd64 Minimal subset of the Python language (version 3.12)
ii re2c 3.1-1build1 amd64 lexer generator for C, C++, Go and Rust
ii readline-common 8.2-4build1 all GNU readline and history libraries, common files
ii ripgrep 14.1.0-1 amd64 Recursively searches directories for a regex pattern
ii rpcsvc-proto 1.4.2-0ubuntu7 amd64 RPC protocol compiler and definitions
ii rsync 3.2.7-1ubuntu1.2 amd64 fast, versatile, remote (and local) file-copying tool
ii screen 4.9.1-1build1 amd64 terminal multiplexer with VT100/ANSI terminal emulation
ii sed 4.9-2build1 amd64 GNU stream editor for filtering/transforming text
ii sensible-utils 0.0.22 all Utilities for sensible alternative selection
ii socat 1.8.0.0-4build3 amd64 multipurpose relay for bidirectional data transfer
ii strace 6.8-0ubuntu2 amd64 System call tracer
ii sudo 1.9.15p5-3ubuntu5.24.04.1 amd64 Provide limited super user privileges to specific users
ii sysstat 12.6.1-2 amd64 system performance tools for Linux
ii sysvinit-utils 3.08-6ubuntu3 amd64 System-V-like utilities
ii tar 1.35+dfsg-3build1 amd64 GNU version of the tar archiving utility
ii time 1.9-0.2build1 amd64 GNU time program for measuring CPU resource usage
ii tzdata 2025b-0ubuntu0.24.04.1 all time zone and daylight-saving time data
ii ubuntu-keyring 2023.11.28.1 all GnuPG keys of the Ubuntu archive
ii ucf 3.0043+nmu1 all Update Configuration File(s): preserve user changes to config files
ii universal-ctags 5.9.20210829.0-1 amd64 build tag file indexes of source code definitions
ii unminimize 0.2.1 amd64 Un-minimize your minimial images or setup
ii unzip 6.0-28ubuntu4.1 amd64 De-archiver for .zip files
ii util-linux 2.39.3-9ubuntu6.3 amd64 miscellaneous system utilities
ii valgrind 1:3.22.0-0ubuntu3 amd64 instrumentation framework for building dynamic analysis tools
ii wget 1.21.4-1ubuntu4.1 amd64 retrieves files from the web
ii xz-utils 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression utilities
ii yash 2.55-2 amd64 yet another shell
ii yq 3.1.0-3 all Command-line YAML processor - jq wrapper for YAML documents
ii zip 3.0-13ubuntu0.2 amd64 Archiver for .zip files
ii zlib1g-dev:amd64 1:1.3.dfsg-3.1ubuntu2.1 amd64 compression library - development
ii zlib1g:amd64 1:1.3.dfsg-3.1ubuntu2.1 amd64 compression library - runtime
ii zlib1g:i386 1:1.3.dfsg-3.1ubuntu2.1 i386 compression library - runtime
ii zoxide 0.9.3-1 amd64 Smarter cd command for your terminal
ii zsh 5.9-6ubuntu2 amd64 shell with lots of features
ii zsh-common 5.9-6ubuntu2 all architecture independent files for Zsh
ii zstd 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- CLI tool
ii 7zip 23.01+dfsg-11 amd64 7-Zip file archiver with a high compression ratio
ii apt 2.8.3 amd64 commandline package manager
ii aria2 1.37.0+debian-1build3 amd64 High speed download utility
ii base-files 13ubuntu10.2 amd64 Debian base system miscellaneous files
ii base-passwd 3.6.3build1 amd64 Debian base system master password and group files
ii bash 5.2.21-2ubuntu4 amd64 GNU Bourne Again SHell
ii bash-completion 1:2.11-8 all programmable completion for the bash shell
ii bat 0.24.0-1build1 amd64 cat(1) clone with syntax highlighting and git integration
ii bfs 3.1.2-1build1 amd64 Breadth-first version of find(1)
ii binutils 2.42-4ubuntu2.5 amd64 GNU assembler, linker and binary utilities
ii binutils-common:amd64 2.42-4ubuntu2.5 amd64 Common files for the GNU assembler, linker and binary utilities
ii binutils-x86-64-linux-gnu 2.42-4ubuntu2.5 amd64 GNU binary utilities, for x86-64-linux-gnu target
ii bsdextrautils 2.39.3-9ubuntu6.3 amd64 extra utilities from 4.4BSD-Lite
ii bsdutils 1:2.39.3-9ubuntu6.3 amd64 basic utilities from 4.4BSD-Lite
ii btop 1.3.0-1 amd64 Modern and colorful command line resource monitor that shows usage and stats
ii bubblewrap 0.9.0-1ubuntu0.1 amd64 utility for unprivileged chroot and namespace manipulation
ii busybox 1:1.36.1-6ubuntu3.1 amd64 Tiny utilities for small and embedded systems
ii bzip2 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor - utilities
ii bzip3 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - utilities
ii ca-certificates 20240203 all Common CA certificates
ii cabextract 1.11-2 amd64 Microsoft Cabinet file unpacker
ii ccache 4.9.1-1 amd64 Compiler cache for fast recompilation of C/C++ code
ii chrpath 0.16-2build1 amd64 Tool to edit the rpath in ELF binaries
ii cmake 3.28.3-1build7 amd64 cross-platform, open-source make system
ii cmake-data 3.28.3-1build7 all CMake data files (modules, templates and documentation)
ii coreutils 9.4-3ubuntu6 amd64 GNU core utilities
ii cpio 2.15+dfsg-1ubuntu2 amd64 GNU cpio -- a program to manage archives of files
ii cpp 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp)
ii cpp-13 13.3.0-6ubuntu2~24.04 amd64 GNU C preprocessor
ii cpp-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C preprocessor for x86_64-linux-gnu
ii cpp-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C preprocessor (cpp) for the amd64 architecture
ii curl 8.5.0-2ubuntu10.6 amd64 command line tool for transferring data with URL syntax
ii dash 0.5.12-6ubuntu5 amd64 POSIX-compliant shell
ii debconf 1.5.86ubuntu1 all Debian configuration management system
ii debianutils 5.17build1 amd64 Miscellaneous utilities specific to Debian
ii diffstat 1.66-1build1 amd64 produces graph of changes introduced by a diff file
ii diffutils 1:3.10-1build1 amd64 File comparison utilities
ii direnv 2.32.1-2ubuntu0.24.04.3 amd64 Utility to set directory specific environment variables
ii dmidecode 3.5-3ubuntu0.1 amd64 SMBIOS/DMI table decoder
ii dpkg 1.22.6ubuntu6.1 amd64 Debian package management system
ii e2fsprogs 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system utilities
ii elfutils 0.190-1.1ubuntu0.1 amd64 collection of utilities to handle ELF objects
ii execstack 0.0.20131005-1.1ubuntu1 amd64 ELF GNU_STACK program header editing utility
ii eza 0.18.2-1 amd64 Modern replacement for ls
ii fd-find 9.0.0-1 amd64 Simple, fast and user-friendly alternative to find
ii file 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers
ii findutils 4.9.0-5build1 amd64 utilities for finding files--find, xargs
ii fish 3.7.0-1 amd64 friendly interactive shell
ii fish-common 3.7.0-1 all friendly interactive shell (architecture-independent files)
ii fzf 0.44.1-1ubuntu0.3 amd64 general-purpose command-line fuzzy finder
ii g++ 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler
ii g++-13 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler
ii g++-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler (multilib support)
ii g++-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler for x86_64-linux-gnu architecture
ii g++-multilib 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler (multilib files)
ii g++-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler for the amd64 architecture
ii gawk 1:5.2.1-2build3 amd64 GNU awk, a pattern scanning and processing language
ii gcc 4:13.2.0-7ubuntu1 amd64 GNU C compiler
ii gcc-13 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler
ii gcc-13-base:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler (multilib support)
ii gcc-13-x86-64-linux-gnu 13.3.0-6ubuntu2~24.04 amd64 GNU C compiler for the x86_64-linux-gnu architecture
ii gcc-14-base:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-14-base:i386 14.2.0-4ubuntu2~24.04 i386 GCC, the GNU Compiler Collection (base package)
ii gcc-multilib 4:13.2.0-7ubuntu1 amd64 GNU C compiler (multilib files)
ii gcc-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the amd64 architecture
ii gdb 15.0.50.20240403-0ubuntu1 amd64 GNU Debugger
ii gh 2.45.0-1ubuntu0.3 amd64 GitHub CLI, GitHubs official command line tool
ii git 1:2.43.0-1ubuntu7.3 amd64 fast, scalable, distributed revision control system
ii git-man 1:2.43.0-1ubuntu7.3 all fast, scalable, distributed revision control system (manual pages)
ii gojq 0.12.13-1ubuntu0.24.04.3 amd64 pure Go implementation of jq (program)
ii gpgv 2.4.4-2ubuntu17.3 amd64 GNU privacy guard - signature verification tool
ii grep 3.11-4build1 amd64 GNU grep, egrep and fgrep
ii groff-base 1.23.0-3build2 amd64 GNU troff text-formatting system (base system components)
ii gzip 1.12-1ubuntu3.1 amd64 GNU compression utilities
ii hostname 3.23+nmu2ubuntu2 amd64 utility to set/show the host name or domain name
ii ht 2.1.0+repack1-5 amd64 Viewer/editor/analyser (mostly) for executables
ii htop 3.3.0-4build1 amd64 interactive processes viewer
ii hyperfine 1.18.0-2build1 amd64 Command-line benchmarking tool
ii init-system-helpers 1.66ubuntu1 all helper tools for all init systems
ii jq 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor
ii just 1.21.0-1 amd64 Save and run project-specific commands
ii ksh 20240113 all transitional package
ii ksh93u+m 1.0.8-1 amd64 AT&T KornShell
ii less 590-2ubuntu2.1 amd64 pager program similar to more
ii lftp 4.9.2-2ubuntu1 amd64 Sophisticated command-line FTP/HTTP/BitTorrent client programs
ii lib32asan8 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector (32bit)
ii lib32atomic1 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions (32bit)
ii lib32gcc-13-dev 13.3.0-6ubuntu2~24.04 amd64 GCC support library (32 bit development files)
ii lib32gcc-s1 14.2.0-4ubuntu2~24.04 amd64 GCC support library (32 bit Version)
ii lib32gomp1 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library (32bit)
ii lib32itm1 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library (32bit)
ii lib32quadmath0 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library (32bit)
ii lib32stdc++-13-dev 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii lib32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (32 bit Version)
ii lib32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (32bit)
ii libacl1:amd64 2.3.2-1build1.1 amd64 access control list - shared library
ii libapparmor1:amd64 4.0.1really4.0.1-0ubuntu0.24.04.4 amd64 changehat AppArmor library
ii libapt-pkg6.0t64:amd64 2.8.3 amd64 package management runtime library
ii libarchive13t64:amd64 3.7.2-2ubuntu0.5 amd64 Multi-format archive and compression library (shared library)
ii libaria2-0:amd64 1.37.0+debian-1build3 amd64 C++ library interface to aria2
ii libasan8:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector
ii libasm1t64:amd64 0.190-1.1ubuntu0.1 amd64 library with a programmable assembler interface
ii libassuan0:amd64 2.5.6-1build1 amd64 IPC library for the GnuPG components
ii libatomic1:amd64 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions
ii libattr1:amd64 1:2.5.2-1build1.1 amd64 extended attribute handling - shared library
ii libaudit-common 1:3.1.2-2.1build1.1 all Dynamic library for security auditing - common files
ii libaudit1:amd64 1:3.1.2-2.1build1.1 amd64 Dynamic library for security auditing
ii libbabeltrace1:amd64 1.5.11-3build3 amd64 Babeltrace conversion libraries
ii libbinutils:amd64 2.42-4ubuntu2.5 amd64 GNU binary utilities (private shared library)
ii libblkid1:amd64 2.39.3-9ubuntu6.3 amd64 block device ID library
ii libbrotli1:amd64 1.1.0-2build2 amd64 library implementing brotli encoder and decoder (shared libraries)
ii libbsd0:amd64 0.12.1-1build1.1 amd64 utility functions from BSD systems - shared library
ii libbz2-1.0:amd64 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor library - runtime
ii libbzip3-0:amd64 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - runtime
ii libc-bin 2.39-0ubuntu8.5 amd64 GNU C Library: Binaries
ii libc-dev-bin 2.39-0ubuntu8.5 amd64 GNU C Library: Development binaries
ii libc6-dbg:amd64 2.39-0ubuntu8.5 amd64 GNU C Library: detached debugging symbols
ii libc6-dev-i386 2.39-0ubuntu8.5 amd64 GNU C Library: 32-bit development libraries for AMD64
ii libc6-dev-x32 2.39-0ubuntu8.5 amd64 GNU C Library: X32 ABI Development Libraries for AMD64
ii libc6-dev:amd64 2.39-0ubuntu8.5 amd64 GNU C Library: Development Libraries and Header Files
ii libc6-i386 2.39-0ubuntu8.5 amd64 GNU C Library: 32-bit shared libraries for AMD64
ii libc6-x32 2.39-0ubuntu8.5 amd64 GNU C Library: X32 ABI Shared libraries for AMD64
ii libc6:amd64 2.39-0ubuntu8.5 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.39-0ubuntu8.5 i386 GNU C Library: Shared libraries
ii libcap-ng0:amd64 0.8.4-2build2 amd64 alternate POSIX capabilities library
ii libcap2:amd64 1:2.66-5ubuntu2.2 amd64 POSIX 1003.1e capabilities (library)
ii libcares2:amd64 1.27.0-1.0ubuntu1 amd64 asynchronous name resolver
ii libcc1-0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC cc1 plugin for GDB
ii libcom-err2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 common error description library
ii libcrypt-dev:amd64 1:4.4.36-4build1 amd64 libcrypt development files
ii libcrypt1:amd64 1:4.4.36-4build1 amd64 libcrypt shared library
ii libctf-nobfd0:amd64 2.42-4ubuntu2.5 amd64 Compact C Type Format library (runtime, no BFD dependency)
ii libctf0:amd64 2.42-4ubuntu2.5 amd64 Compact C Type Format library (runtime, BFD dependency)
ii libcurl3t64-gnutls:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour)
ii libcurl4t64:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour)
ii libdb5.3t64:amd64 5.3.28+dfsg2-7 amd64 Berkeley v5.3 Database Libraries [runtime]
ii libdebconfclient0:amd64 0.271ubuntu3 amd64 Debian Configuration Management System (C-implementation library)
ii libdebuginfod-common 0.190-1.1ubuntu0.1 all configuration to enable the Debian debug info server
ii libdebuginfod1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to interact with debuginfod (development files)
ii libdw1t64:amd64 0.190-1.1ubuntu0.1 amd64 library that provides access to the DWARF debug information
ii libelf1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to read and write ELF files
ii liberror-perl 0.17029-2 all Perl module for error/exception handling in an OO-ish way
ii libexpat1:amd64 2.6.1-2ubuntu0.3 amd64 XML parsing C library - runtime library
ii libext2fs2t64:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system libraries
ii libffi8:amd64 3.4.6-1build1 amd64 Foreign Function Interface library runtime
ii libgcc-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC support library (development files)
ii libgcc-s1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC support library
ii libgcc-s1:i386 14.2.0-4ubuntu2~24.04 i386 GCC support library
ii libgcrypt20:amd64 1.10.3-2build1 amd64 LGPL Crypto library - runtime library
ii libgdbm-compat4t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (legacy support runtime version)
ii libgdbm6t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (runtime version)
ii libgit2-1.7:amd64 1.7.2+ds-1ubuntu3 amd64 low-level Git library
ii libglib2.0-0t64:amd64 2.80.0-6ubuntu3.4 amd64 GLib library of C routines
ii libgmp10:amd64 2:6.3.0+dfsg-2ubuntu6.1 amd64 Multiprecision arithmetic library
ii libgnutls30t64:amd64 3.8.3-1.1ubuntu3.4 amd64 GNU TLS library - main runtime library
ii libgomp1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library
ii libgpg-error0:amd64 1.47-3build2.1 amd64 GnuPG development runtime library
ii libgprofng0:amd64 2.42-4ubuntu2.5 amd64 GNU Next Generation profiler (runtime library)
ii libgssapi-krb5-2:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - krb5 GSS-API Mechanism
ii libhiredis1.1.0:amd64 1.2.0-6ubuntu3 amd64 minimalistic C client library for Redis
ii libhogweed6t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (public-key cryptos)
ii libhttp-parser2.9:amd64 2.9.4-6build1 amd64 parser for HTTP messages written in C
ii libhwasan0:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector
ii libicu74:amd64 74.2-1ubuntu3.1 amd64 International Components for Unicode
ii libidn2-0:amd64 2.3.7-2build1.1 amd64 Internationalized domain names (IDNA2008/TR46) library
ii libio-pty-perl 1:1.20-1build2 amd64 Perl module for pseudo tty IO
ii libipc-run-perl 20231003.0-1 all Perl module for running processes
ii libipt2 2.0.6-1build1 amd64 Intel Processor Trace Decoder Library
ii libisl23:amd64 0.26-3build1.1 amd64 manipulating sets and relations of integer points bounded by linear constraints
ii libitm1:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library
ii libjansson4:amd64 2.14-2build2 amd64 C library for encoding, decoding and manipulating JSON data
ii libjq1:amd64 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor - shared library
ii libjsoncpp25:amd64 1.9.5-6build1 amd64 library for reading and writing JSON for C++
ii libk5crypto3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Crypto Library
ii libkeyutils1:amd64 1.6.3-3build1 amd64 Linux Key Management Utilities (library)
ii libkrb5-3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries
ii libkrb5support0:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Support library
ii libldap2:amd64 2.6.7+dfsg-1~exp1ubuntu8.2 amd64 OpenLDAP libraries
ii liblsan0:amd64 14.2.0-4ubuntu2~24.04 amd64 LeakSanitizer -- a memory leak detector (runtime)
ii libluajit-5.1-2:amd64 2.1.0+git20231223.c525bcb+dfsg-1 amd64 Just in time compiler for Lua - library version
ii libluajit-5.1-common 2.1.0+git20231223.c525bcb+dfsg-1 all Just in time compiler for Lua - common files
ii liblz4-1:amd64 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - runtime
ii liblzma5:amd64 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression library
ii liblzo2-2:amd64 2.10-2build4 amd64 data compression library
ii libmagic-mgc 1:5.45-3build1 amd64 File type determination library using "magic" numbers (compiled magic file)
ii libmagic1t64:amd64 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers - library
ii libmd0:amd64 1.1.0-2build1.1 amd64 message digest functions from BSD systems - shared library
ii libmount1:amd64 2.39.3-9ubuntu6.3 amd64 device mounting library
ii libmpc3:amd64 1.3.1-1build1.1 amd64 multiple precision complex floating-point library
ii libmpfr6:amd64 4.2.1-1build1.1 amd64 multiple precision floating-point computation
ii libmsgpackc2:amd64 4.0.0-3build1 amd64 binary-based efficient object serialization library
ii libmspack0t64:amd64 0.11-1.1build1 amd64 library for Microsoft compression formats (shared library)
ii libncurses6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling
ii libncursesw6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling (wide character support)
ii libnettle8t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (symmetric and one-way cryptos)
ii libnghttp2-14:amd64 1.59.0-1ubuntu0.2 amd64 library implementing HTTP/2 protocol (shared library)
ii libnl-3-200:amd64 3.7.0-0.3build1.1 amd64 library for dealing with netlink sockets
ii libnl-genl-3-200:amd64 3.7.0-0.3build1.1 amd64 library for dealing with netlink sockets - generic netlink
ii libnpth0t64:amd64 1.6-3.1build1 amd64 replacement for GNU Pth using system threads
ii libonig5:amd64 6.9.9-1build1 amd64 regular expressions library
ii libp11-kit0:amd64 0.25.3-4ubuntu2.1 amd64 library for loading and coordinating access to PKCS#11 modules - runtime
ii libpam-modules-bin 1.5.3-5ubuntu5.4 amd64 Pluggable Authentication Modules for PAM - helper binaries
ii libpam-modules:amd64 1.5.3-5ubuntu5.4 amd64 Pluggable Authentication Modules for PAM
ii libpam-runtime 1.5.3-5ubuntu5.4 all Runtime support for the PAM library
ii libpam0g:amd64 1.5.3-5ubuntu5.4 amd64 Pluggable Authentication Modules library
ii libpcre2-32-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library - 32 bit runtime files
ii libpcre2-8-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library- 8 bit runtime files
ii libperl5.38t64:amd64 5.38.2-3.2ubuntu0.1 amd64 shared Perl library
ii libpipeline1:amd64 1.5.7-2 amd64 Unix process pipeline manipulation library
ii libpopt0:amd64 1.19+dfsg-1build1 amd64 lib for parsing cmdline parameters
ii libproc2-0:amd64 2:4.0.4-4ubuntu3.2 amd64 library for accessing process information from /proc
ii libpsl5t64:amd64 0.21.2-1.1build1 amd64 Library for Public Suffix List (shared libraries)
ii libpython2.7-minimal:amd64 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7)
ii libpython3-stdlib:amd64 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii libpython3.12-minimal:amd64 3.12.3-1ubuntu0.7 amd64 Minimal subset of the Python language (version 3.12)
ii libpython3.12-stdlib:amd64 3.12.3-1ubuntu0.7 amd64 Interactive high-level object-oriented language (standard library, version 3.12)
ii libpython3.12t64:amd64 3.12.3-1ubuntu0.7 amd64 Shared Python runtime library (version 3.12)
ii libquadmath0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library
ii libreadline8t64:amd64 8.2-4build1 amd64 GNU readline and history libraries, run-time libraries
ii librhash0:amd64 1.4.3-3build1 amd64 shared library for hash functions computing
ii librtmp1:amd64 2.4+20151223.gitfa8646d.1-2build7 amd64 toolkit for RTMP streams (shared library)
ii libsasl2-2:amd64 2.1.28+dfsg1-5ubuntu3.1 amd64 Cyrus SASL - authentication abstraction library
ii libsasl2-modules-db:amd64 2.1.28+dfsg1-5ubuntu3.1 amd64 Cyrus SASL - pluggable authentication modules (DB)
ii libseccomp2:amd64 2.5.5-1ubuntu3.1 amd64 high level interface to Linux seccomp filter
ii libselinux1:amd64 3.5-2ubuntu2.1 amd64 SELinux runtime shared libraries
ii libsemanage-common 3.5-1build5 all Common files for SELinux policy management libraries
ii libsemanage2:amd64 3.5-1build5 amd64 SELinux policy management library
ii libsensors-config 1:3.6.0-9build1 all lm-sensors configuration files
ii libsensors5:amd64 1:3.6.0-9build1 amd64 library to read temperature/voltage/fan sensors
ii libsepol2:amd64 3.5-2build1 amd64 SELinux library for manipulating binary security policies
ii libsframe1:amd64 2.42-4ubuntu2.5 amd64 Library to handle the SFrame format (runtime library)
ii libsigsegv2:amd64 2.14-1ubuntu2 amd64 Library for handling page faults in a portable way
ii libsmartcols1:amd64 2.39.3-9ubuntu6.3 amd64 smart column output alignment library
ii libsource-highlight-common 3.1.9-4.3build1 all architecture-independent files for source highlighting library
ii libsource-highlight4t64:amd64 3.1.9-4.3build1 amd64 source highlighting library
ii libsqlite3-0:amd64 3.45.1-1ubuntu2.3 amd64 SQLite 3 shared library
ii libss2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 command-line interface parsing library
ii libssh-4:amd64 0.10.6-2ubuntu0.1 amd64 tiny C SSH library (OpenSSL flavor)
ii libssh2-1t64:amd64 1.11.0-4.1build2 amd64 SSH2 client-side library
ii libssl3t64:amd64 3.0.13-0ubuntu3.5 amd64 Secure Sockets Layer toolkit - shared libraries
ii libstdc++-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii libstdc++6:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3
ii libsystemd0:amd64 255.4-1ubuntu8.10 amd64 systemd utility library
ii libtalloc2:amd64 2.4.2-1build2 amd64 hierarchical pool based memory allocator
ii libtasn1-6:amd64 4.19.0-3ubuntu0.24.04.1 amd64 Manage ASN.1 structures (runtime)
ii libtermkey1:amd64 0.22-1 amd64 library for processing keyboard input
ii libtime-duration-perl 1.21-2 all module for rounded or exact English expression of durations
ii libtimedate-perl 2.3300-2 all collection of modules to manipulate date/time information
ii libtinfo6:amd64 6.4+20240113-1ubuntu2 amd64 shared low-level terminfo library for terminal handling
ii libtree-sitter0:amd64 0.20.8-2 amd64 incremental parsing system for programming tools
ii libtsan2:amd64 14.2.0-4ubuntu2~24.04 amd64 ThreadSanitizer -- a Valgrind-based detector of data races (runtime)
ii libubsan1:amd64 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (runtime)
ii libuchardet0:amd64 0.0.8-1build1 amd64 universal charset detection library - shared library
ii libudev1:amd64 255.4-1ubuntu8.10 amd64 libudev shared library
ii libunibilium4:amd64 2.1.0-3 amd64 simple, self-contained terminfo library
ii libunistring5:amd64 1.1-2build1.1 amd64 Unicode string library for C
ii libunwind8:amd64 1.6.2-3build1.1 amd64 library to determine the call-chain of a program - runtime
ii liburing2:amd64 2.5-1build1 amd64 Linux kernel io_uring access library - shared library
ii libutempter0:amd64 1.2.1-3build1 amd64 privileged helper for utmp/wtmp updates (runtime)
ii libuuid1:amd64 2.39.3-9ubuntu6.3 amd64 Universally Unique ID library
ii libuv1t64:amd64 1.48.0-1.1build1 amd64 asynchronous event notification library - runtime library
ii libvterm0:amd64 0.3.3-2build1 amd64 abstract terminal library
ii libwrap0:amd64 7.6.q-33 amd64 Wietse Venema's TCP wrappers library
ii libx11-6:amd64 2:1.8.7-1build1 amd64 X11 client-side library
ii libx11-data 2:1.8.7-1build1 all X11 client-side library
ii libx32asan8 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector (x32)
ii libx32atomic1 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions (x32)
ii libx32gcc-13-dev 13.3.0-6ubuntu2~24.04 amd64 GCC support library (x32 development files)
ii libx32gcc-s1 14.2.0-4ubuntu2~24.04 amd64 GCC support library (x32)
ii libx32gomp1 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library (x32)
ii libx32itm1 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library (x32)
ii libx32quadmath0 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library (x32)
ii libx32stdc++-13-dev 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii libx32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (x32)
ii libx32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (x32)
ii libxau6:amd64 1:1.0.9-1build6 amd64 X11 authorisation library
ii libxcb1:amd64 1.15-1ubuntu2 amd64 X C Binding
ii libxdmcp6:amd64 1:1.1.3-0ubuntu6 amd64 X11 Display Manager Control Protocol library
ii libxml2:amd64 2.9.14+dfsg-1.3ubuntu3.3 amd64 GNOME XML library
ii libxxhash0:amd64 0.8.2-2build1 amd64 shared library for xxhash
ii libyaml-0-2:amd64 0.2.5-1build1 amd64 Fast YAML 1.1 parser and emitter library
ii libzstd-dev:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- development files
ii libzstd1:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm
ii linux-libc-dev:amd64 6.8.0-64.67 amd64 Linux Kernel Headers for development
ii login 1:4.13+dfsg1-4ubuntu3.2 amd64 system login tools
ii logsave 1.47.0-2.4~exp1ubuntu4.1 amd64 save the output of a command in a log file
ii lsb-release 12.0-2 all Linux Standard Base version reporting utility (minimal implementation)
ii lsd 1.0.0-2 amd64 ls command with a lot of pretty colors and some other stuff
ii lua-luv:amd64 1.48.0-2-2build1 amd64 libuv bindings for Lua
ii lz4 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - tool
ii lzip 1.24.1-1build1 amd64 lossless data compressor based on the LZMA algorithm
ii lzop 1.04-2build3 amd64 fast compression program
ii make 4.3-4.1build2 amd64 utility for directing compilation
ii man-db 2.12.0-4build2 amd64 tools for reading manual pages
ii mawk 1.3.4.20240123-1build1 amd64 Pattern scanning and text processing language
ii media-types 10.1.0 all List of standard media types and their usual file extension
ii minify 2.20.17-1 amd64 CLI implementation of the Go minify library package
ii mksh 59c-37 amd64 MirBSD Korn Shell
ii moreutils 0.69-1 amd64 additional Unix utilities
ii mount 2.39.3-9ubuntu6.3 amd64 tools for mounting and manipulating filesystems
ii musl:amd64 1.2.4-2 amd64 standard C library
ii ncurses-base 6.4+20240113-1ubuntu2 all basic terminal type definitions
ii ncurses-bin 6.4+20240113-1ubuntu2 amd64 terminal-related programs and man pages
ii ncurses-term 6.4+20240113-1ubuntu2 all additional terminal type definitions
ii neovim 0.9.5-6ubuntu2 amd64 heavily refactored vim fork
ii neovim-runtime 0.9.5-6ubuntu2 all heavily refactored vim fork (runtime files)
ii netbase 6.4 all Basic TCP/IP networking system
ii ninja-build 1.11.1-2 amd64 small build system closest in spirit to Make
ii openssl 3.0.13-0ubuntu3.5 amd64 Secure Sockets Layer toolkit - cryptographic utility
ii p7zip 16.02+transitional.1 all transitional package
ii parallel 20231122+ds-1 all build and execute command lines from standard input in parallel
ii passwd 1:4.13+dfsg1-4ubuntu3.2 amd64 change and administer password and group data
ii patch 2.7.6-7build3 amd64 Apply a diff file to an original
ii patchelf 0.18.0-1.1build1 amd64 modify properties of ELF executables
ii patchutils 0.4.2-1build3 amd64 Utilities to work with patches
ii pax-utils 1.3.7-1 amd64 Security-focused ELF files checking tool
ii perl 5.38.2-3.2ubuntu0.1 amd64 Larry Wall's Practical Extraction and Report Language
ii perl-base 5.38.2-3.2ubuntu0.1 amd64 minimal Perl system
ii perl-modules-5.38 5.38.2-3.2ubuntu0.1 all Core Perl modules
ii procps 2:4.0.4-4ubuntu3.2 amd64 /proc file system utilities
ii proot 5.1.0-1.3 amd64 emulate chroot, bind mount and binfmt_misc for non-root users
ii python2.7-minimal 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7)
ii python3 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii python3-argcomplete 3.1.4-1ubuntu0.1 all bash tab completion for argparse (for Python 3)
ii python3-minimal 3.12.3-0ubuntu2 amd64 minimal subset of the Python language (default python3 version)
ii python3-pyasn1 0.4.8-4 all ASN.1 library for Python (Python 3 module)
ii python3-pycryptodome 3.20.0+dfsg-1 amd64 cryptographic Python library (Python 3)
ii python3-pycurl 7.45.3-1build2 amd64 Python bindings to libcurl (Python 3)
ii python3-pyelftools 0.30-1 all pure-python3 library for parsing ELF and DWARF
ii python3-toml 0.10.2-1 all library for Tom's Obvious, Minimal Language - Python 3.x
ii python3-tomli 2.0.1-2 all lil' TOML parser for Python
ii python3-tomli-w 1.0.0-2 all lil' TOML writer for Python
ii python3-xmltodict 0.13.0-1 all Makes working with XML feel like you are working with JSON (Python 3)
ii python3-yaml 6.0.1-2build2 amd64 YAML parser and emitter for Python3
ii python3-zstd 1.5.5.1-1build1 amd64 python bindings to Yann Collet ZSTD compression library
ii python3.12 3.12.3-1ubuntu0.7 amd64 Interactive high-level object-oriented language (version 3.12)
ii python3.12-minimal 3.12.3-1ubuntu0.7 amd64 Minimal subset of the Python language (version 3.12)
ii re2c 3.1-1build1 amd64 lexer generator for C, C++, Go and Rust
ii readline-common 8.2-4build1 all GNU readline and history libraries, common files
ii ripgrep 14.1.0-1 amd64 Recursively searches directories for a regex pattern
ii rpcsvc-proto 1.4.2-0ubuntu7 amd64 RPC protocol compiler and definitions
ii rsync 3.2.7-1ubuntu1.2 amd64 fast, versatile, remote (and local) file-copying tool
ii screen 4.9.1-1build1 amd64 terminal multiplexer with VT100/ANSI terminal emulation
ii sed 4.9-2build1 amd64 GNU stream editor for filtering/transforming text
ii sensible-utils 0.0.22 all Utilities for sensible alternative selection
ii socat 1.8.0.0-4build3 amd64 multipurpose relay for bidirectional data transfer
ii strace 6.8-0ubuntu2 amd64 System call tracer
ii sudo 1.9.15p5-3ubuntu5.24.04.1 amd64 Provide limited super user privileges to specific users
ii sysstat 12.6.1-2 amd64 system performance tools for Linux
ii sysvinit-utils 3.08-6ubuntu3 amd64 System-V-like utilities
ii tar 1.35+dfsg-3build1 amd64 GNU version of the tar archiving utility
ii time 1.9-0.2build1 amd64 GNU time program for measuring CPU resource usage
ii tzdata 2025b-0ubuntu0.24.04.1 all time zone and daylight-saving time data
ii ubuntu-keyring 2023.11.28.1 all GnuPG keys of the Ubuntu archive
ii ucf 3.0043+nmu1 all Update Configuration File(s): preserve user changes to config files
ii universal-ctags 5.9.20210829.0-1 amd64 build tag file indexes of source code definitions
ii unzip 6.0-28ubuntu4.1 amd64 De-archiver for .zip files
ii util-linux 2.39.3-9ubuntu6.3 amd64 miscellaneous system utilities
ii valgrind 1:3.22.0-0ubuntu3 amd64 instrumentation framework for building dynamic analysis tools
ii wget 1.21.4-1ubuntu4.1 amd64 retrieves files from the web
ii xz-utils 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression utilities
ii yash 2.55-2 amd64 yet another shell
ii yq 3.1.0-3 all Command-line YAML processor - jq wrapper for YAML documents
ii zip 3.0-13ubuntu0.2 amd64 Archiver for .zip files
ii zlib1g-dev:amd64 1:1.3.dfsg-3.1ubuntu2.1 amd64 compression library - development
ii zlib1g:amd64 1:1.3.dfsg-3.1ubuntu2.1 amd64 compression library - runtime
ii zlib1g:i386 1:1.3.dfsg-3.1ubuntu2.1 i386 compression library - runtime
ii zoxide 0.9.3-1 amd64 Smarter cd command for your terminal
ii zsh 5.9-6ubuntu2 amd64 shell with lots of features
ii zsh-common 5.9-6ubuntu2 all architecture independent files for Zsh
ii zstd 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- CLI tool
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
||/ Name Version Architecture Description
Packages sorted by Installed-Size:
1156978 ===== TOTAL (390 packages)
1023146 ===== TOTAL (372 packages)
76943 valgrind amd64
61804 gcc-13-riscv64-linux-gnu amd64
61333 gcc-13-x86-64-linux-gnu amd64
44381 gh amd64
36493 cmake amd64
35919 libicu74 amd64
33545 g++-13-x86-64-linux-gnu amd64
30811 cpp-13-x86-64-linux-gnu amd64
29774 cpp-13-riscv64-linux-gnu amd64
29333 libperl5.38t64 amd64
29327 libperl5.38t64 amd64
21815 neovim-runtime all
21692 git amd64
21662 libstdc++-13-dev amd64
19159 perl-modules-5.38 all
18028 libgcc-13-dev-riscv64-cross all
16248 zsh-common all
16082 libgcc-13-dev amd64
13431 libc6 amd64
@@ -437,25 +401,23 @@ Packages sorted by Installed-Size:
12004 libc6-x32 amd64
11989 libc6-i386 amd64
11549 binutils-x86-64-linux-gnu amd64
11179 libc6-dbg amd64
11172 libc6-dbg amd64
10984 cmake-data all
10791 libasan8 amd64
9704 libx32asan8 amd64
9539 lib32asan8 amd64
9420 binutils-riscv64-linux-gnu amd64
9023 libpython3.12-stdlib amd64
9022 libpython3.12-stdlib amd64
8924 libpython3.12t64 amd64
8902 libtsan2 amd64
8335 libmagic-mgc amd64
8296 lib32gcc-13-dev amd64
8119 libc6-dev-x32 amd64
7927 python3.12-minimal amd64
7926 python3.12-minimal amd64
7913 perl-base amd64
7531 libx32gcc-13-dev amd64
7493 linux-libc-dev amd64
7460 linux-libc-dev amd64
7226 lib32stdc++-13-dev amd64
7059 libx32stdc++-13-dev amd64
7025 linux-libc-dev-riscv64-cross all
7024 direnv amd64
6947 libc6-dev-i386 amd64
6944 coreutils amd64
@@ -465,7 +427,7 @@ Packages sorted by Installed-Size:
6158 7zip amd64
5219 bat amd64
5210 ripgrep amd64
5181 libpython3.12-minimal amd64
5180 libpython3.12-minimal amd64
4897 libhwasan0 amd64
4341 ncurses-term all
4244 minify amd64
@@ -489,7 +451,6 @@ Packages sorted by Installed-Size:
3364 libubsan1 amd64
3249 libapt-pkg6.0t64 amd64
3181 libx32ubsan1 amd64
3181 libstdc++6-riscv64-cross all
3111 ksh93u+m amd64
3110 libstdc++6 amd64
3104 lib32ubsan1 amd64
@@ -499,7 +460,6 @@ Packages sorted by Installed-Size:
2894 lib32stdc++6 amd64
2810 libx32stdc++6 amd64
2785 libpython2.7-minimal amd64
2642 libasan8-riscv64-cross all
2431 zsh amd64
2419 passwd amd64
2352 libgnutls30t64 amd64
@@ -551,7 +511,6 @@ Packages sorted by Installed-Size:
905 libarchive13t64 amd64
884 login amd64
852 busybox amd64
851 libubsan1-riscv64-cross all
843 libbrotli1 amd64
812 lua-luv amd64
785 musl amd64
@@ -560,7 +519,7 @@ Packages sorted by Installed-Size:
761 libzstd1 amd64
751 libsepol2 amd64
745 libsource-highlight4t64 amd64
737 python3.12 amd64
736 python3.12 amd64
732 xz-utils amd64
708 tar amd64
672 perl amd64
@@ -601,7 +560,6 @@ Packages sorted by Installed-Size:
375 unzip amd64
373 libgomp1 amd64
367 libmount1 amd64
362 libgomp1-riscv64-cross all
358 libjq1 amd64
357 bfs amd64
355 ninja-build amd64
@@ -681,7 +639,6 @@ Packages sorted by Installed-Size:
151 libaudit1 amd64
150 python3-argcomplete all
149 libmpc3 amd64
149 libitm1-riscv64-cross all
148 libsasl2-2 amd64
148 libcc1-0 amd64
143 libyaml-0-2 amd64
@@ -689,7 +646,6 @@ Packages sorted by Installed-Size:
137 librtmp1 amd64
136 libhiredis1.1.0 amd64
133 libkrb5support0 amd64
133 libgcc-s1-riscv64-cross all
131 libipt2 amd64
130 init-system-helpers all
130 bubblewrap amd64
@@ -701,7 +657,6 @@ Packages sorted by Installed-Size:
120 libpopt0 amd64
115 libitm1 amd64
115 libapparmor1 amd64
113 gcc-13-riscv64-linux-gnu-base amd64
113 gcc-13-base amd64
112 jq amd64
112 gcc-14-base i386
@@ -712,9 +667,7 @@ Packages sorted by Installed-Size:
107 sysvinit-utils amd64
107 libwrap0 amd64
106 libc-dev-bin amd64
106 gcc-13-cross-base all
105 lib32itm1 amd64
105 gcc-14-cross-base all
103 libio-pty-perl amd64
100 libassuan0 amd64
99 libpsl5t64 amd64
@@ -761,9 +714,9 @@ Packages sorted by Installed-Size:
51 logsave amd64
51 libutempter0 amd64
51 libdebuginfod-common all
49 python3-xmltodict all
49 libatomic1 amd64
48 libmsgpackc2 amd64
47 python3-xmltodict all
47 libx32atomic1 amd64
47 libsigsegv2 amd64
46 hostname amd64
@@ -771,7 +724,6 @@ Packages sorted by Installed-Size:
42 libnpth0t64 amd64
41 libxdmcp6 amd64
41 libkeyutils1 amd64
40 libatomic1-riscv64-cross all
39 lib32atomic1 amd64
38 libdebconfclient0 amd64
37 gcc amd64
@@ -788,17 +740,14 @@ Packages sorted by Installed-Size:
26 libsemanage-common all
25 libsensors-config all
25 gcc-x86-64-linux-gnu amd64
25 gcc-riscv64-linux-gnu amd64
20 cpp-x86-64-linux-gnu amd64
20 cpp-riscv64-linux-gnu amd64
17 lsb-release all
17 libaudit-common all
16 unminimize amd64
13 g++ amd64
11 g++-x86-64-linux-gnu amd64
11 cpp-13 amd64
8 p7zip all
8 gcc-multilib amd64
6 gcc-13-multilib amd64
6 g++-multilib amd64
6 g++-13-multilib amd64
0 libc6-riscv64-cross all
0 libc6-dev-riscv64-cross all
-1
View File
@@ -48,7 +48,6 @@ run_upx=( "${emu[@]}" "$upx_exe" )
echo "run_upx='${run_upx[*]}'"
# run_upx sanity check
"${run_upx[@]}" --version-short || true
if ! "${run_upx[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
-6
View File
@@ -9,12 +9,6 @@
Memcheck:Cond
fun:enframe
}
{
musl-malloc-get_nominal_size
Memcheck:Cond
fun:get_nominal_size
fun:__libc_free
}
# these are only needed for older musl versions
+3 -19
View File
@@ -295,15 +295,13 @@ forceinline constexpr upx_uint64_t no_bswap64(upx_uint64_t v) noexcept { return
#define ne16_to_le16(v) bswap16(v)
#define ne32_to_le32(v) bswap32(v)
#define ne64_to_le64(v) bswap64(v)
#elif (ACC_ABI_LITTLE_ENDIAN)
#else
#define ne16_to_be16(v) bswap16(v)
#define ne32_to_be32(v) bswap32(v)
#define ne64_to_be64(v) bswap64(v)
#define ne16_to_le16(v) no_bswap16(v)
#define ne32_to_le32(v) no_bswap32(v)
#define ne64_to_le64(v) no_bswap64(v)
#else
#error "ACC_ABI_ENDIAN"
#endif
/*************************************************************************
@@ -362,12 +360,8 @@ inline constexpr unsigned get_be24(const byte *p) noexcept {
inline constexpr unsigned get_le24(const byte *p) noexcept {
return upx::compile_time::get_le24(p);
}
inline constexpr unsigned get_ne24(const byte *p) noexcept {
return upx::compile_time::get_ne24(p);
}
inline constexpr void set_be24(byte *p, unsigned v) noexcept { upx::compile_time::set_be24(p, v); }
inline constexpr void set_le24(byte *p, unsigned v) noexcept { upx::compile_time::set_le24(p, v); }
inline constexpr void set_ne24(byte *p, unsigned v) noexcept { upx::compile_time::set_ne24(p, v); }
REQUIRE_XE24
forceinline bele_constexpr unsigned get_be24(const XE24 *p) noexcept {
@@ -378,10 +372,6 @@ forceinline bele_constexpr unsigned get_le24(const XE24 *p) noexcept {
return get_le24(upx::ptr_static_cast<const byte *>(p));
}
REQUIRE_XE24
forceinline bele_constexpr unsigned get_ne24(const XE24 *p) noexcept {
return get_ne24(upx::ptr_static_cast<const byte *>(p));
}
REQUIRE_XE24
forceinline bele_constexpr void set_be24(XE24 *p, unsigned v) noexcept {
set_be24(upx::ptr_static_cast<byte *>(p), v);
}
@@ -389,10 +379,6 @@ REQUIRE_XE24
forceinline bele_constexpr void set_le24(XE24 *p, unsigned v) noexcept {
set_le24(upx::ptr_static_cast<byte *>(p), v);
}
REQUIRE_XE24
forceinline bele_constexpr void set_ne24(XE24 *p, unsigned v) noexcept {
set_ne24(upx::ptr_static_cast<byte *>(p), v);
}
REQUIRE_XE32
inline bele_constexpr unsigned get_le26(const XE32 *p) noexcept { return get_le32(p) & 0x03ffffff; }
@@ -1099,7 +1085,7 @@ TT_UPX_IS_INTEGRAL(LE32);
TT_UPX_IS_INTEGRAL(LE64);
#undef TT_UPX_IS_INTEGRAL
// NE - Native Endianness (aka Host Endianness aka CPU Endianness)
// native types
#if (ACC_ABI_BIG_ENDIAN)
typedef BE16 NE16;
typedef BE32 NE32;
@@ -1110,7 +1096,7 @@ typedef BE64 NE64;
#define ne16_compare_signed be16_compare_signed
#define ne32_compare_signed be32_compare_signed
#define ne64_compare_signed be64_compare_signed
#elif (ACC_ABI_LITTLE_ENDIAN)
#else
typedef LE16 NE16;
typedef LE32 NE32;
typedef LE64 NE64;
@@ -1120,8 +1106,6 @@ typedef LE64 NE64;
#define ne16_compare_signed le16_compare_signed
#define ne32_compare_signed le32_compare_signed
#define ne64_compare_signed le64_compare_signed
#else
#error "ACC_ABI_ENDIAN"
#endif
/*************************************************************************
+3 -3
View File
@@ -135,7 +135,7 @@ struct BEPolicy final
S u32_compare_signed(const void *a, const void *b) C { return be32_compare_signed(a, b); }
S u64_compare_signed(const void *a, const void *b) C { return be64_compare_signed(a, b); }
static void compileTimeAssertions() noexcept {
static void compileTimeAssertions() {
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
COMPILE_TIME_ASSERT(sizeof(U32) == 4)
COMPILE_TIME_ASSERT(sizeof(U64) == 8)
@@ -194,7 +194,7 @@ struct LEPolicy final
S u32_compare_signed(const void *a, const void *b) C { return le32_compare_signed(a, b); }
S u64_compare_signed(const void *a, const void *b) C { return le64_compare_signed(a, b); }
static void compileTimeAssertions() noexcept {
static void compileTimeAssertions() {
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
COMPILE_TIME_ASSERT(sizeof(U32) == 4)
COMPILE_TIME_ASSERT(sizeof(U64) == 8)
@@ -210,7 +210,7 @@ private:
UPX_CXX_DISABLE_NEW_DELETE(LEPolicy)
};
// NE - Native Endianness policy (aka Host Policy)
// Native Endianness policy (aka Host Policy)
#if (ACC_ABI_BIG_ENDIAN)
typedef BEPolicy NEPolicy;
typedef BEPolicy HostPolicy;
+3 -8
View File
@@ -262,7 +262,7 @@ ASSERT_SAME_TYPE(short, upx_int16_t);
ASSERT_SAME_TYPE(unsigned short, upx_uint16_t);
ASSERT_SAME_TYPE(int, upx_int32_t);
ASSERT_SAME_TYPE(unsigned, upx_uint32_t);
#if (__SIZEOF_LONG_LONG__ + 0 < 16)
#if (__SIZEOF_LONG_LONG__ + 0 < 128)
ASSERT_SAME_TYPE(long long, upx_int64_t);
ASSERT_SAME_TYPE(unsigned long long, upx_uint64_t);
#endif
@@ -1104,11 +1104,11 @@ void upx_compiler_sanity_check(void) noexcept {
alignas(16) static constexpr const byte dd[32] = {
0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0,
0, 0, 0, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0, 0, 0, 0, 0};
constexpr const byte *d = dd + 7;
#if !defined(upx_fake_alignas_16)
assert_noexcept(ptr_is_aligned<16>(dd));
assert_noexcept(ptr_is_aligned(dd, 16));
#endif
constexpr const byte *d = dd + 7;
static_assert(upx::compile_time::get_be16(d) == 0xfffe);
static_assert(upx::compile_time::get_be24(d) == 0xfffefd);
static_assert(upx::compile_time::get_be32(d) == 0xfffefdfc);
@@ -1292,9 +1292,6 @@ void upx_compiler_sanity_check(void) noexcept {
assert_noexcept(testNoAliasing(&u.v_int, &u.v_llong));
assert_noexcept(testNoAliasing(&u.v_long, &u.v_llong));
#if 1 && (ACC_CC_MSC) && (defined(_M_ARM64) || defined(_M_ARM64EC))
// @COMPILER_BUG @MSVC_BUG
#else
assert_noexcept(TestIntegerWrap<unsigned>::inc_gt(0));
assert_noexcept(!TestIntegerWrap<unsigned>::inc_gt(UINT_MAX));
assert_noexcept(TestIntegerWrap<unsigned>::dec_lt(1));
@@ -1311,7 +1308,6 @@ void upx_compiler_sanity_check(void) noexcept {
assert_noexcept(!TestIntegerWrap<int>::neg_eq(1));
assert_noexcept(!TestIntegerWrap<int>::neg_eq(INT_MAX));
assert_noexcept(TestIntegerWrap<int>::neg_eq(INT_MIN)); // special case
#endif
}
/*************************************************************************
@@ -1467,8 +1463,7 @@ TEST_CASE("libc qsort") {
return true;
}
};
constexpr size_t N = 256;
constexpr size_t N = 4096;
Elem e[N];
for (size_t n = 0; n <= N; n = 2 * n + 1) {
// system sort functions
-2
View File
@@ -68,9 +68,7 @@
#endif
#endif
// NOLINTBEGIN(bugprone-unintended-char-ostream-output)
#include <doctest/doctest/parts/doctest.cpp>
// NOLINTEND(bugprone-unintended-char-ostream-output)
#endif // DOCTEST_CONFIG_DISABLE
+6 -189
View File
@@ -101,6 +101,9 @@ TEST_CASE("basic xspan usage") {
CHECK(b0.raw_size_in_bytes() == 0u);
CHECK(bp.raw_size_in_bytes() == 0u);
#endif
CHECK(raw_bytes(b0, 999999) == buf);
CHECK(raw_bytes(bp, 999999) == buf);
CHECK(raw_bytes(c0, 4) == buf);
CHECK(raw_index_bytes(c0, 1, 3) == buf + 1);
CHECK(raw_bytes(cp, 4) == buf);
@@ -177,6 +180,9 @@ TEST_CASE("basic xspan usage") {
CHECK(b0.raw_size_in_bytes() == 0u);
CHECK(bp.raw_size_in_bytes() == 0u);
#endif
CHECK(raw_bytes(b0, 999999) == buf);
CHECK(raw_bytes(bp, 999999) == buf);
CHECK(raw_bytes(c0, 4) == buf);
CHECK(raw_index_bytes(c0, 1, 3) == buf + 1);
CHECK(raw_bytes(cp, 4) == buf);
@@ -870,195 +876,6 @@ TEST_CASE("PtrOrSpan int") {
CHECK(a == buf + 8);
}
/*************************************************************************
//
**************************************************************************/
#ifdef UPX_VERSION_HEX
namespace {
template <class T>
static noinline void check_bele_a(const T &mb, size_t i) {
if (i < 2) {
CHECK_THROWS(get_ne16(mb));
CHECK_THROWS(get_be16(mb));
CHECK_THROWS(get_le16(mb));
CHECK_THROWS(set_ne16(mb, 0));
CHECK_THROWS(set_be16(mb, 0));
CHECK_THROWS(set_le16(mb, 0));
} else {
CHECK_NOTHROW(get_ne16(mb));
CHECK_NOTHROW(get_be16(mb));
CHECK_NOTHROW(get_le16(mb));
CHECK_NOTHROW(set_ne16(mb, 0));
CHECK_NOTHROW(set_be16(mb, 0));
CHECK_NOTHROW(set_le16(mb, 0));
}
if (i < 3) {
CHECK_THROWS(get_ne24(mb));
CHECK_THROWS(get_be24(mb));
CHECK_THROWS(get_le24(mb));
CHECK_THROWS(set_ne24(mb, 0));
CHECK_THROWS(set_be24(mb, 0));
CHECK_THROWS(set_le24(mb, 0));
} else {
CHECK_NOTHROW(get_ne24(mb));
CHECK_NOTHROW(get_be24(mb));
CHECK_NOTHROW(get_le24(mb));
CHECK_NOTHROW(set_ne24(mb, 0));
CHECK_NOTHROW(set_be24(mb, 0));
CHECK_NOTHROW(set_le24(mb, 0));
}
if (i < 4) {
CHECK_THROWS(get_ne32(mb));
CHECK_THROWS(get_be32(mb));
CHECK_THROWS(get_le32(mb));
CHECK_THROWS(set_ne32(mb, 0));
CHECK_THROWS(set_be32(mb, 0));
CHECK_THROWS(set_le32(mb, 0));
} else {
CHECK_NOTHROW(get_ne32(mb));
CHECK_NOTHROW(get_be32(mb));
CHECK_NOTHROW(get_le32(mb));
CHECK_NOTHROW(set_ne32(mb, 0));
CHECK_NOTHROW(set_be32(mb, 0));
CHECK_NOTHROW(set_le32(mb, 0));
}
if (i < 8) {
CHECK_THROWS(get_ne64(mb));
CHECK_THROWS(get_be64(mb));
CHECK_THROWS(get_le64(mb));
CHECK_THROWS(set_ne64(mb, 0));
CHECK_THROWS(set_be64(mb, 0));
CHECK_THROWS(set_le64(mb, 0));
} else {
CHECK_NOTHROW(get_ne64(mb));
CHECK_NOTHROW(get_be64(mb));
CHECK_NOTHROW(get_le64(mb));
CHECK_NOTHROW(set_ne64(mb, 0));
CHECK_NOTHROW(set_be64(mb, 0));
CHECK_NOTHROW(set_le64(mb, 0));
}
}
template <class T>
static noinline void check_bele_c(const T &mb, size_t i) {
if (i < 2) {
CHECK_THROWS(get_ne16(mb));
CHECK_THROWS(get_be16(mb));
CHECK_THROWS(get_le16(mb));
} else {
CHECK_NOTHROW(get_ne16(mb));
CHECK_NOTHROW(get_be16(mb));
CHECK_NOTHROW(get_le16(mb));
}
if (i < 3) {
CHECK_THROWS(get_ne24(mb));
CHECK_THROWS(get_be24(mb));
CHECK_THROWS(get_le24(mb));
} else {
CHECK_NOTHROW(get_ne24(mb));
CHECK_NOTHROW(get_be24(mb));
CHECK_NOTHROW(get_le24(mb));
}
if (i < 4) {
CHECK_THROWS(get_ne32(mb));
CHECK_THROWS(get_be32(mb));
CHECK_THROWS(get_le32(mb));
} else {
CHECK_NOTHROW(get_ne32(mb));
CHECK_NOTHROW(get_be32(mb));
CHECK_NOTHROW(get_le32(mb));
}
if (i < 8) {
CHECK_THROWS(get_ne64(mb));
CHECK_THROWS(get_be64(mb));
CHECK_THROWS(get_le64(mb));
} else {
CHECK_NOTHROW(get_ne64(mb));
CHECK_NOTHROW(get_be64(mb));
CHECK_NOTHROW(get_le64(mb));
}
}
} // namespace
#endif // UPX_VERSION_HEX
TEST_CASE("xspan global overloads") {
byte buf_a[16] = {};
const byte buf_c[16] = {};
for (size_t i = 0; i < 16; i++) {
XSPAN_0_VAR(byte, a0, buf_a, i);
XSPAN_P_VAR(byte, ap, buf_a, i);
XSPAN_S_VAR(byte, as, buf_a, i);
XSPAN_0_VAR(const byte, c0, buf_c, i);
XSPAN_P_VAR(const byte, cp, buf_c, i);
XSPAN_S_VAR(const byte, cs, buf_c, i);
#ifdef UPX_VERSION_HEX
check_bele_a(a0, i);
check_bele_a(ap, i);
check_bele_a(as, i);
check_bele_c(c0, i);
check_bele_c(cp, i);
check_bele_c(cs, i);
CHECK_THROWS(upx_adler32(a0, i + 1));
CHECK_THROWS(upx_adler32(ap, i + 1));
CHECK_THROWS(upx_adler32(as, i + 1));
CHECK_THROWS(upx_adler32(c0, i + 1));
CHECK_THROWS(upx_adler32(cp, i + 1));
CHECK_THROWS(upx_adler32(cs, i + 1));
if (i == 0) {
CHECK_THROWS(upx_safe_strlen(a0));
CHECK_THROWS(upx_safe_strlen(ap));
CHECK_THROWS(upx_safe_strlen(as));
CHECK_THROWS(upx_safe_strlen(c0));
CHECK_THROWS(upx_safe_strlen(cp));
CHECK_THROWS(upx_safe_strlen(cs));
}
#endif
CHECK_THROWS(memchr(a0, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(ap, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(as, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(c0, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(cp, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memchr(cs, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK(memcmp(a0, a0, i) == 0);
CHECK(memcmp(ap, a0, i) == 0);
CHECK(memcmp(as, a0, i) == 0);
CHECK_THROWS(memcmp(a0, a0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(ap, a0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(as, a0, i + 1)); // NOLINT(bugprone-unused-return-value)
CHECK_NOTHROW(memcpy(a0, c0, i));
CHECK_NOTHROW(memcpy(ap, cp, i));
CHECK_NOTHROW(memcpy(as, cs, i));
CHECK_THROWS(memcpy(a0, c0, i + 1));
CHECK_THROWS(memcpy(ap, cp, i + 1));
CHECK_THROWS(memcpy(as, cs, i + 1));
CHECK_NOTHROW(memmove(a0, c0, i));
CHECK_NOTHROW(memmove(ap, cp, i));
CHECK_NOTHROW(memmove(as, cs, i));
CHECK_THROWS(memmove(a0, c0, i + 1));
CHECK_THROWS(memmove(ap, cp, i + 1));
CHECK_THROWS(memmove(as, cs, i + 1));
CHECK_NOTHROW(memset(a0, 255, i));
CHECK_NOTHROW(memset(ap, 255, i));
CHECK_NOTHROW(memset(as, 255, i));
CHECK_THROWS(memset(a0, 254, i + 1));
CHECK_THROWS(memset(ap, 254, i + 1));
CHECK_THROWS(memset(as, 254, i + 1));
}
}
/*************************************************************************
// codegen
**************************************************************************/
+2 -3
View File
@@ -248,9 +248,8 @@ static void __UCL_CDECL my_free(ucl_voidp p) { free(p); }
} // extern "C"
int upx_ucl_init(void) {
#if 1 && (ACC_CC_MSC && ACC_ARCH_I386) && (_MSC_VER >= 1940)
// @COMPILER_BUG @MSVC_BUG
(void) ucl_init();
#if (ACC_CC_MSC && ACC_ARCH_I386) && (_MSC_VER >= 1940)
(void) ucl_init(); // TODO later
#else
if (ucl_init() != UCL_E_OK)
return -1;
+5 -11
View File
@@ -100,7 +100,6 @@ static_assert((char) (-1) == 255); // -funsigned-char
#endif // UPX_CONFIG_DISABLE_WERROR
#endif // UPX_CONFIG_DISABLE_WSTRICT
// upx_is_constant_evaluated
#if __cplusplus >= 202002L // C++20
#define upx_is_constant_evaluated std::is_constant_evaluated
#elif __has_builtin(__builtin_is_constant_evaluated) // clang-9, gcc-10
@@ -120,7 +119,7 @@ static_assert((char) (-1) == 255); // -funsigned-char
#define upx_std_atomic(Type) Type
#define upx_std_once_flag upx_std_atomic(size_t)
template <class NoexceptCallable>
inline void upx_std_call_once(upx_std_once_flag &flag, NoexceptCallable &&f) noexcept {
inline void upx_std_call_once(upx_std_once_flag &flag, NoexceptCallable &&f) {
if (__acc_unlikely(!flag)) {
flag = 1;
f();
@@ -377,7 +376,6 @@ inline void NO_printf(const char *, ...) noexcept {}
inline void NO_fprintf(FILE *, const char *, ...) noexcept attribute_format(2, 3);
inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
// upx_memcmp_inline
#if __has_builtin(__builtin_memcmp)
#define upx_memcmp_inline __builtin_memcmp
#elif defined(__clang__) || defined(__GNUC__)
@@ -385,8 +383,6 @@ inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
#else
#define upx_memcmp_inline memcmp
#endif
// upx_memcpy_inline
#if __has_builtin(__builtin_memcpy_inline) && 0 // TODO later: clang constexpr limitation?
#define upx_memcpy_inline __builtin_memcpy_inline
#elif __has_builtin(__builtin_memcpy)
@@ -397,7 +393,6 @@ inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
#define upx_memcpy_inline memcpy
#endif
// upx_return_address()
#if defined(__wasi__)
#define upx_return_address() nullptr
#elif __has_builtin(__builtin_return_address)
@@ -807,15 +802,14 @@ int upx_doctest_check();
// util/membuffer.h
class MemBuffer;
void *membuffer_get_void_ptr(MemBuffer &mb) noexcept;
const void *membuffer_get_void_ptr(const MemBuffer &mb) noexcept;
unsigned membuffer_get_size_in_bytes(const MemBuffer &mb) noexcept;
unsigned membuffer_get_size(MemBuffer &mb) noexcept;
// main.cpp
extern const char *progname;
bool main_set_exit_code(int ec);
int main_get_options(int argc, char **argv);
void main_get_envoptions();
noinline int upx_main(int argc, char *argv[]) may_throw;
int upx_main(int argc, char *argv[]) may_throw;
// msg.cpp
void printSetNl(int need_nl) noexcept;
@@ -832,8 +826,8 @@ void infoHeader();
void infoWriting(const char *what, upx_int64_t size);
// work.cpp
noinline void do_one_file(const char *iname, char *oname) may_throw;
noinline int do_files(int i, int argc, char *argv[]) may_throw;
void do_one_file(const char *iname, char *oname) may_throw;
int do_files(int i, int argc, char *argv[]) may_throw;
// help.cpp
extern const char gitrev[];
+3 -3
View File
@@ -49,7 +49,7 @@ const char gitrev[] = UPX_VERSION_GITREV;
const char gitrev[1] = {0};
#endif
void show_header() {
void show_header(void) {
FILE *f = con_term;
int fg;
@@ -85,7 +85,7 @@ void show_header() {
// usage
**************************************************************************/
void show_usage() {
void show_usage(void) {
FILE *f = con_term;
con_fprintf(f, "Usage: %s [-123456789dlthVL] [-qvfk] [-o file] %sfile..\n", progname,
@@ -381,7 +381,7 @@ void show_help(int verbose) {
// license
**************************************************************************/
void show_license() {
void show_license(void) {
FILE *f = con_term;
show_header();
+1 -2
View File
@@ -367,8 +367,6 @@ int ElfLinker::addLoader(const char *sname) {
return outputlen;
char *begin = strdup(sname);
assert(begin != nullptr);
const auto begin_deleter = upx::MallocDeleter(&begin, 1); // don't leak memory
char *end = begin + strlen(begin);
for (char *sect = begin; sect < end;) {
for (char *tokend = sect; *tokend; tokend++)
@@ -420,6 +418,7 @@ int ElfLinker::addLoader(const char *sname) {
}
sect += strlen(sect) + 1;
}
::free(begin);
return outputlen;
}
+1 -1
View File
@@ -35,7 +35,7 @@ class ElfLinker /*not_final*/ : private upx::noncopyable {
friend class Packer;
public:
const N_BELE_RTP::AbstractPolicy *const bele; // TE - Target Endianness
const N_BELE_RTP::AbstractPolicy *const bele; // target endianness
protected:
struct Section;
struct Symbol;
+7 -4
View File
@@ -67,9 +67,12 @@ static void handle_opterr(acc_getopt_p g, const char *f, void *v) {
static int exit_code = EXIT_OK;
#if (WITH_GUI)
static noreturn void do_exit() { throw exit_code; }
static noinline void do_exit(void) { throw exit_code; }
#else
static noreturn void do_exit() {
#if defined(__GNUC__)
static void do_exit(void) __attribute__((__noreturn__));
#endif
static void do_exit(void) {
static bool in_exit = false;
if (in_exit)
@@ -112,7 +115,7 @@ static noinline void e_exit(int ec) {
do_exit();
}
static noinline void e_usage() {
static noinline void e_usage(void) {
if (opt->debug.getopt_throw_instead_of_exit)
throw EXIT_USAGE;
show_usage();
@@ -214,7 +217,7 @@ static void check_and_update_options(int i, int argc) {
// misc
**************************************************************************/
static void e_help() {
static void e_help(void) {
show_help(0);
e_exit(EXIT_USAGE);
}
+1 -3
View File
@@ -108,8 +108,7 @@ class Dummy {
/* Register usage information. */ //
// PT_MIPS_RTPROC = 0x70000001, /* Runtime procedure table. */
// PT_MIPS_OPTIONS = 0x70000002,
PT_ARM_EXIDX = (0x70000000 + 1), /* ARM unwind segment. */
PT_MIPS_ABIFLAGS = 0x70000003, /* FP mode requirement. */
PT_MIPS_ABIFLAGS = 0x70000003, /* FP mode requirement. */
};
enum { // p_flags
@@ -149,7 +148,6 @@ class Dummy {
SHT_LOOS = 0x60000000, /* LOcal OS; SHT_ANDROID_REL{,A} is +1, +2 */
SHT_LOPROC = 0x70000000, /* Start of processor-specific */
SHT_ARM_EXIDX = (SHT_LOPROC + 1), /* ARM unwind section. */
SHT_ARM_ATTRIBUTES = (SHT_LOPROC + 3), /* ARM attributes section. */
};
+57 -72
View File
@@ -487,17 +487,17 @@ PackLinuxElf32::slide_sh_offset(Elf32_Shdr *shdr)
{
unsigned sh_offset = get_te32(&shdr->sh_offset);
unsigned sh_addr = get_te32(&shdr->sh_addr);
char const *sh_name = get_te32(&shdr->sh_name) + shstrtab;
(void)sh_name; // convenience for debug
if (Elf32_Shdr::SHF_WRITE & get_te32(&shdr->sh_flags)
|| (sh_offset && !sh_addr))
{
unsigned newoff = so_slide + sh_offset + (is_asl ? asl_delta : 0);
if (sh_addr // only check "real memory"
&& (unsigned)this->file_size < newoff) {
if ((unsigned)this->file_size < newoff) {
throwInternalError("bad slide %p %#x", shdr, (unsigned)so_slide);
}
set_te32(&shdr->sh_offset, newoff);
if (sh_addr) // change only if non-zero
set_te32(&shdr->sh_addr,
so_slide + sh_addr + (is_asl ? asl_delta : 0));
return newoff;
}
return sh_offset;
@@ -520,17 +520,17 @@ PackLinuxElf64::slide_sh_offset(Elf64_Shdr *shdr)
{
unsigned sh_offset = get_te64(&shdr->sh_offset);
unsigned sh_addr = get_te64(&shdr->sh_addr);
char const *sh_name = get_te32(&shdr->sh_name) + shstrtab;
(void)sh_name; // convenience for debug
if (Elf64_Shdr::SHF_WRITE & get_te64(&shdr->sh_flags)
|| (sh_offset && !sh_addr))
{
unsigned newoff = so_slide + sh_offset + (is_asl ? asl_delta : 0);
if (sh_addr // only check "real memory"
&& (unsigned)this->file_size < newoff) {
if ((unsigned)this->file_size < newoff) {
throwInternalError("bad slide %p %#x", shdr, (unsigned)so_slide);
}
set_te64(&shdr->sh_offset, newoff);
if (sh_addr) // change only if non-zero
set_te64(&shdr->sh_addr,
so_slide + sh_addr + (is_asl ? asl_delta : 0));
return newoff;
}
return sh_offset;
@@ -641,18 +641,25 @@ off_t PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
Elf32_Phdr *const phdr0 = (Elf32_Phdr *)lowmem.subref(
"bad e_phoff", e_phoff, e_phnum * sizeof(Elf32_Phdr));
Elf32_Phdr *phdr = phdr0, *outp = phdr0;
Elf32_Phdr *phdr = phdr0;
upx_off_t off = fo->st_size(); // 64 bits
so_slide = 0;
for (unsigned j = 0; j < e_phnum; ++j, ++phdr) {
// p_vaddr and p_paddr do not change!
unsigned const len = get_te32(&phdr->p_filesz);
unsigned const ioff = get_te32(&phdri[j].p_offset); // without asl_delta
unsigned align= get_te32(&phdr->p_align);
unsigned const type = get_te32(&phdr->p_type);
unsigned const len = get_te32(&phdr->p_filesz);
if (Elf32_Phdr::PT_INTERP==type
|| Elf32_Phdr::PT_ARM_EXIDX==type) {
/* OMIT */ continue; // OMIT: reference to compressed data
if (Elf32_Phdr::PT_INTERP==type) {
// Rotate to highest position, so it can be lopped
// by decrementing e_phnum.
memcpy((unsigned char *)ibuf, phdr, sizeof(*phdr)); // extract
memmove(phdr, 1+phdr, (e_phnum - (1+ j))*sizeof(*phdr)); // overlapping
memcpy(&phdr[e_phnum - (1+ j)], (unsigned char *)ibuf, sizeof(*phdr)); // to top
--phdr; --e_phnum;
set_te16(&ehdri.e_phnum, e_phnum);
set_te16(&((Elf32_Ehdr *)(unsigned char *)lowmem)->e_phnum, e_phnum);
continue;
}
if (PT_LOAD == type) {
if (!ioff) { // first PT_LOAD must contain everything written so far
@@ -700,21 +707,12 @@ off_t PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
fo->seek(0, SEEK_END);
}
}
continue; // all done with this PT_LOAD
}
else if (Elf32_Phdr::PT_DYNAMIC == type
|| Elf32_Phdr::PT_GNU_RELRO == type) {
unsigned delta = so_slide + (is_asl ? asl_delta : 0);
set_te32(&phdr->p_offset, delta + ioff);
// unsigned x = get_te32(&phdr->p_vaddr);
// set_te32(&phdr->p_vaddr, delta + x);
// unsigned y = get_te32(&phdr->p_paddr);
// set_te32(&phdr->p_paddr, delta + y);
if (xct_off < ioff) {
set_te32(&phdr->p_offset, so_slide + (is_asl ? asl_delta : 0) + ioff);
}
*outp++ = *phdr; // propagate
} // end each Phdr
e_phnum = outp - phdr0;
set_te16(&ehdri.e_phnum, e_phnum);
set_te16(&((Elf32_Ehdr *)(unsigned char *)lowmem)->e_phnum, e_phnum);
if (sec_arm_attr || is_asl) { // must update Shdr.sh_offset for so_slide
Elf32_Shdr *shdr = shdri;
@@ -771,7 +769,6 @@ off_t PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
return total_out;
}
// NYI 2025-12-10: should be updated from the Elf32::pack3 version
off_t PackLinuxElf64::pack3(OutputFile *fo, Filter &ft)
{
if (!overlay_offset) {
@@ -838,7 +835,7 @@ off_t PackLinuxElf64::pack3(OutputFile *fo, Filter &ft)
Elf64_Phdr *const phdr0 = (Elf64_Phdr *)lowmem.subref(
"bad e_phoff", e_phoff, e_phnum * sizeof(Elf64_Phdr));
Elf64_Phdr *phdr = phdr0, *outp = phdr0;
Elf64_Phdr *phdr = phdr0;
upx_off_t off = fo->st_size(); // 64 bits
so_slide = 0;
for (unsigned j = 0; j < e_phnum; ++j, ++phdr) {
@@ -848,9 +845,16 @@ off_t PackLinuxElf64::pack3(OutputFile *fo, Filter &ft)
u64_t align= get_te64(&phdr->p_align);
unsigned const type = get_te32(&phdr->p_type);
if (Elf64_Phdr::PT_INTERP==type) {
continue; // OMIT
// Rotate to highest position, so it can be lopped
// by decrementing e_phnum.
memcpy((unsigned char *)ibuf, phdr, sizeof(*phdr)); // extract
memmove(phdr, 1+phdr, (e_phnum - (1+ j))*sizeof(*phdr)); // overlapping
memcpy(&phdr[e_phnum - (1+ j)], (unsigned char *)ibuf, sizeof(*phdr)); // to top
--phdr; --e_phnum;
set_te16(&ehdri.e_phnum, e_phnum);
set_te16(&((Elf64_Ehdr *)(unsigned char *)lowmem)->e_phnum, e_phnum);
continue;
}
*outp++ = *phdr; // propagate
if (PT_LOAD == type) {
if (!ioff) { // first PT_LOAD must contain everything written so far
set_te64(&phdr->p_filesz, sz_pack2 + lsize); // is this correct?
@@ -899,9 +903,6 @@ off_t PackLinuxElf64::pack3(OutputFile *fo, Filter &ft)
set_te64(&phdr->p_offset, so_slide + (is_asl ? asl_delta : 0) + ioff);
}
} // end each Phdr
e_phnum = outp - phdr0;
set_te16(&ehdri.e_phnum, e_phnum);
set_te16(&((Elf64_Ehdr *)(unsigned char *)lowmem)->e_phnum, e_phnum);
if (sec_arm_attr || is_asl) { // must update Shdr.sh_offset for so_slide
// Update {DYNAMIC}.sh_offset by so_slide.
@@ -1703,8 +1704,6 @@ PackLinuxElf32::buildLinuxLoader(
relocateLoader();
}
unsigned bb1; // aid for possible debugging NRV/UCL
void
PackLinuxElf64::buildLinuxLoader(
upx_byte const *const proto,
@@ -6106,8 +6105,6 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
// Keep _Shdr for SHF_WRITE.
// Discard _Shdr with (0==sh_addr), except _Shdr[0]
// Keep ARM_ATTRIBUTES
// Remove .ARM.extab(PROGBITS) and .ARM.exidx(SHT_ARM_EXIDX)
// because they refer to compressed .text(PT_LOAD)
unsigned const want_types_mask = 0
| 1u<<SHT_PROGBITS // see comment above, and special code below
| 1u<<SHT_HASH
@@ -6182,14 +6179,30 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
|| (Elf32_Shdr::SHT_ARM_ATTRIBUTES == sh_type)
) {
*sh_out = *sh_in; // *sh_in is a candidate for fowarding
if (sh_offset > xct_off) { // may slide down: earlier compression
if (sh_offset >= xct_off_hi) { // easy: so_slide down
if (Elf32_Shdr::SHT_ARM_ATTRIBUTES != sh_type) {
slide_sh_offset(sh_out);
}
}
else { // somewhere in compressed; try proportional (aligned)
// But note that PROGBITS without SHF_ALLOC
// will be dropped below.
u32_t const slice = xct_off + (~0xFu & (unsigned)(
(sh_offset - xct_off) *
((sh_offset - xct_off) / (float)(xct_off_hi - xct_off))));
//set_te32(&sh_out->sh_addr, slice);
set_te32(&sh_out->sh_offset, slice);
}
u32_t const max_sz = total_out - get_te32(&sh_out->sh_offset);
if (sh_size > max_sz) { // avoid complaint "extends beyond EOF"
set_te32(&sh_out->sh_size, max_sz);
}
}
if (j == e_shstrndx) { // changes Elf32_Ehdr itself
set_te16(&eho->e_shstrndx, sh_out -
(Elf32_Shdr *)mb_shdro.getVoidPtr());
}
if (Elf32_Shdr::SHT_ARM_EXIDX == sh_type
|| 0==strcmp(".ARM.extab", name)) {
/* OMIT */ continue; // OMIT: compressed contents
}
if (Elf32_Shdr::SHT_ARM_ATTRIBUTES == sh_type
|| (SHT_NOTE == sh_type && xct_off < sh_offset)
) { // append a copy
@@ -6203,7 +6216,7 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
if (!(Elf32_Shdr::SHF_ALLOC & sh_flags)) {
// .debug_*, .gnu_debuglink etc. Typically compressed
// but not in RAM, and gdb (BFD) gets confused.
/* OMIT */ continue; // OMIT the commit: do not forward
continue; // OMIT the commit: do not forward
} else
if (sh_offset <= xct_off
&& 0 == strcmp(".text", name) ) {
@@ -6218,31 +6231,9 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
n_shstrsec = sh_out;
} else
if (strcmp(".dynstr", name)) {
/* OMIT */ continue; // OMIT the commit of non-global symbol names
continue; // OMIT the commit of non-global symbol names
}
}
if (sh_offset > xct_off) { // may slide down: earlier compression
if (sh_offset >= xct_off_hi) { // easy: so_slide down
if (Elf32_Shdr::SHT_ARM_ATTRIBUTES != sh_type
// && Elf32_Shdr::SHT_ARM_EXIDX != sh_type
) {
slide_sh_offset(sh_out);
}
}
else { // somewhere in compressed; try proportional (aligned)
// Note that PROGBITS without SHF_ALLOC is already omitted.
u32_t const slice = xct_off + (~0xFu & (unsigned)(
(sh_offset - xct_off) *
((sh_offset - xct_off) / (float)(xct_off_hi - xct_off))));
//set_te32(&sh_out->sh_addr, slice);
set_te32(&sh_out->sh_offset, slice);
}
u32_t const max_sz = total_out - get_te32(&sh_out->sh_offset);
if (sh_size > max_sz) { // avoid complaint "extends beyond EOF"
set_te32(&sh_out->sh_size, max_sz);
}
}
// Will be forwarded, but needs a name.
set_te32(&sh_out->sh_name, ptr_shstrings - (char *)mb_shstrings.getVoidPtr());
do { // stupid MSVC lacks stpcpy()
*ptr_shstrings++ = *name;
@@ -6288,7 +6279,6 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
}
}
}
UNUSED(ptr);
fo->seek(0, SEEK_SET);
fo->rewrite(eho, sizeof(*eho));
@@ -6299,7 +6289,6 @@ unsigned PackLinuxElf32::forward_Shdrs(OutputFile *fo, Elf32_Ehdr *const eho)
return penalty;
}
// NYI 2025-12-10: should be merged from Elf32::forward_Shdrs
unsigned PackLinuxElf64::forward_Shdrs(OutputFile *fo, Elf64_Ehdr *const eho)
{
if (!fo) {
@@ -6311,9 +6300,7 @@ unsigned PackLinuxElf64::forward_Shdrs(OutputFile *fo, Elf64_Ehdr *const eho)
// Keep _Shdr for rtld data (below xct_off).
// Discard _Shdr for compressed regions, except ".text" for gdb.
// Keep _Shdr with SHF_WRITE.
// Keep ARM_ATTRIBUTES.
// Remove .ARM.extab(PROGBITS) and .ARM.exidx(ARM_EXIDX)
// because they refer to compressed .text.
// Keep ARM_ATTRIBUTES
// Discard _Shdr with (0==sh_addr), except _Shdr[0]
unsigned const want_types_mask =
1u<<SHT_SYMTAB
@@ -6361,6 +6348,7 @@ unsigned PackLinuxElf64::forward_Shdrs(OutputFile *fo, Elf64_Ehdr *const eho)
for (unsigned j = 1; j < e_shnum; ++j, ++sh_in) {
char const *sh_name = &shstrtab[get_te32(&sh_in->sh_name)];
(void)sh_name; // debugging
unsigned sh_type = get_te32(&sh_in->sh_type);
u64_t sh_flags = get_te64(&sh_in->sh_flags);
u64_t sh_addr = get_te64(&sh_in->sh_addr);
@@ -6405,9 +6393,6 @@ unsigned PackLinuxElf64::forward_Shdrs(OutputFile *fo, Elf64_Ehdr *const eho)
set_te16(&eho->e_shstrndx, sh_out -
(Elf64_Shdr *)mb_shdro.getVoidPtr());
}
if (0==strcmp(".ARM.extab", sh_name)) {
/* OMIT */ continue; // OMIT: compressed contents
}
if (j == e_shstrndx
|| sec_arm_attr == sh_in
|| (SHT_NOTE == sh_type && xct_off < sh_offset)
+1 -5
View File
@@ -658,11 +658,7 @@ void PackUnix::unpack(OutputFile *fo)
fi->readx(&bhdr, szb_info);
ph.u_len = sz_unc = get_te32(&bhdr.sz_unc);
ph.c_len = sz_cpr = get_te32(&bhdr.sz_cpr);
if (szb_info < sizeof(b_info)) { // some upx version 11
bhdr.b_method = ph.method;
bhdr.b_ftid = ph.filter;
bhdr.b_cto8 = ph.filter_cto;
}
ph.set_method(bhdr.b_method);
if (sz_unc == 0) // uncompressed size 0 -> EOF
{
+6 -6
View File
@@ -857,9 +857,9 @@ void Packer::relocateLoader() {
}
/*************************************************************************
// void Packer::compressWithFilters():
// Try compression with several methods and filters, choose the best
// or first working one. Needs buildLoader().
// void Packer::compressWithFilters():
// Try compression with several methods and filters, choose the best
/ or first working one. Needs buildLoader().
//
// Required inputs:
// this->ph
@@ -1015,9 +1015,9 @@ void Packer::compressWithFilters(byte *i_ptr,
byte *const hdr_ptr, const unsigned hdr_len,
Filter *const parm_ft, // updated
const unsigned overlap_range,
const upx_compress_config_t *const cconf,
upx_compress_config_t const *const cconf,
int filter_strategy, // in+out for prepareFilters
const bool inhibit_compression_check) {
bool const inhibit_compression_check) {
parm_ft->buf_len = f_len;
// struct copies
const PackHeader orig_ph = this->ph;
@@ -1219,7 +1219,7 @@ void Packer::compressWithFilters(Filter *ft, const unsigned overlap_range,
}
void Packer::compressWithFilters(Filter *ft, const unsigned overlap_range,
const upx_compress_config_t *cconf, int filter_strategy,
upx_compress_config_t const *cconf, int filter_strategy,
unsigned filter_off, unsigned ibuf_off, unsigned obuf_off,
byte *const hdr_ptr, unsigned hdr_len,
bool inhibit_compression_check) {
+8 -8
View File
@@ -162,7 +162,7 @@ protected:
unsigned f_len, // subset of [*i_ptr, +i_len)
byte *const hdr_ptr, unsigned hdr_len,
Filter *parm_ft, // updated
unsigned overlap_range, const upx_compress_config_t *cconf,
unsigned overlap_range, upx_compress_config_t const *cconf,
int filter_strategy, bool inhibit_compression_check = false);
// util for verifying overlapping decompression
@@ -248,7 +248,7 @@ protected:
int patch_le32(void *b, int blen, const void *old, unsigned new_);
void checkPatch(void *b, int blen, int boff, int size);
// relocation util [see packer_r.cpp]
// relocation util
static unsigned optimizeReloc(unsigned relocnum, SPAN_P(byte) relocs, SPAN_S(byte) out,
SPAN_P(byte) image, unsigned image_size, int bits, bool bswap,
int *big);
@@ -260,7 +260,7 @@ protected:
// permissive version using "void *"
inline unsigned get_te16(const void *p) const noexcept { return bele->get16(p); }
inline unsigned get_te32(const void *p) const noexcept { return bele->get32(p); }
inline unsigned get_te64_32(const void *p) const may_throw { return (unsigned) bele->get64(p); }
inline unsigned get_te64_32(const void *p) const { return (unsigned) bele->get64(p); }
inline upx_uint64_t get_te64(const void *p) const noexcept { return bele->get64(p); }
inline void set_te16(void *p, unsigned v) noexcept { bele->set16(p, v); }
inline void set_te32(void *p, unsigned v) noexcept { bele->set32(p, v); }
@@ -293,11 +293,11 @@ protected:
return bele->get32(p);
}
template <class T, class = enable_if_te64<T> >
inline unsigned get_te64_32(const T *p) const may_throw {
upx_uint64_t v = bele->get64(p);
if ((v >> 32) != 0)
throwCantPack("64-bit value too big %#llx", v);
return (unsigned) v;
inline unsigned get_te64_32(const T *p) const {
upx_uint64_t val = get_te64(p);
if (val >> 32)
throwCantPack("64-bit value too big %#llx", val);
return (unsigned) val;
}
template <class T, class = enable_if_te64<T> >
inline upx_uint64_t get_te64(const T *p) const noexcept {
+3 -3
View File
@@ -39,13 +39,12 @@ struct PackHeader final {
~PackHeader() noexcept = default;
void reset() noexcept;
int set_method(int m, unsigned offset = 0); // check, then assign
int getPackHeaderSize() const;
void putPackHeader(SPAN_S(byte) p) const;
bool decodePackHeaderFromBuf(SPAN_S(const byte) b, int blen);
int getPackHeaderSize() const;
// fields stored in compressed file => see stub/src/include/header.S
// enum { magic = UPX_MAGIC_LE32 };
int version;
@@ -64,6 +63,7 @@ struct PackHeader final {
int n_mru; // specific name for filter ctojr
};
int header_checksum;
int set_method(int m, unsigned offset = 0); // check, then assign
// support fields for verifying decompression
unsigned saved_u_adler;
+30 -64
View File
@@ -96,7 +96,6 @@ PeFile::PeFile(InputFile *f) : super(f) {
use_tls_callbacks = false;
oloadconf = nullptr;
soloadconf = 0;
dbgCET = nullptr;
isdll = false;
isrtm = false;
@@ -1480,39 +1479,30 @@ void PeFile::processTls2(Reloc *const rel, const Interval *const iv, unsigned ne
if (sotls == 0)
return;
// add new relocation entries
if (tls_handler_offset > 0 && tls_handler_offset_reloc > 0)
rel->add_reloc(tls_handler_offset + tls_handler_offset_reloc, reloc_type);
unsigned ic;
// NEW: if TLS callbacks are used, relocate the VA of the callback chain, too - Stefan Widmann
for (unsigned ic = 0; ic < (unsigned) (use_tls_callbacks ? 4 : 3); ic++)
rel->add_reloc(newaddr + ic * cb_size, reloc_type);
for (ic = 0; ic < (use_tls_callbacks ? sizeof(LE32) * cb_size : (sizeof(LE32) - 1) * cb_size);
ic += cb_size)
rel->add_reloc(newaddr + ic, reloc_type);
SPAN_S_VAR(tls, const tlsp, mb_otls);
// now the relocation entries in the tls data area
for (unsigned ic = 0; ic < iv->ivnum; ic++) {
for (ic = 0; ic < iv->ivnum; ic += sizeof(LE32)) {
SPAN_S_VAR(byte, const pp,
otls + (iv->ivarr[ic].start - (tlsp->datastart - imagebase) + sizeof(tls)));
LEXX *const p = (LEXX *) raw_bytes(pp, sizeof(LEXX));
cb_value_t kc = *p;
if (kc >= tlsp->datastart && kc < tlsp->dataend) {
// add a relocation entry referring to an address inside of the original tls data area
// - as the new tls area is moved, the referred address have to be also adjusted
if (kc < tlsp->dataend && kc >= tlsp->datastart) {
kc += newaddr + sizeof(tls) - tlsp->datastart;
*p = kc + imagebase;
rel->add_reloc(kc, iv->ivarr[ic].len);
} else {
// add a relocation entry referring to an address outside of the original tls data area
// by adding the difference of the new tlsdatastart and the old tlsdatastart to
// the address of the original relocation record
const unsigned a =
iv->ivarr[ic].start + (newaddr + sizeof(tls)) - (tlsp->datastart - imagebase);
// Must not overwrite compressed data
if (a < newaddr && !opt->win32_pe.strip_relocs)
throwCantPack("relocation too low (%#x < %#x); try --strip-relocs", a, newaddr);
rel->add_reloc(a, iv->ivarr[ic].len);
}
} else
rel->add_reloc(kc - imagebase, iv->ivarr[ic].len);
}
const unsigned tls_data_size = tlsp->dataend - tlsp->datastart;
@@ -1736,15 +1726,15 @@ PeFile::Resource::upx_rnode *PeFile::Resource::convert(const void *rnode, upx_rn
branch->name = nullptr;
branch->parent = parent;
branch->nc = ic;
branch->children = New0(upx_rnode *, ic);
branch->children = New(upx_rnode *, ic);
branch->data = *node;
if (!root) // first one
root = branch; // prevent leak if xcheck throws (hacked unpack or test)
for (const res_dir_entry *rde = node->entries + ic - 1; --ic >= 0; rde--) {
upx_rnode *child = convert(start + (rde->child & 0x7fffffff), branch, level + 1);
branch->children[ic] = child;
xcheck(child);
branch->children[ic] = child;
child->id = rde->tnl;
if (child->id & 0x80000000) {
const byte *p = start + (child->id & 0x7fffffff);
@@ -2093,32 +2083,25 @@ unsigned PeFile::stripDebug(unsigned overlaystart) {
if (IDADDR(PEDIR_DEBUG) == 0)
return overlaystart;
struct alignas(1) DebugDir final {
byte _[16]; // flags, time/date, version, type
LE32 size;
byte __[4]; // rva
LE32 fpos;
};
COMPILE_TIME_ASSERT(sizeof(DebugDir) == 28)
COMPILE_TIME_ASSERT_ALIGNED1(DebugDir)
COMPILE_TIME_ASSERT(sizeof(((DebugDir *) nullptr)->_) == 16)
COMPILE_TIME_ASSERT(sizeof(((DebugDir *) nullptr)->__) == 4)
const unsigned skip = IDADDR(PEDIR_DEBUG);
const unsigned take = IDSIZE(PEDIR_DEBUG);
DebugDir *const dd0 = (DebugDir *) ibuf.subref("bad debug %#x", skip, take);
DebugDir *dd = dd0;
for (unsigned ic = 0; ic < IDSIZE(PEDIR_DEBUG) / sizeof(DebugDir); ic++, dd++) {
if (IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS == dd->type && dd->size == sizeof(LE32) &&
dd->fpos <= (file_size_u - sizeof(LE32))) {
// fpos need not belong to any PEDIR_* section.
// Read directly from input file, but keep position (paranoia).
LE32 word;
upx_off_t const now_pos = fi->tell();
fi->seek(dd->fpos, SEEK_SET);
fi->read(&word, sizeof(word));
fi->seek(now_pos, SEEK_SET);
if (IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT & word) {
*(dbgCET = dd0) = *dd; // remember presence; copy to front
}
}
const DebugDir *dd = (const DebugDir *) ibuf.subref("bad debug %#x", skip, take);
for (unsigned ic = 0; ic < IDSIZE(PEDIR_DEBUG) / sizeof(DebugDir); ic++, dd++)
if (overlaystart == dd->fpos)
overlaystart += dd->size;
}
ibuf.fill((!dbgCET ? 0 : sizeof(DebugDir)) + IDADDR(PEDIR_DEBUG),
(!dbgCET ? 0 : -(int) sizeof(DebugDir)) + IDSIZE(PEDIR_DEBUG), FILLVAL);
ibuf.fill(IDADDR(PEDIR_DEBUG), IDSIZE(PEDIR_DEBUG), FILLVAL);
return overlaystart;
}
@@ -2505,8 +2488,8 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
obuf.clear(ph.c_len, c_len - ph.c_len);
const unsigned aligned_sotls = ALIGN_UP(sotls, usizeof(LEXX));
const unsigned s1size = ALIGN_UP(ic + c_len + codesize, usizeof(LEXX)) + aligned_sotls +
soloadconf + (dbgCET ? (sizeof(LE32) + sizeof(*dbgCET)) : 0);
const unsigned s1size =
ALIGN_UP(ic + c_len + codesize, usizeof(LEXX)) + aligned_sotls + soloadconf;
const unsigned s1addr = (newvsize - (ic + c_len) + oam1) & ~oam1;
const unsigned ncsection = (s1addr + s1size + oam1) & ~oam1;
@@ -2524,7 +2507,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
oh.chksum = 0;
// fill the data directory
ODADDR(PEDIR_DEBUG) = 0; // dbgCET later
ODADDR(PEDIR_DEBUG) = 0;
ODSIZE(PEDIR_DEBUG) = 0;
ODADDR(PEDIR_IAT) = 0;
ODSIZE(PEDIR_IAT) = 0;
@@ -2532,8 +2515,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
ODSIZE(PEDIR_BOUND_IMPORT) = 0;
// tls & loadconf are put into section 1
ic = s1addr + s1size - aligned_sotls - soloadconf -
(dbgCET ? (sizeof(LE32) + sizeof(*dbgCET)) : 0);
ic = s1addr + s1size - aligned_sotls - soloadconf;
if (use_tls_callbacks)
tls_handler_offset = linker->getSymbolOffset("PETLSC2") + upxsection;
@@ -2548,11 +2530,6 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
ODSIZE(PEDIR_LOAD_CONFIG) = soloadconf;
ic += soloadconf;
if (dbgCET) {
ODADDR(PEDIR_DEBUG) = ic;
ODSIZE(PEDIR_DEBUG) = sizeof(*dbgCET);
ic += sizeof(LE32) + ODSIZE(PEDIR_DEBUG);
}
const bool rel_at_sections_start = last_section_rsrc_only;
ic = ncsection;
@@ -2698,19 +2675,6 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
fo->write(ibuf, sizeof(LEXX) - ic);
fo->write(otls, aligned_sotls);
fo->write(oloadconf, soloadconf);
if (dbgCET) {
ic = fo->getBytesWritten();
dbgCET->fpos = ic + sizeof(*dbgCET);
dbgCET->rva = rvamin + 0x400 + dbgCET->fpos; // 0x400 => soheaders
LE32 word;
set_le32(&word, IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT);
if (0) { // set all bytes t0 zero
memset(dbgCET, 0, sizeof(*dbgCET));
set_le32(&word, 0);
}
fo->write(dbgCET, sizeof(*dbgCET));
fo->write(&word, sizeof(word));
}
if ((ic = fo->getBytesWritten() & fam1) != 0)
fo->write(ibuf, oh.filealign - ic);
if (!last_section_rsrc_only)
@@ -2731,7 +2695,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
fo->write(ibuf, oh.filealign - ic);
}
#if 0 // (debug) print section sizes
#if 0
printf("%-13s: program hdr : %8d bytes\n", getName(), (int) sizeof(oh));
printf("%-13s: sections : %8d bytes\n", getName(), (int) sizeof(osection[0]) * oobjs);
printf("%-13s: ident : %8d bytes\n", getName(), (int) identsize);
@@ -3066,6 +3030,8 @@ void PeFile::unpack0(OutputFile *fo, const ht &ih, ht &oh, ord_mask_t ord_mask,
// memset(eistart, 0, ptr_udiff_bytes(extra_info, eistart) + 4);
// fill the data directory
ODADDR(PEDIR_DEBUG) = 0;
ODSIZE(PEDIR_DEBUG) = 0;
ODADDR(PEDIR_IAT) = 0;
ODSIZE(PEDIR_IAT) = 0;
ODADDR(PEDIR_BOUND_IMPORT) = 0;
-11
View File
@@ -519,17 +519,6 @@ protected:
void build(char *base, unsigned newoffs);
unsigned getsize() const { return size; }
};
struct alignas(1) DebugDir final {
LE32 flags, date_time, version;
LE32 type;
LE32 size;
LE32 rva;
LE32 fpos;
};
enum { IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS = 20 };
enum { IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT = 0x001 };
struct DebugDir *dbgCET = nullptr;
};
class PeFile32 : public PeFile {
+76 -9
View File
@@ -42,6 +42,8 @@ endif
# ************************************************************************/
ifndef STUBS
STUBS += riscv64-linux.elf-entry.h
STUBS += riscv64-linux.elf-fold.h
STUBS += amd64-darwin.dylib-entry.h
STUBS += amd64-darwin.macho-entry.h
STUBS += amd64-darwin.macho-fold.h
@@ -167,7 +169,7 @@ all: $$(all.targets)
@echo "timestamp" > $@
.DELETE_ON_ERROR: .upx-stubtools-stamp
%/.tmp-stamp:
@mkdir -p "$(dir $@)"
@mkdir -p $(dir $@)
@echo "timestamp" > $@
.PRECIOUS: %/.tmp-stamp
.all-stamp: $$(STUBS)
@@ -208,7 +210,6 @@ ECHO_e = /bin/echo -e
ECHO_E = /bin/echo -E
PERL = perl
PYTHON2 = python2
PYTHON3 = python3
UNIX2DOS := $(PERL) -i -pe 's/$$/\r/;'
# trim (strip) trailing whitespace
@@ -241,15 +242,15 @@ define tc
endef
# default tools
tc.default.bin2h = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/bin2h.py" --ident=auto-stub
tc.default.bin2h = $(PYTHON2) $(top_srcdir)/src/stub/scripts/bin2h.py --ident=auto-stub
##tc.default.bin2h-c = $(call tc,bin2h) --compress=14,15,0
tc.default.bin2h-c = $(call tc,bin2h) --compress=0
tc.default.brandelf = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/brandelf.py" $(if $(tc_bfdname),--bfdname=$(tc_bfdname))
tc.default.gpp_inc = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/gpp_inc.py"
tc.default.gpp_mkdep = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/gpp_inc.py" -o /dev/null
tc.default.brandelf = $(PYTHON2) $(top_srcdir)/src/stub/scripts/brandelf.py $(if $(tc_bfdname),--bfdname=$(tc_bfdname))
tc.default.gpp_inc = $(PYTHON2) $(top_srcdir)/src/stub/scripts/gpp_inc.py
tc.default.gpp_mkdep = $(PYTHON2) $(top_srcdir)/src/stub/scripts/gpp_inc.py -o /dev/null
tc.default.pp-as = i386-linux-gcc-3.4.6 -E -nostdinc -x assembler-with-cpp -Wall
tc.default.sstrip = sstrip-20060518
tc.default.xstrip = $(PYTHON3) "$(top_srcdir)/src/stub/scripts/xstrip.py"
tc.default.xstrip = $(PYTHON2) $(top_srcdir)/src/stub/scripts/xstrip.py
# default multiarch-binutils
tc.default.m-ar = multiarch-ar-2.17
@@ -319,9 +320,9 @@ endef
define tc.default.f-embed_objinfo_without_xstrip_keep_dot_text
chmod a-x $1
$(call tc,objcopy) -R .data -R .bss $1
$(call tc,objcopy) -R .data -R .bss $1
$(call tc,objcopy) -R .comment -R .note -R .note.GNU-stack -R .reginfo $1
$(call tc,objcopy) --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main $1
$(call tc,objcopy) --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main --keep-symbol=str_upx $1
#
# Disassemble for human readability
# objdump
@@ -2183,6 +2184,72 @@ powerpc64-linux.kernel.vmlinux-head.h : $(srcdir)/src/$$T.S
$(call tc,objcopy) --output-target binary --only-section .text tmp/$T.o tmp/$T.bin
$(call tc,bin2h) tmp/$T.bin $@
# =====
# /***********************************************************************
# // riscv64-linux.elf
# ************************************************************************/
riscv64-linux.elf%.h : tc_list = riscv64-linux.elf default
riscv64-linux.elf%.h : tc_bfdname = elf64-littleriscv64
tc.riscv64-linux.elf.gcc = /usr/bin/riscv64-linux-gnu-gcc -nostdinc -MMD -MT $@
tc.riscv64-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables # -fno-stack-protector
tc.riscv64-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror
tc.riscv64-linux.elf.objcopy = /usr/bin/riscv64-linux-gnu-objcopy
# Override of objcopy is needed because:
# multiarch-objcopy-2.17 -F elf64-littleriscv64 --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main tmp/riscv64-linux.elf-entry.bin
# multiarch-objcopy-2.17: tmp/riscv64-linux.elf-entry.bin: Invalid bfd target
tc.riscv64-linux.elf.objdump = /usr/bin/riscv64-linux-gnu-objdump
# Override of objdump is needed because:
# multiarch-objdump-2.17 -b elf64-littleriscv64 -Dr tmp/riscv64-linux.elf-entry.bin | sed -e 's/[ ]*$//' > tmp/riscv64-linux.elf-entry.bin.disasm
# multiarch-objdump-2.17: tmp/riscv64-linux.elf-entry.bin: Invalid bfd target
# multiarch-objdump-2.17 -b elf64-littleriscv64 -htr -w tmp/riscv64-linux.elf-entry.bin | sed -e 's/[ ]*$//' | cat --squeeze-blank | sed -e '1{/^$/d}' -e '${/^$/d}' | sed -e '1s/^.*: *file format/file format/' -e 's/ / /g' -e 's/ 00*/ 0/g' -e 's/CONTENTS.*/CONTENTS/' > tmp/riscv64-linux.elf-entry.bin.dump
# multiarch-objdump-2.17: tmp/riscv64-linux.elf-entry.bin: Invalid bfd target
tc.riscv64-linux.elf.ld = /usr/bin/riscv64-linux-gnu-ld
# Override of ld is needed because:
# multiarch-objcopy-2.17 -F elf64-littleriscv64 --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main tmp/riscv64-linux.elf-entry.bin
# multiarch-objcopy-2.17: tmp/riscv64-linux.elf-entry.bin: Invalid bfd target
riscv64-linux.elf-entry.h : $(srcdir)/src/$$T.S
$(call tc,gcc) -c $< -o tmp/$T.bin
$(call tc,f-embed_objinfo,tmp/$T.bin)
$(call tc,bin2h) tmp/$T.bin $@
riscv64-linux.elf-fold.h : $(srcdir)/src/$$T.lds \
tmp/$$T.o \
tmp/riscv64-linux.elf-help_umf.o \
tmp/riscv64-linux.elf-upxfd_linux.o \
tmp/riscv64-expand.o \
tmp/riscv64-linux.elf-main2.o
$(call tc,ld) -r -Map tmp/$T.map $(filter %.o,$^) -o tmp/$T.bin
$(call tc,f-embed_objinfo_without_xstrip_keep_dot_text,tmp/$T.bin)
$(call tc,bin2h) tmp/$T.bin $@
tmp/riscv64-linux.elf-fold.o : $(srcdir)/src/$$T.S
$(call tc,gcc) -c $< -o $@
$(call tc,f-objstrip,$@)
tmp/riscv64-linux.elf-main2.o : $(srcdir)/src/$$T.c $(srcdir)/src/i386-linux.elf-main2.c
$(call tc,gcc) -c $< -o $@
$(call tc,f-objstrip,$@)
tmp/riscv64-linux.elf-help_umf.o: $(srcdir)/src/$$T.S
$(call tc,gcc) -c $< -o $@
tmp/riscv64-linux.elf-upxfd_linux.o : $(srcdir)/src/upxfd_linux.c
$(call tc,gcc) -c -O $< -o $@
$(call tc,objcopy) --strip-unneeded --rename-section .text=UMF_LINUX \
-R .riscv.attributes -R .data -R .bss -R .note.GNU-stack $@
$(call tc,objdump) -Dr $(tc_objdump_disasm_options) $@ | $(RTRIM) > $@.disasm
tmp/riscv64-expand.o: $(srcdir)/src/$$T.S
$(call tc,gcc) -c $< -o $@
# =====
# /***********************************************************************
# // dependencies
+36 -39
View File
@@ -1,4 +1,4 @@
#! /usr/bin/env python3
#! /usr/bin/env python2
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
#
# bin2h.py --
@@ -45,7 +45,7 @@ class opts:
# ************************************************************************/
def w_header_c(w, ifile, ofile, n):
w(("/* %s\n created from %s, %d (0x%x) bytes\n" % (os.path.basename(ofile), os.path.basename(ifile), n, n)).encode())
w("/* %s\n created from %s, %d (0x%x) bytes\n" % (os.path.basename(ofile), os.path.basename(ifile), n, n))
w("""\n\
This file is part of the UPX executable compressor.
@@ -74,7 +74,7 @@ def w_header_c(w, ifile, ofile, n):
John F. Reiser
<jreiser@users.sourceforge.net>
*/\n\n""".encode())
*/\n\n""")
# /***********************************************************************
@@ -87,11 +87,11 @@ class DataWriter:
self.pos = None
def w_bol(self, pos):
self.w(("/* 0x%04x */ " % (pos)).encode())
self.w("/* 0x%04x */ " % (pos))
self.pos = pos
def w_eol(self, fill=""):
if self.pos is not None:
self.w((fill.rstrip() + "\n").encode())
self.w(fill.rstrip() + "\n")
class DataWriter_c(DataWriter):
@@ -101,8 +101,8 @@ class DataWriter_c(DataWriter):
if i & 15 == 0:
self.w_eol()
self.w_bol(i)
w(("%3d" % data[i]).encode())
if i != n - 1: w(",".encode())
w("%3d" % ord(data[i]))
if i != n - 1: w(",")
self.w_eol()
@@ -113,10 +113,10 @@ class DataWriter_gas(DataWriter):
if i & 15 == 0:
self.w_eol()
self.w_bol(i)
w(".byte ".encode())
w(".byte ")
else:
w(",".encode())
w(("%3d" % data[i]).encode())
w(",")
w("%3d" % ord(data[i]))
self.w_eol()
@@ -128,12 +128,12 @@ class _DataWriter_gas_u32(DataWriter):
if i & 15 == 0:
self.w_eol()
self.w_bol(i)
w(".int ".encode())
w(".int ")
else:
w(",".encode())
w(",")
v = struct.unpack(self.DECODE, data[i:i+4])
assert len(v) == 1, v
w(("0x%08x" % (v[0] & 0xffffffff)).encode())
w("0x%08x" % (v[0] & 0xffffffffL))
self.w_eol()
class DataWriter_gas_be32(_DataWriter_gas_u32):
@@ -148,7 +148,7 @@ class DataWriter_nasm(DataWriter):
def w_eol(self, fill=""):
if self.pos is not None:
self.w(fill)
self.w((" ; 0x%04x\n" % (self.pos)).encode())
self.w(" ; 0x%04x\n" % (self.pos))
def w_data(self, data):
w, n = self.w, len(data)
@@ -156,10 +156,10 @@ class DataWriter_nasm(DataWriter):
if i & 15 == 0:
self.w_eol()
self.w_bol(i)
w("db ".encode())
w("db ")
else:
w(",".encode())
w(("%3d" % ord(data[i])).encode())
w(",")
w("%3d" % ord(data[i]))
nn = ((n + 15) & ~15) - n
self.w_eol(" " * 4 * nn)
@@ -169,21 +169,21 @@ class DataWriter_nasm(DataWriter):
# ************************************************************************/
def w_checksum_c(w, s, data):
w(("#define %s_SIZE %d\n" % (s, len(data))).encode())
w(("#define %s_ADLER32 0x%08x\n" % (s, 0xffffffff & zlib.adler32(data))).encode())
w(("#define %s_CRC32 0x%08x\n" % (s, 0xffffffff & zlib.crc32(data))).encode())
w("\n".encode())
w("#define %s_SIZE %d\n" % (s, len(data)))
w("#define %s_ADLER32 0x%08x\n" % (s, 0xffffffffL & zlib.adler32(data)))
w("#define %s_CRC32 0x%08x\n" % (s, 0xffffffffL & zlib.crc32(data)))
w("\n")
def write_stub(w, odata, method_index, methods):
method = methods[method_index]
if len(methods) > 1:
if method_index == 0:
w(("#if (%s == %d)\n\n" % (opts.mname, method)).encode())
w("#if (%s == %d)\n\n" % (opts.mname, method))
elif method_index < len(methods) - 1:
w(("\n#elif (%s == %d)\n\n" % (opts.mname, method)).encode())
w("\n#elif (%s == %d)\n\n" % (opts.mname, method))
else:
w("\n#else\n\n".encode())
w("\n#else\n\n")
if opts.ident:
if opts.mode == "c":
@@ -193,8 +193,8 @@ def write_stub(w, odata, method_index, methods):
#w("#if defined(__ELF__)\n")
#w('__attribute__((__section__("upx_stubs")))\n')
#w("#endif\n")
w(("ATTRIBUTE_FOR_STUB(%s)\n" % (opts.ident)).encode())
w(("unsigned char %s[%d] = {\n" % (opts.ident, len(odata))).encode())
w("ATTRIBUTE_FOR_STUB(%s)\n" % (opts.ident))
w("unsigned char %s[%d] = {\n" % (opts.ident, len(odata)))
if opts.mode == "c":
DataWriter_c(w).w_data(odata)
elif opts.mode == "gas":
@@ -209,11 +209,11 @@ def write_stub(w, odata, method_index, methods):
assert 0, ("invalid mode", opts.mode)
if opts.ident:
if opts.mode == "c":
w("};\n".encode())
w("};\n")
if len(methods) > 1:
if method_index == len(methods) - 1:
w("\n#endif\n".encode())
w("\n#endif\n")
# /***********************************************************************
@@ -293,10 +293,10 @@ def main(argv):
# check file size
st = os.stat(ifile)
if 1 and st.st_size <= 0:
sys.stderr.write("%s: ERROR: empty file\n" % (ifile))
print >> sys.stderr, "%s: ERROR: empty file" % (ifile)
sys.exit(1)
if 1 and st.st_size > 128*1024:
sys.stderr.write("%s: ERROR: file is too big (%d bytes)\n" % (ifile, st.st_size))
print >> sys.stderr, "%s: ERROR: file is too big (%d bytes)" % (ifile, st.st_size)
sys.exit(1)
# read ifile
@@ -321,22 +321,19 @@ def main(argv):
# compress stubs
# (process in reverse order so that incompressible do not get sorted first)
mdata, mdata_odata = [], {}
### FIXME assert len(opts.methods) >= 1
### r_methods = opts.methods[:]
### r_methods.reverse()
r_methods = [];
for m in opts.methods:
r_methods.insert(0, m)
assert len(opts.methods) >= 1
r_methods = opts.methods[:]
r_methods.reverse()
for method in r_methods:
method, odata = compress_stub(method, idata)
if method in mdata_odata:
if mdata_odata.has_key(method):
assert mdata_odata[method] == odata
else:
mdata_odata[method] = odata
mdata.append(method)
assert len(mdata) >= 1
mdata.reverse()
##print (opts.methods, [(i, len(mdata_odata[i])) for i in mdata])
##print opts.methods, [(i, len(mdata_odata[i])) for i in mdata]
# write ofile
if opts.dry_run:
@@ -352,7 +349,7 @@ def main(argv):
if opts.mode == "c":
if opts.verbose >= 0:
w_header_c(w, ifile, ofile, len(idata))
w(("/* clang" + "-format" + " off */\n\n").encode())
w("/* clang" + "-format" + " off */\n\n")
for i in range(len(mdata)):
write_stub(w, mdata_odata[mdata[i]], i, mdata)
if ofp:
+8 -8
View File
@@ -1,4 +1,4 @@
#! /usr/bin/env python3
#! /usr/bin/env python2
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
#
# brandelf.py --
@@ -54,32 +54,32 @@ def do_file(fn):
def write(s):
if not opts.dry_run:
fp.write(s.encode())
fp.write(s)
def brand_arm(s):
if e_ident[4:7] != s.encode():
if e_ident[4:7] != s:
raise Exception("%s is not %s" % (fn, opts.bfdname))
write("\x61") # ELFOSABI_ARM
def brand_freebsd(s):
if e_ident[4:7] != s.encode():
if e_ident[4:7] != s:
raise Exception("%s is not %s" % (fn, opts.bfdname))
write("\x09")
def brand_linux(s):
if e_ident[4:7] != s.encode():
if e_ident[4:7] != s:
raise Exception("%s is not %s" % (fn, opts.bfdname))
##write("\x00Linux\x00\x00\x00")
write("\x00" * 9)
def brand_netbsd(s):
if e_ident[4:7] != s.encode():
if e_ident[4:7] != s:
raise Exception("%s is not %s" % (fn, opts.bfdname))
write("\x02")
def brand_openbsd(s):
if e_ident[4:7] != s.encode():
if e_ident[4:7] != s:
raise Exception("%s is not %s" % (fn, opts.bfdname))
write("\x0c")
if opts.bfdname[:3] == "elf":
if e_ident[:4] != "\x7f\x45\x4c\x46".encode():
if e_ident[:4] != "\x7f\x45\x4c\x46":
raise Exception("%s is not %s" % (fn, "ELF"))
fp.seek(7, 0)
if opts.bfdname == "elf32-bigarm" and opts.elfosabi == "arm":
+8 -8
View File
@@ -1,4 +1,4 @@
#! /usr/bin/env python3
#! /usr/bin/env python2
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
#
# gpp_inc.py -- Generic PreProcessor: include
@@ -83,7 +83,7 @@ def parse_comment(state, l, comment):
def handle_inc_c(state, l, ofp):
m = re.search(r"^\s*\#\s*include\s+([\"\<])(.+?)([\"\>])(.*)$", l.decode())
m = re.search(r"^\s*\#\s*include\s+([\"\<])(.+?)([\"\>])(.*)$", l)
if not m:
return l
q1, inc, q2, comment = m.groups()
@@ -93,7 +93,7 @@ def handle_inc_c(state, l, ofp):
elif q1 == '"' and q2 == '"':
dirs = [state[1]] + opts.includes
else:
raise Exception("syntax error: include line " + l.decode())
raise Exception("syntax error: include line " + l)
for dir in dirs:
fn = os.path.join(dir, inc)
if os.path.isfile(fn):
@@ -130,13 +130,13 @@ def handle_file(ifn, ofp, parent_state=None):
ifp = open(ifn, "rb")
for l in ifp.readlines():
state[2] += 1 # line counter
l = l.rstrip("\n".encode())
l = l.rstrip("\n")
if opts.mode == "c":
l = handle_inc_c(state, l, ofp)
elif opts.mode == "nasm":
l = handle_inc_nasm(state, l, ofp)
if l is not None:
ofp.write(l + "\n".encode())
ofp.write(l + "\n")
def main(argv):
@@ -179,12 +179,12 @@ def main(argv):
os.unlink(fn)
if files_mmd:
fp = open(fn, "wb")
fp.write(("%s : \\\n" % opts.target_mmd).encode())
fp.write("%s : \\\n" % opts.target_mmd)
for i, f in enumerate(files_mmd):
if i < len(files_mmd) - 1:
fp.write((" %s \\\n" % f).encode())
fp.write(" %s \\\n" % f)
else:
fp.write((" %s\n" % f).encode())
fp.write(" %s\n" % f)
fp.close()
+16 -14
View File
@@ -1,4 +1,4 @@
#! /usr/bin/env python3
#! /usr/bin/env python2
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
#
# xstrip.py -- truncate ELF objects created by multiarch-objcopy-2.17
@@ -46,7 +46,7 @@ def strip_with_dump(dump_fn, eh, idata):
new_len = 0
lines = open(dump_fn, "rb").readlines()
for l in lines:
l = re.sub(r"\s+", " ", l.strip().decode())
l = re.sub(r"\s+", " ", l.strip())
f = l.split(" ")
if len(f) >= 8:
if f[7].startswith("CONTENTS"):
@@ -54,9 +54,9 @@ def strip_with_dump(dump_fn, eh, idata):
sh_size = int("0x" + f[2], 16)
if sh_offset + sh_size > new_len:
new_len = sh_offset + sh_size
##print (sh_offset, sh_size, f)
##print sh_offset, sh_size, f
if new_len > len(eh):
##print (dump_fn, new_len)
##print dump_fn, new_len
return eh, idata[:new_len-len(eh)]
return eh, idata
@@ -67,7 +67,7 @@ def strip_with_dump(dump_fn, eh, idata):
def check_dump(dump_fn):
lines = open(dump_fn, "rb").readlines()
lines = map(lambda l: re.sub(r"\s+", " ", l.strip().decode()).strip(), lines)
lines = map(lambda l: re.sub(r"\s+", " ", l.strip()).strip(), lines)
lines = filter(None, lines)
d = "\n".join(lines)
psections = d.find("Sections:\n")
@@ -88,10 +88,10 @@ def check_dump(dump_fn):
assert int(f[0], 10) == len(sections)
e = f[1], int(f[2], 16), int(f[5], 16), int(f[6][3:], 10), len(sections)
sections.append(e)
assert not e[0] in section_names, e
assert not section_names.has_key(e[0]), e
assert not e[0].endswith(":"), ("bad section name", e)
section_names[e[0]] = e
##print (sections)
##print sections
# preprocessSymbols
symbols = []
section = None
@@ -140,25 +140,25 @@ def do_file(fn):
fp = open(fn, "r+b")
fp.seek(0, 0)
idata = fp.read()
if idata[:4] != "\x7f\x45\x4c\x46".encode():
if idata[:4] != "\x7f\x45\x4c\x46":
raise Exception("%s is not %s" % (fn, "ELF"))
if idata[4:7] == "\x01\x01\x01".encode():
if idata[4:7] == "\x01\x01\x01":
# ELF32 LE
eh, idata = idata[:52], idata[52:]
e_shnum, e_shstrndx = struct.unpack("<HH", eh[48:52])
assert e_shstrndx + 3 == e_shnum
##eh = eh[:48] + struct.pack("<HH", e_shnum - 3, e_shstrndx)
elif idata[4:7] == "\x01\x02\x01".encode():
elif idata[4:7] == "\x01\x02\x01":
# ELF32 BE
eh, idata = idata[:52], idata[52:]
e_shnum, e_shstrndx = struct.unpack(">HH", eh[48:52])
assert e_shstrndx + 3 == e_shnum
elif idata[4:7] == "\x02\x01\x01".encode():
elif idata[4:7] == "\x02\x01\x01":
# ELF64 LE
eh, idata = idata[:64], idata[64:]
e_shnum, e_shstrndx = struct.unpack("<HH", eh[60:64])
assert e_shstrndx + 3 == e_shnum
elif idata[4:7] == "\x02\x02\x01".encode():
assert e_shstrndx + 3 >= e_shnum
elif idata[4:7] == "\x02\x02\x01":
# ELF64 BE
eh, idata = idata[:64], idata[64:]
e_shnum, e_shstrndx = struct.unpack(">HH", eh[60:64])
@@ -167,7 +167,7 @@ def do_file(fn):
raise Exception("%s is not %s" % (fn, "ELF"))
odata = None
pos = idata.find("\0.symtab\0.strtab\0.shstrtab\0".encode())
pos = idata.find("\0.symtab\0.strtab\0.shstrtab\0")
if opts.with_dump:
eh, odata = strip_with_dump(opts.with_dump, eh, idata)
# Other compilers can intermix the contents of .rela sections
@@ -178,6 +178,8 @@ def do_file(fn):
assert pos >= len(odata), ("unexpected strip_with_dump", pos, len(odata))
elif re.search(r"^arm64-", os.path.basename(fn)):
assert pos >= len(odata), ("unexpected strip_with_dump", pos, len(odata))
elif re.search(r"^riscv", os.path.basename(fn)):
assert pos >= len(odata), ("unexpected strip_with_dump", pos, len(odata))
else:
assert pos == len(odata), ("unexpected strip_with_dump", pos, len(odata))
else:
+42 -2
View File
@@ -77,6 +77,16 @@ extern void my_bkpt(void *, ...);
/*und*/ : "x30"); \
str; \
})
#elif defined(__riscv) //}{
#define ANDROID_FRIEND 0
#define addr_string(string) ({ \
char const *str; \
asm("jal 0f; .string \"" string "\"; .balign 4; 0: mv %0,ra" \
/*out*/ : "=r"(str) \
/* in*/ : \
/*und*/ : "x30"); \
str; \
})
#else //}{
#error;
#endif //}
@@ -279,6 +289,36 @@ make_hatch(
DPRINTF("hatch=%%p\\n", hatch);
return hatch;
}
#elif defined(__riscv) //{
static void *
make_hatch(
ElfW(Phdr) const *const phdr,
char *next_unc,
unsigned const frag_mask
)
{
unsigned long a = (unsigned long)next_unc;
int *hatch = (int *)((3u & -a) + a);
int code[3] = {
0,0,0 //NYI illegal instruction
};
DPRINTF("make_hatch %%p %%p %%x\\n", phdr, next_unc, frag_mask);
if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) {
if (sizeof(code) <= (unsigned)(frag_mask & -(long)hatch)) {
hatch[0] = code[0];
hatch[1] = code[1];
hatch[2] = code[2];
}
else { // Does not fit at hi end of .text, so must use a new page "permanently"
int mfd = upxfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
write(mfd, &code, sizeof(code));
hatch = mmap(0, sizeof(code), PROT_READ|PROT_EXEC, MAP_SHARED, mfd, 0);
close(mfd);
}
}
DPRINTF("hatch=%%p\\n", hatch);
return hatch;
}
#elif defined(__powerpc64__) //}{
static void *
make_hatch(
@@ -660,7 +700,7 @@ upx_main2( // returns entry address
/*arg4*/ ElfW(auxv_t) *const av
#if defined(__x86_64) //{
/*arg5*/ , ElfW(Addr) elfaddr // In: &ElfW(Ehdr) for stub
#elif defined(__aarch64__) //}{
#elif defined(__aarch64__) || defined(__riscv) //}{
/*arg5*/ , ElfW(Addr) elfaddr
#elif defined(__powerpc64__) //}{
/*arg5*/ , ElfW(Addr) *p_reloc // In: &ElfW(Ehdr) for stub; Out: 'slide' for PT_INTERP
@@ -681,7 +721,7 @@ upx_main2( // returns entry address
// ehdr = Uncompress Ehdr and Phdrs
unpackExtent(&xi2, &xo); // never filtered?
#if defined(__x86_64) || defined(__aarch64__) //{
#if defined(__x86_64) || defined(__aarch64__) || defined(__riscv) //{
ElfW(Addr) *const p_reloc = &elfaddr;
#endif //}
ElfW(Addr) page_mask = get_page_mask(); (void)page_mask;
-1
View File
@@ -34,7 +34,6 @@
#undef x86_64
//.altmacro // not supported by x86_64-linux-as-2.15
.code64
.macro section name
.section \name
+2 -2
View File
@@ -198,7 +198,7 @@ ifneq ($(wildcard $(WATCOM)/binl/wcl),)
# step 3: clean asm
lzma_d_c%.S : tmp/lzma_d_c%.i cleanasm.py $(MAKEFILE_LIST)
$(PYTHON2) cleanasm.py --label-prefix=$(LABEL_PREFIX) $< $@
$(PYTHON) cleanasm.py --label-prefix=$(LABEL_PREFIX) $< $@
# step 2: compile, strip and disasm
tmp/lzma_d_c%.i : tmp/lzma_d_c%.S $(MAKEFILE_LIST)
@@ -233,7 +233,7 @@ ifneq ($(wildcard $(WATCOM)/binl/wcl),)
$(call tc,wdis) tmp/$T_wc.obj | $(RTRIM) > tmp/$T_wc.obj.disasm
endif
# convert
$(PYTHON2) wdis2gas.py tmp/$T_wc.obj.disasm $@
$(PYTHON) wdis2gas.py tmp/$T_wc.obj.disasm $@
.PRECIOUS: tmp/lzma_d_c%.i tmp/lzma_d_c%.S
+3
View File
@@ -0,0 +1,3 @@
# convenience Makefile
default %:
$(MAKE) -C ../../.. $@
+55
View File
@@ -0,0 +1,55 @@
MAKEFLAGS += -rR
.SUFFIXES:
.SECONDEXPANSION:
ifndef top_srcdir
__dir_list = . .. ../.. ../../.. ../../../.. ../../../../..
__dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
vpath %.c $(top_srcdir)/src/stub/src/c
STUBS =
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
ifneq ($(UPX_LZMA_VERSION),)
STUBS += lzma_d_cf.S lzma_d_cs.S lzma_d_cn.S
endif
default.targets = all
ifeq ($(strip $(STUBS)),)
STUBS = NO_STUBS
all.targets =
endif
include $(top_srcdir)/src/stub/Makefile
# /***********************************************************************
# // method-lzma
# ************************************************************************/
lzma_d_c%.S : tc_list = method-lzma riscv64-linux.elf default
lzma_d_c%.S : tc_bfdname = elf64-riscv64
c := tc.method-lzma.gcc
$c = $(tc.riscv64-linux.elf.gcc)
$c += -Os -fomit-frame-pointer
$c += -fno-unit-at-a-time
$c += -ffunction-sections
$c += -fwrapv
$c += -DWITH_LZMA=$(UPX_LZMA_VERSION)
$c += -I$(UPX_LZMADIR)
$c += -I$(top_srcdir)/src
lzma_d_c%.S : lzma_d_c.c
$(call tc,gcc) $(PP_FLAGS) -c $< -o tmp/$T.o
$(call tc,f-objstrip,tmp/$T.o)
$(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
head -c-1 tmp/$T.bin > tmp/$T.out
$(call tc,objdump) -b binary -m i386:x86-64 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
$(call tc,bin2h) --mode=gas tmp/$T.out $@
lzma_d_cf.% : PP_FLAGS = -DFAST
lzma_d_cs.% : PP_FLAGS = -DSMALL
lzma_d_cn.% : PP_FLAGS = -DFAST -mno-red-zone
+96
View File
@@ -0,0 +1,96 @@
/*
; macros.S --
;
; This file is part of the UPX executable compressor.
;
; Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 1996-2025 Laszlo Molnar
; All Rights Reserved.
;
; UPX and the UCL library are free software; you can redistribute them
; and/or modify them under the terms of the GNU General Public License as
; published by the Free Software Foundation; either version 2 of
; the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; see the file COPYING.
; If not, write to the Free Software Foundation, Inc.,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
; Markus F.X.J. Oberhumer Laszlo Molnar
; <markus@oberhumer.com> <ezerotven+github@gmail.com>
;
*/
.macro section name
.section \name
.endm
.macro syscall num
li a7,\num; ecall
.endm
NBPW= 8
.macro PUSH4 a,b,c,d
addi sp,sp,-4*NBPW
sd \a,0*NBPW(sp)
sd \b,1*NBPW(sp)
sd \c,2*NBPW(sp)
sd \d,3*NBPW(sp)
.endm
.macro POP4 a,b,c,d
ld \a,0*NBPW(sp)
ld \b,1*NBPW(sp)
ld \c,2*NBPW(sp)
ld \d,3*NBPW(sp)
addi sp,sp,4*NBPW
.endm
.macro PUSH3 a,b,c
addi sp,sp,-4*NBPW
sd \a,0*NBPW(sp)
sd \b,1*NBPW(sp)
sd \c,2*NBPW(sp)
.endm
.macro POP3 a,b,c
ld \a,0*NBPW(sp)
ld \b,1*NBPW(sp)
ld \c,2*NBPW(sp)
addi sp,sp,4*NBPW
.endm
.macro PUSH2 a,b
addi sp,sp,-2*NBPW
sd \a,0*NBPW(sp)
sd \b,1*NBPW(sp)
.endm
.macro POP2 a,b,c
ld \a,0*NBPW(sp)
ld \b,1*NBPW(sp)
addi sp,sp,2*NBPW
.endm
.macro PUSH1 a
addi sp,sp,-2*NBPW
sd \a,0*NBPW(sp)
.endm
.macro POP1 a
ld \a,0*NBPW(sp)
addi sp,sp,2*NBPW
.endm
.macro SUB2 dst,src
sub \dst,\dst,\src
.endm
// vi:ts=8:et:nowrap
+85
View File
@@ -0,0 +1,85 @@
/* riscv64 nrv2b_d.S -- RISCV64 decompressor for NRV2B
This file is part of the UPX executable compressor.
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2025 Laszlo Molnar
Copyright (C) 2000-2025 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
*/
.text
#ifndef NO_METHOD_CHECK
cmpb $ M_NRV2B_LE32,methb; jne not_n2b
#endif
li bits,1<<31 // empty; force refill
li len,0
li disp,-1 // initial displacement
j top_n2b
#undef EOF
#define EOF eof_n2b
lit_n2b:
addi src,src,1; sb bytpre,(dst)
addi dst,dst,1
top_n2b:
lbu bytpre,(src) # prefetch: literal, or bottom 8 bits of offset
jnextb1yp lit_n2b
li off,1
offmore_n2b:
getnextbp(off)
jnextb0np offmore_n2b
addi off,off,-3; blt off,zero,len_n2b # use previous offset
slli off,off,8
or off,off,bytpre; addi src,src,1
xori disp,off,~0; beq disp,zero,EOF
len_n2b:
li off,1
getnextb(len); getnextb(len) # two bits; cc set on result
bne len,zero,gotlen_n2b # raw 1,2,3 ==> 2,3,4
mv len,off # len= 1, the msb
addi off,off,3-1 # raw 2.. ==> 5..
lenmore_n2b:
getnextb(len)
jnextb0n lenmore_n2b
gotlen_n2b:
li t0,0x300; lui t0,0xfffff # -0xd00
sltu retbit,t0,disp
add len,len,off; add len,len,retbit # len += off + (disp < -0xd00)
//NYI call copy@plt; .extern copy
bot_n2b: # In: 0==len
j top_n2b
#ifndef NO_METHOD_CHECK //{
not_n2b:
push %rdi; pop %rsi # src = arg1
#endif //}
# fall into daisy chain
/*
vi:ts=8:et:nowrap
*/
+22
View File
@@ -0,0 +1,22 @@
#if 0 //{ pre-defined
#define ra x1 /* return address */
#define sp x2 /* stack ptr */
#define gp x3 /* global ptr */
#define tp x4 /* thread ptr */
#endif //}
#define t0 x5
#define t1 x6
#define t2 x7
#define s0 x8
#define s1 x9
#define rv a0 /* return value */
/* NOTE: THE FIRST ARGUMENT IS arg1, NOT arg0. */
#define arg1 x10 /* same as rv */
#define arg2 x11
#define arg3 x12
#define arg4 x13
#define arg5 x14
#define arg6 x15
+211
View File
@@ -0,0 +1,211 @@
/*
; riscv64-expand.S -- decompressors for riscv64
;
; This file is part of the UPX executable compressor.
;
; Copyright (C) 1996-2021 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 1996-2021 Laszlo Molnar
; Copyright (C) 2000-2021 John F. Reiser
; All Rights Reserved.
;
; UPX and the UCL library are free software; you can redistribute them
; and/or modify them under the terms of the GNU General Public License as
; published by the Free Software Foundation; either version 2 of
; the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; see the file COPYING.
; If not, write to the Free Software Foundation, Inc.,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
; Markus F.X.J. Oberhumer Laszlo Molnar
; <markus@oberhumer.com> <ezerotven+github@gmail.com>
;
; John F. Reiser
; <jreiser@users.sourceforge.net>
;
*/
NBPW = 8
#include "arch/riscv/64/macros.S"
.macro call subr; jal \subr; .endm
section EXP_HEAD
sz_unc= 0
sz_cpr= 4
b_method= 8
b_ftid= 9
b_cto8= 10
b_extra= 11
sz_binfo= 12
f_expand: .globl f_expand // f_expand(b_info *, dst, &dstlen)
// Supervisor for de-compression, un-filter, and sync_cache
// Input to supervisor:
#define fx_src a0
#define fx_dst a1
#define fx_dstlen a2
PUSH4 fx_src,fx_dst,fx_dstlen,ra // MATCH_95 params to unfilter and sync_cache
// Input to de-compressor:
#define xsrc a0
#define xsrclen a1
#define xdst a2
#define xdstlen a3
#define meth a4
lbu meth,b_method(fx_src)
mv xdstlen,fx_dstlen // arg4
mv xdst,fx_dst // arg3
lw xsrclen,sz_cpr(xsrc) // arg2
addi xsrc,fx_src,sz_binfo // arg1
call decompress
mv a3,a0 // save retval
POP4 fx_src,fx_dst,fx_dstlen,ra // MATCH_95 fx_src,fx_dst,fx_dstlen,ra
lw fx_dst,(fx_dst) // actual length used by decompressor
PUSH3 fx_src,fx_dst,a2 // MATCH_96 params for sync_cache
lbu a3,b_ftid(sp)
lbu a2,b_cto8(sp)
beqz a3,no_unf
//NYI #include "arch/arm64/v8/bxx.S" // unfilter code; args in registers, fall-through return
no_unf:
POP2 a0,a1 // MATCH_96 dst, len
add a1,a1,a0 // lo, hi
//NYI sync_cache // in macros.S
POP1 a0 // MATCH_96 retval from decompress
ret
#undef fx_src
#undef fx_dst
#undef fx_dstlen
#undef xsrc
#undef xsrclen
#undef xdst
#undef xdstlen
decompress: // (src *, cpr_len, dst *, &dstlen);
// sections NRV2B, etc, inserted here by addLoader() from ::buildLinuxLoader()
section EXP_TAIL
// Fall through: daisy chain had no matching method
li a0,-1
mv a1,meth
ebreak // EXP_TAIL daisy chain fail
#define src a0
#define bits a1
#define dst a2
#define off a3
#define len a4
#define disp a5
#define retbit t0
#define bytpre t1
.globl eof
// sync_cache is done in tail of f_expand, after possible unfilter
// NYI: eof_n2b, eof_n2d, eof_n2e should be unified.
eof_n2b: // .globl eof_n2b .type eof_n2b,%function
eof: // MATCH_90 end of a compressed extent; need sync_cache after unfilter
ld a2,0*NBPW(sp) // &input_eof
sub a0,src,a3 // src -= eof; // return 0: good; else: bad
ld a1,1*NBPW(sp) // original dst
sub dst,dst,a1 // dst -= original dst; actual length of output
ld a1,2*NBPW(sp) // &dstlen
sw dst,(a1) // actual length used at dst XXX: 4GB
ld ra,3*NBPW(sp)
addi sp,sp,4*NBPW
ret
// WINDOWS_BACK compatibility seems to be broken
// if POP3 replaces POP2+POP1 (MATCH_92, MATCH_91)
#define srclim a7
eof_n2d: // .globl eof_n2d
eof_n2e: // .globl eof_n2e
POP2 a3,a4 // MATCH_92 r3= orig_dst; r4= plen_dst
SUB2 src,srclim // 0 if actual src length equals expected length
SUB2 dst,a3 // actual dst length
sw dst,(a4)
POP1 ra // MATCH_91
ret
eof_lzma: .globl eof_lzma
POP4 x2,x3, fp,ra // MATCH_94 x2= orig_dst; x3= plen_dst
ret
upx_mmap_and_fd: .globl upx_mmap_and_fd
// UMF_LINUX goes here
#define M_NRV2B_LE32 2
#define M_NRV2B_8 3
#define M_NRV2D_LE32 5
#define M_NRV2D_8 6
#define M_NRV2E_LE32 8
#define M_NRV2E_8 9
#define M_CL1B_LE32 11
#define M_LZMA 14
#define NO_METHOD_CHECK 1 /* subsumed here by daisy chain */
getbit:
srli retbit,bits,63 # hi bit of 64
slli bits,bits,1; beq bits,zero,refill
ret
/* On refill: prefetch next byte, for latency reduction on literals and offsets. */
refill:
lw bits,(src); addi src,src,4
srli retbit,bits,31 # hi bit of 4 bytes fetched
slli bits,bits,1; lbu bytpre,(src) # prefetch
ori bits,bits,1 # the flag bit
slli bits,bits,32 # hi 32 bits in 64-bit register
ret
/* jump on next bit {0,1} with prediction {y==>likely, n==>unlikely} */
/* Prediction omitted for now. */
#define jnextb0np jnextb0yp
#define jnextb0yp GETBITp; beq retbit,zero,
#define jnextb1np jnextb1yp
#define jnextb1yp GETBITp; bne retbit,zero,
#define GETBITp \
call getbit
/* Same, but without prefetch (not useful for length of match.) */
#define jnextb0n jnextb0y
#define jnextb0y GETBIT; beq retbit,zero,
#define jnextb1n jnextb1y
#define jnextb1y GETBIT; bne retbit,zero,
#define GETBIT \
call getbit
/* rotate next bit into bottom bit of reg */
#define getnextbp(reg) GETBITp; slli reg,reg,1; or reg,reg,retbit
#define getnextb(reg) getnextbp(reg)
section NRV2E
li t0,M_NRV2E_LE32; bne meth,t0,not_nrv2e
//NYI #include "arch/arm64/v8/nrv2e_d.S"
not_nrv2e:
section NRV2D
li t0,M_NRV2D_LE32; bne meth,t0,not_nrv2d
//NYI #include "arch/arm64/v8/nrv2d_d.S"
not_nrv2d:
section NRV2B
li t0,M_NRV2B_LE32; bne meth,t0,not_nrv2b
#include "arch/riscv/64/nrv2b_d.S"
not_nrv2b:
section LZMA_DAISY
li t0,M_LZMA; bne meth,t0,not_lzma
//NYI #include "arch/arm64/v8/lzma_d.S"
not_lzma:
+287
View File
@@ -0,0 +1,287 @@
/* riscv64-linux.elf-entry.S -- Linux program entry point & decompressor (Elf binary)
*
* This file is part of the UPX executable compressor.
*
* Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
* Copyright (C) 1996-2025 Laszlo Molnar
* Copyright (C) 2000-2025 John F. Reiser
* All Rights Reserved.
*
* UPX and the UCL library are free software; you can redistribute them
* and/or modify them under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING.
* If not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Markus F.X.J. Oberhumer Laszlo Molnar
* <markus@oberhumer.com> <ezerotven+github@gmail.com>
*
* John F. Reiser
* <jreiser@users.sourceforge.net>
*/
#include "arch/riscv/64/macros.S"
#include "arch/riscv/64/regs.h"
NBPW= 8
/* These from /usr/include/unistd_64.h */
__NR_close= 57
__NR_exit= 93
__NR_ftruncate= 64
__NR_memfd_create= 279
__NR_mmap= 222
__NR_mprotect= 226
__NR_msync= 227
__NR_openat= 56
__NR_write= 64
sz_Ehdr= 64
e_phnum= 56
sz_Phdr= 56
sz_l_info= 12
l_lsize= 8
sz_p_info= 12
sz_b_info= 12
sz_unc= 0
sz_cpr= 4
b_method= 8
AT_PAGESZ= 6
PROT_READ= 1
PROT_WRITE= 2
PROT_EXEC= 4
MAP_SHARED= 1
MAP_PRIVATE= 2
MAP_FIXED= 0x10
MAP_ANONYMOUS= 0x20
MFD_EXEC= 0x0010
SYS_mmap= 9 // 64-bit mode only!
FD_stderr= 2
M_NRV2B_LE32=2 // ../conf.h
M_NRV2D_LE32=5
M_NRV2E_LE32=8
// https://www.uclibc.org/docs/psABI-x86_64.pdf
section ELFMAINX
sz_pack2= .-4
_start: .globl _start
//// nop; int3 # uncomment for debugging
ld s0,0(sp) // argc
addi s1,sp,NBPW // argv
//NYI lea cancel_dummy(%rip),%r15
section ELFMAINX2
// same as in riscv64-linux.elf-fold.S
F_FRAME= 8*NBPW
F_EOF= 7*NBPW
F_ENTR= 6*NBPW; F_PMASK= F_ENTR
F_RDX= 5*NBPW
F_LENU= 4*NBPW
F_ADRU= 3*NBPW
F_ELFA= 2*NBPW
F_LENX= 1*NBPW
F_ADRX= 0*NBPW
D_FOLD= 2*NBPW // .data space at start of unfold
D_PMASK= 0*NBPW
D_XSIGSEGV= 1*NBPW
// find auxv
slli t0,s0,3 // NBPW * argc
add t0,t0,a1 // end argv
0: // find end of env
addi t0,t0,NBPW // &env[k]
ld t1,(t0); bnez t1,0b
// find AT_PAGESZ in auxv
addi t0,t0,NBPW // &auxv
li a7,AT_PAGESZ // desired key
0:
ld t1,(t0); ld t2,NBPW(t0); addi t0,t0,2*NBPW
beq t1,a7,1f // found it
bne t1,zero,0b // keep searching
li t2,0x1000 // default PAGE_SIZE
1:
sub a7,zero,t2 // PAGE_MASK
2:
// Create anonymous temporary file on mfd; like upxfd_create
jal arg1,0f
str_upx:
.asciz "upx"
0:
// lla arg1,str_upx
li arg2,MFD_EXEC // flags
syscall __NR_memfd_create
bne a0,zero,ok_memfd // success
no_memfd: // so try /dev/shm
O_RDWR= 2
O_DIRECTORY= 0200000 // 0x010000
O_TMPFILE= 020000000 // 0x400000
# lla arg1,str_devmem
jal arg1,0f
str_devmem:
.asciz "/dev/mem"
.balign 4
0:
li arg2,0700 // mode
li arg3,O_RDWR | O_TMPFILE | O_DIRECTORY
syscall __NR_openat
ok_memfd:
#define mfd s2
mv mfd,rv
lla t0,sz_pack2
#define elfa s3
lw t1,(t0); sub elfa,t0,t1
#define binf s4
lla binf,4+o_binfo
#define lenu s5
lw lenu,sz_unc(binf)
#define szp2 s6
#define lenx s7
sub lenx,szp2,binf
#define adrx s8
add adrx,elfa,binf
#define old_sp s9
mv old_sp,sp
// alloca()
sub sp,sp,lenu; andi sp,sp,-2*NBPW
// Decompress the rest of this loader, and jump to it.
#define dst a2
#define src a0
#define lsrc a1
mv dst,sp
lw lsrc,sz_cpr(binf)
lbu t0,b_method(binf); li t1,M_NRV2B_LE32|(0<<8); beq t0,t1,0f; ebreak
0:
add t0,lsrc,src; sw t0,F_EOF(old_sp)
//%rsp:
// MATCH_10 old_sp
// MATCH_11 &input_eof
//%rbp === old_sp: array of F_FRAME
#define src a0
#define bits a1
#define dst a2
#define off a3
#define len a4
#define disp a5
#define retbit t0
#define bytpre t1
/* jump on next bit {0,1} with prediction {y==>likely, n==>unlikely} */
/* Prediction omitted for now. */
#define jnextb0np jnextb0yp
#define jnextb0yp GETBITp; beq retbit,zero,
#define jnextb1np jnextb1yp
#define jnextb1yp GETBITp; bne retbit,zero,
#define GETBITp \
call getbit
/* Same, but without prefetch (not useful for length of match.) */
#define jnextb0n jnextb0y
#define jnextb0y GETBIT; beq retbit,zero,
#define jnextb1n jnextb1y
#define jnextb1y GETBIT; bne retbit,zero,
#define GETBIT \
call getbit
/* rotate next bit into bottom bit of reg */
#define getnextbp(reg) GETBITp; slli reg,reg,1; or reg,reg,retbit
#define getnextb(reg) getnextbp(reg)
// We already checked the method and no filter.
#define NO_METHOD_CHECK 1
#include "arch/riscv/64/nrv2b_d.S"
getbit:
srli retbit,bits,63 # hi bit of 64
slli bits,bits,1; beq bits,zero,refill
ret
/* On refill: prefetch next byte, for latency reduction on literals and offsets. */
refill:
lw bits,(src); addi src,src,4
srli retbit,bits,31 # hi bit of 4 bytes fetched
slli bits,bits,1; lbu bytpre,(src) # prefetch
ori bits,bits,1 # the flag bit
slli bits,bits,32 # hi 32 bits in 64-bit register
ret
n2b_EOFbad:
ebreak
eof_n2b:
lw t0,F_EOF(old_sp)
bne t0,src,n2b_EOFbad
// Write de-compressed 'fold' to file
lw t0,F_PMASK(old_sp); sw t0,D_PMASK(sp) // propagate PAGE_MASK
lwu arg3,F_LENU(old_sp)
mv arg2,sp
mv arg1,mfd
mv s2,arg3 // LENU
0: // /dev/shm might be restricted to 8KiB at a time!
syscall __NR_write
add arg2,arg2,rv // ptr += count
sub arg3,arg3,rv // decrement count
bnez arg3,0b // not finished
// de-alloca()
mv sp,old_sp
// Map unfolded code the SELinux way
li arg6,0 // offset
mv arg5,mfd
li arg4,MAP_SHARED
li arg3,PROT_READ|PROT_EXEC // FIXME: add PROT_WRITE for DEBUG only
mv arg2,s2 // LENU
li arg1,0 // (%arg1)dst = 0; // kernel chooses addr
syscall __NR_mmap
sw rv,F_ADRU(old_sp)
mv arg1,mfd
syscall __NR_close
// Use the copy.
ld a0,F_ADRU(sp) //
addi a0,a0,D_FOLD // beyond .data
jr a0 // goto unfolded stub
// IDENTSTR goes here
section ELFMAINZ
.balign 4
o_binfo:
.long O_BINFO // offset of b_info for .text | is_ptinerp | unmap_all_pages
FOLD:
// { b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...}
/*__XTHEENDX__*/
/* vim:set ts=8 sw=8 et: */
+340
View File
@@ -0,0 +1,340 @@
/* riscv64-linux.elf-fold.S -- linkage to C code to process Elf binary
*
* This file is part of the UPX executable compressor.
*
* Copyright (C) 2000-2025 John F. Reiser
* All Rights Reserved.
*
* UPX and the UCL library are free software; you can redistribute them
* and/or modify them under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING.
* If not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Markus F.X.J. Oberhumer Laszlo Molnar
* <markus@oberhumer.com> <ezerotven+github@gmail.com>
*
* John F. Reiser
* <jreiser@users.sourceforge.net>
*/
NBPW= 8
#include "arch/riscv/64/macros.S"
#include "arch/riscv/64/regs.h"
PATH_MAX= 4096 // /usr/include/linux/limits.h
sz_b_info= 12
sz_unc= 0
sz_cpr= 4
sz_l_info= 12
sz_p_info= 12
MAP_PRIVATE= 0x02
MAP_FIXED= 0x10
PROT_READ= 0x1
O_RDONLY= 0
FD_CWD= -100
OVERHEAD=2048
/* 64-bit mode only! */
__NR_read= 0
__NR_write= 1
__NR_openat= 2 //NYI
__NR_close= 3
__NR_mmap= 9
__NR_mprotect= 10
__NR_munmap= 11
__NR_msync= 26 // 0x1a
MS_SYNC= 4
__NR_brk= 12
__NR_memfd_create= 0x13f // 319
__NR_ftruncate= 0x4d // 77
__NR_exit= 60
__NR_readlink= 89
unmap_all_pages= (1<<1)
is_ptinterp= (1<<0)
// same as in riscv64-linux.elf-entry.S
F_FRAME= 8*NBPW
F_EOF= 7*NBPW // sometimes omitted from FRAME
F_ENTR= 6*NBPW; F_PMASK= F_ENTR
F_RDX= 5*NBPW
F_LENU= 4*NBPW
F_ADRU= 3*NBPW
F_ELFA= 2*NBPW
F_LENX= 1*NBPW
F_ADRX= 0*NBPW
D_FOLD= 2*NBPW // .data space at start of unfold
D_PMASK= 0*NBPW
D_XSIGSEGV= 1*NBPW
#define rsp sp /* x2 */
#define rax a0 /* x10 */
#define rbx s1 /* x9 */
#define rbp s0 /* x8 */
#define rcx t2 /* x7 */
#define rdx t1 /* x6 */
#define r12 t0 /* x5 */
#define rdi a5 /* x15 */
#define rsi a4 /* x14 */
#define r15 a3 /* x13 */
#define r14 a2 /* x12 */
#define r13 a1 /* x11 */
#define rfd rbp /* file descriptor for /proc/self/exe */
.balign 8
PAGE_MASK: .quad -1<<12 // default
cancel_sigsegv: .quad 0 // subroutine that cancels sigaction(SIGSEGV,)
// IN: [ADRX,+LENX): compressed data; [ADRU,+LENU): expanded fold (w/ upx_main2)
// %rsp= %rbp= &F_ADRX; %r13= O_BINFO | is_ptinterp | unmap_all_pages
// no 'section', thus '.text'; also loaded first in riscv64-linux.elf-fold.bin.
// Code from riscv64-linux2.elf-main.c is also .text, and is next.
fold_begin:
//// ebreak # DEBUG
// copy is_interp bit from r13 to F_ELFA(rbp)
ld t0,F_ELFA(rbp); andi t1,r13,is_ptinterp; or t0,t0,t1;
sd t0,F_ELFA(rbp)
// if !unmap_all_pages then need space on stack for result of readlink("/proc/self/exe",...)
mv rsi,rsp
andi t0,r13,unmap_all_pages
bnez t0,5f; li t0,PATH_MAX; sub rsp,rsp,t0; 0:
mv rdi,rsp
li rcx,8
0: // copy down ADRX,LDRX,ELFA,ADRU,LENU,rdx,%entry,argc
ld t0,(rsi); addi rsi,rsi,NBPW; addi rcx,rcx,-1
sd t0,(rdi); addi rdi,rdi,NBPW; bnez rcx,0b
5:
0: // copy down argv
ld t0,(rsi); addi rsi,rsi,NBPW
sd t0,(rdi); addi rdi,rdi,NBPW
bnez t0,0b
mv r14,rdi // remember &new_env[0]
andi t0,r13,unmap_all_pages; bnez t0,0f
sd zero,(rdi); addi rdi,rdi,NBPW // space for new_env[0]
0: // find old Elf64_auxv
ld t0,(rsi); sd t0,(rdi); bnez t0,0b
mv t2,rdi # &old Elf64_auxv
0: // find &strings (beyond auxv)
ld t0,(rsi); ld t1,NBPW(rsi); addi rsi,rsi,2*NBPW
sd t0,(rdi); sd t1,NBPW(rdi); addi rdi,rdi,2*NBPW
bnez t0,0b
mv r15,rdi # beyond auxv
mv r13,rsi # beginning of strings
sub rdi,rdi,t2 # -length of auxv
andi t0,r13,unmap_all_pages; beqz t0,env_pse
ori rfd,rfd,~0; mv r14,rdi; j no_env_pse # no fd; beyond auxv
env_pse:
li arg3,0 # O_RdONLY
lla arg2,proc_self_exe
li arg1,FD_CWD
call openat; mv rfd,rv # fd
li arg3,-1+ PATH_MAX # buflen
mv arg2,sp # buffer
lla arg1,proc_self_exe
syscall __NR_readlink; bgez rv,0f
// readlink() failed. Set the result equal to the argument.
lla arg2,proc_self_exe # failure result= "/proc/self/exe"
li rcx,15 # sizeof "/proc/self/exe"
0:
// std
addi rdi,r13,-1 # dst last byte
sb zero,(rdi) # terminate
addi rsi,arg2,-1
add rsi,rsi,rcx # src last byte
0: // slide up (hi end goes first)
lbu t0,(rsi); addi rsi,rsi,-1; addi rcx,rcx,-1
sb t0,(rdi); addi rdi,rdi,-1; bnez rcx,0b
// add new env " =..."
li t0,' '; sb t0,-3(rdi); sb t0,-2(rdi); sb t0,-1(rdi); addi rdi,rdi,-3
sd rdi,(r14) # new_env[0]
andi rdi,rdi,-NBPW # align
mv rcx,r15
sub rsp,rsp,rcx # byte count
addi rdi,rdi,-NBPW # &last qword of new auxv
addi rsi,r15,-NBPW # &last qword of old auxv
// end of auxv must move by even number of NBPW
mv t0,rdi
xor t0,t0,rsi
andi t0,t0,NBPW
sub rdi,rdi,t0
mv r14,rdi # &last qword of new auxv
srl rcx,rcx,3
0:
ld t0,(rsi); addi rsi,rsi,-NBPW; addi rcx,rcx,-1
sd t0,(rdi); addi rdi,rdi,-NBPW; bnez rcx,0b
addi rsp,rdi,NBPW
// cld
add arg4,r14,r12; addi arg4,arg4,NBPW # &new Elf64_auxv %r12 dead
no_env_pse:
ld arg1,F_ADRX(rbp)
ld arg2,F_LENX(rbp)
andi arg1,arg1,~(is_ptinterp | unmap_all_pages)
ld arg5,F_ELFA(rbp) # ELFA | is_ptinterp
andi t0,arg5,is_ptinterp; or arg4,arg4,t0 # transfer is_ptinterp to &new_ELF64_auxv
sub arg5,arg5,t0 # and clear from ELFA
mv r13,arg5 # save ELFA
addi rsp,rsp,-OVERHEAD
mv arg3,rsp # &ELf64_Ehdr temporary space
call upx_main2 # Out: rv= entry
// entry= upx_main2(
// b_info *arg1, {%rdi}
// total_size arg2, {%rsi}
// Elf64_Ehdr *arg3, {%rdx}
// Elf32_Auxv_t *arg4, {%rcx}
// Elf64_Addr elfaddr {%r8}
// )
// rsp/ {OVERHEAD},ADRU,LENU,rdx,%entry, argc,argv,0,envp,0,auxv,0,strings
li t0,OVERHEAD
add rsp,rsp,t0 # remove Elf64_Ehdr temporary space
#define r_fd ebx
ld rfd,(rbp) //NYI
sd rv,3*NBPW(rsp) # entry
//NYI call *cancel_sigsegv(%rip)
sz_Ehdr= 8*NBPW
e_type= 16
ET_EXEC= 2
sz_Phdr= 7*NBPW
p_memsz= 5*NBPW
// Discard pages of compressed data (includes [ADRX,+LENX) )
addi arg2,r13,p_memsz+sz_Phdr+sz_Ehdr # Phdr[C_TEXT= 1].p_memsz
//cmpw $ET_EXEC, e_type(%r13); jne 1f
mv arg1,r13; call brk // also sets the brk
1:
mv arg1,r13; call munmap # discard C_TEXT compressed data
// Map 1 page of /proc/self/exe so that the symlink does not disappear.
bltz rfd,no_pse_map
li arg6,0 # 0 offset
mv arg5,rfd
li arg4,MAP_PRIVATE
li arg3,PROT_READ
li arg2,1<<12
li arg1,0
call mmap
mv arg1,rfd
call close
no_pse_map:
ld arg1,F_ADRU(rbp) # ADRU: unfolded upx_main2 etc.
ld arg2,F_LENU(rbp)
li a7,__NR_munmap
jr r14 # goto: syscall; pop %rdx; ret
get_page_mask: .globl get_page_mask
ld rv,PAGE_MASK
ret
section SYSCALLS
my_bkpt: .globl my_bkpt
ebreak // my_bkpt
ret
proc_self_exe:
.asciz "/proc/self/exe"
.balign 4
upxfd_create: .globl upxfd_create // (char *tag, unsigned flags)
0: // try memfd_create
syscall __NR_memfd_create; j ok_memfd //NYI
O_RDWR= 2
O_DIRECTORY= 0200000 // 0x010000
O_TMPFILE= 020000000 // 0x400000
li arg4,0700 # mode
li arg3,O_RDWR|O_DIRECTORY|O_TMPFILE
la arg3,dev_shm
li arg1,FD_CWD
syscall __NR_openat
ok_memfd:
ret
Pmap: .globl Pmap // page-align the lo end
ld t0,PAGE_MASK; xori t0,t0,~0 // frag mask
and arg1,arg1,t0 // frag
sub arg1,arg1,t0
add arg2,arg2,t0
mmap: .globl mmap
li a7,__NR_mmap
sysgo:
sys_check:
ebreak // sys_check
syscall 0 //NYI
//NYI syscall error checking
ret
Psync: .globl Psync
li a7,__NR_msync
j 5f
Pprotect: .globl Pprotect
li a7,__NR_mprotect
j 5f
Punmap: .globl Punmap // page-align the lo end
li a7,__NR_munmap
5:
ld t0,PAGE_MASK; xori t0,t0,~0 // frag mask
and t0,t0,arg1 // frag
sub arg1,arg1,t0
add arg2,arg2,t0
j sysgo
munmap: .globl munmap
li a7,__NR_munmap; 5: j 5f
exit: .globl exit
li a7,__NR_exit; 5: j 5f
brk: .globl brk
li a7,__NR_brk; 5: j 5f
close: .globl close
li a7,__NR_close; 5: j 5f
ftruncate: .globl ftruncate
li a7,__NR_ftruncate; 5: j 5f
open: .globl openat
li a7,__NR_openat; 5: j 5f
mprotect: .globl mprotect
li a7,__NR_mprotect; 5: j 5f
msync: .globl msync
li a7,__NR_msync; 5: j 5f
Pwrite: .globl Pwrite
write: .globl write
li a7,__NR_write; 5: j 5f
read: .globl read
li a7,__NR_read; 5: j sysgo
// vim:set ts=8 sw=8 et:
+37
View File
@@ -0,0 +1,37 @@
/* riscv64-linux.elf-fold.lds -- static linker script to build riscv64-linux.elf-fold.bin
This file is part of the UPX executable compressor.
Copyright (C) 2000-2025 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
*/
OUTPUT_FORMAT("elf64-littleriscv64", "elf64-littleriscv64", "elf64-littleriscv64")
OUTPUT_ARCH(riscv64)
SECTIONS
{
. = SIZEOF_HEADERS;
}
@@ -0,0 +1,5 @@
.section HUMF_A, "ax"
j upx_mmap_and_fd_android
.section HUMF_L, "ax"
j upx_mmap_and_fd_linux
+1
View File
@@ -0,0 +1 @@
#include "amd64-linux.elf-main2.c"
+10
View File
@@ -74,6 +74,16 @@ extern void my_bkpt(void const *, ...);
/*und*/ : "x30"); \
str; \
})
#elif defined(__riscv) //}{
#define ANDROID_FRIEND 0
#define addr_string(string) ({ \
char const *str; \
asm("jal 0f; .string \"" string "\"; .balign 4; 0: mv %0,ra" \
/*out*/ : "=r"(str) \
/* in*/ : \
/*und*/ : "x30"); \
str; \
})
#else //}{
#define ANDROID_FRIEND 0
#error addr_string
+16 -32
View File
@@ -192,74 +192,58 @@ forceinline constexpr void set_le64(byte *p, upx_uint64_t v) noexcept {
forceinline constexpr upx_uint16_t get_ne16(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN)
return get_be16(p);
#elif (ACC_ABI_LITTLE_ENDIAN)
return get_le16(p);
#else
#error "ACC_ABI_ENDIAN"
return get_le16(p);
#endif
}
forceinline constexpr upx_uint32_t get_ne24(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN)
return get_be24(p);
#elif (ACC_ABI_LITTLE_ENDIAN)
return get_le24(p);
#else
#error "ACC_ABI_ENDIAN"
return get_le24(p);
#endif
}
forceinline constexpr upx_uint32_t get_ne32(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN)
return get_be32(p);
#elif (ACC_ABI_LITTLE_ENDIAN)
return get_le32(p);
#else
#error "ACC_ABI_ENDIAN"
return get_le32(p);
#endif
}
forceinline constexpr upx_uint64_t get_ne64(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN)
return get_be64(p);
#elif (ACC_ABI_LITTLE_ENDIAN)
return get_le64(p);
#else
#error "ACC_ABI_ENDIAN"
return get_le64(p);
#endif
}
forceinline constexpr void set_ne16(byte *p, upx_uint16_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN)
set_be16(p, v);
#elif (ACC_ABI_LITTLE_ENDIAN)
set_le16(p, v);
#else
#error "ACC_ABI_ENDIAN"
set_le16(p, v);
#endif
}
forceinline constexpr void set_ne24(byte *p, upx_uint32_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN)
set_be24(p, v);
#elif (ACC_ABI_LITTLE_ENDIAN)
set_le24(p, v);
#else
#error "ACC_ABI_ENDIAN"
set_le24(p, v);
#endif
}
forceinline constexpr void set_ne32(byte *p, upx_uint32_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN)
set_be32(p, v);
#elif (ACC_ABI_LITTLE_ENDIAN)
set_le32(p, v);
#else
#error "ACC_ABI_ENDIAN"
set_le32(p, v);
#endif
}
forceinline constexpr void set_ne64(byte *p, upx_uint64_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN)
set_be64(p, v);
#elif (ACC_ABI_LITTLE_ENDIAN)
set_le64(p, v);
#else
#error "ACC_ABI_ENDIAN"
set_le64(p, v);
#endif
}
@@ -373,17 +357,16 @@ private:
#define UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL(Klass) private:
#endif
class NonCopyAble {
class noncopyable {
protected:
forceinline constexpr NonCopyAble() noexcept {}
forceinline constexpr noncopyable() noexcept {}
#if __cplusplus >= 202002L
forceinline constexpr ~NonCopyAble() noexcept = default;
forceinline constexpr ~noncopyable() noexcept = default;
#else
forceinline ~NonCopyAble() noexcept = default;
forceinline ~noncopyable() noexcept = default;
#endif
UPX_CXX_DISABLE_COPY_MOVE(NonCopyAble)
UPX_CXX_DISABLE_COPY_MOVE(noncopyable)
};
typedef NonCopyAble noncopyable;
/*************************************************************************
// <type_traits>
@@ -494,6 +477,7 @@ forceinline constexpr T wrapping_add(const T &a, const T &b) noexcept {
typedef std::make_unsigned_t<T> U;
return T(U(a) + U(b));
}
template <class T>
forceinline constexpr T wrapping_sub(const T &a, const T &b) noexcept {
static_assert(std::is_integral_v<T>);
@@ -623,10 +607,10 @@ struct TriBool final {
static constexpr bool is_third_true = IsThirdTrue;
// types
typedef T underlying_type;
typedef decltype(T(0) + T(0)) promoted_type;
enum value_type : underlying_type { False = 0, True = 1, Third = 2 };
static_assert(std::is_integral_v<underlying_type>);
typedef decltype(T(0) + T(0)) promoted_type;
static_assert(std::is_integral_v<promoted_type>);
enum value_type : underlying_type { False = 0, True = 1, Third = 2 };
static_assert(sizeof(value_type) == sizeof(underlying_type));
static_assert(sizeof(underlying_type) <= sizeof(promoted_type));
// constructors
+97 -226
View File
@@ -33,8 +33,7 @@
// extra functions to reduce dependency on membuffer.h
void *membuffer_get_void_ptr(MemBuffer &mb) noexcept { return mb.getVoidPtr(); }
const void *membuffer_get_void_ptr(const MemBuffer &mb) noexcept { return mb.getVoidPtr(); }
unsigned membuffer_get_size_in_bytes(const MemBuffer &mb) noexcept { return mb.getSizeInBytes(); }
unsigned membuffer_get_size(MemBuffer &mb) noexcept { return mb.getSize(); }
/*static*/ MemBuffer::Stats MemBuffer::stats;
@@ -62,7 +61,7 @@ static noinline void init_use_simple_mcheck() noexcept {
}
use_simple_mcheck_flag = r;
}
static noinline bool use_simple_mcheck() noexcept {
static bool use_simple_mcheck() noexcept {
static upx_std_once_flag init_done;
upx_std_call_once(init_done, init_use_simple_mcheck);
// NOTE: clang-analyzer-unix.Malloc does not know that this flag is "constant"; see below
@@ -84,6 +83,22 @@ MemBuffer::MemBuffer(upx_uint64_t bytes) may_throw : MemBufferBase<byte>() {
MemBuffer::~MemBuffer() noexcept { this->dealloc(); }
// similar to BoundedPtr, except checks only at creation
// skip == offset, take == size_in_bytes
void *MemBuffer::subref_impl(const char *errfmt, size_t skip, size_t take) {
debug_set(debug.last_return_address_subref, upx_return_address());
// check overrun and wrap-around
if (skip + take > size_in_bytes || skip + take < skip) {
char buf[100];
// printf is using unsigned formatting
if (!errfmt || !errfmt[0])
errfmt = "bad subref %#x %#x";
upx_safe_snprintf(buf, sizeof(buf), errfmt, (unsigned) skip, (unsigned) take);
throwCantPack(buf);
}
return ptr + skip;
}
/*static*/
unsigned MemBuffer::getSizeForCompression(unsigned uncompressed_size, unsigned extra) {
if (uncompressed_size == 0)
@@ -119,31 +134,13 @@ void MemBuffer::allocForDecompression(unsigned uncompressed_size, unsigned extra
debug_set(debug.last_return_address_alloc, upx_return_address());
}
void MemBuffer::fill(size_t off, size_t bytes, int value) {
void MemBuffer::fill(unsigned off, unsigned len, int value) {
debug_set(debug.last_return_address_fill, upx_return_address());
checkState();
// check overrun and wrap-around
if very_unlikely (off + bytes > size_in_bytes || off + bytes < off)
if (off > size_in_bytes || len > size_in_bytes || off + len > size_in_bytes)
throwCantPack("MemBuffer::fill out of range; take care!");
if (bytes > 0)
memset(ptr + off, value, bytes);
}
// similar to BoundedPtr, except checks only at creation
// skip == offset, take == size_in_bytes
void *MemBuffer::subref_impl(const char *errfmt, size_t skip, size_t take) {
debug_set(debug.last_return_address_subref, upx_return_address());
checkState();
// check overrun and wrap-around
if very_unlikely (skip + take > size_in_bytes || skip + take < skip) {
char buf[100];
// printf is using unsigned formatting
if (!errfmt || !errfmt[0])
errfmt = "bad subref %#x %#x";
upx_safe_snprintf(buf, sizeof(buf), errfmt, (unsigned) skip, (unsigned) take);
throwCantPack(buf);
}
return ptr + skip;
if (len > 0)
memset(ptr + off, value, len);
}
/*************************************************************************
@@ -156,21 +153,21 @@ void *MemBuffer::subref_impl(const char *errfmt, size_t skip, size_t take) {
#define MAGIC2(p) ((PTR_BITS32(p) ^ 0xfefdbeeb ^ 0x88224411) | 1)
void MemBuffer::checkState() const may_throw {
if very_unlikely (ptr == nullptr)
if (!ptr)
throwInternalError("block not allocated");
assert(size_in_bytes > 0);
if (use_simple_mcheck()) {
const byte *p = (const byte *) ptr;
if very_unlikely (get_ne32(p - 4) != MAGIC1(p))
if (get_ne32(p - 4) != MAGIC1(p))
throwInternalError("memory clobbered before allocated block 1");
if very_unlikely (get_ne32(p - 8) != size_in_bytes)
if (get_ne32(p - 8) != size_in_bytes)
throwInternalError("memory clobbered before allocated block 2");
if very_unlikely (get_ne32(p + size_in_bytes) != MAGIC2(p))
if (get_ne32(p + size_in_bytes) != MAGIC2(p))
throwInternalError("memory clobbered past end of allocated block");
}
}
void MemBuffer::alloc(const upx_uint64_t bytes) may_throw {
void MemBuffer::alloc(upx_uint64_t bytes) may_throw {
// INFO: we don't automatically free a used buffer
assert(ptr == nullptr);
assert(size_in_bytes == 0);
@@ -186,7 +183,7 @@ void MemBuffer::alloc(const upx_uint64_t bytes) may_throw {
NO_printf("MemBuffer::alloc %llu: %p\n", bytes, p);
if (!p)
throwOutOfMemoryException();
size_in_bytes = size_type(bytes);
size_in_bytes = ACC_ICONV(unsigned, bytes);
if (use_simple_mcheck()) {
p += 16;
// store magic constants to detect buffer overruns
@@ -209,60 +206,49 @@ void MemBuffer::alloc(const upx_uint64_t bytes) may_throw {
}
void MemBuffer::dealloc() noexcept {
if (ptr == nullptr) {
assert_noexcept(size_in_bytes == 0);
return;
}
debug_set(debug.last_return_address_dealloc, upx_return_address());
if (ptr != nullptr) {
debug_set(debug.last_return_address_dealloc, upx_return_address());
#if DEBUG || 1
// info: calling checkState() here violates "noexcept", so we need a try block
bool shall_check = true;
// bool shall_check = (std::uncaught_exceptions() == 0); // only if not unwinding
// TODO later: add a priority() method to class Throwable
if (shall_check) {
try {
checkState();
} catch (const Throwable &e) {
printErr("unknown", e);
std::terminate();
} catch (...) {
std::terminate();
// info: calling checkState() here violates "noexcept", so we need a try block
bool shall_check = true;
// bool shall_check = (std::uncaught_exceptions() == 0); // only if not unwinding
// TODO later: add a priority() method to class Throwable
if (shall_check) {
try {
checkState();
} catch (const Throwable &e) {
printErr("unknown", e);
std::terminate();
} catch (...) {
std::terminate();
}
}
}
#endif
stats.global_dealloc_counter += 1;
stats.global_total_active_bytes -= size_in_bytes;
if (use_simple_mcheck()) {
byte *p = (byte *) ptr;
// clear magic constants
set_ne32(p - 8, 0);
set_ne32(p - 4, 0);
set_ne32(p + size_in_bytes, 0);
set_ne32(p + size_in_bytes + 4, 0);
//
::free(p - 16); // NOLINT(clang-analyzer-unix.Malloc) // see NOTE above
stats.global_dealloc_counter += 1;
stats.global_total_active_bytes -= size_in_bytes;
if (use_simple_mcheck()) {
byte *p = (byte *) ptr;
// clear magic constants
set_ne32(p - 8, 0);
set_ne32(p - 4, 0);
set_ne32(p + size_in_bytes, 0);
set_ne32(p + size_in_bytes + 4, 0);
//
::free(p - 16); // NOLINT(clang-analyzer-unix.Malloc) // see NOTE above
} else {
::free(ptr); // NOLINT(clang-analyzer-unix.Malloc) // see NOTE above
}
ptr = nullptr;
size_in_bytes = 0;
} else {
::free(ptr); // NOLINT(clang-analyzer-unix.Malloc) // see NOTE above
assert_noexcept(size_in_bytes == 0);
}
ptr = nullptr;
size_in_bytes = 0;
}
/*************************************************************************
//
**************************************************************************/
TEST_CASE("MemBuffer unused 1") {
MemBuffer mb;
(void) mb;
}
TEST_CASE("MemBuffer unused 2") {
MemBuffer mb;
CHECK(mb.raw_ptr() == nullptr);
CHECK(mb.raw_size_in_bytes() == 0);
}
TEST_CASE("MemBuffer core") {
constexpr size_t N = 64;
MemBuffer mb;
@@ -306,160 +292,45 @@ TEST_CASE("MemBuffer core") {
}
TEST_CASE("MemBuffer global overloads") {
{
MemBuffer mb1(1);
MemBuffer mb4(4);
mb1.clear();
mb4.clear();
CHECK(memcmp(mb1, "\x00", 1) == 0);
CHECK_THROWS(memcmp(mb1, "\x00\x00", 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp("\x00\x00", mb1, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(mb1, mb4, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(mb4, mb1, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_NOTHROW(memset(mb1, 255, 1));
CHECK_THROWS(memset(mb1, 254, 2));
CHECK(mb1[0] == 255);
}
MemBuffer mb(1);
MemBuffer mb4(4);
mb.clear();
mb4.clear();
CHECK(memcmp(mb, "\x00", 1) == 0);
CHECK_THROWS(memcmp(mb, "\x00\x00", 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp("\x00\x00", mb, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(mb, mb4, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(mb4, mb, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_NOTHROW(memset(mb, 255, 1));
CHECK_THROWS(memset(mb, 254, 2));
CHECK(mb[0] == 255);
CHECK_THROWS(get_be16(mb));
CHECK_THROWS(get_be32(mb));
CHECK_THROWS(get_be64(mb));
CHECK_THROWS(get_le16(mb));
CHECK_THROWS(get_le32(mb));
CHECK_THROWS(get_le64(mb));
CHECK_NOTHROW(get_be16(mb4));
CHECK_NOTHROW(get_be32(mb4));
CHECK_THROWS(get_be64(mb4));
CHECK_NOTHROW(get_le16(mb4));
CHECK_NOTHROW(get_le32(mb4));
CHECK_THROWS(get_le64(mb4));
CHECK_NOTHROW(set_be32(mb4, 0));
CHECK_THROWS(set_be64(mb4, 0));
CHECK_NOTHROW(set_le32(mb4, 0));
CHECK_THROWS(set_le64(mb4, 0));
}
for (size_t i = 1; i <= 16; i++) {
MemBuffer mb(i);
mb.clear();
TEST_CASE("MemBuffer unused 1") {
MemBuffer mb;
CHECK(mb.raw_ptr() == nullptr);
CHECK(mb.raw_size_in_bytes() == 0);
}
if (i < 2) {
CHECK_THROWS(get_ne16(mb));
CHECK_THROWS(get_be16(mb));
CHECK_THROWS(get_le16(mb));
CHECK_THROWS(set_ne16(mb, 0));
CHECK_THROWS(set_be16(mb, 0));
CHECK_THROWS(set_le16(mb, 0));
} else {
CHECK_NOTHROW(get_ne16(mb));
CHECK_NOTHROW(get_be16(mb));
CHECK_NOTHROW(get_le16(mb));
CHECK_NOTHROW(set_ne16(mb, 0));
CHECK_NOTHROW(set_be16(mb, 0));
CHECK_NOTHROW(set_le16(mb, 0));
}
if (i < 3) {
CHECK_THROWS(get_ne24(mb));
CHECK_THROWS(get_be24(mb));
CHECK_THROWS(get_le24(mb));
CHECK_THROWS(set_ne24(mb, 0));
CHECK_THROWS(set_be24(mb, 0));
CHECK_THROWS(set_le24(mb, 0));
} else {
CHECK_NOTHROW(get_ne24(mb));
CHECK_NOTHROW(get_be24(mb));
CHECK_NOTHROW(get_le24(mb));
CHECK_NOTHROW(set_ne24(mb, 0));
CHECK_NOTHROW(set_be24(mb, 0));
CHECK_NOTHROW(set_le24(mb, 0));
}
if (i < 4) {
CHECK_THROWS(get_ne32(mb));
CHECK_THROWS(get_be32(mb));
CHECK_THROWS(get_le32(mb));
CHECK_THROWS(set_ne32(mb, 0));
CHECK_THROWS(set_be32(mb, 0));
CHECK_THROWS(set_le32(mb, 0));
} else {
CHECK_NOTHROW(get_ne32(mb));
CHECK_NOTHROW(get_be32(mb));
CHECK_NOTHROW(get_le32(mb));
CHECK_NOTHROW(set_ne32(mb, 0));
CHECK_NOTHROW(set_be32(mb, 0));
CHECK_NOTHROW(set_le32(mb, 0));
}
if (i < 8) {
CHECK_THROWS(get_ne64(mb));
CHECK_THROWS(get_be64(mb));
CHECK_THROWS(get_le64(mb));
CHECK_THROWS(set_ne64(mb, 0));
CHECK_THROWS(set_be64(mb, 0));
CHECK_THROWS(set_le64(mb, 0));
} else {
CHECK_NOTHROW(get_ne64(mb));
CHECK_NOTHROW(get_be64(mb));
CHECK_NOTHROW(get_le64(mb));
CHECK_NOTHROW(set_ne64(mb, 0));
CHECK_NOTHROW(set_be64(mb, 0));
CHECK_NOTHROW(set_le64(mb, 0));
}
CHECK_NOTHROW(mb.subref("", 0, 0));
CHECK_NOTHROW(mb.subref("", 0, i));
CHECK_NOTHROW(mb.subref("", i, 0));
CHECK_NOTHROW(mb.subref("", i - 1, 1));
CHECK_THROWS(mb.subref("", 0, i + 1));
CHECK_THROWS(mb.subref("", i + 1, 0));
CHECK_THROWS(mb.subref("", i, 1));
CHECK_THROWS(mb.subref("", (size_t) -1, 0));
CHECK_THROWS(mb.subref("", (size_t) -1, i));
#if DEBUG || !(ACC_CC_CLANG && __PPC64__ && ACC_ABI_BIG_ENDIAN) || 0
// @COMPILER_BUG @CLANG_BUG
if (i < 2) {
CHECK_THROWS(mb.subref("", 0, sizeof(NE16)));
CHECK_THROWS(mb.subref("", 0, sizeof(BE16)));
CHECK_THROWS(mb.subref("", 0, sizeof(LE16)));
} else {
CHECK_NOTHROW(mb.subref("", 0, sizeof(NE16)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(BE16)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(LE16)));
}
if (i < 4) {
CHECK_THROWS(mb.subref("", 0, sizeof(NE32)));
CHECK_THROWS(mb.subref("", 0, sizeof(BE32)));
CHECK_THROWS(mb.subref("", 0, sizeof(LE32)));
} else {
CHECK_NOTHROW(mb.subref("", 0, sizeof(NE32)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(BE32)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(LE32)));
}
if (i < 8) {
CHECK_THROWS(mb.subref("", 0, sizeof(NE64)));
CHECK_THROWS(mb.subref("", 0, sizeof(BE64)));
CHECK_THROWS(mb.subref("", 0, sizeof(LE64)));
} else {
CHECK_NOTHROW(mb.subref("", 0, sizeof(NE64)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(BE64)));
CHECK_NOTHROW(mb.subref("", 0, sizeof(LE64)));
}
CHECK_NOTHROW(mb.subref_u<byte *>("", 0));
CHECK_NOTHROW(mb.subref_u<byte *>("", i - 1));
CHECK_THROWS(mb.subref_u<byte *>("", i));
CHECK_THROWS(mb.subref_u<byte *>("", (size_t) -1));
if (i < 2) {
CHECK_THROWS(mb.subref_u<NE16 *>("", 0));
CHECK_THROWS(mb.subref_u<BE16 *>("", 0));
CHECK_THROWS(mb.subref_u<LE16 *>("", 0));
} else {
CHECK_NOTHROW(mb.subref_u<NE16 *>("", 0));
CHECK_NOTHROW(mb.subref_u<BE16 *>("", 0));
CHECK_NOTHROW(mb.subref_u<LE16 *>("", 0));
}
if (i < 4) {
CHECK_THROWS(mb.subref_u<NE32 *>("", 0));
CHECK_THROWS(mb.subref_u<BE32 *>("", 0));
CHECK_THROWS(mb.subref_u<LE32 *>("", 0));
} else {
CHECK_NOTHROW(mb.subref_u<NE32 *>("", 0));
CHECK_NOTHROW(mb.subref_u<BE32 *>("", 0));
CHECK_NOTHROW(mb.subref_u<LE32 *>("", 0));
}
if (i < 8) {
CHECK_THROWS(mb.subref_u<NE64 *>("", 0));
CHECK_THROWS(mb.subref_u<BE64 *>("", 0));
CHECK_THROWS(mb.subref_u<LE64 *>("", 0));
} else {
CHECK_NOTHROW(mb.subref_u<NE64 *>("", 0));
CHECK_NOTHROW(mb.subref_u<BE64 *>("", 0));
CHECK_NOTHROW(mb.subref_u<LE64 *>("", 0));
}
#endif
}
TEST_CASE("MemBuffer unused 2") {
MemBuffer mb;
(void) mb;
}
TEST_CASE("MemBuffer array access") {
+11 -21
View File
@@ -41,9 +41,9 @@ public:
typedef T element_type;
typedef typename std::add_lvalue_reference<T>::type reference;
typedef typename std::add_pointer<T>::type pointer;
typedef unsigned size_type; // limited by UPX_RSIZE_MAX
typedef pointer iterator;
typedef typename std::add_pointer<const T>::type const_iterator;
typedef size_t size_type; // limited by UPX_RSIZE_MAX
protected:
static const size_t element_size = sizeof(element_type);
@@ -62,8 +62,8 @@ public:
// array access
reference operator[](ptrdiff_t i) const may_throw {
// NOTE: &array[SIZE] is *not* legal for containers like std::vector and MemBuffer !
if very_unlikely (i < 0 || mem_size(element_size, i) >= size_in_bytes)
throwCantPack("MemBuffer invalid array index %td (%zu bytes)", i, size_in_bytes);
if very_unlikely (i < 0 || mem_size(element_size, i) + element_size > size_in_bytes)
throwCantPack("MemBuffer invalid array index %td (%u bytes)", i, size_in_bytes);
return ptr[i];
}
// dereference
@@ -169,8 +169,8 @@ inline typename MemBufferBase<T>::pointer raw_index_bytes(const MemBufferBase<T>
#define XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION(A, B, RType) \
typename std::enable_if<std::is_same<A, B>::value, RType>::type
#endif
#define XSPAN_FWD_C_IS_MEMBUFFER 1
#define C MemBufferBase
#define XSPAN_FWD_C_IS_MEMBUFFER 1
#if WITH_XSPAN >= 1
#define D XSPAN_NS(Ptr)
#endif
@@ -194,22 +194,22 @@ public:
static unsigned getSizeForDecompression(unsigned uncompressed_size, unsigned extra = 0)
may_throw;
noinline void alloc(upx_uint64_t bytes) may_throw;
void alloc(upx_uint64_t bytes) may_throw;
void allocForCompression(unsigned uncompressed_size, unsigned extra = 0) may_throw;
void allocForDecompression(unsigned uncompressed_size, unsigned extra = 0) may_throw;
noinline void checkState() const may_throw;
noinline void dealloc() noexcept;
void dealloc() noexcept;
void checkState() const may_throw;
// explicit conversion
void *getVoidPtr() noexcept { return (void *) ptr; }
const void *getVoidPtr() const noexcept { return (const void *) ptr; }
unsigned getSizeInBytes() const noexcept { return size_in_bytes; }
unsigned getSize() const noexcept { return size_in_bytes / element_size; }
unsigned getSize() const noexcept { return size_in_bytes; } // note: element_size == 1
// util
noinline void fill(size_t off, size_t bytes, int value) may_throw;
forceinline void clear(size_t off, size_t bytes) may_throw { fill(off, bytes, 0); }
noinline void fill(unsigned off, unsigned len, int value) may_throw;
forceinline void clear(unsigned off, unsigned len) may_throw { fill(off, len, 0); }
forceinline void clear() may_throw { fill(0, size_in_bytes, 0); }
// If the entire range [skip, skip+take) is inside the buffer,
@@ -219,19 +219,9 @@ public:
forceinline pointer subref(const char *errfmt, size_t skip, size_t take) may_throw {
return (pointer) subref_impl(errfmt, skip, take);
}
template <class U>
forceinline U subref_u(const char *errfmt, size_t skip) may_throw {
COMPILE_TIME_ASSERT(std::is_pointer<U>::value)
return (U) subref_impl(errfmt, skip, sizeof(typename std::remove_pointer<U>::type));
}
template <class U>
forceinline U subref_u(const char *errfmt, size_t skip, size_t take) may_throw {
COMPILE_TIME_ASSERT(std::is_pointer<U>::value)
return (U) subref_impl(errfmt, skip, take);
}
private:
noinline void *subref_impl(const char *errfmt, size_t skip, size_t take) may_throw;
void *subref_impl(const char *errfmt, size_t skip, size_t take) may_throw;
// static debug stats
struct Stats {
+1 -1
View File
@@ -75,6 +75,6 @@
#define _LIBCPP_HAS_ALIGNED_ALLOCATION 0
#endif
#endif
#endif // _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
#endif
/* vim:set ts=4 sw=4 et: */
+29 -30
View File
@@ -71,7 +71,7 @@ bool mem_size_valid(upx_uint64_t element_size, upx_uint64_t n, upx_uint64_t extr
}
upx_rsize_t mem_size(upx_uint64_t element_size, upx_uint64_t n, upx_uint64_t extra1,
upx_uint64_t extra2) may_throw {
upx_uint64_t extra2) {
assert(element_size > 0);
if very_unlikely (element_size == 0 || element_size > UPX_RSIZE_MAX)
throwCantPack("mem_size 1; take care");
@@ -144,8 +144,7 @@ TEST_CASE("ptr_diff") {
}
// check that 2 buffers do not overlap; will throw on error
void ptraddr_check_no_overlap(upx_ptraddr_t a, size_t a_size, upx_ptraddr_t b, size_t b_size)
may_throw {
void ptraddr_check_no_overlap(upx_ptraddr_t a, size_t a_size, upx_ptraddr_t b, size_t b_size) {
if very_unlikely (a == 0 || b == 0)
throwCantPack("ptr_check_no_overlap-nullptr");
upx_ptraddr_t a_end = a + mem_size(1, a_size);
@@ -161,7 +160,7 @@ void ptraddr_check_no_overlap(upx_ptraddr_t a, size_t a_size, upx_ptraddr_t b, s
// check that 3 buffers do not overlap; will throw on error
void ptraddr_check_no_overlap(upx_ptraddr_t a, size_t a_size, upx_ptraddr_t b, size_t b_size,
upx_ptraddr_t c, size_t c_size) may_throw {
upx_ptraddr_t c, size_t c_size) {
if very_unlikely (a == 0 || b == 0 || c == 0)
throwCantPack("ptr_check_no_overlap-nullptr");
upx_ptraddr_t a_end = a + mem_size(1, a_size);
@@ -254,14 +253,6 @@ TEST_CASE("ptr_check_no_overlap 3") {
// stdlib
**************************************************************************/
void *upx_calloc(size_t n, size_t element_size) may_throw {
const upx_rsize_t bytes = mem_size(element_size, n); // assert size
void *p = ::malloc(bytes);
if (p != nullptr && bytes > 0)
memset(p, 0, bytes);
return p;
}
const char *upx_getenv(const char *envvar) noexcept {
if (envvar != nullptr && envvar[0])
return ::getenv(envvar);
@@ -269,11 +260,11 @@ const char *upx_getenv(const char *envvar) noexcept {
}
// random value from libc; quality is not important for UPX
int upx_rand() noexcept {
int upx_rand(void) noexcept {
return ::rand(); // NOLINT(clang-analyzer-security.insecureAPI.rand)
}
void upx_rand_init() noexcept {
void upx_rand_init(void) noexcept {
unsigned seed = 0;
seed ^= UPX_VERSION_HEX;
#if (!HAVE_GETTIMEOFDAY || (ACC_OS_DOS32 && defined(__DJGPP__))) && !defined(__wasi__)
@@ -291,6 +282,14 @@ void upx_rand_init() noexcept {
::srand(seed);
}
void *upx_calloc(size_t n, size_t element_size) may_throw {
size_t bytes = mem_size(element_size, n); // assert size
void *p = ::malloc(bytes);
if (p != nullptr)
memset(p, 0, bytes);
return p;
}
// simple unoptimized memswap()
// TODO later: CHERI clang-14 bug/miscompilation with upx_memswap(); or
// maybe caused by tagged-memory issues ???
@@ -421,22 +420,6 @@ void upx_std_stable_sort(void *array, size_t n, upx_compare_func_t compare) {
#endif
}
#if UPX_CONFIG_USE_STABLE_SORT
// instantiate function templates for all element sizes we need; efficient
// run-time, but code size bloat (about 4KiB code size for each function
// with my current libstdc++); not really needed as libc qsort() is
// good enough for our use cases
template void upx_std_stable_sort<1>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<2>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<4>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<5>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<8>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<16>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<32>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<56>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<72>(void *, size_t, upx_compare_func_t);
#endif // UPX_CONFIG_USE_STABLE_SORT
TEST_CASE("upx_memswap") {
auto check4 = [](int off1, int off2, int len, int a, int b, int c, int d) {
byte p[4] = {0, 1, 2, 3};
@@ -490,6 +473,22 @@ TEST_CASE("upx_memswap") {
}
}
#if UPX_CONFIG_USE_STABLE_SORT
// instantiate function templates for all element sizes we need; efficient
// run-time, but code size bloat (about 4KiB code size for each function
// with my current libstdc++); not really needed as libc qsort() is
// good enough for our use cases
template void upx_std_stable_sort<1>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<2>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<4>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<5>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<8>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<16>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<32>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<56>(void *, size_t, upx_compare_func_t);
template void upx_std_stable_sort<72>(void *, size_t, upx_compare_func_t);
#endif // UPX_CONFIG_USE_STABLE_SORT
#if !defined(DOCTEST_CONFIG_DISABLE) && DEBUG
#if __cplusplus >= 202002L // use C++20 std::next_permutation() to test all permutations
namespace {
+13 -25
View File
@@ -67,12 +67,13 @@ inline void mem_size_assert(upx_uint64_t element_size, upx_uint64_t n) may_throw
}
// "new" with asserted size; will throw on invalid size
#if DEBUG
template <class T>
inline T *NewT(upx_uint64_t n) may_throw {
T *NewArray(upx_uint64_t n) may_throw {
COMPILE_TIME_ASSERT(std::is_standard_layout<T>::value)
COMPILE_TIME_ASSERT(std::is_trivially_copyable<T>::value)
COMPILE_TIME_ASSERT(std::is_trivially_default_constructible<T>::value)
const upx_rsize_t bytes = mem_size(sizeof(T), n); // assert size
upx_rsize_t bytes = mem_size(sizeof(T), n); // assert size
T *array = new T[size_t(n)];
#if !defined(__SANITIZE_MEMORY__)
if (array != nullptr && bytes > 0) {
@@ -83,25 +84,11 @@ inline T *NewT(upx_uint64_t n) may_throw {
UNUSED(bytes);
return array;
}
#if DEBUG || 1
#define New(type, n) (NewT<type>((n)))
#define New(type, n) (NewArray<type>((n)))
#else
#define New(type, n) new type[mem_size_get_n(sizeof(type), (n))]
#endif
template <class T>
inline T *New0T(upx_uint64_t n) may_throw {
COMPILE_TIME_ASSERT(std::is_standard_layout<T>::value)
COMPILE_TIME_ASSERT(std::is_trivially_copyable<T>::value)
COMPILE_TIME_ASSERT(std::is_trivially_default_constructible<T>::value)
const upx_rsize_t bytes = mem_size(sizeof(T), n); // assert size
T *array = new T[size_t(n)];
if (array != nullptr && bytes > 0)
memset(array, 0, bytes); // NOLINT(bugprone-multi-level-implicit-pointer-conversion)
return array;
}
#define New0(type, n) (New0T<type>((n)))
/*************************************************************************
// ptr util
**************************************************************************/
@@ -134,17 +121,18 @@ forceinline bool ptr_is_aligned(const void *p, size_t alignment) noexcept {
// ptrdiff_t with nullptr checks and asserted size; will throw on failure
// NOTE: returns size_in_bytes, not number of elements!
noinline int ptr_diff_bytes(const void *a, const void *b) may_throw;
noinline unsigned ptr_udiff_bytes(const void *a, const void *b) may_throw; // asserts a >= b
int ptr_diff_bytes(const void *a, const void *b) may_throw;
unsigned ptr_udiff_bytes(const void *a, const void *b) may_throw; // asserts a >= b
// short names "ptr_diff" and "ptr_udiff" for types with sizeof(X) == 1
template <class T, class U>
forceinline typename std::enable_if<sizeof(T) == 1 && sizeof(U) == 1, int>::type
ptr_diff(const T *a, const U *b) may_throw {
inline typename std::enable_if<sizeof(T) == 1 && sizeof(U) == 1, int>::type ptr_diff(const T *a,
const U *b)
may_throw {
return ptr_diff_bytes(a, b);
}
template <class T, class U>
forceinline typename std::enable_if<sizeof(T) == 1 && sizeof(U) == 1, unsigned>::type
inline typename std::enable_if<sizeof(T) == 1 && sizeof(U) == 1, unsigned>::type
ptr_udiff(const T *a, const U *b) may_throw {
return ptr_udiff_bytes(a, b);
}
@@ -193,8 +181,8 @@ noinline const char *upx_getenv(const char *envvar) noexcept;
noinline void upx_memswap(void *a, void *b, size_t bytes) noexcept;
noinline void upx_rand_init() noexcept;
noinline int upx_rand() noexcept;
noinline void upx_rand_init(void) noexcept;
noinline int upx_rand(void) noexcept;
typedef int(__acc_cdecl_qsort *upx_compare_func_t)(const void *, const void *);
typedef void (*upx_sort_func_t)(void *array, size_t n, size_t element_size, upx_compare_func_t);
@@ -241,7 +229,7 @@ bool maketempname(char *ofilename, size_t size, const char *ifilename, const cha
bool force = true);
bool makebakname(char *ofilename, size_t size, const char *ifilename, bool force = true);
noinline bool is_envvar_true(const char *envvar, const char *alternate_name = nullptr) noexcept;
bool is_envvar_true(const char *envvar, const char *alternate_name = nullptr) noexcept;
unsigned get_ratio(upx_uint64_t u_len, upx_uint64_t c_len);
bool set_method_name(char *buf, size_t size, int method, int level);
+7 -7
View File
@@ -44,33 +44,33 @@ struct XSpanStats {
static XSpanStats xspan_stats;
// HINT: set env-var "UPX_DEBUG_DOCTEST_DISABLE=1" for improved debugging experience
void xspan_fail_nullptr() may_throw {
void xspan_fail_nullptr() {
xspan_stats.fail_nullptr += 1;
throwCantPack("xspan unexpected NULL pointer; take care!");
}
void xspan_fail_nullbase() may_throw {
void xspan_fail_nullbase() {
xspan_stats.fail_nullbase += 1;
throwCantPack("xspan unexpected NULL base; take care!");
}
void xspan_fail_not_same_base() may_throw {
void xspan_fail_not_same_base() {
xspan_stats.fail_not_same_base += 1;
throwCantPack("xspan unexpected base pointer; take care!");
}
void xspan_fail_range_nullptr() may_throw {
void xspan_fail_range_nullptr() {
xspan_stats.fail_range_nullptr += 1;
throwCantPack("xspan_check_range: unexpected NULL pointer; take care!");
}
void xspan_fail_range_nullbase() may_throw {
void xspan_fail_range_nullbase() {
xspan_stats.fail_range_nullbase += 1;
throwCantPack("xspan_check_range: unexpected NULL base; take care!");
}
void xspan_fail_range_range() may_throw {
void xspan_fail_range_range() {
xspan_stats.fail_range_range += 1;
throwCantPack("xspan_check_range: pointer out of range; take care!");
}
void xspan_check_range(const void *ptr, const void *base, ptrdiff_t size_in_bytes) may_throw {
void xspan_check_range(const void *ptr, const void *base, ptrdiff_t size_in_bytes) {
xspan_stats.check_range_counter += 1;
if very_unlikely (ptr == nullptr)
xspan_fail_range_nullptr();
+2 -18
View File
@@ -92,7 +92,7 @@ XSPAN_FWD_TU_VOIDPTR(int) memcmp(const C<T> &a, const E<U> &b, size_t n) {
#endif
template <class T>
inline void *memcpy(const C<T> a, const void *b, size_t n) {
inline void *memcpy(C<T> a, const void *b, size_t n) {
return memcpy(a.raw_bytes(n), b, n);
}
template <class T>
@@ -114,7 +114,7 @@ XSPAN_FWD_TU_VOIDPTR(void *) memcpy(const C<T> &a, const E<U> &b, size_t n) {
#endif
template <class T>
inline void *memmove(const C<T> a, const void *b, size_t n) {
inline void *memmove(C<T> a, const void *b, size_t n) {
return memmove(a.raw_bytes(n), b, n);
}
template <class T>
@@ -204,10 +204,6 @@ inline unsigned get_ne16(const C<T> &a) {
return get_ne16(a.raw_bytes(2));
}
template <class T>
inline unsigned get_ne24(const C<T> &a) {
return get_ne24(a.raw_bytes(3));
}
template <class T>
inline unsigned get_ne32(const C<T> &a) {
return get_ne32(a.raw_bytes(4));
}
@@ -221,10 +217,6 @@ inline unsigned get_be16(const C<T> &a) {
return get_be16(a.raw_bytes(2));
}
template <class T>
inline unsigned get_be24(const C<T> &a) {
return get_be24(a.raw_bytes(3));
}
template <class T>
inline unsigned get_be32(const C<T> &a) {
return get_be32(a.raw_bytes(4));
}
@@ -255,10 +247,6 @@ inline void set_ne16(const C<T> &a, unsigned v) {
return set_ne16(a.raw_bytes(2), v);
}
template <class T>
inline void set_ne24(const C<T> &a, unsigned v) {
return set_ne24(a.raw_bytes(3), v);
}
template <class T>
inline void set_ne32(const C<T> &a, unsigned v) {
return set_ne32(a.raw_bytes(4), v);
}
@@ -272,10 +260,6 @@ inline void set_be16(const C<T> &a, unsigned v) {
return set_be16(a.raw_bytes(2), v);
}
template <class T>
inline void set_be24(const C<T> &a, unsigned v) {
return set_be24(a.raw_bytes(3), v);
}
template <class T>
inline void set_be32(const C<T> &a, unsigned v) {
return set_be32(a.raw_bytes(4), v);
}
+6 -6
View File
@@ -43,12 +43,12 @@
XSPAN_NAMESPACE_BEGIN
// HINT: set env-var "UPX_DEBUG_DOCTEST_DISABLE=1" for improved debugging experience
noreturn void xspan_fail_nullptr() may_throw;
noreturn void xspan_fail_nullbase() may_throw;
noreturn void xspan_fail_not_same_base() may_throw;
noreturn void xspan_fail_range_nullptr() may_throw;
noreturn void xspan_fail_range_nullbase() may_throw;
noreturn void xspan_fail_range_range() may_throw;
noreturn void xspan_fail_nullptr(void) may_throw;
noreturn void xspan_fail_nullbase(void) may_throw;
noreturn void xspan_fail_not_same_base(void) may_throw;
noreturn void xspan_fail_range_nullptr(void) may_throw;
noreturn void xspan_fail_range_nullbase(void) may_throw;
noreturn void xspan_fail_range_range(void) may_throw;
void xspan_check_range(const void *ptr, const void *base, ptrdiff_t size_in_bytes) may_throw;
// help constructor to distinguish between number of elements and bytes
+13 -16
View File
@@ -34,6 +34,11 @@ class CSelf {
#endif
public:
typedef T element_type;
typedef typename std::add_lvalue_reference<T>::type reference;
typedef typename std::add_pointer<T>::type pointer;
typedef size_t size_type;
// befriend all
template <class>
friend struct PtrOrSpan;
@@ -42,11 +47,6 @@ public:
template <class>
friend struct Span;
typedef T element_type;
typedef typename std::add_lvalue_reference<T>::type reference;
typedef typename std::add_pointer<T>::type pointer;
typedef size_t size_type;
#if XSPAN_CONFIG_ENABLE_IMPLICIT_CONVERSION
public:
operator pointer() const noexcept { return ptr; }
@@ -119,7 +119,6 @@ forceinline ~CSelf() noexcept {}
size_in_bytes = 0;
assertInvariants();
}
// constructors from pointers
CSelf(pointer first, XSpanCount count)
: ptr(makePtr(first)), base(makeBase(first)),
@@ -172,13 +171,12 @@ forceinline ~CSelf() noexcept {}
// constructors from MemBuffer
CSelf(MemBuffer &mb)
: CSelf(makeNotNull((pointer) membuffer_get_void_ptr(mb)),
XSpanSizeInBytes(membuffer_get_size_in_bytes(mb))) {}
XSpanSizeInBytes(membuffer_get_size(mb))) {}
CSelf(pointer first, MemBuffer &mb)
: CSelf(first, XSpanSizeInBytes(membuffer_get_size_in_bytes(mb)),
: CSelf(first, XSpanSizeInBytes(membuffer_get_size(mb)),
makeNotNull((pointer) membuffer_get_void_ptr(mb))) {}
CSelf(std::nullptr_t, MemBuffer &) XSPAN_DELETED_FUNCTION;
#endif
// disable constructors from nullptr to catch compile-time misuse
private:
CSelf(std::nullptr_t, XSpanCount) XSPAN_DELETED_FUNCTION;
@@ -406,7 +404,7 @@ public:
}
private:
pointer check_deref(pointer p) const may_throw {
pointer check_deref(pointer p) const {
assertInvariants();
if __acc_cte (!configRequirePtr && p == nullptr)
xspan_fail_nullptr();
@@ -414,7 +412,7 @@ private:
xspan_check_range(p, base, size_in_bytes - sizeof(T));
return p;
}
pointer check_deref(pointer p, ptrdiff_t n) const may_throw {
pointer check_deref(pointer p, ptrdiff_t n) const {
assertInvariants();
if __acc_cte (!configRequirePtr && p == nullptr)
xspan_fail_nullptr();
@@ -424,7 +422,7 @@ private:
xspan_check_range(p, base, size_in_bytes - sizeof(T));
return p;
}
pointer check_add(pointer p, ptrdiff_t n) const may_throw {
pointer check_add(pointer p, ptrdiff_t n) const {
assertInvariants();
if __acc_cte (!configRequirePtr && p == nullptr)
xspan_fail_nullptr();
@@ -444,15 +442,14 @@ public: // raw access
pointer raw_base() const noexcept { return base; }
size_type raw_size_in_bytes() const noexcept { return size_in_bytes; }
pointer raw_bytes(size_t bytes) const may_throw {
pointer raw_bytes(size_t bytes) const {
assertInvariants();
if (bytes > 0) {
if __acc_cte (!configRequirePtr && ptr == nullptr)
xspan_fail_nullptr();
if __acc_cte (configRequireBase || base != nullptr)
if __acc_cte (configRequireBase || base != nullptr) {
xspan_check_range(ptr, base, size_in_bytes - bytes);
if very_unlikely (__acc_cte(VALGRIND_CHECK_MEM_IS_ADDRESSABLE(ptr, bytes) != 0))
throwCantPack("raw_bytes valgrind-check-mem");
}
}
return ptr;
}
+2 -9
View File
@@ -80,8 +80,6 @@ public:
ptr_invalidate_and_poison(ptr); // point to non-null invalid address
assertInvariants();
}
// inline CSelf() : ptr(nullptr) { invalidate(); }
inline CSelf() { assertInvariants(); }
// constructors from pointers
@@ -134,6 +132,7 @@ public:
}
// comparison
bool operator==(pointer other) const noexcept { return ptr == other; }
template <class U>
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
@@ -202,20 +201,14 @@ private:
static forceinline pointer check_deref(pointer p, ptrdiff_t n) noexcept { return p + n; }
static forceinline pointer check_add(pointer p, ptrdiff_t n) noexcept { return p + n; }
// disable taking the address => force passing by reference
// [I'm not too sure about this design decision, but we can always allow it if needed]
Self *operator&() const XSPAN_DELETED_FUNCTION;
public: // raw access
pointer raw_ptr() const noexcept { return ptr; }
pointer raw_bytes(size_t bytes) const may_throw {
pointer raw_bytes(size_t bytes) const {
assertInvariants();
if (bytes > 0) {
if very_unlikely (ptr == nullptr)
xspan_fail_nullptr();
if very_unlikely (__acc_cte(VALGRIND_CHECK_MEM_IS_ADDRESSABLE(ptr, bytes) != 0))
throwCantPack("raw_bytes valgrind-check-mem");
}
return ptr;
}
+5 -5
View File
@@ -1,7 +1,7 @@
#pragma once
#define UPX_VERSION_HEX 0x050100 /* 05.01.00 */
#define UPX_VERSION_STRING "5.1.0"
#define UPX_VERSION_STRING4 "5.10"
#define UPX_VERSION_DATE "Oct 24th 2025"
#define UPX_VERSION_DATE_ISO "2025-10-24"
#define UPX_VERSION_HEX 0x050003 /* 05.00.03 */
#define UPX_VERSION_STRING "5.0.3"
#define UPX_VERSION_STRING4 "5.03"
#define UPX_VERSION_DATE "Jul 21st 2025"
#define UPX_VERSION_DATE_ISO "2025-07-21"
#define UPX_VERSION_YEAR "2025"
+13 -15
View File
@@ -329,21 +329,19 @@ void do_one_file(const char *const iname, char *const oname) may_throw {
}
// handle command - actual work starts HERE
{
PackMaster pm(&fi, opt);
if (opt->cmd == CMD_COMPRESS)
pm.pack(&fo);
else if (opt->cmd == CMD_DECOMPRESS)
pm.unpack(&fo);
else if (opt->cmd == CMD_TEST)
pm.test();
else if (opt->cmd == CMD_LIST)
pm.list();
else if (opt->cmd == CMD_FILEINFO)
pm.fileInfo();
else
throwInternalError("invalid command");
}
PackMaster pm(&fi, opt);
if (opt->cmd == CMD_COMPRESS)
pm.pack(&fo);
else if (opt->cmd == CMD_DECOMPRESS)
pm.unpack(&fo);
else if (opt->cmd == CMD_TEST)
pm.test();
else if (opt->cmd == CMD_LIST)
pm.list();
else if (opt->cmd == CMD_FILEINFO)
pm.fileInfo();
else
throwInternalError("invalid command");
// copy time stamp
if (oname[0] && opt->preserve_timestamp && fo.isOpen())