*BSD News Article 12702


Return to BSD News archive

Newsgroups: comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!dog.ee.lbl.gov!hellgate.utah.edu!fcom.cc.utah.edu!cs.weber.edu!terry
From: terry@cs.weber.edu (A Wizard of Earth C)
Subject: Re: A challenge to all true kernel hackers - conditional symlinks.
Message-ID: <1993Mar11.001929.5652@fcom.cc.utah.edu>
Sender: news@fcom.cc.utah.edu
Organization: Weber State University  (Ogden, UT)
References: <JKH.93Mar9214944@whisker.lotus.ie> <CGD.93Mar9185827@eden.CS.Berkeley.EDU>
Date: Thu, 11 Mar 93 00:19:29 GMT
Lines: 59

In article <CGD.93Mar9185827@eden.CS.Berkeley.EDU> cgd@eden.CS.Berkeley.EDU (Chris G. Demetriou) writes:
>In article <JKH.93Mar9214944@whisker.lotus.ie> jkh@whisker.lotus.ie (Jordan K. Hubbard) writes:
>[ the idea ... ]
>
>YES, that would be wonderful.  it's the one thing about apollos that
>i *loved*...  thank god you didn't ask for `node_data... 8-)
>
>>The question is, is anyone out there game to see what it would take to
>>do this in 386bsd?  I think you'll find getting at the current process
>>environment from namei() somewhat tricky..
>
>possibly impossible, w/o mods to the rest of the kernel, esp.
>if processes decide to mangle their args buf...
>
>namei takes a struct proc * of the process in question, it's just a matter
>of finding the environment variables, and i can' think of
>a reliable way to do that, w/o hacking exec slightly...

	This is a simple mod of /sys/kern/vfs_lookup.c, but it introduces
a number of *bad* security holes (look at the CERT advisories on NeXT
machines if you don't believe me).  The exec hack is not strictly necessary,
although if done that way requires mods to the user struct and the proc
struct.  The easy way is to look at the crt0.o code that passes arguments
to main(); you are interested in the envp.  Just reference the memory the
same way from the kernel (you may have to fault stuff in -- this is the
problematic part).

The mod should be done to lookup(), not namei(), and the contents of the
symbolic link will have to be the same so ls -l of the link gives the
link data rather than a listing of the link target.  This gets more
complicated, in that it blows any possibility of concurrency under SMP
until the secondary lookup has completed.  Basically, the lookup of
symbolic links is done twice, once without "follow-links" to read the
link data, and once to lookup th substituted link data.  This has to be
done in case the lookup invokes another "conditional" symbolic link as
it's terminal object.

Either way, it's handled outside of the scope of a particular file system
type (above the VFS layer).

Basically, this results in what would be called "logical names" if we were
all VMS users.

I would vote *against* making this mod until we have a generic installation
system, since wide-scale use of such a feature before then could put us all
through hell later on (at least those of us interested in cleaning up the
install process).


					Terry Lambert
					terry@icarus.weber.edu
---
Any opinions in this posting are my own and not those of my present
or previous employers.
-- 
-------------------------------------------------------------------------------
                                        "I have an 8 user poetic license" - me
 Get the 386bsd FAQ from agate.berkeley.edu:/pub/386BSD/386bsd-0.1/unofficial
-------------------------------------------------------------------------------