From owner-freebsd-x11@freebsd.org Tue Aug 4 09:06:49 2020 Return-Path: Delivered-To: freebsd-x11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD6473B5CFB for ; Tue, 4 Aug 2020 09:06:49 +0000 (UTC) (envelope-from zeising+freebsd@daemonic.se) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4BLTQd1xC6z4658 for ; Tue, 4 Aug 2020 09:06:49 +0000 (UTC) (envelope-from zeising+freebsd@daemonic.se) Received: by mailman.nyi.freebsd.org (Postfix) id 4265F3B5CFA; Tue, 4 Aug 2020 09:06:49 +0000 (UTC) Delivered-To: x11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 422F73B5CF9 for ; Tue, 4 Aug 2020 09:06:49 +0000 (UTC) (envelope-from zeising+freebsd@daemonic.se) Received: from mail.daemonic.se (mail.daemonic.se [IPv6:2607:f740:d:20::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BLTQc44b9z45jX; Tue, 4 Aug 2020 09:06:48 +0000 (UTC) (envelope-from zeising+freebsd@daemonic.se) Received: from cid.daemonic.se (localhost [IPv6:::1]) by mail.daemonic.se (Postfix) with ESMTP id 4BLTQY3lftz3mjt; Tue, 4 Aug 2020 09:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=daemonic.se; h= content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:user-agent:date:date :message-id:from:from:references:subject:subject:received :received; s=20151023; t=1596532004; bh=8RfBXXy0QOw3U+DtfRcKtWqL Xrq7c/IlhizXA4hiIiQ=; b=nvEMk0VP477PWdqGTh25u+GONe4I/UYn3DBPnMvM gJM5VjY1xuWc35Nh3ytXwqzPBN12ssDkx+2auFcpCn7shEfp9NxfxTBn5a4pAaOZ st4WyJlB0n5kYtH5t7l+mrejelkEAHinfylrzBZOE0uCEou31DRvO+zmwl2CkoiL Y88= X-Virus-Scanned: amavisd-new at daemonic.se Received: from mail.daemonic.se ([IPv6:::1]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256) by cid.daemonic.se (mailscanner.daemonic.se [IPv6:::1]) (amavisd-new, port 10587) with ESMTPS id X7Aa3GCApHAt; Tue, 4 Aug 2020 09:06:44 +0000 (UTC) Received: from vivi.daemonic.se (vivi.daemonic.se [IPv6:2001:470:dca9:1200::4]) by mail.daemonic.se (Postfix) with ESMTPSA id 4BLTQX4sPfz3lbm; Tue, 4 Aug 2020 09:06:44 +0000 (UTC) Subject: Re: Recent libX11 update broke emacs To: Ashish SHUKLA , Kevin Oberman Cc: "freebsd-x11@freebsd.org" , emacs@freebsd.org References: <3fd8de9f-5746-1216-6047-af576d851b1a@daemonic.se> <15394c3c-27ba-5548-45ee-ea1e98b56a27@FreeBSD.org> <6684a1e6-862c-51da-ce17-9fafdf23b2f4@FreeBSD.org> From: Niclas Zeising Message-ID: <6646fd04-f7c7-7e9e-99f6-f6ceeddaf888@daemonic.se> Date: Tue, 4 Aug 2020 11:06:43 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <6684a1e6-862c-51da-ce17-9fafdf23b2f4@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4BLTQc44b9z45jX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:36236, ipnet:2607:f740:d::/48, country:US]; TAGGED_FROM(0.00)[freebsd] X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 09:06:49 -0000 On 2020-08-04 06:48, Ashish SHUKLA wrote: > On 8/4/20 10:04 AM, Ashish SHUKLA wrote: >> On 8/4/20 3:38 AM, Niclas Zeising wrote: >>> On 2020-08-03 19:07, Kevin Oberman wrote: >>>> This is a weird problem and I'm uncertain if it is in libW11, > x11-server, >>>> or emacs. As a result, I'm crossposting to both lists. >>>> >>>> Yesterday, after upgrading libX11 and x11-server, I could no longer = run >>>> Emacs to an X display. It crashed quickly with a segmentation error >>>> in the >>>> pthread library. Oddly, I could run it to my local xserver from a re= mote >>>> system. >>> >>> Where does the segfault occur before entering pthreads? >>> >>>> Rolling back the x11 server did not help nor did rolling back libX11= or >>>> even both of them. I had to roll back libX11 first and build the ser= ver >>>> with the old libX11. Rebuilding emacs with the new ports made no >>>> difference. >>> >>> Which version of the server did you build? The patch to xorg-server = is >>> trivial, just switching out malloc for calloc have the memory 0 >>> initialized. The patch to libX11 is rather more involved. >>> It is possible that someone accidentally changed the ABI of libX11, I >>> guess. What happens if you use the version with just the security fi= xes >>> (the version I committed first, and that was merged to the Q3 branch.= ) >>> >>>> >>>> Since the old libX11 contains a very serious vulnerability, I reall= y >>>> hate >>>> to leave it this way, but I also have a hard time getting anything d= one >>>> without emacs. Nothing other than emacs seems to have a problem with > this >>> >>> There is one commit after libX11 1.6.10, that takes care of a regress= ion. >>> Can you apply >>> > https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/93fce3f4e79cbc7= 37d6468a4f68ba3de1b83953b >>> on top of the libX11 1.6.10 update and see if that fixes anything? >>> >>> Regards >> >> Able to get Emacs to segfault: >> >> =CE=BB lldb -e /usr/local/bin/emacs >> (lldb) target create "/usr/local/bin/emacs" >> Current executable set to '/usr/local/bin/emacs' (x86_64). >> (lldb) run -Q >> Process 36196 launching >> Process 36196 launched: '/usr/local/bin/emacs' (x86_64) >> Process 36196 stopped >> * thread #1, name =3D 'emacs-28.0.50', stop reason =3D signal SIGSEGV: >> invalid address (fault address: 0x0) >> frame #0: 0x0000000000427ca0 >> emacs`best_xim_style(xim=3D0x0000000000000000) at xfns.c:2629:21 >> (lldb) bt > [...] >=20 >> >> >> And workaround is launching Emacs like: env -u XMODIFIERS emacs >> >> I'll try the libX11 patch and give it a shot. >=20 > Emacs, with libX11 built with the patch, works fine now. It seems like > it's also reported in Debian[1], and they merged it. Maybe we can do th= e > same ? >=20 > References: > [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D966691 >=20 Thank you, I'll see about adding that patch to the port and package then. It looks like this is both a bug in libX11 and to some extent also emacs? Kevin, can you double check that the patch works for you. I find it=20 strange that you have to rebuild both xorg-server and libX11 for it to=20 work, are you forcing static linkage somewhere? Regards --=20 Niclas