Web lists-archives.com

Re: Self-compiled xorg-server 1.20.0 crashes at startup, buffer overflow




On 03/08/2018 18:19, tumtum00 wrote:
On 31 July 2018 7:57 PM, Jon Turney wrote:

I tried 3 new machines today, can reproduce the issue in all of them. All were Win7 x86_64. 2 VMs installed from scratch (one in English, the other German as in my first report) plus a system running on bare metal.

#7 0x000000018017e7e9 in __chk_fail () at /usr/src/debug/cygwin-2.10.0-1/newlib/libc/ssp/chk_fail.c:11
msg = "*** buffer overflow detected ***: terminated\n"
#8 0x000000018018c1c3 in __memcpy_chk (dst=0x60008e570, src=0x45, len=0, slen=0) at /usr/src/debug/cygwin-2.10.0-1/newlib/libc/ssp/memcpy_chk.c:48

This is a wrapper around memcpy, which is being used as we are building
with _FORTIFY_SOURCE

I'd suggest setting a breakpoint on this line (after installing the
cygwin-debuginfo package for relevant debug info) and trying to
understand why it's not succeeding.

Attached the backtrace at memcpy_chk.c:48.
I've been trying to figure out what is going on from the source code, but I'm not really getting anywhere.

Does it suffice to install cygwin-debuginfo or do I need to set something up?
I ran gdb with `set cygwin-exceptions on` too, but no further information came up in the backtrace.

Thread 1 hit Breakpoint 1, __memcpy_chk (dst=0x60008c7a0, src=0x10059f4b0 <values>, len=8, slen=4)
    at /usr/src/debug/cygwin-2.10.0-1/newlib/libc/ssp/memcpy_chk.c:48
48	/usr/src/debug/cygwin-2.10.0-1/newlib/libc/ssp/memcpy_chk.c: No such file or directory.
#0  __memcpy_chk (dst=0x60008c7a0, src=0x10059f4b0 <values>, len=8, slen=4)

The "no such file or directory" doesn't make much sense to me. That file should be provided by cygwin-debuginfo package.

Anyhow, I think to fix this, you need a cygwin with the following changes (the latest snapshot should be ok)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commitdiff;h=4564b30f331a067e71b25308ac7c8a85ceb4b122;hp=4d1a356f7b36905f5e2b616513b111ef042f1a43
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commitdiff;h=e494b560350cabef94126a4478096aae89ae35a0

Sorry for not working this out sooner, but I'd convinced myself that these changes are in the current cygwin-devel package, when in fact they aren't.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple