2.3.7: generic_write_page(): O_APPEND & inode->i_size not SMP safe

Manfred Spraul (masp0008@stud.uni-sb.de)
Mon, 21 Jun 1999 23:03:08 +0200


1) if 2 threads write to an O_APPEND file, then they could write to the same
address:
pos is set to i_size before releasing the kernel lock, but multiple writers
could be in the middle part of generic_write_page().
We could increase i_size before releasing the kernel lock, but what if a
user mode process calls sys_write() with a bad pointer?

2) setting inode->i_size is not SMP safe.

generic_file_read():
1924 if (pos > inode->i_size)
1925 inode->i_size = pos;
1926

Btw, does the POSIX standard make any guarantees about the atomicity of
sys_write()?

--
    Manfred

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