[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/26] linux-user: Check lock_user() return value for
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 10/26] linux-user: Check lock_user() return value for NULL |
Date: |
Thu, 22 Sep 2016 15:13:30 +0300 |
From: Peter Maydell <address@hidden>
lock_user() can return NULL, which typically means the syscall
should fail with EFAULT. Add checks in various places where
Coverity spotted that we were missing them.
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7a50a57..efcc17a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5008,6 +5008,11 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie,
uint8_t *buf_temp, int fd,
host_data = (char*)host_dm + host_dm->data_start;
argptr = lock_user(VERIFY_READ, guest_data, guest_data_size, 1);
+ if (!argptr) {
+ ret = -TARGET_EFAULT;
+ goto out;
+ }
+
switch (ie->host_cmd) {
case DM_REMOVE_ALL:
case DM_LIST_DEVICES:
@@ -11271,6 +11276,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
case TARGET_NR_mq_unlink:
p = lock_user_string(arg1 - 1);
+ if (!p) {
+ ret = -TARGET_EFAULT;
+ break;
+ }
ret = get_errno(mq_unlink(p));
unlock_user (p, arg1, 0);
break;
--
2.1.4
- [Qemu-devel] [PULL 01/26] linux-user: Fix handling of iovec counts, (continued)
- [Qemu-devel] [PULL 01/26] linux-user: Fix handling of iovec counts, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 03/26] linux-user: Allow bad msg_name for recvfrom on connected socket, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 02/26] linux-user: Fix errno for sendrecvmsg with large iovec length, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 05/26] linux-user: Use direct syscall for utimensat, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 04/26] linux-user: Implement FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctls, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 07/26] linux-user: Range check the nfds argument to ppoll syscall, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 08/26] linux-user: report signals being taken in strace output, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 06/26] linux-user: Check for bad event numbers in epoll_wait, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 09/26] linux-user: Pass missing MAP_ANONYMOUS to target_mmap() call, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 11/26] linux-user: Fix incorrect use of host errno in do_ioctl_dm(), riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 10/26] linux-user: Check lock_user() return value for NULL,
riku . voipio <=
- [Qemu-devel] [PULL 13/26] linux-user: Check dump_write() return in elf_core_dump(), riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 15/26] linux-user: Use correct target SHMLBA in shmat(), riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 14/26] linux-user: Use glib malloc functions in load_symbols(), riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 12/26] linux-user: Fix error handling in flatload.c target_pread(), riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 16/26] linux-user: ppc64: set MSR_CM bit for BookE 2.06 MMU, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 17/26] linux-user: Recheck for pending synchronous signals too, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 18/26] linux-user: Pass si_type information to queue_signal() explicitly, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 24/26] linux-user: Sanity check clone flags, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 19/26] linux-user: SIGSEGV on signal entry need not be fatal, riku . voipio, 2016/09/22
- [Qemu-devel] [PULL 20/26] linux-user: ARM: Give SIGSEGV if signal frame setup fails, riku . voipio, 2016/09/22