PROBLEM: fcntl(F_GETLK) on NFS-mounted file makes machine unusable

Martin Baulig (martin@home-of-linux.org)
Tue, 1 Jun 1999 20:07:41 +0200 (CEST)


Hello,

if you do a fcntl() with F_GETLK on a NFS-mounted file/directory this will
make the system unusable printing

=====
RPC: doubly enqueued task!
RPC: failed to add task to queue: error: -11!
lockd: couldn't bind to server 136.199.14.109 - retrying.
=====

on the console (running `klogd -c 8 -d -s' and inserted an
`udelay(500000)' in printk ()).

The system is not responding anymore (running root shell with nice -18 on
tty1, but doesn't respond to any command within more than 10 minutes).

* Kernel Versions: 2.2.2, 2.2.6 and 2.2.9
* C Library: glibc 2.0.7
* System: SuSE 6.1 (same with SuSE 6.0 and Debian 2.x)

Any normal user of the system can produce this bug by using something like
this:

====
#include <stdio.h>
#include <stdlib.h>

#include <fcntl.h>
#include <unistd.h>

int
main (int argc, char *argv [])
{
int fd, ret;
struct flock flk;

fd = open ("/home/baulig/fcntl-killer.c", O_RDONLY);
if (!fd) {
perror ("open (/home/baulig/fcntl-killer.c)");
exit (1);
}

memset (&flk, 0, sizeof (flk));

ret = fcntl (fd, F_GETLK, &flk);
if (ret == -1) {
perror ("fcntl");
exit (1);
}
}
====

This will make the system unusable as soon as it executes the fcntl ()
system call. The machine is still responding to ping () but I have not
managed to make it do anything productive after that (for instance a short
C program printing the current time serveral times a second stops either).

As a side note, if you install netscape on a nfs mounted device, it will
use such a deadly fcntl () as soon as you choose `File / New Message'.

Please let me know if you need any more information.

--
Martin Baulig - martin@home-of-linux.org - http://www.home-of-linux.org

- 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/