List Info

Thread: patch: more TTY handling fixes




patch: more TTY handling fixes
user name
2007-02-01 12:58:32
Hi,

attached is a patch with a couple of related fixes to TTY
handling. 
The patch was need to make DFB work in my setup when running
DFB 
applications both as root and as unprivileged user and both
from the 
physical terminal (/dev/tty1) and SSH login shell. Part of
it is, I'm 
sorry to say, reversal of changes I suggested (these two
revisions: 
http://directfb
.org/index.php/viewcvs.cgi/DirectFB/systems/fbdev/fbdev.c.di
ff?r1=1.49&r2=1.51).

Here's more detailed description of the changes:

* Previously, the process attached itself to a new
controlling TTY 
only if vt_switch option was on. This patch changes it to
always 
(unless VT handling is completely disabled, of course)
attach the 
process to the TTY being used by the app as the new
controlling TTY. 
This is because we always need some controlling TTY, without
it, there 
could be SIGHUP/SIGCONT signals (see e.g. my post about
re-adding 
setpgid() call). Note that the patch moves TIOCSCTTY call
outside 
of "if vt-switch" branch, but completely removes
TIOCNOTTY - - that's 
because the latter is not needed, setsid() already detached
the 
process from controlling TTY. So "vt-switch" now
only 
controls "physical" change of the currently active
console.

* /dev/tty? files are opened with O_NOCTTY. Linux kernel has
a feature 
that if a process without controlling TTY opens a TTY
device, it's 
made its controlling TTY, unless you use O_NOCTTY, so this
change 
ensure that we only attach to the desired TTY explicitly
using 
TIOCSCTTY.

* Moved TIOCSCTTY before KBSETMODE use, otherwise non-root
users get 
EPERM from KBSETMODE ioctl(), because you can't do that
operation on 
anything other than your controlling TTY normally.

* Removed setpgid() calls, because they interfered with
setsid() later 
and weren't really necessary now that other cTTY problems
were fixed. 
Ditto for the removed dfb_vt_detach() call (I couldn't find
any 
information about why it was there in the first place, but
everything 
works without it as far as I can tell).


I'm not sure if you'll want to include it in 1.0.0: on one
hand, it 
fixes a serious problem with running as non-root user, on
the other 
hand, it's not trivial change and may have some consequences
I 
missed. I'd certainly appreciate a review of the patch, I'm
still 
quite unfamiliar with the DFB code.

Regards,
Vaclav

-- 
PGP key: 0x465264C9, available from http://pgp.mit.edu/

_______________________________________________
directfb-dev mailing list
directfb-devdirectfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/
directfb-dev

  
Re: patch: more TTY handling fixes
user name
2007-02-02 00:46:23
Vaclav Slavik schrieb:
> I'm not sure if you'll want to include it in 1.0.0: on
one hand, it 
> fixes a serious problem with running as non-root user,
on the other 
> hand, it's not trivial change and may have some
consequences I 
> missed. I'd certainly appreciate a review of the patch,
I'm still 
> quite unfamiliar with the DFB code.

Awesome!

Thanks for digging in the old code and fixing all these
issues. I will
go through them once more, but so far it all seems
reasonable and the
patch looks good.

I'll commit this and some other VT switching changes I made
a
while back, but forgot to commit. Anything else for RC4?

-- 
Best regards,
   Denis Oliver Kropp

.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/
                |
"------------------------------------------"

_______________________________________________
directfb-dev mailing list
directfb-devdirectfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/
directfb-dev

Re: patch: more TTY handling fixes
country flaguser name
Germany
2007-02-05 05:51:23
Vaclav Slavik schrieb:
> Hi,
> 
> attached is a patch with a couple of related fixes to
TTY handling. 
> The patch was need to make DFB work in my setup when
running DFB 
> applications both as root and as unprivileged user and
both from the 
> physical terminal (/dev/tty1) and SSH login shell. Part
of it is, I'm 
> sorry to say, reversal of changes I suggested (these
two revisions: 
> http://directfb
.org/index.php/viewcvs.cgi/DirectFB/systems/fbdev/fbdev.c.di
ff?r1=1.49&r2=1.51).

I couldn't find anything bad, all fixes make sense as far as
I can tell...

Good that someone (you) exists knowing about such old
interfaces 


I just applied the patch for the RC4 release today.

-- 
Best regards,
   Denis Oliver Kropp

.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/
                |
"------------------------------------------"

_______________________________________________
directfb-dev mailing list
directfb-devdirectfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/
directfb-dev

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )