From owner-freebsd-current@FreeBSD.ORG Fri Jan 7 05:09:07 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 920141065675 for ; Fri, 7 Jan 2011 05:09:07 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id EDC518FC0C for ; Fri, 7 Jan 2011 05:09:06 +0000 (UTC) Received: by wwf26 with SMTP id 26so16872272wwf.31 for ; Thu, 06 Jan 2011 21:09:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=0sdUYY0YU19YUn4lvOoxHTVgY7VUT2IHMVfkwdVb9xY=; b=u8wNVKzn66jMQ+vdPls+ku8o/frG0s68TAl17LqfaCKAD8IQklf6oqRXXpEN3/1jF6 9ce8zdl39EBwkuEGvvpRpVZItjbmRVrO2ZiDeSaJAcqL2+FtBz1rgBosOgr6rqoII4IQ sYLZn8qij9f9vN//Kb8Q+F5wVWd5ArciLUMJk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=r6S9ulCT3hYvTXmn3ukObQuswy1zqXfrS29TXj+16vFQXcUV32Z+EH4bsoQprNxwTj fVR4PhVw7ngAccGExZPi9W+GFppTfEaeg2OJMQ17h5q47+fxP8fqnvU6avYhUmu9HdCY qgrOJKWPEhGLHNZrTVgtOvWFjIYkwmzkZoHCo= MIME-Version: 1.0 Received: by 10.216.141.37 with SMTP id f37mr9965720wej.31.1294376945561; Thu, 06 Jan 2011 21:09:05 -0800 (PST) Sender: yanegomi@gmail.com Received: by 10.216.254.226 with HTTP; Thu, 6 Jan 2011 21:09:05 -0800 (PST) In-Reply-To: <4D269B72.4040709@ee.lbl.gov> References: <4D268557.2090704@ee.lbl.gov> <4D268B98.3080906@ee.lbl.gov> <4D269B72.4040709@ee.lbl.gov> Date: Thu, 6 Jan 2011 21:09:05 -0800 X-Google-Sender-Auth: mW2XIN9NB2zw_tBwFW7ksTMZ4TM Message-ID: From: Garrett Cooper To: Craig Leres Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Current , Ed Schouten 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 05:09:07 -0000 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" =A0 =A0 =A0 =A0 xterm =A0 on =A0secure >> ttyv1 "/usr/libexec/getty Pc" =A0 =A0 =A0 =A0 xterm =A0 on =A0secure >> ttyv2 "/usr/libexec/getty Pc" =A0 =A0 =A0 =A0 xterm =A0 on =A0secure >> ttyv3 "/usr/libexec/getty Pc" =A0 =A0 =A0 =A0 xterm =A0 on =A0secure >> ttyv4 "/usr/libexec/getty Pc" =A0 =A0 =A0 =A0 xterm =A0 on =A0secure >> ttyv5 "/usr/libexec/getty Pc" =A0 =A0 =A0 =A0 xterm =A0 on =A0secure >> ttyv6 "/usr/libexec/getty Pc" =A0 =A0 =A0 =A0 xterm =A0 on =A0secure >> ttyv7 "/usr/libexec/getty Pc" =A0 =A0 =A0 =A0 xterm =A0 on =A0secure >> ttyv8 "/usr/local/bin/xdm -nodaemon" =A0xterm =A0 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: > > =A0 =A0 =A0 =A0case TIOCCONS: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Set terminal as console TTY. */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (*(int *)data) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0error =3D priv_check(td, P= RIV_TTY_CONSOLE); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (error) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (er= ror); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * XXX: constty should rea= lly need to be locked! > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * XXX: allow disconnected= constty's to be stolen! > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */ > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (constty =3D=3D tp) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0)= ; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (constty !=3D NULL) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (EB= USY); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tty_unlock(tp); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0constty_set(tp); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tty_lock(tp); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else if (constty =3D=3D tp) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0constty_clear(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (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: > > =A0 =A0 =A0 =A0case TIOCCONS: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Set terminal as console TTY. */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (*(int *)data) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (EPERM) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else if (constty =3D=3D tp) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0constty_clear(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (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, -Garrett