[lkml]   [2007]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: sys_write() racy for multi-threaded append?
Michael K. Edwards <> wrote:

> On 3/8/07, Eric Dumazet <> wrote:
>> Absolutely not. We dont want to slow down kernel 'just in case a fool might
>> want to do crazy things'
> Actually, I think it would make the kernel (negligibly) faster to bump
> f_pos before the vfs_write() call.

This is a security risk.

other process:
Thread 1:
write(fd, large)

Thread 2:
fseek(fd, -n, relative)
read(fd, buf)
BTW: The best thing you can do to a program where two threads race for
writing one fd is to let it crash and burn in the most spectacular way
allowed without affecting the rest of the system, unless it happens to
be a pipe and the number of bytes written is less than PIPE_MAX.
The secret of the universe is #@*%! NO CARRIER

Friß, Spammer:
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-03-12 08:57    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean