[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Passive versus active translators
From: |
Neal H Walfield |
Subject: |
Passive versus active translators |
Date: |
Thu, 21 Jun 2001 18:01:00 -0500 |
User-agent: |
Mutt/1.3.18i |
Using settrans to start an active translators sets up a completely
different enviornment than that created when a file system launches a
passive translator. There are three main differences:
o File descriptors
- settrans: stderr is the user's tty
- libfshelp: nothing
o Current working directory
- settrans: user's current working directory
- libfshelp: the directory in which we find the
translator.
o User ids
- settrans: The euid and egid of the user that lauched
settrans.
- libfshelp: The uid and gid of the node.
The first difference is clearly justifiable -- when starting a passive
translator, there is no tty. We do, however, special case translators
with root privlidges by allowing them to open the console to dump their
error messages.
The second and third difference can be extremely confusing and this is
complicated even further when we cannot see the any errors when the
passive translator is launched. Consider the following in which we set
an active translator as root with the backing store `foo' readable only
by root, using a relative path on the node `tmp' with the uid neal and
the gid neal:
neal@desdemona:~ (0)$ dd if=/dev/zero of=foo bs=1024 count=1024
1024+0 records in
1024+0 records out
neal@desdemona:~ (0)$ /sbin/mke2fs -F foo
mke2fs 1.20, 25-May-2001 for EXT2 FS 0.5b, 95/08/09
...
Writing inode tables: 0/1done
Writing superblocks and filesystem accounting information: done
neal@desdemona:~ (0)$ sudo chown root.root foo
neal@desdemona:~ (0)$ sudo chmod 600 foo
The backing store is not owned by root is only readable by root.
neal@desdemona:~ (0)$ touch tmp
tmp is now owned by neal.
neal@desdemona:~ (0)$ sudo settrans -ap tmp /hurd/ext2fs foo
Let us see what happens when we use a relative path to the backing
store.
neal@desdemona:~ (0)$ ls -l tmp
total 12
drwxr-xr-x 2 root root 12288 Jun 21 15:59 lost+found
neal@desdemona:~ (0)$ ls -ld tmp
drwxr-xr-x 3 neal neal 1024 Jun 21 15:59 tmp
It works.
neal@desdemona:~ (0)$ sudo settrans -ag tmp
Kill the active translator.
neal@desdemona:~ (0)$ ls -l tmp
ls: tmp: Translator died
The passive translator fails to start!
neal@desdemona:~ (1)$ sudo settrans -g tmp
neal@desdemona:~ (0)$ sudo settrans -ap tmp /hurd/ext2fs `pwd`/foo
Now we use a full path.
neal@desdemona:~ (0)$ ls -l tmp
total 12
drwxr-xr-x 2 root root 12288 Jun 21 15:59 lost+found
Ok, this works.
neal@desdemona:~ (0)$ sudo settrans -ag tmp
neal@desdemona:~ (0)$ ls -l tmp
ls: tmp: Translator died
But again, we fail to start the passive translator.
neal@desdemona:~ (1)$ sudo settrans -g tmp
neal@desdemona:~ (0)$ ls -l tmp
-rw-r--r-- 1 neal neal 0 Jun 21 15:59 tmp
That is what the problem is: settrans is starting the active translator
with root permissions while libfshelp is only giving it the uid and gid
of the node.
neal@desdemona:~ (0)$ sudo chown root.root tmp
neal@desdemona:~ (0)$ sudo settrans tmp /hurd/ext2fs `pwd`/foo
Let us see what happens now:
neal@desdemona:~ (0)$ ls -l tmp
total 12
drwxr-xr-x 2 root root 12288 Jun 21 15:59 lost+found
Ok, the active translator works.
neal@desdemona:~ (0)$ sudo settrans -ag tmp
neal@desdemona:~ (0)$ ls -l tmp
total 12
drwxr-xr-x 2 root root 12288 Jun 21 15:59 lost+found
And so does the passive translator.
It only took me a few hours to figure point three out. However, for
someone who does not know the Hurd, he will become very frustrated.
Additionally, I even left out a common failure: using a relative path
for the translator itself (e.g. when testing a build, I might use
`settrans -ap foo test').
I would like to implement the following in settrans:
o emit a warning if the translator is a relative path, e.g.
`settrans foo bar'.
o use fshelp_start_translator_long instead of
fshelp_start_translator and sets the uid and gid to that of
the underlying node.
o set the current working directory of the translator to that of
the directory of the translator.
pgpmMPUSDRdVF.pgp
Description: PGP signature