Le lun. 04 oct. 2021 14h51 -0400, Chet Ramey a écrit :
> It's a problem with valgrind, described in another thread with this
> subject. Build bash with -DDISABLE_MALLOC_WRAPPERS to work around it.
Thanks Chet, that flag makes those crashes disappear.
However the crash after _nss_systemd_getpwuid_r() remains:

# systemd-run --pipe -p DynamicUser=1 -E LD_LIBRARY_PATH=$(nix-store -q $(which 
systemctl))/lib -pBindReadOnlyPaths={/etc,/nix,/run} -p RootDirectory=/run/bash 
-- $(readlink -e bash5-with-bash-malloc/bin/bash) --norc -c $(readlink $(which 
id))
> Running as unit: run-u2893.service
> malloc: unknown:0: assertion botched
> realloc: start and end chunk sizes differ
> Aborting...

Strangely that crash no longer happens when bash is run within valgrind,
and the correct dynamic username is retrieved by libnss_systemd.so.2:

# systemd-run --pipe -p DynamicUser=1 -E LD_LIBRARY_PATH=$(nix-store -q $(which 
systemctl))/lib -pBindReadOnlyPaths={/etc,/nix,/run} -p RootDirectory=/run/bash 
-- $(readlink $(which valgrind)) -- $(readlink -e 
bash5-with-bash-malloc/bin/bash) --norc -c $(readlink $(which id))
> Running as unit: run-u2961.service
> ==649969== Memcheck, a memory error detector
> ==649969== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
> ==649969== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
> ==649969== Command: 
> /nix/store/kjf6d8a28jia291s6vf1a1qi3apbk252-bash-5.1-p8/bin/bash --norc -c 
> /nix/store/j93py7g2fd0qmxq5q2mhnvc6ziijkjb8-coreutils-8.32/bin/id
> ==649969== 
> uid=63383(run-u2961) gid=63383(run-u2961) groups=63383(run-u2961)

Reply via email to