delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/07/31/13:57:59

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:cc:reply-to
:message-id:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=LsFjd2AqQLKgX5hc
M6+fjBPl0ftdokPyhCq+3Tg6B65aApV7jOcOAMnQ73lpKar9zeC0+OUA+jFs9F/t
N4QuxQFv9UBY0AcNvI1wgCH6Y6wJpCePrvb2KSX3Y/yI+LcF07uuUno6VuL8B+QG
QrFSkj5iwsBsVrjFVqptFptA3Qo=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:cc:reply-to
:message-id:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=3DT+SAGWdJ7XP1f1amhb+m
sSbDY=; b=dW7FcX4tiHJea9jJIVj9ZFl5JjSsa5+QhS4mfNZKPhemKhezDr/CpG
c3kyRRYZujHvEOD50QtyVoVT+wP67ORnSF5IXiujpsDNgdnH6qlvC8k8/fsjVSmz
IwoSyfDWfOb4rpc/WmyDPzheXsQqgX4Jx8jt2LwtLx+fg+kItG72c=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=tumtum00, H*RU:!192.168.1.102!, Hx-spam-relays-external:!192.168.1.102!, H*r:ip*192.168.1.102
X-HELO: out1-smtp.messagingengine.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :reply-to:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=Kj1D+XhDa+755Szc1cp900Pw5u0ilazzp0QoaOonuIw=; b=MdTe6C/dMlpy wk/hdMz2g2JFU+9A8fAKStm1Y9vgxCcksB8em485bJpprxyxhPZo/HAbx+XHHLAW lBzluexx10biDcNs6uCiJVp2abCZmmdR4qSIu9xzPYaDLNcrZlpw0BWb2gymwXHD q4hKc9eXdwsDMBmDjhmGSe6+BAq6fp7MiCxpASG9flogCT2P2/iAjk0HxQK1hGlu etLLc8c9xbFU4bEoI22nMqPCfwJ7rXfSwzgDQpP3SbaF1AhyftNYTnpElDhoRs6f /udkXWtsFz/rCjXHaCBYbfZj6XLiYdDM974gCW7jr5QQyUZwPXFvtTll07KXOFxi /+wKmeD++w==
Subject: Re: Self-compiled xorg-server 1.20.0 crashes at startup, buffer overflow
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
References: <xXobGF2ZMAup4U6upeZeUT3opDh7hre6sWHSAxvN47Xqg3DQf19yecPcsNI_fp-hZ9wlneKpfh18sFgVad0nRvTKnojh_4yCAEF9Zw-s0a0=@protonmail.com>
From: Jon Turney <jon DOT turney AT dronecode DOT org DOT uk>
Cc: tumtum00 <tumtum00 AT protonmail DOT com>
Reply-To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
Message-ID: <e95c0d44-ed2f-691f-9605-bb94833453ed@dronecode.org.uk>
Date: Tue, 31 Jul 2018 18:57:41 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
MIME-Version: 1.0
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 AT entry=0x60008e570, property=<optimized out>, pending=pending AT entry=0, range=range AT entry=0,
>     immutable=immutable AT entry=0, num_values=num_values AT entry=2, values=values AT entry=0x10059f4b0 <values>) at ../randr/rrproperty.c:385
>         prop = 0x60008cff0
>         add = <optimized out>
>         new_values = 0x60008e650
> #10 0x00000001004b682e in RROutputCreate (pScreen=pScreen AT entry=0x60008bff0, name=name AT entry=0x100586942 <__func__.9648+722> "default", nameLength=nameLength AT entry=7,
>     devPrivate=devPrivate AT entry=0x0) at ../randr/rroutput.c:120
>         values = {0, 1}
>         output = 0x60008e570
>         outputs = <optimized out>
>         nonDesktopAtom = <optimized out>
> #11 0x000000010040c11b in winRandRInit (pScreen=pScreen AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019