Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 950609 - sys-fs/dd-rescue-1.99.20: sporadic test failures
Summary: sys-fs/dd-rescue-1.99.20: sporadic test failures
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL: https://sourceforge.net/p/ddrescue/ti...
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks:
 
Reported: 2025-03-04 21:15 UTC by Sam James
Modified: 2025-03-14 18:38 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_950609.txt,588.54 KB, text/plain)
2025-03-04 21:15 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-04 21:15:17 UTC
Created attachment 920219 [details]
build.log

I've reported this upstream already at https://sourceforge.net/p/ddrescue/tickets/9/ but filing this to keep notes as we go, as they can't reproduce it yet.

It's non-deterministic and the failure isn't always the same either.

```
dd_rescue: (info): hash ( 0): sha256 testfile (0-8388612): af8982aa6e42b83315d49caf60bc5572f6a984e8c3cd23c95e1161a105f3e003
./dd_rescue -a -b 16k -L ./libddr_hash.so=sha256 testfile testfile.copy
dd_rescue: (info): Using softbs=16.0kiB, hardbs=4.0kiB
dd_rescue: (info): expect to copy 8192.0kiB from testfile
dd_rescue: (info): read testfile (8192.0kiB): EOF
dd_rescue: (info): Summary for testfile -> testfile.copy
dd_rescue: (info): ipos:      8192.0k, opos:      8192.0k, xferd:      8192.0k
                   errs:      0, errxfer:         0.0k, succxfer:      5584.0k
             +curr.rate:   695446kB/s, avg.rate:   695446kB/s, avg.load:187.2%
             >-----------------------------------------< 100%  TOT:  0:00:00 
dd_rescue: (info): hash ( 0): sha256 testfile (0-8388612): ddafd6dabc5ff4083fd8ad23320c5317ac8b1794510762056a0b5eb3eca88e4a
8196	testfile
7088	testfile.copy
testfile testfile.copy differ: byte 8388610, line 26193
ERROR 97: Sparse compare error
make[1]: *** [Makefile:762: check_sparse] Error 97
make[1]: Leaving directory '/var/tmp/portage/sys-fs/dd-rescue-1.99.20/work/dd_rescue-1.99.20'
make: *** [Makefile:630: check] Error 2
 * ERROR: sys-fs/dd-rescue-1.99.20::gentoo failed (test phase):
 *   emake failed
```

---

$ emerge --info
Portage 3.0.67-3+gc75b61b52-dirty (python 3.13.2-final-0, default/linux/amd64/23.0/hardened, gcc-15, glibc-2.41, 6.13.5 x86_64)
=================================================================
System uname: Linux-6.13.5-x86_64-AMD_Ryzen_9_3950X_16-Core_Processor-with-glibc2.41
KiB Mem:    65738736 total,   5448164 free
KiB Swap:   16662520 total,  14813640 free
Timestamp of repository gentoo: Tue, 04 Mar 2025 19:03:27 +0000
Head commit of repository gentoo: ee3decebbfb4d536d51c2e31303e75a76cf96e6e

Timestamp of repository kde: Sun, 02 Mar 2025 21:48:30 +0000
Head commit of repository kde: f41a17b9d62f91e24f9679f31ab65588a07d02db

Timestamp of repository qt: Sun, 16 Feb 2025 18:51:59 +0000
Head commit of repository qt: a77029c92e97881af929ecd9f00dafbf52fe5460

Timestamp of repository sam_c: Mon, 03 Mar 2025 18:03:32 +0000
Head commit of repository sam_c: e19fbb19bc718775e5f4631356948d56c3122503

sh dash 0.5.12-r1
ld GNU ld (Gentoo 9999 p1) 2.44.50.20250304
ccache version 4.10.2 [disabled]
app-misc/pax-utils:        1.3.8::gentoo
app-shells/bash:           5.3_beta_p20250224::gentoo
dev-build/autoconf:        2.69-r9::gentoo, 2.71-r7::gentoo, 2.72-r1::gentoo, 9999::gentoo
dev-build/automake:        1.16.5-r2::gentoo, 1.17-r2::gentoo
dev-build/cmake:           3.31.6::gentoo
dev-build/libtool:         2.5.4::gentoo
dev-build/make:            4.4.1-r100::gentoo
dev-build/meson:           1.7.0::gentoo
dev-java/java-config:      2.3.4::gentoo
dev-lang/perl:             5.40.1::gentoo
dev-lang/python:           3.10.16_p2::gentoo, 3.11.11_p2::gentoo, 3.12.9::gentoo, 3.13.2::gentoo, 3.13.2-r100::gentoo
dev-lang/rust:             1.85.0-r1::gentoo
dev-util/ccache:           4.10.2-r1::gentoo
llvm-core/clang:           18.1.8-r6::gentoo, 19.1.7::gentoo
llvm-core/lld:             19.1.7::gentoo
llvm-core/llvm:            18.1.8-r6::gentoo, 19.1.7::gentoo
sys-apps/baselayout:       2.17::gentoo
sys-apps/sandbox:          2.45::gentoo
sys-apps/systemd:          257.2::gentoo
sys-devel/binutils:        2.38-r2::gentoo, 2.39-r5::gentoo, 2.40-r9::gentoo, 2.41-r5::gentoo, 2.42-r2::gentoo, 2.43-r2::gentoo, 9999::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/gcc:             10.5.0::gentoo, 11.5.0::gentoo, 12.4.1_p20250227::gentoo, 13.3.1_p20250301::gentoo, 14.2.1_p20250301::gentoo, 15.0.9999::gentoo
sys-devel/gcc-config:      2.12.1::gentoo
sys-kernel/linux-headers:  6.13::gentoo (virtual/os-headers)
sys-libs/glibc:            2.41::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    eclass-overrides: sam_c
    volatile: False
    sync-git-verify-commit-signature: yes
    sync-git-clone-extra-opts: -b stable -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneExpire=now

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

kde
    location: /var/db/repos/kde
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/kde.git
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

local
    location: /var/db/repos/local
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

qt
    location: /var/db/repos/qt
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/qt.git
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

sam_c
    location: /var/db/repos/sam_c
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/sam_c.git
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

Binary Repositories:

binhost
    priority: 9999
    sync-uri: https://www.mirrorservice.org/sites/distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64

Installed sets: @sam-emacs, @sam-fonts, @sam-fortune, @sam-tests
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -march=native -mtls-dialect=gnu2 -flto=jobserver -fno-semantic-interposition -pipe -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -frecord-gcc-switches -fdiagnostics-details -fdiagnostics-set-output=text:experimental-nesting=yes -Wa,-O2 -Wa,-mtune=znver2 -Warray-bounds  -Wstrict-aliasing -Wfree-nonheap-object -Wuninitialized -Wmaybe-uninitialized -Wreturn-type -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=odr -Warray-bounds -fdiagnostics-details -Wstringop-overread -Wstringop-overflow -Wstringop-truncation -Wformat-overflow -Wformat-truncation -Wbuiltin-declaration-mismatch -Wtautological-compare"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O3 -march=native -mtls-dialect=gnu2 -flto=jobserver -fno-semantic-interposition -pipe -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -frecord-gcc-switches -fdiagnostics-details -fdiagnostics-set-output=text:experimental-nesting=yes -Wa,-O2 -Wa,-mtune=znver2 -Warray-bounds  -Wstrict-aliasing -Wfree-nonheap-object -Wuninitialized -Wmaybe-uninitialized -Wreturn-type -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=odr -Warray-bounds -fdiagnostics-details -Wstringop-overread -Wstringop-overflow -Wstringop-truncation -Wformat-overflow -Wformat-truncation"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going --with-bdeps=y --complete-graph --deep --dynamic-deps=n --changed-deps=n --usepkg=y --implicit-system-deps=n --usepkg-exclude sys-fs/zfs --usepkg-exclude sys-fs/zfs-kmod --jobs=4 --load-average 32"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O3 -march=native -mtls-dialect=gnu2 -flto=jobserver -fno-semantic-interposition -pipe -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -frecord-gcc-switches -fdiagnostics-details -fdiagnostics-set-output=text:experimental-nesting=yes -Wa,-O2 -Wa,-mtune=znver2 -Warray-bounds  -Wstrict-aliasing -Wfree-nonheap-object -Wuninitialized -Wmaybe-uninitialized -Wreturn-type -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=odr -Warray-bounds -fdiagnostics-details -Wstringop-overread -Wstringop-overflow -Wstringop-truncation -Wformat-overflow -Wformat-truncation"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg clean-logs config-protect-if-modified distlocks export-pms-vars fixlafiles ipc-sandbox merge-wait mount-sandbox multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O3 -march=native -mtls-dialect=gnu2 -flto=jobserver -fno-semantic-interposition -pipe -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -frecord-gcc-switches -fdiagnostics-details -fdiagnostics-set-output=text:experimental-nesting=yes -Wa,-O2 -Wa,-mtune=znver2 -Warray-bounds  -Wstrict-aliasing -Wfree-nonheap-object -Wuninitialized -Wmaybe-uninitialized -Wreturn-type -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=odr -Warray-bounds -fdiagnostics-details -Wstringop-overread -Wstringop-overflow -Wstringop-truncation -Wformat-overflow -Wformat-truncation"
GENTOO_MIRRORS="https://www.mirrorservice.org/sites/distfiles.gentoo.org/ https://mirror.bytemark.co.uk/gentoo/ https://mirrors.soeasyto.com/distfiles.gentoo.org/"
LANG="en_GB.UTF-8"
LDFLAGS="-O3 -march=native -mtls-dialect=gnu2 -flto=jobserver -fno-semantic-interposition -pipe -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -frecord-gcc-switches -fdiagnostics-details -fdiagnostics-set-output=text:experimental-nesting=yes -Wa,-O2 -Wa,-mtune=znver2 -Warray-bounds  -Wstrict-aliasing -Wfree-nonheap-object -Wuninitialized -Wmaybe-uninitialized -Wreturn-type -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=odr -Warray-bounds -fdiagnostics-details -Wstringop-overread -Wstringop-overflow -Wstringop-truncation -Wformat-overflow -Wformat-truncation -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=odr -Warray-bounds -fdiagnostics-details -Wstringop-overread -Wstringop-overflow -Wstringop-truncation -Wformat-overflow -Wformat-truncation -fdiagnostics-color=always -flto=jobserver -Wl,--defsym=__gentoo_check_ldflags__=0"
LEX="reflex"
LINGUAS="en en_GB"
MAKEOPTS="-j32 -l32"
PKGDIR="/var/cache/binpkgs"
PORTAGE_BUNZIP2_COMMAND="lbunzip2"
PORTAGE_COMPRESS="xz"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
RUSTFLAGS="-C target-cpu=native -C link-arg=-Wl,-z,pack-relative-relocs"
SHELL="/bin/bash"
USE="X a52 aac acl acpi activities aes alsa amd64 avx avx2 bash-completion bluetooth branding bzip2 cairo caps cdda cdr crypt dbus declarative dist-kernel dri dts dvd dvdr editorconfig emacs encode exif f16c filecaps firewalld flac fma3 freetype gdbm gif gmp gpm graphite gtk gui hardened harfbuzz hunspell iconv icu ipv6 jit jpeg kde kdesu kf6compat kwallet lcms libnotify libtirpc lto mad mmx mmxext mng modules-compress mp3 mp4 mpeg multilib ncurses nftables nls ogg opengl openmp pam pango pclmul pcre pdf pgo pic pie pipewire plasma png policykit popcnt ppds pulseaudio qml qt5 qt6 rdrand readline screencast sdl seccomp semantic-desktop sha sound spell sse sse2 sse3 sse4_1 sse4_2 sse4a ssl ssp ssse3 startup-notification svg system-av1 system-binutils system-boost system-bootstrap system-cairo system-clang system-digest system-ffmpeg system-harfbuzz system-heimdal system-icu system-jpeg system-leveldb system-libevent system-libs system-libvpx system-libyaml system-llvm system-lz4 system-mitkrb5 system-sqlite system-ssl system-tbb system-uulib system-webp system-zlib systemd test-rust tiff truetype udev udisks unicode upower usb valgrind verify-sig vorbis vulkan wayland widgets x264 xattr xcb xft xml xtpax xv xvid zlib zsh-completion" ABI_X86="32 64" ADA_TARGET="gcc_14" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-GB" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="AArch64 AMDGPU ARM AVR BPF Hexagon Lanai MSP430 Mips NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_13" PYTHON_TARGETS="python3_12 pypy3 python3_10 python3_11 python3_13 python3_13t" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="aarch64 aarch64_be alpha armeb hppa i386 m68k ppc ppc64 ppc64le sparc sparc64 x86_64" RUBY_TARGETS="ruby32 ruby31" VIDEO_CARDS="amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
YACC="byacc"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, SIZE, STRINGS, STRIP, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-04 21:15:47 UTC
If I unpack dd_rescue-1.99.20.tar.bz2 and run simply `make && make check`, then `time ( while true ; do LD_LIBRARY_PATH=. ./test_sparse.sh "-L ./libddr_crypt.so=AES192-CTR:weakrnd:pbkdf2:pass=ABC:" "encrypt" "decrypt" 8388612 || break ; done ; )`, it has a decent chance for me of failing within 30 seconds.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-04 21:18:01 UTC
(In reply to Sam James from comment #1)
> If I unpack dd_rescue-1.99.20.tar.bz2 and run simply `make && make check`,
> then `time ( while true ; do LD_LIBRARY_PATH=. ./test_sparse.sh "-L
> ./libddr_crypt.so=AES192-CTR:weakrnd:pbkdf2:pass=ABC:" "encrypt" "decrypt"
> 8388612 || break ; done ; )`, it has a decent chance for me of failing
> within 30 seconds.

One such failure:
```
$ time ( while true ; do LD_LIBRARY_PATH=. ./test_sparse.sh "-L ./libddr_crypt.so=AES192-CTR:weakrnd:pbkdf2:pass=ABC:" "encrypt" "decrypt" 8388612 || break ; done ; )
[...]
./dd_rescue -a -b 16k -L ./libddr_crypt.so=AES192-CTR:weakrnd:pbkdf2:pass=ABC:decrypt testfile.copy2 testfile.copy
dd_rescue: (info): Using softbs=16.0kiB, hardbs=4.0kiB
dd_rescue: (warning): crypt (-1): Don't specify sensitive data on the command line!
dd_rescue: (info): expect to copy 8192.0kiB from testfile.copy2
dd_rescue: (info): crypt ( 0): Derived salt from testfile.copy2=0000000000800004
dd_rescue: (info): crypt ( 0): Generate KEY and IV from same passwd/salt
dd_rescue: (info): read testfile.copy2 (8192.0kiB): EOF
dd_rescue: (info): Summary for testfile.copy2 -> testfile.copy
dd_rescue: (info): ipos:      8192.0k, opos:      8192.0k, xferd:      8192.0k
                   errs:      0, errxfer:         0.0k, succxfer:      8192.0k
             +curr.rate:  2286034kB/s, avg.rate:  2286034kB/s, avg.load:199.7%
             >-----------------------------------------< 100%  TOT:  0:00:00
dd_rescue: (warning): crypt ( 0): Adjusted offset 8388608 -> 8388612 (524288), towr 0
dd_rescue: (warning): crypt ( 0): Dec alignment error! (8388612-0)=8388612 4/4
8196    testfile.copy2
8196    testfile
5584    testfile.copy
testfile testfile.copy differ: byte 8388609, line 26146
ERROR 97: Sparse compare error

real    0m12.597s
user    0m5.264s
sys     0m7.375s

$ diffoscope testfile testfile.copy
--- testfile
+++ testfile.copy
@@ -524282,8 +524282,8 @@
 007fff90: 52b9 200b 151a 9f75 fc3e 88ed 89e5 f9d8  R. ....u.>......
 007fffa0: 1232 6572 f515 ca03 7017 ee57 c164 c1c4  .2er....p..W.d..
 007fffb0: 8f62 c4eb 0252 82ed 327d f8aa fb3f ae25  .b...R..2}...?.%
 007fffc0: bcc7 b497 c924 482c 0c32 dab9 5f8f 667b  .....$H,.2.._.f{
 007fffd0: 4813 6d41 921d 3e85 903c 6c3e a8d1 9c4b  H.mA..>..<l>...K
 007fffe0: 6226 37f9 1d4b 51f9 64bc 2ae7 fb51 2578  b&7..KQ.d.*..Q%x
 007ffff0: a184 4677 82ef 47da 0e8d 8076 bee5 551c  ..Fw..G....v..U.
-00800000: bbe9 ec33                                ...3
+00800000: 0000 0000                                ....
```
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-04 21:24:19 UTC
Another one:

```
$ time ( while true ; do LD_LIBRARY_PATH=. ./test_sparse.sh "-L ./libddr_crypt.so=AES192-CTR:weakrnd:pbkdf2:pass=ABC:" "encrypt" "decrypt" 8388612 || break ; done ; )
[...]
./dd_rescue -a -b 16k -L ./libddr_crypt.so=AES192-CTR:weakrnd:pbkdf2:pass=ABC:encrypt testfile testfile.copy2
dd_rescue: (info): Using softbs=16.0kiB, hardbs=4.0kiB
dd_rescue: (warning): crypt (-1): Don't specify sensitive data on the command line!
dd_rescue: (info): expect to copy 8192.0kiB from testfile
dd_rescue: (info): crypt ( 0): Derived salt from testfile.copy2=0000000000800004
dd_rescue: (info): crypt ( 0): Generate KEY and IV from same passwd/salt
dd_rescue: (info): read testfile (8192.0kiB): EOF
dd_rescue: (info): Summary for testfile -> testfile.copy2
dd_rescue: (info): ipos:      8192.0k, opos:      8192.0k, xferd:      8192.0k
                   errs:      0, errxfer:         0.0k, succxfer:      8192.0k
             +curr.rate:  2113248kB/s, avg.rate:  2113248kB/s, avg.load:199.7%
             >-----------------------------------------< 100%  TOT:  0:00:00
dd_rescue: (warning): crypt ( 0): Enc alignment error! (8388612-0)=8388612 4/4
dd_rescue: libddr_crypt.c:1532: crypt_blk_cb: Assertion `left < BLKSZ-state->inbuf' failed.
./test_sparse.sh: line 14: 2383266 Aborted                 (core dumped) ./dd_rescue $1 $2$3 ${TESTFILE} ${TESTFILE}.copy2
ERROR 198: Error with sparse

real    0m17.740s
user    0m7.233s
sys     0m10.413s
```

Backtrace when building w/ `make EXTRA_CFLAGS="-Og -ggdb3" check`:
```
(gdb)
#0  __pthread_kill_implementation (threadid=139879710168896, signo=6, no_tid=0) at pthread_kill.c:44
#1  __pthread_kill_internal (threadid=139879710168896, signo=6) at pthread_kill.c:89
#2  __GI___pthread_kill (threadid=139879710168896, signo=signo@entry=6) at pthread_kill.c:100
#3  0x00007f384841fd56 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007f3848401655 in __GI_abort () at abort.c:73
#5  0x00007f38484015be in __assert_fail_base (fmt=<optimized out>, assertion=0x7f38486ec2a5 "left < BLKSZ-state->inbuf", file=<optimized out>, line=<optimized out>,
    function=function@entry=0x4 <error: Cannot access memory at address 0x4>) at assert.c:118
#6  0x00007f38484160d0 in __assert_fail (assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=0x4 <error: Cannot access memory at address 0x4>)
    at assert.c:127
#7  0x00007f38486cfc75 in crypt_blk_cb (fst=0x55b507521940 <_fstate.2>, bf=0x55b5244be000 "", towr=0x7fffdc667fcc, eof=1, recall=<optimized out>, stat=<optimized out>)
    at libddr_crypt.c:1532
#8  0x000055b50750c2c2 in call_plugins_block (bf=<optimized out>, towr=towr@entry=0x7fffdc667fcc, eof=eof@entry=1, skip=skip@entry=0x7fffdc667fd4, op=op@entry=0x55b5075219e0 <_opts.5>,
    fst=fst@entry=0x55b507521940 <_fstate.2>) at dd_rescue.c:537
#9  0x000055b50750e85f in writeblock (towrite=towrite@entry=0, shouldwrite=shouldwrite@entry=0x7fffdc668024, op=op@entry=0x55b5075219e0 <_opts.5>,
    fst=fst@entry=0x55b507521940 <_fstate.2>, prg=prg@entry=0x55b507521900 <_progress.1>, dop=0x55b5075219b0 <_dpopts.4>) at dd_rescue.c:1904
#10 0x000055b50750e9d1 in real_cleanup (op=0x55b5075219e0 <_opts.5>, fst=0x55b507521940 <_fstate.2>, prg=0x55b507521900 <_progress.1>, dop=<optimized out>,
    dst=0x55b5075219a0 <_dpstate.3>, closelog=closelog@entry=0 '\000') at dd_rescue.c:1482
#11 0x000055b50750ed09 in cleanup (closelog=closelog@entry=0 '\000') at dd_rescue.c:1552
#12 0x000055b507514b9d in main (argc=<optimized out>, argv=<optimized out>) at dd_rescue.c:3638
```
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-04 21:24:58 UTC
(gdb) up
#7  0x00007f38486cfc75 in crypt_blk_cb (fst=0x55b507521940 <_fstate.2>, bf=0x55b5244be000 "", towr=0x7fffdc667fcc, eof=1, recall=<optimized out>, stat=<optimized out>)
    at libddr_crypt.c:1532
1532                    assert(left < BLKSZ-state->inbuf);
(gdb) p left
$1 = -12
(gdb) p BLKSZ
$2 = 16
(gdb) p state->inbuf
$3 = 0
Comment 5 Kostadin Shishmanov 2025-03-05 00:24:39 UTC
the loop (while true ; do LD_LIBRARY_PATH=. ./test_sparse.sh "-L ./libddr_crypt.so=AES192-CTR:weakrnd:pbkdf2:pass=ABC:" "encrypt" "decrypt" 8388612 || break ; done ;) seems to work fine for me on both a desktop with a Ryzen 7 7800X3D and a laptop with Ryzen 5 5650U when running on both tmpfs and an "actual" file system. Could be related to hardening? I don't use a hardened profile on either of the systems and USE=cet is disabled for both glibc and gcc.
Comment 6 Larry the Git Cow gentoo-dev 2025-03-14 16:24:53 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0561bd1023d8ebe3fd01f7efb0bedb4b966668b5

commit 0561bd1023d8ebe3fd01f7efb0bedb4b966668b5
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-03-14 16:23:44 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-03-14 16:24:18 +0000

    sys-fs/dd-rescue: add 9999
    
    Testing new upstream changes.
    
    Bug: https://bugs.gentoo.org/950609
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-fs/dd-rescue/dd-rescue-9999.ebuild | 132 +++++++++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)
Comment 7 Larry the Git Cow gentoo-dev 2025-03-14 18:38:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e4bff4898ca56fcb7a295a3298129e4be6791f9

commit 1e4bff4898ca56fcb7a295a3298129e4be6791f9
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-03-14 18:37:15 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-03-14 18:37:19 +0000

    sys-fs/dd-rescue: add 1.99.21
    
    Thanks a lot to upstream for working to try figure it out over an extended
    period. Thanks also to Kostadin for exploring it with me.
    
    Closes: https://bugs.gentoo.org/950609
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-fs/dd-rescue/Manifest                 |   1 +
 sys-fs/dd-rescue/dd-rescue-1.99.21.ebuild | 132 ++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+)