Package: valgrind
Version: 1:3.20.0-2

Hi.  During debci autopkgtest of a new version of libgssglue on i386 I
got a failure like this, which is fatal and execution halts.

117s vex x86->IR: unhandled instruction bytes: 0x2E 0x8D 0xB4 0x26
117s ==5711== valgrind: Unrecognised instruction at address 0x4d285c8.
117s ==5711==    at 0x4D285C8: ??? (in 
/usr/lib/i386-linux-gnu/libgssglue.so.1.0.0)
117s ==5711==    by 0x4D27893: ??? (in 
/usr/lib/i386-linux-gnu/libgssglue.so.1.0.0)
117s ==5711==    by 0x4D27B0E: ??? (in 
/usr/lib/i386-linux-gnu/libgssglue.so.1.0.0)
117s ==5711==    by 0x4D27069: gss_import_name (in 
/usr/lib/i386-linux-gnu/libgssglue.so.1.0.0)
117s ==5711==    by 0x486BA0F: ??? (in 
/usr/lib/i386-linux-gnu/libgsasl.so.18.0.0)
117s ==5711==    by 0x485757C: gsasl_step (in 
/usr/lib/i386-linux-gnu/libgsasl.so.18.0.0)
117s ==5711==    by 0x4857623: gsasl_step64 (in 
/usr/lib/i386-linux-gnu/libgsasl.so.18.0.0)
117s ==5711==    by 0x10B387: ??? (in /usr/bin/gsasl)
117s ==5711==    by 0x4ADE7C4: (below main) (libc_start_call_main.h:58)
117s ==5711== Your program just tried to execute an instruction that Valgrind
117s ==5711== did not recognise.  There are two possible reasons for this.
117s ==5711== 1. Your program has a bug and erroneously jumped to a non-code
117s ==5711==    location.  If you are running Memcheck and you just saw a
117s ==5711==    warning about a bad jump, it's probably your program's fault.
117s ==5711== 2. The instruction is legitimate but Valgrind doesn't handle it,
117s ==5711==    i.e. it's Valgrind's fault.  If you think this is the case or
117s ==5711==    you are not sure, please let us know and we'll try to fix it.
117s ==5711== Either way, Valgrind will now raise a SIGILL signal which will
117s ==5711== probably kill your program.
117s ==5711== 
117s ==5711== Process terminating with default action of signal 4 (SIGILL)
117s ==5711==  Illegal opcode at address 0x4D285C8
117s ==5711==    at 0x4D285C8: ??? (in 
/usr/lib/i386-linux-gnu/libgssglue.so.1.0.0)
117s ==5711==    by 0x4D27893: ??? (in 
/usr/lib/i386-linux-gnu/libgssglue.so.1.0.0)
117s ==5711==    by 0x4D27B0E: ??? (in 
/usr/lib/i386-linux-gnu/libgssglue.so.1.0.0)
117s ==5711==    by 0x4D27069: gss_import_name (in 
/usr/lib/i386-linux-gnu/libgssglue.so.1.0.0)
117s ==5711==    by 0x486BA0F: ??? (in 
/usr/lib/i386-linux-gnu/libgsasl.so.18.0.0)
117s ==5711==    by 0x485757C: gsasl_step (in 
/usr/lib/i386-linux-gnu/libgsasl.so.18.0.0)
117s ==5711==    by 0x4857623: gsasl_step64 (in 
/usr/lib/i386-linux-gnu/libgsasl.so.18.0.0)
117s ==5711==    by 0x10B387: ??? (in /usr/bin/gsasl)
117s ==5711==    by 0x4ADE7C4: (below main) (libc_start_call_main.h:58)

I can reproduce this in debian sid like this, on my amd64 laptop:

podman run --arch 386  -it --rm debian:unstable-slim
apt update
apt install valgrind gsasl
apt dist-upgrade
valgrind --error-exitcode=1 /usr/bin/gsasl -m GSSAPI -d --no-starttls --imap 
no-such-domain.example 143

Running it without valgrind works:

/usr/bin/gsasl -m GSSAPI -d --no-starttls --imap no-such-domain.example 143
/usr/bin/gsasl: no-such-domain.example: Name or service not known

However running it under gdb doesn't seem to work either:

root@65b9c363c623:/# gdb --silent /usr/bin/gsasl
Reading symbols from /usr/bin/gsasl...
(No debugging symbols found in /usr/bin/gsasl)
(gdb) r -m GSSAPI -d --no-starttls --imap no-such-domain.example 143
Starting program: /usr/bin/gsasl -m GSSAPI -d --no-starttls --imap 
no-such-domain.example 143

warning: Error disabling address space randomization: Success
warning: Could not trace the inferior process.
warning: ptrace: Operation not permitted
During startup program exited with code 127.

The build log for this libgssglue on i386 (built just a day ago in
debian sid) is here:

https://buildd.debian.org/status/fetch.php?pkg=libgssglue&arch=i386&ver=0.8-1&stamp=1701797253&raw=0

Libgssglue is a simple C library with no dependencies, and no complexity
in the build system, but do you notice anything odd with the compiler
settings here that could cause it to generate unwanted instructions?

If the libgssglue library doesn't contain unwanted instructions, isn't
this a valgrind bug?

If relevant, the build log for gsasl is here:

https://buildd.debian.org/status/fetch.php?pkg=gsasl&arch=i386&ver=2.2.0-2&stamp=1689109164&raw=0

Do you spot anything odd in that?  This build was long ago, on a much
older sid so maybe something changed meanwhile.

I look at the debci output on i386 for libgssglue 0.7-2 which passed,
and it looks like this:

https://ci.debian.net/packages/libg/libgssglue/testing/i386/40704726/

Notice the 'Illegal instruction' outputs directly when starting 'gsasl',
which causes the self-test to not use valgrind at all.  In the new 0.8
debci output, you can see that several self-tests for 'gsasl' works
under valgrind, it is just when it comes to libgssglue code that it
triggers the 'Illegal instruction'.

I will disable use of valgrind on i386 during debci/autopkgtest until I
can figure out how to fix this problem.  Currently libgssglue's
autopkgtest depends on 'valgrind-if-available' which results in use of
valgrind on all platforms where Debian provides it.

/Simon

Attachment: signature.asc
Description: PGP signature

Reply via email to