GNU bug report logs - #37308
guix weston-launch segfaults, /usr/bin/weston-launch does not -- why?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Bengt Richter <bokr@HIDDEN>; dated Thu, 5 Sep 2019 12:19:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 37308 <at> debbugs.gnu.org:


Received: (at 37308) by debbugs.gnu.org; 5 Sep 2019 20:22:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 05 16:22:43 2019
Received: from localhost ([127.0.0.1]:36124 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i5yHC-0004MU-V4
	for submit <at> debbugs.gnu.org; Thu, 05 Sep 2019 16:22:43 -0400
Received: from tobias.gr ([80.241.217.52]:37154)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1i5yH7-0004MC-KK
 for 37308 <at> debbugs.gnu.org; Thu, 05 Sep 2019 16:22:40 -0400
Received: by tobias.gr (OpenSMTPD) with ESMTP id 6cc8a6fa;
 Thu, 5 Sep 2019 20:22:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=tobias.gr; h=from:to:cc
 :subject:references:in-reply-to:date:message-id:mime-version
 :content-type; s=2018; i=me@HIDDEN; bh=eWpbYxpfTII/JjmM1zy2Lq
 Mmql+2b05Uf/CZxtUmZFw=; b=YIRu7pkTFPwUS62OnI5WuqHjuFwzUpq6o4CQWX
 JjVmP56IDGNr9QrjJ6fEFs1kCdy4iuMPt34bqJAkvWVlwdKpPSTQaDfncUdsTRXL
 m9hpNMW/ADdlLNpMVCQTlx0qF3duTPdGzLQS5Wn3V2g+RzReN2GUjQUc9g4kMhKW
 B67qJzWrjOFU0kj5XlhzHAPhFUVbn48NwCtABy1loyuw85+NYxEzs9flRhHForkQ
 pWzVVeC58lJHaDNtF8fGDkRRUrt3nSWrZBuPkYOTCRYzzJsD4Qur5OP+rm+4DbAd
 4hTlBDfncBzDZoHACWmW4QJjcQECBHVGcQKxznly7i48VtDQ==
Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id a7286dc0
 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); 
 Thu, 5 Sep 2019 20:22:35 +0000 (UTC)
From: Tobias Geerinckx-Rice <me@HIDDEN>
To: Bengt Richter <bokr@HIDDEN>
Subject: Re: bug#37308: guix weston-launch segfaults,
 /usr/bin/weston-launch does not -- why?
References: <20190905121748.GB6283@HIDDEN>
In-reply-to: <20190905121748.GB6283@HIDDEN>
Date: Thu, 05 Sep 2019 22:22:34 +0200
Message-ID: <87mufiijcl.fsf@nckx>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 37308
Cc: 37308 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Bengt,

Bengt Richter =E5=86=99=E9=81=93=EF=BC=9A
> Could we have [strace -k] back, or is it a security issue?

Ask upstream, they disabled[0] it by default, but I can't see how=20
it could ever be a =E2=80=98security issue=E2=80=99.  strace isn't installe=
d=20
setuid.

Thanks for noticing,

T G-R

[0]:=20
https://github.com/strace/strace/blob/172dc2fedd23d4debf65252eb3aafe0df70a1=
567/NEWS#L200

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCXXFuigAKCRANsP+IT1Vt
eZ30AP4rihe8vt2u8iGbo8hOUe8G2LatxXdr2jP+Jxi2dNocfQEA4qB/lUQblBX9
J/J2aaIw6iHLd3k3pGBH/ef11MFaYwU=
=mIL2
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-guix@HIDDEN:
bug#37308; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Sep 2019 12:18:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 05 08:18:15 2019
Received: from localhost ([127.0.0.1]:34903 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i5qiM-00020W-Pu
	for submit <at> debbugs.gnu.org; Thu, 05 Sep 2019 08:18:15 -0400
Received: from lists.gnu.org ([209.51.188.17]:58556)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bokr@HIDDEN>) id 1i5qiK-00020O-GE
 for submit <at> debbugs.gnu.org; Thu, 05 Sep 2019 08:18:13 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33528)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <bokr@HIDDEN>) id 1i5qiI-0006Oy-KR
 for bug-guix@HIDDEN; Thu, 05 Sep 2019 08:18:12 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bokr@HIDDEN>) id 1i5qiG-00027K-H3
 for bug-guix@HIDDEN; Thu, 05 Sep 2019 08:18:10 -0400
Received: from imta-35.everyone.net ([216.200.145.35]:54564
 helo=imta-38.everyone.net)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <bokr@HIDDEN>) id 1i5qiD-00024c-QA
 for bug-guix@HIDDEN; Thu, 05 Sep 2019 08:18:06 -0400
Received: from pps.filterd (m0004961.ppops.net [127.0.0.1])
 by imta-38.everyone.net (8.16.0.27/8.16.0.27) with SMTP id x85C4FrY031013
 for <bug-guix@HIDDEN>; Thu, 5 Sep 2019 05:18:01 -0700
X-Eon-Originating-Account: utRTc-OTf8EmvNsqouCqh1TF5Ox0aj4Q_nOOMvTDgL4
X-Eon-Dm: m0116293.ppops.net
Received: by m0116293.mta.everyone.net (EON-AUTHRELAY2 - 32d0d199) id
 m0116293.5d70550f.199a20
 for <bug-guix@HIDDEN>; Thu, 5 Sep 2019 05:17:58 -0700
X-Eon-Sig: AQMHrIJdcPz27tFdZgIAAAAB,ab66a702b721a878c2c9f9330882a9c8
X-Eip: ZZR1LiQTbMLWSx17a6ueU0v_21hlcz8rEj-A-grt0vM
Date: Thu, 5 Sep 2019 05:17:48 -0700
From: Bengt Richter <bokr@HIDDEN>
To: New-Bug <bug-guix@HIDDEN>
Subject: guix weston-launch segfaults, /usr/bin/weston-launch does not -- why?
Message-ID: <20190905121748.GB6283@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
User-Agent: Mutt/1.12.1 (2019-06-15)
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, ,
 definitions=2019-09-05_04:, , signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000
 definitions=main-1909050120
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic]
X-Received-From: 216.200.145.35
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Bengt Richter <bokr@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

I used guix strace and /usr/bin/strace to try to diagnose weston-launch,
from grepping my history:

  531  /usr/bin/strace -fyk -o wes-launch-fyk $(which weston-launch|xargs readlink -f)
  553  /usr/bin/strace -fyk -o wes-launch-fyk-usr $(which /usr/bin/weston-launch|xargs readlink -f)

I used /usr/bin/strace because it still had the -k option:

$ diff -u <(/usr/bin/strace -h) <(strace -h)
--- /dev/fd/63	2019-09-05 01:38:07.086388920 -0700
+++ /dev/fd/62	2019-09-05 01:38:07.086388920 -0700
@@ -7,7 +7,6 @@
 Output format:
   -a column      alignment COLUMN for printing syscall results (default 40)
   -i             print instruction pointer at time of syscall
-  -k             obtain stack trace between each syscall
   -o file        send trace output to FILE instead of stderr
   -q             suppress messages about attaching, detaching, etc.
   -r             print relative timestamp
$ 

Could we have it back, or is it a security issue? Anyway, it does a LOT
of work, so it makes the trace very slow -- but still useful.

The first thing I noticed was a permission problem. 
 Note difference between trace logs (no EACCES errors for /usr/bin/weston-launch):

$ grep EACC wes-launch-fyk
3989  openat(AT_FDCWD, "/dev/input/event3", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event9", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event10", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event0", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event2", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event1", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event7", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event11", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event12", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event13", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event14", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event15", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event16", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event4", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event8", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event5", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  openat(AT_FDCWD, "/dev/input/event6", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
3989  ioctl(4</dev/dri/card0>, DRM_IOCTL_DROP_MASTER, 0) = -1 EACCES (Permission denied)
$ 
$ grep EACC wes-launch-fyk-usr
$ 
(The above grep found no (! :) EACCES problems for /usr/bin/weston-launch in the strace ouput)

Here's my attempt to see what kind of errors happened:

$ egrep -ohe '-1 E.*' wes-launch-fyk|sort|uniq -c|sort -h
      1 -1 EPERM (Operation not permitted)
      2 -1 ENOTTY (Inappropriate ioctl for device)
     18 -1 EACCES (Permission denied)
     40 -1 EINVAL (Invalid argument)
    640 -1 ENOENT (No such file or directory)
$ 

EINVALs look like they may mostly be legitimate probes for input devices,
and ENOENTs are mostly walking through all the places to look for config data
-- which seems like someone could memoize away once at login time so a program
would usually just have to do a single am-I-newer-than-my-memoized-config-data check.

The /usr/bin/weston-launch succeeded in bringing up the gui weston/wayland desktop
with an icon for starting a terminal, so naturally it did a lot more, and bumped
into more things. Some look like bugs, but I'm not sure using /usr/bin/strace like

    /usr/bin/strace -fyk -o wes-launch-fyk $(which weston-launch|xargs readlink -f)

was not itself producing some errors. Amazing tool anyway :)

$ egrep -ohe '-1 E.*' wes-launch-fyk-usr|sort|uniq -c|sort -h
      1 -1 EBADF (Bad file descriptor)
      1 -1 EPERM (Operation not permitted)
      3 -1 ENOTTY (Inappropriate ioctl for device)
     68 -1 EAGAIN (Resource temporarily unavailable)
     86 -1 EINVAL (Invalid argument)
    984 -1 ENOENT (No such file or directory)
$
I included the -y option so you can see the files as </path/to/file> in the strace,
so it seems /dev/dri/card0 produced EPERM for both versions of weston-launch.

Idk what _IOC does  to /dev/tty1, but I guess the <anon_inode:[eventpoll]> might come from
exiting the gui desktop using Ctl-Alt-Backspace.

BTW, I have noticed  that on returning to console after such an exit, I lose write permission
to /dev/stderr -- don't know what that means, but I get it back if I log out and log back in.

$ egrep '(EBADF|EPERM|ENOTTY)' wes-launch-fyk wes-launch-fyk-usr
wes-launch-fyk:3989  ioctl(0</dev/tty1>, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0x1) = -1 ENOTTY (Inappropriate ioctl for device)
wes-launch-fyk:3990  ioctl(12</dev/dri/card0>, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, 0x7fffc5200270) = -1 EPERM (Operation not permitted)
wes-launch-fyk:3989  ioctl(0</dev/tty1>, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0) = -1 ENOTTY (Inappropriate ioctl for device)
wes-launch-fyk-usr:5421  ioctl(0</dev/tty1>, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0x1) = -1 ENOTTY (Inappropriate ioctl for device)
wes-launch-fyk-usr:5422  ioctl(15</dev/dri/card0>, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, 0x7ffdb7571460) = -1 EPERM (Operation not permitted)
wes-launch-fyk-usr:5422  epoll_ctl(17<anon_inode:[eventpoll]>, EPOLL_CTL_DEL, 19, NULL) = -1 EBADF (Bad file descriptor)
wes-launch-fyk-usr:5421  ioctl(0</dev/tty1>, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0) = -1 ENOTTY (Inappropriate ioctl for device)
wes-launch-fyk-usr:5421  ioctl(0</dev/tty1>, DRM_IOCTL_DROP_MASTER, 0) = -1 ENOTTY (Inappropriate ioctl for device)
$

The output logged to the console tty1 can be extracted from the strace,
along with the segfault:

egrep '/dev/tty1|SEG' wes-launch-fyk|tail -20

3990  write(2</dev/tty1>, "event5: opening input device '/d"..., 83) = 83
3990  write(2</dev/tty1>, "[00:35:11.032] ", 15) = 15
3990  write(2</dev/tty1>, "event5  - failed to create input"..., 60) = 60
3989  write(2</dev/tty1>, "Error opening device /dev/input/"..., 58) = 58
3990  write(2</dev/tty1>, "[00:35:11.100] ", 15) = 15
3990  write(2</dev/tty1>, "event6: opening input device '/d"..., 83) = 83
3990  write(2</dev/tty1>, "[00:35:11.110] ", 15) = 15
3990  write(2</dev/tty1>, "event6  - failed to create input"..., 60) = 60
3990  write(2</dev/tty1>, "[00:35:11.136] ", 15) = 15
3990  write(2</dev/tty1>, "warning: no input devices on ent"..., 191) = 191
3990  write(2</dev/tty1>, "[00:35:11.144] ", 15) = 15
3990  write(2</dev/tty1>, "failed to create input devices\n", 31) = 31
3990  close(0</dev/tty1> <unfinished ...>
3990  --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7f2ee04e23c4} ---
3990  +++ killed by SIGSEGV (core dumped) +++
3989  wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGSEGV && WCOREDUMP(s)}], 0, NULL) = 3990
3989  ioctl(0</dev/tty1>, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0) = -1 ENOTTY (Inappropriate ioctl for device)
3989  ioctl(0</dev/tty1>, KDSKBMODE, 0x3) = 0
3989  ioctl(0</dev/tty1>, KDSETMODE, 0) = 0
3989  ioctl(0</dev/tty1>, VT_SETMODE, 0x7ffeaa561f84) = 0

I still haven't nailed just where it happens, but I need some zs right now :)

Any help getting my guix weston-launch running would be greatly appreciated!

BTW, icecat sort of runs on top of /usr/bin/weston-launch, but it crashes seemingly on any save-as type of action,
blasting all the way back to the login console, not just back to the weston-terminal from which it was launched.

BTW2, I finally got icecat to show useful output after shotgunning like:

 guix package -i nss-certs
 guix upgrade icecat
 guix install fontconfig
 guix install libxfont
 guix install font-dejavu -->> this finally gave icecat a font
 guix install moka-icon-theme
 guix install hicolor-icon-theme
 guix install less
 guix package -i libsigsegv

I think it would be nice to be advised that font-dejavu may solve
the hex-box-font problem for a novice ;-)

installed mozjs also, but must have logged it elsewhere
(it's of course in guix package -l)

Anyway, TIA

Regards,
Bengt Richter





Acknowledgement sent to Bengt Richter <bokr@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#37308; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.