From patchwork Wed Jun 8 13:30:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 69652 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2513814qgf; Wed, 8 Jun 2016 07:04:39 -0700 (PDT) X-Received: by 10.140.19.178 with SMTP id 47mr4622675qgh.83.1465394679046; Wed, 08 Jun 2016 07:04:39 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o106si757966qgd.28.2016.06.08.07.04.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Jun 2016 07:04:39 -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]:57184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAe62-0001X7-G7 for patch@linaro.org; Wed, 08 Jun 2016 10:04:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZk-0004bh-C8 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZg-0005rl-3r for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:16 -0400 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:36339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZf-0005r9-7D for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:12 -0400 Received: by mail-lf0-x22c.google.com with SMTP id j5so5845016lfb.3 for ; Wed, 08 Jun 2016 06:31:11 -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=DhV/oP05KwEd/jtC4IptYVMdOQ8EbJIgoM7xLBz7S9E=; b=fWUq95Knvey7gu2g6I5xWhQSS5SrbPN96h5wl7SP3JrmeNuVJv8vWJGu2rnGvOTRsb /aIRnsGVBNsA/lj2mEK6LB4oPvb0/ssflJQW3hZdNhSGYDxtwvplhDgX5CyL/63eGgwo n4Su9dIvtuVJgowdTAYIiCLb+fg6skHXlon8o= 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=DhV/oP05KwEd/jtC4IptYVMdOQ8EbJIgoM7xLBz7S9E=; b=T1+7YYSjU/c55NMUs6cNElT38j8//gpjXoWqfWeYpwi9XSzY1CiLc7ak7d+SQ/Eeu/ z03Wc5UmthnSBn4TGf3rWuIHgnv3FA6nVaYjFy9uBuWf4ItK32GL31c/A/XdIeqYS/L7 Y5xbBD5IqkjgBBUoC13MrnWEgtH5RIykZpumF5uNDBwujDrQ8czu+Nepk/WGOtZvO9su W9f60q9cbLM0+EFM897zbTfnAKxl7Eb+WqDKFqPE8+acD+ZgRrbGZoJSepmbOrPWxJzn 2uXcZPx2pKpCYG6wuz5T5db/fkABj3XzPOzxAVBOVX+xb/9sfj/Y7ykp2TspEpnmw6hO ZnQQ== X-Gm-Message-State: ALyK8tIRNU+q3iA4JcaeC5ib/NjF2BB6RyVowVTPvLf9O39OoRGqpKrS5YPhC+Xf3zCs7mSl X-Received: by 10.25.216.234 with SMTP id r103mr3866033lfi.192.1465392665593; Wed, 08 Jun 2016 06:31:05 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:31:04 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:13 +0300 Message-Id: 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::22c Subject: [Qemu-devel] [PULL 32/44] linux-user: Use safe_syscall wrapper for mq_timedsend and mq_timedreceive 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 mq_timedsend and mq_timedreceive syscalls. Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) -- 2.1.4 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b41d269..294e5ee 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -750,6 +750,12 @@ static int safe_msgrcv(int msgid, void *msgp, size_t sz, long type, int flags) return safe_ipc(Q_IPCCALL(1, Q_MSGRCV), msgid, sz, flags, msgp, type); } #endif +#if defined(TARGET_NR_mq_open) && defined(__NR_mq_open) +safe_syscall5(int, mq_timedsend, int, mqdes, const char *, msg_ptr, + size_t, len, unsigned, prio, const struct timespec *, timeout) +safe_syscall5(int, mq_timedreceive, int, mqdes, char *, msg_ptr, + size_t, len, unsigned *, prio, const struct timespec *, timeout) +#endif static inline int host_to_target_sock_type(int host_type) { @@ -10593,11 +10599,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, p = lock_user (VERIFY_READ, arg2, arg3, 1); if (arg5 != 0) { target_to_host_timespec(&ts, arg5); - ret = get_errno(mq_timedsend(arg1, p, arg3, arg4, &ts)); + ret = get_errno(safe_mq_timedsend(arg1, p, arg3, arg4, &ts)); host_to_target_timespec(arg5, &ts); + } else { + ret = get_errno(safe_mq_timedsend(arg1, p, arg3, arg4, NULL)); } - else - ret = get_errno(mq_send(arg1, p, arg3, arg4)); unlock_user (p, arg2, arg3); } break; @@ -10610,11 +10616,13 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, p = lock_user (VERIFY_READ, arg2, arg3, 1); if (arg5 != 0) { target_to_host_timespec(&ts, arg5); - ret = get_errno(mq_timedreceive(arg1, p, arg3, &prio, &ts)); + ret = get_errno(safe_mq_timedreceive(arg1, p, arg3, + &prio, &ts)); host_to_target_timespec(arg5, &ts); + } else { + ret = get_errno(safe_mq_timedreceive(arg1, p, arg3, + &prio, NULL)); } - else - ret = get_errno(mq_receive(arg1, p, arg3, &prio)); unlock_user (p, arg2, arg3); if (arg4 != 0) put_user_u32(prio, arg4);