[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/11] linux-user: fix statfs
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PATCH 01/11] linux-user: fix statfs |
Date: |
Thu, 18 Oct 2012 14:30:57 +0300 |
From: Alexander Graf <address@hidden>
The statfs syscall should always memset(0) its full struct extent before
writing to it. Newer versions of the syscall use one of the reserved fields
for flags, which would otherwise get stale values from uncleaned memory.
This fixes libarchive for me, which got confused about the return value of
pathconf("/", _PC_REC_XFER_ALIGN) otherwise, as it some times gave old pointers
as return value.
Signed-off-by: Alexander Graf <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 471d060..1a38169 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6529,6 +6529,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
__put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid.val[0]);
__put_user(stfs.f_fsid.__val[1], &target_stfs->f_fsid.val[1]);
__put_user(stfs.f_namelen, &target_stfs->f_namelen);
+ __put_user(stfs.f_frsize, &target_stfs->f_frsize);
+ memset(target_stfs->f_spare, 0, sizeof(target_stfs->f_spare));
unlock_user_struct(target_stfs, arg2, 1);
}
break;
@@ -6557,6 +6559,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
__put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid.val[0]);
__put_user(stfs.f_fsid.__val[1], &target_stfs->f_fsid.val[1]);
__put_user(stfs.f_namelen, &target_stfs->f_namelen);
+ __put_user(stfs.f_frsize, &target_stfs->f_frsize);
+ memset(target_stfs->f_spare, 0, sizeof(target_stfs->f_spare));
unlock_user_struct(target_stfs, arg3, 1);
}
break;
--
1.7.9.5
- [Qemu-devel] [PULL] [PATCH 00/11] Pending linux-user patches, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 04/11] linux-user: Implement gethostname, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 01/11] linux-user: fix statfs,
riku . voipio <=
- [Qemu-devel] [PATCH 09/11] tcg: Remove TCG_TARGET_HAS_GUEST_BASE define, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 02/11] linux-user: fix multi-threaded /proc/self/maps, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 05/11] alpha-linux-user: Fix sigaltstack structure definition, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 11/11] linux-user: register align p{read, write}64, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 07/11] linux-user: If loading fails, print error as string, not number, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 10/11] linux-user: ppc: mark as long long aligned, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 03/11] linux-user: Perform more checks on iovec lists, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 08/11] configure: Remove unnecessary host_guest_base code, riku . voipio, 2012/10/18
- [Qemu-devel] [PATCH 06/11] linux-user: Fix siginfo handling, riku . voipio, 2012/10/18
- Re: [Qemu-devel] [PULL] [PATCH 00/11] Pending linux-user patches, Aurelien Jarno, 2012/10/19