NetBSD Problem Report #54364

From martin@aprisoft.de  Tue Jul  9 17:08:54 2019
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 970AF7A188
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  9 Jul 2019 17:08:54 +0000 (UTC)
Message-Id: <20190709170845.689D75CC80C@emmas.aprisoft.de>
Date: Tue,  9 Jul 2019 19:08:45 +0200 (CEST)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: gdb/ptrace fools the X server (?!?)
X-Send-Pr-Version: 3.95

>Number:         54364
>Category:       xsrc
>Synopsis:       gdb/ptrace fools the X server (?!?)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    xsrc-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 09 17:10:00 +0000 2019
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.50
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD martins.aprisoft.de 8.99.50 NetBSD 8.99.50 (GENERIC) #3: Tue Jul 9 16:32:27 CEST 2019 martin@martins.aprisoft.de:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

To be honest I have no idea if this an X userland problem, or a kernel thing.
I can reproduce it easily & reliable on this one machine, running the very
latest current as of earlier today (but it also happened with a few days older
versions of -current).

Problem is:

 - when I run gdb in an rxvt on this machine and the debugee forks an
   external program, the X server gets confused and start entering
   ENTER keys (or \n) to whatever window has the focus.

 - I have not found a way to make it stop, besides killing X

 - I can not switch away to another console

>How-To-Repeat:

 - Open rxvt (have not tried with others, probably does not matter).
 - run something like "gdb sysinst" and select a vnd as target
 - sysinst will fork a disklabel command

I now get an endless stream of enter keys.

Ktrace of the X server shows EAGAIN failures like this:

   439      1 X        CALL  writev(0x1a,0x7f7fff5685b0,1)
   439      1 X        GIO   fd 26 wrote 32 bytes
       "\^\\0\M-z\M-@)\0`\^A&\^A\0\0N\M-=c\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
   439      1 X        RET   writev 32/0x20
   439      1 X        CALL  recvmsg(0x1e,0x7f7fff568ae0,0)
   439      1 X        MISC  msghdr: [name=0x0, namelen=0, iov=0x7f7fff568ad0, i
ovlen=1, control=0x7f7fff568b10, controllen=528, flags=4000000]
   439      1 X        RET   recvmsg -1 errno 35 Resource temporarily unavailable
   439      1 X        CALL  __setitimer50(0,0x7f7fff568d10,0)
   439      1 X        RET   __setitimer50 0
   439      1 X        CALL  __clock_gettime50(3,0x7f7fff568d20)
   439      1 X        RET   __clock_gettime50 0
   439      1 X        CALL  poll(0x78453bd3b700,0x14,0x32)
   439      1 X        RET   poll 1
   439      1 X        CALL  __setitimer50(0,0x7f7fff568d10,0)
   439      1 X        RET   __setitimer50 0
   439      1 X        CALL  recvmsg(0x1a,0x7f7fff568ae0,0)
   439      1 X        MISC  msghdr: [name=0x0, namelen=0, iov=0x7f7fff568ad0, iovlen=1, control=0x7f7fff568b10, controllen=528, flags=4000000]
   439      1 X        GIO   fd 26 read 24 bytes
       "\^T\0\^F\0)\0`\^A&\^A\0\0\^F\0\0\0\0\0\0\0\^A\0\0\0"
   439      1 X        MISC  msghdr: [name=0x0, namelen=0, iov=0x7f7fff568ad0, iovlen=1, control=0x7f7fff568b10, controllen=0, flags=0]
   439      1 X        RET   recvmsg 24/0x18
   439      1 X        CALL  writev(0x1a,0x7f7fff568c60,1)
   439      1 X        GIO   fd 26 wrote 32 bytes
       "\^A \M-{\M-@\^A\0\0\0\^F\0\0\0\0\0\0\0\^A\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
        \0"
   439      1 X        RET   writev 32/0x20
   439      1 X        CALL  writev(0x1a,0x7f7fff568c60,1)
   439      1 X        GIO   fd 26 wrote 4 bytes
       "N\M-=c\0"
   439      1 X        RET   writev 4
   439      1 X        CALL  recvmsg(0x1a,0x7f7fff568ae0,0)
   439      1 X        MISC  msghdr: [name=0x0, namelen=0, iov=0x7f7fff568ad0, iovlen=1, control=0x7f7fff568b10, controllen=528, flags=4000000]
   439      1 X        RET   recvmsg -1 errno 35 Resource temporarily unavailable


>Fix:
n/a

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.