summaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux
diff options
context:
space:
mode:
authorAnton Ivanov2014-03-07 19:37:47 +0100
committerRichard Weinberger2014-04-20 23:57:21 +0200
commit0565103d1adbd765ca45248d04c327c076dd1571 (patch)
treebc72dc69499b068766284276bee91884afb1218b /arch/um/os-Linux
parentum: Missing pipe handling (diff)
downloadkernel-qcow2-linux-0565103d1adbd765ca45248d04c327c076dd1571.tar.gz
kernel-qcow2-linux-0565103d1adbd765ca45248d04c327c076dd1571.tar.xz
kernel-qcow2-linux-0565103d1adbd765ca45248d04c327c076dd1571.zip
um: Memory corruption on startup
The reverse case of this race (you must msync before read) is well known. This is the not so common one. It can be triggered only on systems which do a lot of task switching and only at UML startup. If you are starting 200+ UMLs ~ 0.5% will always die without this fix. Signed-off-by: Anton Ivanov <antivano@cisco.com> [rw: minor whitespace fixes] Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r--arch/um/os-Linux/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index 07a750197bb0..08d90fba952c 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -237,6 +237,12 @@ void os_close_file(int fd)
{
close(fd);
}
+int os_fsync_file(int fd)
+{
+ if (fsync(fd) < 0)
+ return -errno;
+ return 0;
+}
int os_seek_file(int fd, unsigned long long offset)
{