Re: silent semantic changes with reiser4

Jamie Lokier
2004-08-26T17:33:06Z

Linus Torvalds wrote:
> And it would be perfectly ok for O_DIRECTORY to open such a file, as long
> as it opens the directory branch, not the special device.

What about:

cd /dev/into_directory_branch/
run_setuid_program

-> calls pwd
pwd opens("."), (".."), ("../..") etc.

-> the setuid program thus ends up opening a device or fifo,
when it does pwd's path walk. Yes it could use the getcwd
syscall, but some programs do their own path walk.

> I advocated (long ago) something like this for /dev handling, just because
> I think it would make sense to have
>
> /dev/hda <- special file
> /dev/hda/part1 <- partition 1 (aka /dev/hda1)
>
> which just seems like a very obvious and intuitive interface to me. Of
> course, we have so much legacy in /dev that there's no real point to doing
> this, but it's still an appealing approach, I think.

It also fits the container idea very well:

/dev/hda/part1/ <- the filesystem inside partition 1

That's not a contrivance, it's what I'd expect to happen if
/dev/hda is an ordinary file containing a disk image:

image.bin <- hard disk image (a regular file)
image.bin/part1 <- partition 1
image.bin/part1/ <- the filesystem inside partition 1

That's assuming there's a format handler which recognises that image.

-- Jamie