Subject: Re: xterm tty ownership (LFS)
To: Christos Zoulas <christos@astron.com>
From: Gary Duzan <gary@duzan.org>
List: tech-kern
Date: 09/17/2007 07:37:31
In Message <fceiej$3b0$1@sea.gmane.org> ,
   christos@astron.com (Christos Zoulas) wrote:

=>In article <200709140057.l8E0vtJh025845@wheel.duzan.org>,
=>Gary Duzan  <gary@duzan.org> wrote:
=>>
=>>   Here is the latest I have. I added VOP_PRINT before and after
=>>the call to VOP_SETATTR in sys/kern/tty_ptm.c:pty_grant_slave(),
=>>and get:
=>>
=>>==========================================================================
=>>tag VT_UFS, ino 494587, on dev 0, 0 flags 0x0, effnlink 1, nlink 1
=>>        mode 020666, owner 0, group 0, size 0 lock type vnlock: EXCL
=>>(count 1) by pid 462.1
=>>tag VT_UFS, ino 494587, on dev 0, 0 flags 0x2, effnlink 1, nlink 1
=>>        mode 020620, owner 100, group 4, size 0 lock type vnlock: EXCL
=>>(count 1) by pid 462.1
=>>==========================================================================
=>>
=>>   Looks ok to me. Nevertheless, the terminal reverts back to the
=>>original permissions, and I get this in the xterm:
=>>
=>>==========================================================================
=>>utmp_update: /dev/ttyp1: Is not owned by you
=>>capo { ~ } % tty
=>>/dev/ttyp1
=>>capo { ~ } % ls -li /dev/ttyp1
=>>494587 crw-rw-rw-  1 root  wheel  5, 1 Sep 13 20:40 /dev/ttyp1
=>>==========================================================================
=>
=>Add some debugging printfs to the lfs setattr for that particular inode, since
=>you know the number...

   lfs_setattr() is basically a call to ufs_setattr() with some
extra checking first. It seems like that is operating correctly.

   Maybe I need to fsync the ifile or something? That doesn't sound
right, but somehow the inode change isn't taking.

   I have some ideas on things to test, namely doing a namei lookup
in the TIOCPTMGET code to see if the returned permissions match,
but I probably won't get to it until tomorrow.

   Thanks.

					Gary Duzan