From owner-freebsd-current@FreeBSD.ORG Fri Jan 7 11:53:58 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91B5B1065673 for ; Fri, 7 Jan 2011 11:53:58 +0000 (UTC) (envelope-from clbuisson@orange.fr) Received: from smtp.smtpout.orange.fr (smtp04.smtpout.orange.fr [80.12.242.126]) by mx1.freebsd.org (Postfix) with ESMTP id 0BCF58FC13 for ; Fri, 7 Jan 2011 11:53:57 +0000 (UTC) Received: from localhost ([92.156.106.245]) by mwinf5d07 with ME id sbPs1f00T5Hi3Yk03bPs44; Fri, 07 Jan 2011 12:23:54 +0100 Message-ID: <4D26F7C8.2010508@orange.fr> Date: Fri, 07 Jan 2011 12:23:52 +0100 From: Claude Buisson User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.13) Gecko/20101211 Thunderbird/3.1.7 MIME-Version: 1.0 To: Garrett Cooper References: <4D268557.2090704@ee.lbl.gov> <4D268B98.3080906@ee.lbl.gov> <4D269B72.4040709@ee.lbl.gov> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Current , Ed Schouten , Craig Leres Subject: Re: xterm -C and TIOCCONS vs. PRIV_TTY_CONSOLE X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jan 2011 11:53:58 -0000 On 01/07/2011 06:09, Garrett Cooper wrote: > On Thu, Jan 6, 2011 at 8:49 PM, Craig Leres wrote: >> On 01/06/11 20:05, Garrett Cooper wrote: >>> Just to make sure we're both on the same page: >>> >>> $ grep xterm /etc/ttys >>> ttyv0 "/usr/libexec/getty Pc" xterm on secure >>> ttyv1 "/usr/libexec/getty Pc" xterm on secure >>> ttyv2 "/usr/libexec/getty Pc" xterm on secure >>> ttyv3 "/usr/libexec/getty Pc" xterm on secure >>> ttyv4 "/usr/libexec/getty Pc" xterm on secure >>> ttyv5 "/usr/libexec/getty Pc" xterm on secure >>> ttyv6 "/usr/libexec/getty Pc" xterm on secure >>> ttyv7 "/usr/libexec/getty Pc" xterm on secure >>> ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure >> >> No, that's not what mine looks like. I changed it to match and rebooted >> but it doesn't help with the TIOCCONS issue. >> >> When I run xinit, it starts up the xterm -C which does a TIOCCONS. The >> 8.1 kernel checks for PRIV_TTY_CONSOLE which isn't set and denies the >> request: >> >> case TIOCCONS: >> /* Set terminal as console TTY. */ >> if (*(int *)data) { >> error = priv_check(td, PRIV_TTY_CONSOLE); >> if (error) >> return (error); >> >> /* >> * XXX: constty should really need to be locked! >> * XXX: allow disconnected constty's to be stolen! >> */ >> >> if (constty == tp) >> return (0); >> if (constty != NULL) >> return (EBUSY); >> >> tty_unlock(tp); >> constty_set(tp); >> tty_lock(tp); >> } else if (constty == tp) { >> constty_clear(); >> } >> return (0); >> >> >> There's nothing I see in all of /usr/src that turns on PRIV_TTY_CONSOLE >> in any case. You could rewrite the above like this: >> >> case TIOCCONS: >> /* Set terminal as console TTY. */ >> if (*(int *)data) { >> return (EPERM) >> } else if (constty == tp) { >> constty_clear(); >> } >> return (0); >> >> and it won't change any behavior. > > Ok -- figured I would ask about the obvious. I wish I could help > you further right now, but unfortunately I have a lot on my plate. > I've CCed ed@ and the list again so that someone else might be able to > chime in and help you further. > Cheers, a > -Garrett > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" > This is not a new problem, as it lead to a thread on hackers@ in November 2008 (search for "[Testers wanted] /dev/console cleanups" and "xconsole"). I tried a "proof of concept" by building a kernel with options MAC, and patching mac_stub.c to have stub_priv_grant() return 0 in stade of EPERM for PRIV_TTY_CONSOLE. With this, the kernel messages are displayed in xconsole, but not the others messages sent with syslog. Of course, this hack is not to be used on a production system. I hope that a true solution will be found one day or another. Claude Buisson.