Commit 206f0fa7598242e3e3b742e72d4743e9ea4eefd0
1 parent
fd6ce8f6
pread/pwrite syscalls - use page_unprotect_range() in vital cases to avoid probl…
…ems if the kernel writes data in protected page (needed for self-modifying code support) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@164 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
6 additions
and
2 deletions
linux-user/syscall.c
... | ... | @@ -1137,6 +1137,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
1137 | 1137 | ret = 0; /* avoid warning */ |
1138 | 1138 | break; |
1139 | 1139 | case TARGET_NR_read: |
1140 | + page_unprotect_range((void *)arg2, arg3); | |
1140 | 1141 | ret = get_errno(read(arg1, (void *)arg2, arg3)); |
1141 | 1142 | break; |
1142 | 1143 | case TARGET_NR_write: |
... | ... | @@ -2191,9 +2192,12 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2191 | 2192 | case TARGET_NR_prctl: |
2192 | 2193 | goto unimplemented; |
2193 | 2194 | case TARGET_NR_pread: |
2194 | - goto unimplemented; | |
2195 | + page_unprotect_range((void *)arg2, arg3); | |
2196 | + ret = get_errno(pread(arg1, (void *)arg2, arg3, arg4)); | |
2197 | + break; | |
2195 | 2198 | case TARGET_NR_pwrite: |
2196 | - goto unimplemented; | |
2199 | + ret = get_errno(pwrite(arg1, (void *)arg2, arg3, arg4)); | |
2200 | + break; | |
2197 | 2201 | case TARGET_NR_chown: |
2198 | 2202 | ret = get_errno(chown((const char *)arg1, arg2, arg3)); |
2199 | 2203 | break; | ... | ... |