From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bengt Richter Subject: bug#37308: guix weston-launch segfaults, /usr/bin/weston-launch does not -- why? Date: Thu, 5 Sep 2019 05:17:48 -0700 Message-ID: <20190905121748.GB6283@PhantoNv4ArchGx.localdomain> Reply-To: Bengt Richter Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33602) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5qjA-0006SA-H5 for bug-guix@gnu.org; Thu, 05 Sep 2019 08:19:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5qj8-0002W8-Tr for bug-guix@gnu.org; Thu, 05 Sep 2019 08:19:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54315) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5qj8-0002W2-PE for bug-guix@gnu.org; Thu, 05 Sep 2019 08:19:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i5qj8-00021c-Ix for bug-guix@gnu.org; Thu, 05 Sep 2019 08:19:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:33528) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5qiI-0006Oy-KR for bug-guix@gnu.org; Thu, 05 Sep 2019 08:18:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5qiG-00027K-H3 for bug-guix@gnu.org; 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 ) id 1i5qiD-00024c-QA for bug-guix@gnu.org; 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 ; Thu, 5 Sep 2019 05:18:01 -0700 Received: by m0116293.mta.everyone.net (EON-AUTHRELAY2 - 32d0d199) id m0116293.5d70550f.199a20 for ; Thu, 5 Sep 2019 05:17:58 -0700 Content-Disposition: inline List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 37308@debbugs.gnu.org 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, 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 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 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, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0x1) = -1 ENOTTY (Inappropriate ioctl for device) wes-launch-fyk:3990 ioctl(12, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, 0x7fffc5200270) = -1 EPERM (Operation not permitted) wes-launch-fyk:3989 ioctl(0, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0) = -1 ENOTTY (Inappropriate ioctl for device) wes-launch-fyk-usr:5421 ioctl(0, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0x1) = -1 ENOTTY (Inappropriate ioctl for device) wes-launch-fyk-usr:5422 ioctl(15, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, 0x7ffdb7571460) = -1 EPERM (Operation not permitted) wes-launch-fyk-usr:5422 epoll_ctl(17, EPOLL_CTL_DEL, 19, NULL) = -1 EBADF (Bad file descriptor) wes-launch-fyk-usr:5421 ioctl(0, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0) = -1 ENOTTY (Inappropriate ioctl for device) wes-launch-fyk-usr:5421 ioctl(0, 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, "event5: opening input device '/d"..., 83) = 83 3990 write(2, "[00:35:11.032] ", 15) = 15 3990 write(2, "event5 - failed to create input"..., 60) = 60 3989 write(2, "Error opening device /dev/input/"..., 58) = 58 3990 write(2, "[00:35:11.100] ", 15) = 15 3990 write(2, "event6: opening input device '/d"..., 83) = 83 3990 write(2, "[00:35:11.110] ", 15) = 15 3990 write(2, "event6 - failed to create input"..., 60) = 60 3990 write(2, "[00:35:11.136] ", 15) = 15 3990 write(2, "warning: no input devices on ent"..., 191) = 191 3990 write(2, "[00:35:11.144] ", 15) = 15 3990 write(2, "failed to create input devices\n", 31) = 31 3990 close(0 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, _IOC(_IOC_NONE, 0x4b, 0x51, 0), 0) = -1 ENOTTY (Inappropriate ioctl for device) 3989 ioctl(0, KDSKBMODE, 0x3) = 0 3989 ioctl(0, KDSETMODE, 0) = 0 3989 ioctl(0, 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