Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jul 2016 07:26:20 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        freebsd-i386@freebsd.org
Subject:   Re: [Bug 211246] [syscons] console and ttyv0 competing for keystrokes
Message-ID:  <20160721041213.W1931@besplex.bde.org>
In-Reply-To: <20160721013907.T957@besplex.bde.org>
References:  <bug-211246-10@https.bugs.freebsd.org/bugzilla/> <20160721013907.T957@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, 21 Jul 2016, Bruce Evans wrote:

> On Wed, 20 Jul 2016 bugzilla-noreply@freebsd.org wrote:
>
>> ...
>> As an aside, things written to /dev/console invariably appear on the
>> ttyv0-screen on my system, but are never passed on to xconsole.
>
> This seems to be the expected behaviour.  You asked for foot-shooting and
> got it.  This is not a security hole since it requires root privilege.
>
> xconsole without -f should use the correct file.  If not, try /dev/tty or
> $(tty).

It uses the correct file, but still doesn't work...

> xconsole under FreeBSD-11 with a FreeBSD-~5.2 userland and a FreeBSD-4
> ports version of X fails due to permissions problems here, but I saw
> exactly the same behaviour in the simpler setup of logins on ttyv0
> and ttyv1 and a program on ttyv1 grabbing the console using
>
>    int c = 1; ioctl(0, TIOCCONS, &c);".

I forgot to redirect fd 0 from ttyv1 to /dev/console, so this was testing
something different.  Apparently I had /dev/console open somewhere to
get the same symptoms.  But it is not necessary to use TIOCCONS to see
problems.  Simply run "cat /dev/console" on 1 terminal.  This competes
for input with a shell on the device behing the console.  On an SMP
system with 8 CPUs, the sharing of the input was very fair with 3
processes reading it (1 normal, 1 TIOCCONS and 1 /dev/console).

>
> xconsole with no args works correctly under FreeBSD-~5.2.

The permissions problems were just root not being able to read .Xauthority
owned by non-root over nfs (nfs maps root somewhere unusable by default).

The ~5.2 system is UP, so working correctly might have been UP magic
instead of syscons magic.  With 1 cat of /sys/console, the sharing was
very unfair -- the shell on ttyv0 got it all.

So using ttyv0 and console with getty and xconsole is much the same
foot shooting as using them with 2 getty's.  So you must not use ttyv0
if you want to use xconsole!

Not using ttyv0 means not running any program that opens it, starting
with getty (init uses only /dev/console).  There are further
complications for low-level consoles, but using TIOCCONS reduces
complications together with features and bugs in the low-level consoles
by mostly not using them.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160721041213.W1931>