Re: [PATCH] Add a /proc/self/exedir link

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



IMO the program must be aware of the get-my-exedir feature, just configuring
--prefix=/proc/... is aiming for your feet.

I disagree, though /proc/self/exedir may not be the right answer. The problem with the original proposal is there's no concept of a group leader to which files are resolved relative to so there is this problem with child processes.

I sent a mail outlining a scheme that used file descriptor passing to achieve the same effect but with the needed "inheritance" of the path, but, vger seems to have munched it! At least I don't see it on the gmane archives. But the scheme is simple enough:

 * get_prefix() reads /proc/self/exe and turns it into the correct
   directory

 * dup2(open(get_my_exedir()), 999)

 * ./configure --prefix=/proc/self/fd/999

Obviously that code leaks but you get the idea. Paths can now be resolved relative to the magic fd number (whatever numbe is used up to the userspace app). The fd is inherited on exec, so sub-programs that are passed a path relative to it still work.

It doesn't need kernel support which is nice.

It also restricts the problem to passing paths to other processes that are not subprocesses (eg via rpc). But as each process can have its own namespace this will always be an issue that needs careful treatment, and the pain of adjusting software to realpath() it is much lower than modifying every path in every piece of software. That approach was already tried and sucks.

thanks -mike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux