[Toybox] mkpasswd crashes in github ci
enh
enh at google.com
Thu Jun 26 05:41:14 PDT 2025
On Wed, Jun 25, 2025 at 6:44 PM Rob Landley <rob at landley.net> wrote:
>
> On 6/25/25 09:19, enh wrote:
> > On Tue, Jun 24, 2025 at 6:37 PM Rob Landley <rob at landley.net> wrote:
> >>
> >> On 6/6/25 23:05, Rob Landley wrote:
> >>> On 6/5/25 08:51, enh wrote:
> >>>> doesn't affect android's build because we don't build mkpasswd, but
> >>>> the mkpasswd tests are failing on github with sigsegv:
> >>>
> >>> Sigh, the updated the ASAN plumbing, didn't they?
> >>>
> >>> https://landley.net/notes-2024.html#04-07-2024
> >>>
> >>> When you enable ASAN on current gcc toolchains, crypt() drops out and
> >>> becomes a NULL pointer dereference. I don't know why. I need to put a
> >>> crypt() implementation in lib/hash.c.
> >>>
> >>> If you disable ASAN, the tests pass just fine. ASAN is what breaks them.
> >>
> >> If I append this to lib/hash.c:
> >>
> >> char *krypt(char *phrase, char *setting)
> >> {
> >> return "boom";
> >> }
> >> extern __typeof(crypt) crypt __attribute__((__weak__, __alias__("krypt")));
> >>
> >> Doing "ASAN=1 make clean mkpasswd; ./mkpasswd blah" STILL fails with the
> >> exact same null pointer dereference.
> >>
> >> I dunno what gcc's ASAN is doing, but it appears to be failing at
> >> runtime, not link time. I presumably need a compile time probe in
> >> scripts/genconfig.sh to detect crypt() failing and swap it out with a
> >> config symbol and #ifdefs, which is just sad...
> >>
> >> Maybe I should just switch the github test to "make toybox tests" which
> >> will build a toybox binary without ASAN and then test the existing
> >> binary? (The test builds enable ASAN, but make tests will use the
> >> existing binary if there is one, so listing both tests without asan...)
> >
> > or just use clang for asan? probably good to have both clang and gcc
> > in ci anyway, since you support both...
>
> ASAN doesn't work static linked, and I build static bionic binaries to
> avoid manually installing stuff outside of my home dir and /usr/local so
> running the dynamic binaries would require a chroot and sudo (thus not
> something the test suite could do normally).
>
> I suppose I could try building clang glibc binaries for ASAN testing...
yeah, that's what i meant... just make sure the docker image has clang
as well as gcc, and add CC=clang.
> Rob
More information about the Toybox
mailing list