On Sat, 2008-01-26 at 22:03 -0800, Andrew Morton wrote:I chose not to do this because I thought it would change the output of readlink on /proc/pid/exe under certain circumstances. For instance, I think the output of the following would be slightly different: $ mkdir tmp $ cd tmp $ cp /bin/sleep ./ $ ./sleep 10 & $ SLEEP_PID=$! $ ls -l /proc/4733/exe lrwxrwxrwx 1 mhelsley mhelsley 0 Jan 28 15:51 /proc/4733/exe -> /home/mhelsley/tmp/sleep $ rm sleep $ echo $? 0 $ ls -l /proc/4733/exe lrwxrwxrwx 1 mhelsley mhelsley 0 Jan 28 15:51 /proc/4733/exe -> /home/mhelsley/tmp/sleep (deleted) I think simply storing the string at exec time wouldn't show the latter result. Perhaps we could do a lookup during readlink to fix it. That may not always work though -- could chroot or mount namespaces break this? Al Viro's unmap example might also have different output if we just stored the string. When the last VM_EXECUTABLE VMA goes away the symlink shouldn't work. So I think we'd still have to track the map/unmap of VM_EXECUTABLE VMAs similar to what I do in my patch. Using chroot we get a "permission denied" error when doing a readlink on /proc/pid/exe symlinks that point outside the chroot. I'm not sure a lookup using the stored string will fix all cases here. Then there's mount namespaces to consider. I think that the string would hold the path in the mount namespace of the executable whose exe link we're reading rather than the path in the mount namespace of the task reading the link. We may be able to work around all of these. I'm not sure that patch would be simpler though. If you want something a little simpler I could follow Oleg Nesterov's suggestions. I think that could trim at least 20 lines at the cost of continuing to use the mmap semaphore in the /proc/pid/exe readlink path. Cheers, -Matt Helsley --
| Jeremy Allison | Re: [RFC] Heads up on sys_fallocate() |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Joerg Roedel | [PATCH 03/34] AMD IOMMU: add defines and structures for ACPI scanning code |
| Eric W. Biederman | [PATCH] powerpc pseries eeh: Convert to kthread API |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Natalie Protasevich | [BUG] New Kernel Bugs |
git: | |
