diff options
author | Jan-Simon Möller <dl9pf@gmx.de> | 2009-10-17 21:52:43 +0300 |
---|---|---|
committer | Riku Voipio <riku.voipio@iki.fi> | 2009-10-17 21:52:43 +0300 |
commit | dab46405d964a17f8df7df14cca5804537c3f590 (patch) | |
tree | af7700f1ffcf2fa38bdee679c66f130522c7e730 | |
parent | f7680a5593032d0c4f699144666605a4f8b044b9 (diff) |
Re: linux-user/syscall.c - don't add GUEST_BASE to NULL pointer
This patch fixes the mount call. GUEST_BASE shouldn't be added to a NULL pointer on arg5 . failing call:
mount("rootfs", "/", 0x47a78, MS_MGC_VAL|MS_REMOUNT, 0x10000) = -1 EFAULT (Bad address)
correct call:
mount("rootfs", "/", 0x37ab0, MS_MGC_VAL|MS_REMOUNT, NULL) = 0
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
-rw-r--r-- | linux-user/syscall.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 31dfcb75c2..0254226a42 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4463,12 +4463,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, p3 = lock_user_string(arg3); if (!p || !p2 || !p3) ret = -TARGET_EFAULT; - else + else { /* FIXME - arg5 should be locked, but it isn't clear how to * do that since it's not guaranteed to be a NULL-terminated * string. */ - ret = get_errno(mount(p, p2, p3, (unsigned long)arg4, g2h(arg5))); + if ( ! arg5 ) + ret = get_errno(mount(p, p2, p3, (unsigned long)arg4, NULL)); + else + ret = get_errno(mount(p, p2, p3, (unsigned long)arg4, g2h(arg5))); + } unlock_user(p, arg1, 0); unlock_user(p2, arg2, 0); unlock_user(p3, arg3, 0); |