lkml.org 
[lkml]   [1999]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject2.3.7: generic_write_page(): O_APPEND & inode->i_size not SMP safe
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.048 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site