From patchwork Wed Jun 8 13:30:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 69642 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2502557qgf; Wed, 8 Jun 2016 06:42:12 -0700 (PDT) X-Received: by 10.200.42.68 with SMTP id l4mr4525601qtl.73.1465393332017; Wed, 08 Jun 2016 06:42:12 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s2si708705qkb.4.2016.06.08.06.42.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:42:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57064 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdkJ-0005iK-DG for patch@linaro.org; Wed, 08 Jun 2016 09:42:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZc-0004Uh-Ql for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZW-0005pH-DE for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:07 -0400 Received: from mail-lf0-x22d.google.com ([2a00:1450:4010:c07::22d]:36291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZW-0005p6-0k for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:02 -0400 Received: by mail-lf0-x22d.google.com with SMTP id j5so5841768lfb.3 for ; Wed, 08 Jun 2016 06:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/x2qmPFK0+WDsoAVvelLQkItYbhF8+cCJvN5BRZTfYg=; b=DLIyK75I3YTCyN0eIITaNLy0qeEQPKT8alrrdOXsH5rzJpzzLhXQ6nKS+LVa98xEIC rYdwQGAb+BrbTPzWPfoZF5NgnIdIKp+Voet8DBCz+2u66GzZKBysOdRMjkMLzDOyq5oH cFdoXfwaROVyMARPlLQ/w4ywVHAYWcqhXCEWU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/x2qmPFK0+WDsoAVvelLQkItYbhF8+cCJvN5BRZTfYg=; b=YkQgBxUF+/xaH/xIYGT4ChTiPhRlpVV2aq1cyuy17EtRHdQclomVeAHFQsFXAb4YmU IxdZG6HMEJZ2nlEFECOVt+P9RsPgUhnWKRiLRIU43cpOCYCNr1GJUj0YKDuTJdLzZAvh BDLfCcT+Arh3fDBh40J6u16sdVib7WeKmorMjNsARWEcwMcFjX7V2nAessW5piBiSEnM 0yx1vJQAvJFcNOFlTKB2RlLvTBeWdtszFjn0VtcDFWwWp/60a7W1Q4LT6Cb/qI7Xy8Hw Vd50xeLkjxtA4I79otkbT6C0fOXw4iNhDWVG6YUFg7BplfdUrKbOFthax06oL3c5gzYV v5UQ== X-Gm-Message-State: ALyK8tKSSJOAscX20/tP/yu9zOK6u15gPzSrzUgj0Und7QhA4v/xlC5Ikdew6pc63/TOMWfZ X-Received: by 10.25.83.11 with SMTP id h11mr4716282lfb.36.1465392661313; Wed, 08 Jun 2016 06:31:01 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.31.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:31:00 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:09 +0300 Message-Id: <918c03ed9ac583eb9d5c33345a814291e1dd2e87.1465392531.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22d Subject: [Qemu-devel] [PULL 28/44] linux-user: Use safe_syscall wrapper for readv and writev syscalls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Use the safe_syscall wrapper for readv and writev syscalls. Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.1.4 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8f8d9db..e0c49cc 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -712,6 +712,8 @@ safe_syscall2(int, rt_sigsuspend, sigset_t *, newset, size_t, sigsetsize) safe_syscall2(int, kill, pid_t, pid, int, sig) safe_syscall2(int, tkill, int, tid, int, sig) safe_syscall3(int, tgkill, int, tgid, int, pid, int, sig) +safe_syscall3(ssize_t, readv, int, fd, const struct iovec *, iov, int, iovcnt) +safe_syscall3(ssize_t, writev, int, fd, const struct iovec *, iov, int, iovcnt) static inline int host_to_target_sock_type(int host_type) { @@ -8986,7 +8988,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct iovec *vec = lock_iovec(VERIFY_WRITE, arg2, arg3, 0); if (vec != NULL) { - ret = get_errno(readv(arg1, vec, arg3)); + ret = get_errno(safe_readv(arg1, vec, arg3)); unlock_iovec(vec, arg2, arg3, 1); } else { ret = -host_to_target_errno(errno); @@ -8997,7 +8999,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1); if (vec != NULL) { - ret = get_errno(writev(arg1, vec, arg3)); + ret = get_errno(safe_writev(arg1, vec, arg3)); unlock_iovec(vec, arg2, arg3, 0); } else { ret = -host_to_target_errno(errno);