Subject: Re: Killing stackgap
To: David Laight <david@l8s.co.uk>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 03/10/2007 14:20:59
On Mar 10, 2007, at 2:11 PM, David Laight wrote:

> I presume that p->p_emul->e_path (which ought to be a vnode) is used
> for absolute pathnames, and acts a little like the chroot base -  
> except
> that if the file isn't found the nornal lookup is done.
>
> This makes be think that this ought to be a feature of namei() itself.
> Such a change would also mean that rafts of compat code could be  
> killed
> outright.

Well, I definitely agree with this.  However, you need to use e_path,  
because the path may or may not exist (or may change) at any given  
moment.

So, maybe the right thing to do in namei() is:

	if (e_path != NULL) {
		my_root_vp = lookup e_path;
	} else {
		my_root_vp = proc_root_vp;
	}
  try_again:
	if (lookup relative to my_root_vp fails) {
		if (my_root_vp == proc_root_vp) {
			return ENOENT;
		}
		my_root_vp = proc_root_vp;
		goto try_again;
	}

-- thorpej