[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/19] linux-user: Allow NULL value pointer in setxa
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PATCH 12/19] linux-user: Allow NULL value pointer in setxattr and getxattr |
Date: |
Tue, 31 Jan 2012 11:29:21 +0200 |
From: Peter Maydell <address@hidden>
It's valid to pass a NULL value pointer to setxattr, so don't
fail this case EFAULT.
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 06b19e0..0a78a18 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7809,11 +7809,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
break;
case TARGET_NR_setxattr:
{
- void *p, *n, *v;
+ void *p, *n, *v = 0;
+ if (arg3) {
+ v = lock_user(VERIFY_READ, arg3, arg4, 1);
+ if (!v) {
+ ret = -TARGET_EFAULT;
+ break;
+ }
+ }
p = lock_user_string(arg1);
n = lock_user_string(arg2);
- v = lock_user(VERIFY_READ, arg3, arg4, 1);
- if (p && n && v) {
+ if (p && n) {
ret = get_errno(setxattr(p, n, v, arg4, arg5));
} else {
ret = -TARGET_EFAULT;
@@ -7825,11 +7831,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
break;
case TARGET_NR_getxattr:
{
- void *p, *n, *v;
+ void *p, *n, *v = 0;
+ if (arg3) {
+ v = lock_user(VERIFY_WRITE, arg3, arg4, 0);
+ if (!v) {
+ ret = -TARGET_EFAULT;
+ break;
+ }
+ }
p = lock_user_string(arg1);
n = lock_user_string(arg2);
- v = lock_user(VERIFY_WRITE, arg3, arg4, 0);
- if (p && n && v) {
+ if (p && n) {
ret = get_errno(getxattr(p, n, v, arg4));
} else {
ret = -TARGET_EFAULT;
--
1.7.5.4
- [Qemu-devel] [PATCH 04/19] linux-user: fake /proc/self/maps, (continued)
- [Qemu-devel] [PATCH 04/19] linux-user: fake /proc/self/maps, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 15/19] linux-user: Add default-configs for mipsn32[el], riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 18/19] linux-user: Define TARGET_QEMU_ESIGRETURN for mips64, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 03/19] linux-user: add open() hijack infrastructure, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 10/19] linux-user/strace.c: Correct errno printing for mmap etc, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 11/19] linux-user: fix wait* syscall status returns, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 06/19] linux-user: fake /proc/self/auxv, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 05/19] linux-user: fake /proc/self/stat, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 13/19] linux-user/syscall.c: Implement f and l versions of set/get/removexattr, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 17/19] linux-user: Define TARGET_QEMU_ESIGRETURN for mipsn32, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 12/19] linux-user: Allow NULL value pointer in setxattr and getxattr,
riku . voipio <=
- [Qemu-devel] [PATCH 16/19] linux-user: Add default configs for mips64[el], riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 09/19] linux-user: fix QEMU_STRACE=1 segfault, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 02/19] linux-user: save auxv length, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 19/19] linux-user: Fix sa_flags byte swaps for mips, riku . voipio, 2012/01/31
- [Qemu-devel] [PATCH 08/19] linux-user: add SO_PEERCRED support for getsockopt, riku . voipio, 2012/01/31
- Re: [Qemu-devel] [PATCH 00/19] Pending linux-user patches, Andreas Färber, 2012/01/31