[lxc-devel] procfs and unnamed pipes

Timofey.Kirillov distorhead at gmail.com
Mon Mar 11 16:34:48 UTC 2013


11.03.2013 20:11, Serge Hallyn пишет:
> Quoting Eric W. Biederman (ebiederm at xmission.com):
>> "Timofey.Kirillov" <distorhead at gmail.com> writes:
>>
>>> Hi,
>>>
>>> I have a question about using unnamed pipes with procfs.
>>>
>>> Suppose a chrooted environment with proc mounted as procfs. I am trying
>>> to use bash process substitution feature and get this:
>>>
>>> $ cat <(echo hello)
>>> cat: /dev/fd/63: No such file or directory
>>>
>>> While on the normal system:
>>> $ cat <(echo hello)
>>> hello
>>>
>>> As I understand, the problem is that when fuse making getattr on file
>>> '/dev/fd/63' - it determines that it is symlink. The next step is
>>> readlink, which gives something like that: /25977/fd/63 =>
>>> pipe:[3087676]. And at the final step getattr on file
>>> '/25977/fd/pipe:[3087676]' gives no such file or directory.
>>>
>>> Actually I encouter this issue while working on my own similar fuse proc
>>> (for jail environments). Then I find procfs, tried it out and get the
>>> same failure.
>>>
>>> I am tried to change logic of getattr in the next way. First make normal
>>> stat of file. If it is not S_ISFIFO - make lstat. In that way the
>>> process hangs forever on open syscall:
>>> $ strace cat <(echo hello)
>>> ...
>>> open("/dev/fd/63", O_RDONLY
>>>
>>>
>>> Is there any workaround of this problem?
>> Check to see if /dev/fd is a symlink to /proc/self/fd
>>
>> If that symlink is missing magic using /dev/fd will fail.  I suspect
>> that for some reason your /dev/fd symlink simply has not been created in
>> /dev.
> Eric,
>
> I believe he is using a fuse fs called 'procfs' which isn't properly
> handling readlink.
>
> Timofey, can you confirm?
>
> -serge

Yes, you right, it's all about fuse procfs, I've been inaccurate in 
question.

P.S. sorry for double posting this to lxc-devel and lxc-users. Actually 
I cancel first try on lxc-devel, but it did not cancelled...




More information about the lxc-devel mailing list