• Linus Torvalds's avatar
    vfs: Fix /proc/<tid>/fdinfo/<fd> file handling · 0640113b
    Linus Torvalds authored
    Cyrill Gorcunov reports that I broke the fdinfo files with commit
    30a08bf2 ("proc: move fd symlink i_mode calculations into
    tid_fd_revalidate()"), and he's quite right.
    
    The tid_fd_revalidate() function is not just used for the <tid>/fd
    symlinks, it's also used for the <tid>/fdinfo/<fd> files, and the
    permission model for those are different.
    
    So do the dynamic symlink permission handling just for symlinks, making
    the fdinfo files once more appear as the proper regular files they are.
    
    Of course, Al Viro argued (probably correctly) that we shouldn't do the
    symlink permission games at all, and make the symlinks always just be
    the normal 'lrwxrwxrwx'.  That would have avoided this issue too, but
    since somebody noticed that the permissions had changed (which was the
    reason for that original commit 30a08bf2 in the first place), people
    do apparently use this feature.
    
    [ Basically, you can use the symlink permission data as a cheap "fdinfo"
      replacement, since you see whether the file is open for reading and/or
      writing by just looking at st_mode of the symlink.  So the feature
      does make sense, even if the pain it has caused means we probably
      shouldn't have done it to begin with. ]
    Reported-and-tested-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
    Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
    0640113b
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
array.c Loading commit data...
base.c Loading commit data...
cmdline.c Loading commit data...
consoles.c Loading commit data...
cpuinfo.c Loading commit data...
devices.c Loading commit data...
generic.c Loading commit data...
inode.c Loading commit data...
internal.h Loading commit data...
interrupts.c Loading commit data...
kcore.c Loading commit data...
kmsg.c Loading commit data...
loadavg.c Loading commit data...
meminfo.c Loading commit data...
mmu.c Loading commit data...
namespaces.c Loading commit data...
nommu.c Loading commit data...
page.c Loading commit data...
proc_devtree.c Loading commit data...
proc_net.c Loading commit data...
proc_sysctl.c Loading commit data...
proc_tty.c Loading commit data...
root.c Loading commit data...
softirqs.c Loading commit data...
stat.c Loading commit data...
task_mmu.c Loading commit data...
task_nommu.c Loading commit data...
uptime.c Loading commit data...
version.c Loading commit data...
vmcore.c Loading commit data...