[no subject]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm seeing an issue with what looks like a miscompilation of libcap with gcc-12:

/bin/ls  segfaults when run in a certain directory, triggered by what looks like
an sprintf() called inside "cap_to_text()" in from the libcap library:

#0  __pthread_kill_implementation (threadid=<optimized out>,
signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ?
INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>,
signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f34f856932f in __pthread_kill_internal (signo=6,
threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007f34f8518e42 in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#3  0x00007f34f8503457 in __GI_abort () at abort.c:79
#4  0x00007f34f855d5a8 in __libc_message
(action=action@entry=do_abort, fmt=fmt@entry=0x7f34f8690291 "*** %s
***: terminated\n") at ../sysdeps/posix/libc_fatal.c:155
#5  0x00007f34f85fb042 in __GI___fortify_fail
(msg=msg@entry=0x7f34f8690237 "buffer overflow detected") at
fortify_fail.c:26
#6  0x00007f34f85f9b60 in __GI___chk_fail () at chk_fail.c:28
#7  0x00007f34f85f96d5 in ___sprintf_chk (s=s@entry=0x7fff9f08c6c2
",", flag=flag@entry=1, slen=slen@entry=0,
format=format@entry=0x7f34f86dc085 "%c%s%s%s")
   at sprintf_chk.c:37
#8  0x00007f34f86da882 in sprintf (__fmt=0x7f34f86dc085 "%c%s%s%s",
__s=<optimized out>) at /usr/include/bits/stdio2.h:38
#9  cap_to_text (caps=0x5643cf9b1a38, length_p=0x0) at cap_text.c:431

when libcap is built with gcc-11.3, the "ls" runs just fine; when I replace the
cap_text.o file from the gcc-12 build with the one generated by
gcc-11.2, it also runs fine, so seems like gcc-12 miscompiles
something in cap_to_text function (libcap-2.62)

I attach the disassemblies of the gcc-11 (OK) and gcc-12 built (BAD)
cap_text.o files. Maybe someone here can use this to figure out what
went wrong.
(-O2 -march=znver3 -mtune=znver3 -pipe" are used cflags).

Thanks!
      Manuel

Attachment: cap_text-OK
Description: Binary data

Attachment: cap_text-BAD
Description: Binary data


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux