Re: fadvise syscall?

Richard Gooch (rgooch@ras.ucalgary.ca)
Mon, 18 Mar 2002 09:41:01 -0700


Andrew Morton writes:
> Note that it applies to a file descriptor. If
> posix_fadvise(FADV_DONTNEED) is called against a file descriptor,
> and someone else has an fd open against the same file, that other
> user gets their foot shot off. That's OK.

Let me verify that I understand what you're saying. Process A and B
independently open the file. The file is already in the cache (because
other processes regularly read this file). Process A is slowly reading
stuff. Process B does FADV_DONTNEED on the whole file. The pages are
dropped.

You're saying this is OK? How about this DoS attack:
int fd = open ("/lib/libc.so", O_RDONLY, 0);
while (1) {
posix_fadvise (fd, 0, 0, FADVISE_DONTNEED);
sleep (1);
}

Let me see that disc head move! Wheeee!

Regards,

Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/