From 1b57805a9556d0e8f6d27f81ac0385a4375fc0f317c714d73ddcf00dddb030d3 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Wed, 10 Oct 2012 18:18:11 +0000 Subject: [PATCH] - use ulong for syscall parameters. fixes lseek with big files OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=117 --- 0035-linux-user-use-target_ulong.patch.patch | 56 ++++++++++++++++++++ qemu.changes | 5 ++ qemu.spec | 2 + 3 files changed, 63 insertions(+) create mode 100644 0035-linux-user-use-target_ulong.patch.patch diff --git a/0035-linux-user-use-target_ulong.patch.patch b/0035-linux-user-use-target_ulong.patch.patch new file mode 100644 index 00000000..8c17b6c1 --- /dev/null +++ b/0035-linux-user-use-target_ulong.patch.patch @@ -0,0 +1,56 @@ +From 3a1a6614255d40ee993f536e56cacbe92339f5d2 Mon Sep 17 00:00:00 2001 +From: Alexander Graf +Date: Tue, 9 Oct 2012 09:06:49 +0200 +Subject: [PATCH] linux-user: use target_ulong + +Linux syscalls pass pointers or data length or other information of that sort +to the kernel. This is all stuff you don't want to have sign extended. +Otherwise a host 64bit variable parameter with a size parameter will extend +it to a negative number, breaking lseek for example. + +Pass syscall arguments as ulong always. + +Signed-off-by: Alexander Graf +--- + linux-user/qemu.h | 8 ++++---- + linux-user/syscall.c | 8 ++++---- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/linux-user/qemu.h b/linux-user/qemu.h +index 175d502..c7ee759 100644 +--- a/linux-user/qemu.h ++++ b/linux-user/qemu.h +@@ -194,10 +194,10 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src, + void target_set_brk(abi_ulong new_brk); + abi_long do_brk(abi_ulong new_brk); + void syscall_init(void); +-abi_long do_syscall(void *cpu_env, int num, abi_long arg1, +- abi_long arg2, abi_long arg3, abi_long arg4, +- abi_long arg5, abi_long arg6, abi_long arg7, +- abi_long arg8); ++abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1, ++ abi_ulong arg2, abi_ulong arg3, abi_ulong arg4, ++ abi_ulong arg5, abi_ulong arg6, abi_ulong arg7, ++ abi_ulong arg8); + void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2); + extern THREAD CPUArchState *thread_env; + void cpu_loop(CPUArchState *env); +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index f9e7f33..e3a4d24 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -5222,10 +5222,10 @@ int syscall_restartable(int syscall_nr) + /* do_syscall() should always have a single exit point at the end so + that actions, such as logging of syscall results, can be performed. + All errnos that do_syscall() returns must be -TARGET_. */ +-abi_long do_syscall(void *cpu_env, int num, abi_long arg1, +- abi_long arg2, abi_long arg3, abi_long arg4, +- abi_long arg5, abi_long arg6, abi_long arg7, +- abi_long arg8) ++abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1, ++ abi_ulong arg2, abi_ulong arg3, abi_ulong arg4, ++ abi_ulong arg5, abi_ulong arg6, abi_ulong arg7, ++ abi_ulong arg8) + { + abi_long ret; + struct stat st; diff --git a/qemu.changes b/qemu.changes index f2e8eadf..c927cf85 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Oct 10 18:14:59 UTC 2012 - agraf@suse.com + +- use ulong for syscall parameters. fixes lseek with big files + ------------------------------------------------------------------- Tue Oct 10 17:16:20 UTC 2012 - agraf@suse.com diff --git a/qemu.spec b/qemu.spec index 7d34164a..acd5c9f6 100644 --- a/qemu.spec +++ b/qemu.spec @@ -58,6 +58,7 @@ Patch0031: 0031-linux-user-XXX-disable-fiemap.patch.patch Patch0032: 0032-slirp-nooutgoing.patch.patch Patch0033: 0033-vnc-password-file-and-incoming-conn.patch Patch0034: 0034-linux-user-add-more-blk-ioctls.patc.patch +Patch0035: 0035-linux-user-use-target_ulong.patch.patch # this is to make lint happy Source300: rpmlintrc Source302: bridge.conf @@ -210,6 +211,7 @@ run cross-architecture builds. %patch0032 -p1 %patch0033 -p1 %patch0034 -p1 +%patch0035 -p1 %build # build QEMU