public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: The Cygwin Mailing List <cygwin@cygwin.com>
Cc: tumtum00 <tumtum00@protonmail.com>
Subject: Re: Self-compiled xorg-server 1.20.0 crashes at startup, buffer overflow
Date: Tue, 31 Jul 2018 23:18:00 -0000	[thread overview]
Message-ID: <e95c0d44-ed2f-691f-9605-bb94833453ed@dronecode.org.uk> (raw)
In-Reply-To: <xXobGF2ZMAup4U6upeZeUT3opDh7hre6sWHSAxvN47Xqg3DQf19yecPcsNI_fp-hZ9wlneKpfh18sFgVad0nRvTKnojh_4yCAEF9Zw-s0a0=@protonmail.com>

On 30/07/2018 16:33, tumtum00 wrote:
> after building xorg-server 1.20.0 without errors, the XWin binary crashes at startup due to a buffer overflow. XWin 1.20.0 from Cygwin repos works as expected.
> 
> Setup:
> - Freshly installed Win7 x86_64 VM
> - Cygwin x86_64
> - Dependencies installed as described in https://x.cygwin.com/docs/cg/prog-build-prerequisites.html, plus xcb-composite-devel

Thanks for pointing out this oversight.  I will amend the documentation.

> - Applied the following patches to my Cygwin environment, otherwise the build would fail:
>    https://github.com/cygwinports/cygport/commit/1072fd872757bd7aa97fa8daf95ed13f70f56291
>    https://github.com/cygwinports/cygport/commit/c4e0f0ec5f9a5a691fd19efe2bda3cdf278baef5
> - Downloaded patched xorg-server 1.20.0-2 sources as described in https://x.cygwin.com/docs/cg/prog-obtaining-source.html, "Obtaining via Cygwin setup"
> 
> Build:
>    $ cygport --64 xorg-server.cygport prep
>    $ cygport --64 xorg-server.cygport compile
> 
> XWin binary
>    /usr/src/xorg-server-1.20.0-2.src/xorg-server-1.20.0-2.x86_64/src/xserver-cygwin-1.20.0-2/x86_64-pc-cygwin/hw/xwin/XWin
> is then executed.
> 
> The `--buildtype=debug` option was added to `cygmeson` in `xorg-server.cygport` to generate the attached reports.
> 
> I'm out of ideas on how to continue debugging this. Help would be much appreciated.

I tried to reproduce this problem by following these steps, but the 
produced executable works ok for me.

> #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.

> No locals.
> #9  0x00000001004b80d5 in RRConfigureOutputProperty (output=output@entry=0x60008e570, property=<optimized out>, pending=pending@entry=0, range=range@entry=0,
>     immutable=immutable@entry=0, num_values=num_values@entry=2, values=values@entry=0x10059f4b0 <values>) at ../randr/rrproperty.c:385
>         prop = 0x60008cff0
>         add = <optimized out>
>         new_values = 0x60008e650
> #10 0x00000001004b682e in RROutputCreate (pScreen=pScreen@entry=0x60008bff0, name=name@entry=0x100586942 <__func__.9648+722> "default", nameLength=nameLength@entry=7,
>     devPrivate=devPrivate@entry=0x0) at ../randr/rroutput.c:120
>         values = {0, 1}
>         output = 0x60008e570
>         outputs = <optimized out>
>         nonDesktopAtom = <optimized out>
> #11 0x000000010040c11b in winRandRInit (pScreen=pScreen@entry=0x60008bff0) at ../hw/xwin/winrandr.c:256
>         crtc = 0x60008e240
>         output = <optimized out>


-- 
Jon Turney
Volunteer Cygwin/X X Server maintainer

--
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

  parent reply	other threads:[~2018-07-31 17:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30 17:27 tumtum00
2018-07-30 19:06 ` Marco Atzeri
2018-07-31 16:15 ` tumtum00
2018-07-31 23:18 ` Jon Turney [this message]
2018-08-03 17:19   ` tumtum00
2018-08-03 18:14     ` Jon Turney
2018-08-06 14:52       ` tumtum00

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e95c0d44-ed2f-691f-9605-bb94833453ed@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin@cygwin.com \
    --cc=tumtum00@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).