Re: procfs problems

Thorsten Kukuk (kukuk@tk.uni-paderborn.de)
Wed, 16 Apr 1997 11:09:58 +0200


Hello,

I have a big problem:

I uses glibc and linuxthreads, linux kernel 2.1.35 with SMP.
I create a read lock with fcntl (fd, F_SETLKW, &fl) in a thread.
The FD_CLOEXEC flag is set. That works. But if I kill the program
with ^C, the lock will not be removed.
After starting the programm, before hitting Ctrl-C, cat /proc/locks shows:
1: POSIX ADVISORY READ 437 08:03:8084 0 2147483647 c193ba18 00000000 c193b918 00000000 00000000
2: POSIX ADVISORY WRITE 431 08:03:8001 0 2147483647 c193b918 c193ba18 c3430218 00000000 00000000
3: POSIX ADVISORY WRITE 221 08:03:8016 0 2147483647 c3430218 c193b918 c35be418 00000000 00000000
4: FLOCK ADVISORY WRITE 0 08:03:8015 0 2147483647 c35be418 c3430218 c360ee98 00000000 00000000
5: POSIX ADVISORY WRITE 211 08:03:8027 0 2147483647 c360ee98 c35be418 c3aabc18 00000000 00000000
6: POSIX ADVISORY READ 175 08:03:7946 0 2147483647 c3aabc18 c360ee98 c38e9018 00000000 00000000
7: POSIX ADVISORY WRITE 174 08:03:7945 0 2147483647 c38e9018 c3aabc18 c3aabe98 00000000 00000000
8: POSIX ADVISORY WRITE 169 08:03:7943 0 2147483647 c3aabe98 c38e9018 00000000 00000000 00000000

After killing the program the lock will not be removed, and cat
/proc/locks will result in a seg.fault.
The kernel output:

Apr 16 10:23:18 voyager-sn kernel: Unable to handle kernel NULL pointer dereference at virtual address 0000007e
Apr 16 10:23:18 voyager-sn kernel: current->tss.cr3 = 01738000, Hr3 = 01738000
Apr 16 10:23:18 voyager-sn kernel: *pde = 00000000
Apr 16 10:23:18 voyager-sn kernel: Oops: 0000
Apr 16 10:23:18 voyager-sn kernel: CPU: 1
Apr 16 10:23:18 voyager-sn kernel: EIP: 0010:[<c013b1d2>]
Apr 16 10:23:18 voyager-sn kernel: EFLAGS: 00010202
Apr 16 10:23:18 voyager-sn kernel: eax: 00000003 ebx: c17f0003 ecx: c01eca4a edx: c01eca55
Apr 16 10:23:18 voyager-sn kernel: esi: c193ba18 edi: 00000000 ebp: c17f0000 esp: c17d0f1c
Apr 16 10:23:18 voyager-sn kernel: ds: 0018 es: 0018 ss: 0018
Apr 16 10:23:18 voyager-sn kernel: Process cat (pid: 448, process nr: 70, stackpage=c17d0000)
Apr 16 10:23:18 voyager-sn kernel: Stack: 00000000 c193ba18 00000001 c013b2bd c193ba18 c17f0000 00000001 c01eca
c7
Apr 16 10:23:18 voyager-sn kernel: 00000000 c17d0f98 c17f0000 00000c00 c01503ea c17f0000 00000000 c247f7
c0
Apr 16 10:23:18 voyager-sn kernel: c0150536 c17f0000 0000001e c17d0f98 00000000 00000c00 c17f4040 ffffff
ea
Apr 16 10:23:18 voyager-sn kernel: Call Trace:
Apr 16 10:23:18 voyager-sn kernel: Code: f6 47 7e 40 74 13 66 8b 47 08 66 25 08 04 66 3d 00 04 75 05

Output from ksymoops:
Using `/System.map' to map addresses to symbols.

>>EIP: c013b1d2 <lock_get_status+36/f8>

Code: c013b1d2 <lock_get_status+36/f8>

I hope this helps to fix the problem. I need locking in a thread.

Greetings,
Thorsten

-- 
Thorsten Kukuk  kukuk@vt.uni-paderborn.de
                http://www-vt.uni-paderborn.de/~kukuk
Linux is like a Vorlon.  It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.