Again about [PATCH] /proc filesystem bug in 2.1.125

Vladimir V. Ivanov (vlad@elis.tusur.ru)
Fri, 23 Oct 1998 20:55:41 +0800 (KRAST)


Hi,

Some words about my recently posted patch.
I see that most people uses glibc-2.0.9x. For that case my example with
/bin/pwd isn't so good as I had think.

Because a getcwd from glibc-2.0.9x uses more Linux-specific methods
for getting a current directory (first read /proc/self/cwd symlink,
second uses new system call), the bug doesn't appears in the
glibc-2.0.9x based apps.

But, guys, look in fs/proc/root.c (lines 943-958 in 2.1.125). The code
fragment between {} brackets in for(...). In the filldir() call
an expression ((pid << 16) + PROC_PID_INO) always eq 2 ! However it's
an "inode number generation" in /proc/./ !

Also you may look at the same code in linux 2.0.35, fs/proc/root.c:567.
Now a "pid" is preserved, and expr ((pid << 16) + PROC_PID_INO) really
gives a unique "fake inode number".

Just the "POSIX-compliant" getcwd in glibc-2.0.7 and libc5 depends on this
inode number and fails.

---
Best regards,   Vladimir Ivanov
E-mail:         mailto:vlad@elis.tusur.ru
World Wide Web: http://elis.tusur.ru/~vlad

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/