From patchwork Wed May 31 13:08:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100746 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp292841obc; Wed, 31 May 2017 06:09:01 -0700 (PDT) X-Received: by 10.233.222.134 with SMTP id s128mr28525704qkf.190.1496236141598; Wed, 31 May 2017 06:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236141; cv=none; d=google.com; s=arc-20160816; b=JgNZE6BitwmppZawkmBeJVl1EDPyzsVRRQr+LhNfJk2Uhj1ku84awgKXkIB/URYBFs 25JASuGNnvfYS89T+1zNkYx5gx8mcKenYYi+g307x9zaiWgVsdbnG2zarwsMEduvJ41W UXfUJTrhG/Rl2S423DVNj7Dm+bbwOgY6Uwz+uc6NtaBSGASgTctSQRqO3WQYVbLm04a2 WM9OVBk65hWiagm69akaWgpH5czmtdK69Rjtx9PphfNaiqfrTpUn7IOYBaWAFl2xl8vO ykkmD5LoKZENu+P0I9b7LVOqF1AsClGsWDfwnqd+gm0FuH0bDZO7SjHP3tktJrD8bdwr sGIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=RMgOLgG5+c/J+Ro9pPRuDczuj3GrHSRqyBZcuJsbxVE=; b=V5VhQEdkr1e9kcNWSLLbw3mNVuzQySpKK3K8Wjctv14CU0OFUk+/uk8RAPuLOjkgfF a5K5dFfKCiaLL1hehqKw2YlR6Ixplows1jrzFwr0wEBTQHC+9t6RSIUZeKvZhTwJbSQr eR3zmdbfkYtsZDDyBSnJhFwQK8A0Ro3H82PaN6Fon0xwvJ6pAO0hFNJqxObdA3rPO7+P cpbmbNzt6YIg+yTbQdVONRtPWlaplUcCTDFwDQ2O/G5snGZUJTRxDhK98TAwier2eQFo 1tgk5AbJaONEQdggAmJAzmjsC6zN50mpKOQqYesgaFnqeE/x219h0oN3bHY5y3hZIh6b vt0w== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d27si16180907qtb.47.2017.05.31.06.09.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:09:01 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mx-0007TD-0g for patch@linaro.org; Wed, 31 May 2017 09:08:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Ma-0007S5-Bk for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3MX-0003bN-N2 for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:36 -0400 Received: from mail-lf0-x229.google.com ([2a00:1450:4010:c07::229]:35899) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3MX-0003au-Fw for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:33 -0400 Received: by mail-lf0-x229.google.com with SMTP id h4so8613228lfj.3 for ; Wed, 31 May 2017 06:08:33 -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=RMgOLgG5+c/J+Ro9pPRuDczuj3GrHSRqyBZcuJsbxVE=; b=UOhqYglHdi1P6bL4mtfwI9h6TLTluDK+X8qloa9rKVPk2/Cw89l4A7/UP+De1SpyA2 32rRozdAQk1etJUXVjy+8ex2spuBqtznHBsTIfD8puH5cewH8v7SgmoHOTy0aY2si0C9 1Wx115maE4APGdGcaFs61wbgG1uRl5kVPdoRk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RMgOLgG5+c/J+Ro9pPRuDczuj3GrHSRqyBZcuJsbxVE=; b=qBHky6OJ1rbIMP/RUeHUaWx2glOwp4HaK0khq3vtLhKLYlMxlNHGLX1k6ybdWmEfms kdfP3JrgX/S2YctuNdI1i7mA6r5EWUokVMMLzlRhjGkuyd7SQXuCceF+B0Gk43z/1cr6 X3kNG+U+RiGjkulO5UmMHGxOwdcEnVJlShd6cfXPYRbEEpGTbOwjrc+buebYrvauMv1H Segok8dh2CEfDYr+yzSgVAnw3MnpTJoxZrTB/9Ndb0czr7dgAG0eSj6WXY6QAkk2s5m0 613kfO+tKue/ANkTabYT4apodFXOYUtYngpz7fIK1llwNA7VNH7hzNEgXIlQkOPqPucF nScg== X-Gm-Message-State: AODbwcA8h3gtH/i8bDyYHFsfBtr9hxg6wehUWEG/X04hyN3TgSdd5WYQ YuOAbyvkMY4uHwHMdXEmdg== X-Received: by 10.46.20.9 with SMTP id u9mr8704137ljd.14.1496236112046; Wed, 31 May 2017 06:08:32 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:30 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:13 +0300 Message-Id: <04b9bcf911af2b4563b1f1b2e8a103b796dcc9eb.1496234766.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::229 Subject: [Qemu-devel] [PULL 01/15] linux-user: call fd_trans_target_to_host_data() for write() 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@linaro.org, Laurent Vivier , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Laurent Vivier As for sendmsg() or sendto(), we must call the target to host data translator if it is defined. This is needed for eventfd(): the write() syscall allows to add a value to the internal counter, and so, it must be byte-swapped to the host order. Signed-off-by: Laurent Vivier Signed-off-by: Riku Voipio --- linux-user/syscall.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cec8428589..b2b563e388 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7767,7 +7767,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, case TARGET_NR_write: if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) goto efault; - ret = get_errno(safe_write(arg1, p, arg3)); + if (fd_trans_target_to_host_data(arg1)) { + void *copy = g_malloc(arg3); + memcpy(copy, p, arg3); + ret = fd_trans_target_to_host_data(arg1)(copy, arg3); + if (ret >= 0) { + ret = get_errno(safe_write(arg1, copy, ret)); + } + g_free(copy); + } else { + ret = get_errno(safe_write(arg1, p, arg3)); + } unlock_user(p, arg2, 0); break; #ifdef TARGET_NR_open From patchwork Wed May 31 13:08:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100745 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp292827obc; Wed, 31 May 2017 06:08:59 -0700 (PDT) X-Received: by 10.200.51.66 with SMTP id u2mr31313801qta.12.1496236139864; Wed, 31 May 2017 06:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236139; cv=none; d=google.com; s=arc-20160816; b=ulcIH52rmUrnksiwkzQc9gi82KnLQCKNR+2GCFIMbnEm8+vs1GRlGlv/Cjpuiw1mPr hLsUmKd10BgAV2o14GoKxztJgMwmD9xdpz9ptHNwKMjbesWcODBGYcyFG59sT2pDLYW2 wm2KoZiBJGYnCN2r+TSTRNjyYKZpTlo8Po77idvTrMFGJQ1EnVjOdOzW+QuszG+GoADH Qmp4zGW7XokN+YDsV2NYDjaxpLGA9tBktPHC9FbdjpAShBMU8sJJzEHcLGYonAQ41VxD b6WN2zMq4Nm5TobG/uCGdOiY+BAlzzpOBzqNQ73j9XZdJNh3uDgyTai3qzC69bNUozjX uy6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=1v97PnDIrhxByjUCVxjqIOe26eIkHOTAzNcJ3Z1LSCM=; b=cqBieOJJ93u36cOSSHbSC1Z+A8mRRoptXDa3APjoqdxq6AdE9dIjDkGU6X319Fz9vz URY+wdz6+/f6FPaCQIYHJHBV+dictGckxdvo0AzvouP5C08Gg6h/V5hcSQcXVMuyjIKE Yh4UpCm61sUEMqfAgFdo2VB5w1i+sdCk0XSKI8bKfA1ncyQwZifIY6vrO/gOoYHJGRPu IPsCGDsaHeOKYOZJ6/CabCYblyCSO2XnQ7XPFksXxNiLXUfenI40pXOLoJEATGxCS8vd 7MX/reggQJCQ4C06uoSxXGyadFGcnClfgaauL4dY2PxQeDj5FLBIMrMH8SIGdPVTbxw6 jfZA== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c3si16133424qkb.54.2017.05.31.06.08.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:08:59 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59320 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mv-0007SP-6r for patch@linaro.org; Wed, 31 May 2017 09:08:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Ma-0007S6-Fc for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3MZ-0003bt-7L for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:36 -0400 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]:35553) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3MY-0003bT-W4 for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:35 -0400 Received: by mail-lf0-x232.google.com with SMTP id c184so3857929lfe.2 for ; Wed, 31 May 2017 06:08:34 -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=1v97PnDIrhxByjUCVxjqIOe26eIkHOTAzNcJ3Z1LSCM=; b=evZkuvKhphpv82/JZuOI+//5zng4ZCV+nrPT2mBe4WIrUsfqY0vbr/SFQH8vMPG5KY uCAUu5QkpwIqZHYWCj2GBxdpVwIYki2jQAzTPYYpJnHC6V1WdwXIUm0FzK1/N+BKC+gk TH86h1pNItQQfsNdhVZJqXP3D7qUdI0LEqzOM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1v97PnDIrhxByjUCVxjqIOe26eIkHOTAzNcJ3Z1LSCM=; b=b7SgWSixbxVJCCrdqy49XDBIvOnAW8ddCJ2Im2JH6DKTToIb1u4kH2W0942oLnQvYJ oh9zYlo5w/Hi4l/HL5iTWLgCHwqi1NVEjfnAchK/UybFYho91tSXIQ5U7KduH2oL156S QJkg67Du58M7qnUTeg40QmlRz+WrCJovczZWyOq1oLCiBA0n+mKCSvih57Gnz+AuTm8K CaQ843wAuV2Kq7a+8WNcPyyA5ZBCuhrk3z4DdCqSYu+fRBhyaHiYBerzsbOtAiN9TMYY QDJ1aAWWnqF2RWtdhuAwJo36GKgyvtP7XPND/nWG6qKhnE9bzc5miXUw7OpTrq219Yh0 Wc1g== X-Gm-Message-State: AODbwcBGeO3oe6wAOnvPq3cBflVfl9x0AfgR+J0kCVW+cYPoJ9S9yNZY yPkQ2XgJUMslqhiSOd2Y1g== X-Received: by 10.46.15.10 with SMTP id 10mr7836071ljp.12.1496236113559; Wed, 31 May 2017 06:08:33 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:32 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:14 +0300 Message-Id: <562a20b4ef63bdde6e2e5bac0da02302aeb5299f.1496234766.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::232 Subject: [Qemu-devel] [PULL 02/15] linux-user: fix eventfd 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@linaro.org, Laurent Vivier , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Laurent Vivier When a fd is opened using eventfd(), a read provides a 64bit counter in the host byte order, and a write increase the internal counter by the provided 64bit value. Signed-off-by: Laurent Vivier Signed-off-by: Riku Voipio --- linux-user/syscall.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b2b563e388..2da8426aaa 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7671,6 +7671,28 @@ static target_timer_t get_timer_id(abi_long arg) return timerid; } +static abi_long swap_data_eventfd(void *buf, size_t len) +{ + uint64_t *counter = buf; + int i; + + if (len < sizeof(uint64_t)) { + return -EINVAL; + } + + for (i = 0; i < len; i += sizeof(uint64_t)) { + *counter = tswap64(*counter); + counter++; + } + + return len; +} + +static TargetFdTrans target_eventfd_trans = { + .host_to_target_data = swap_data_eventfd, + .target_to_host_data = swap_data_eventfd, +}; + /* do_syscall() should always have a single exit point at the end so that actions, such as logging of syscall results, can be performed. All errnos that do_syscall() returns must be -TARGET_. */ @@ -11876,7 +11898,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #if defined(TARGET_NR_eventfd) case TARGET_NR_eventfd: ret = get_errno(eventfd(arg1, 0)); - fd_trans_unregister(ret); + fd_trans_register(ret, &target_eventfd_trans); break; #endif #if defined(TARGET_NR_eventfd2) @@ -11890,7 +11912,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, host_flags |= O_CLOEXEC; } ret = get_errno(eventfd(arg1, host_flags)); - fd_trans_unregister(ret); + fd_trans_register(ret, &target_eventfd_trans); break; } #endif From patchwork Wed May 31 13:08:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100749 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp294113obc; Wed, 31 May 2017 06:11:32 -0700 (PDT) X-Received: by 10.200.35.177 with SMTP id q46mr31532760qtq.158.1496236291950; Wed, 31 May 2017 06:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236291; cv=none; d=google.com; s=arc-20160816; b=tGadevj/cwjpe45CZp2ISXu1OzJB/BNzPPnTAp1wUboLRPMd90ob9ecmi9H+Kkw0YD F1R/M7gBtops4KCNc7wmDiIgu8RAdv+2A2PWFe/HJ8xDTD+8vbQoXatO61z3yuMIxbmi TZVkpTJH2CODVQzOfYil2kc4Iw5w6xU5YiGpD/gSfDgnvVktIu0P6vbyThAQYzxIHiw8 OLHbapacwRD+urdv57nicX6Z7nc0EAV+uDbsubmUO/9K6uCV0DRhZs2eFk8im1SqK+wo 3n7ZaRww7O6PyhtobS7SipvltWmefhPv3Kir2aGu1CrqH8uBSVQvMgNNDpaDIyVCDSTE YS5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=ro0PfRjsVkhc/pvBMyQZREjtRPqkIWjlcs9UnUNz23Q=; b=Ig1AecOFFdsMQrm+zzTs5jxYsTTNgI9c4s09E7khz2QlTIuzEK23Fi7DFUWOHve39x i0hOouQ9VjNP863NgHl2hED1TNxlMqeNdlOyclr5fLPqnXK3AG0GM63n34GOWRxaAH6/ 82unmMsOKSGWPpmmDBRni1UCdBAdWo0j5AM+QeQk4SG+Kvnl1rhGvsENiG+IBDK4ZSCm 6nVOnKKTcb9CBRTQAyI7nHkRDpZ1xNTWOd3kF9C61HoK+iPWbXyV1X/6d0BFxkrB6czO tpxNbOJWakCSqzQnvPPR0zr4lYlrwBC3mwPtPZ42S601NJ62f4WudVnF4LRBFDKusKLO rDAA== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s32si16187527qts.244.2017.05.31.06.11.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:11:31 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3PN-0001B8-9x for patch@linaro.org; Wed, 31 May 2017 09:11:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mb-0007SC-K4 for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Ma-0003cS-Lg for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:37 -0400 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:35916) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Ma-0003bx-Eu for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:36 -0400 Received: by mail-lf0-x22a.google.com with SMTP id h4so8614275lfj.3 for ; Wed, 31 May 2017 06:08:36 -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=ro0PfRjsVkhc/pvBMyQZREjtRPqkIWjlcs9UnUNz23Q=; b=U2lmeerRitNiy7ne41dWh2MXGJSqT0MY9mJct0ZBPyolEe7kyy89yaix3skIDUON8E a3zuetGA/fy45zSaK+E2Ql6pt5SLS7e/05CAFHuAuB0dtDtAcUF0cPfPvEd0Pc7OiM3S gzCcvC6z6XNTboMG435obuu6cv9HNY5oEN7oI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ro0PfRjsVkhc/pvBMyQZREjtRPqkIWjlcs9UnUNz23Q=; b=ruNHKyu2Qbd29ay0V6uoVBbZ/fNJctkJrjCMtkx7OWaGXb/+UiuJomf1CXN7rcgavt /4JE+PnPqoOlFNg8LRKOzD1aA31Hg+ihpFQCT6F+rOFEh0LTyFJ8fQqXUFQdZrB3+ped eZ2jntE2o+6OIEks1hdwjCtfzvLJXe+Ex8eB056QinWCU3rmL1yuHzby2DSu8DsqHTys f6v1nJZKf7I32TVtJgXkgwXHAcwFkF0fZ6qErwhwAVUN5+c/DLtXuGoL9tXndfo8NZwK 8E5EuMJ+/jFATRaCRpfF2tI85xQl5DQWeF4NnhpQg7KEiNwADS6NTfQFqFsFA6EmFY7Q wETQ== X-Gm-Message-State: AODbwcDfQRZsBk9+khibMNPpFJlcs0bpkVlyL3K90uIGaDNomsCk3FeN hxv/tyZCySkYL+Ou7F4Ggg== X-Received: by 10.25.19.31 with SMTP id j31mr7472258lfi.79.1496236115103; Wed, 31 May 2017 06:08:35 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:34 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:15 +0300 Message-Id: <43046b5a074029a9354bb2b772ca1f91320440f5.1496234766.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22a Subject: [Qemu-devel] [PULL 03/15] linux-user: fix fadvise64_64() on ppc 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@linaro.org, Laurent Vivier , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Laurent Vivier On ppc, advice is arg2, not arg6: long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, u32 len_high, u32 len_low) Signed-off-by: Laurent Vivier Signed-off-by: Riku Voipio --- linux-user/syscall.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 2da8426aaa..671b13a23b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -11261,6 +11261,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_fadvise64_64 case TARGET_NR_fadvise64_64: +#if defined(TARGET_PPC) + /* 6 args: fd, advice, offset (high, low), len (high, low) */ + ret = arg2; + arg2 = arg3; + arg3 = arg4; + arg4 = arg5; + arg5 = arg6; + arg6 = ret; +#else /* 6 args: fd, offset (high, low), len (high, low), advice */ if (regpairs_aligned(cpu_env)) { /* offset is in (3,4), len in (5,6) and advice in 7 */ @@ -11270,6 +11279,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, arg5 = arg6; arg6 = arg7; } +#endif ret = -host_to_target_errno(posix_fadvise(arg1, target_offset64(arg2, arg3), target_offset64(arg4, arg5), From patchwork Wed May 31 13:08:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100750 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp294117obc; Wed, 31 May 2017 06:11:32 -0700 (PDT) X-Received: by 10.200.48.221 with SMTP id w29mr29116102qta.54.1496236292386; Wed, 31 May 2017 06:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236292; cv=none; d=google.com; s=arc-20160816; b=OJDrsxTAdmyUWtah2Cc1F9tHPSiLRmXbnv01+o2Ok6dX3sOaYPQPO9W2c5Z5fPt6i9 6avPLghB1uT6x8R5XgWp7keiuYUAG2eSrM2m20LqGEhIwykOZ9WKqHTYX11EWa75gdYI exmZQGHbMgCqg1zMEGFugYUzlnzC8IR0dhN6uujqUEkaQuXSngc9pVizvaT43WNpapEi +pKD26EKr52gurdrcFEi9srS1tlV9l3P+BFbMtYPbGV94TvLTN/oEkTGhsjk0ygBXfn6 b2Ifq1Yokq6uWXptHqpmkNPpMDGvgN6YFi9iZrKxq6ZJ31lwpFc9a1heTUDhfIAcTyeO UVLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=+8xB72Fd/V/0yQQJdOSrVyVx4BisqTQiYzTSNb9mXGo=; b=NuFjszLz7VytNCAV2hRZPyor3FHkTsAYw4cniSuSyKJwci74SMHQqCC5TAcPvESytJ nutiki8u1/BFGeBKGoIWRq6QmJ6kpdMkgFJs7yuQKHH0+59cbAjmwOaMMqLoQ1uG8rtv +p0r0IkWLn9spUr9LyaivE1JsBHP+t7V9Vx5zp5LXX386D6dLlveiZOdAosOSZc8VJ4B dRVA7gu7Vxhm2q8IiGG6RwkPKi5f+JRtdve9J/UENisi7eGSKBduoUseDmCV08oX5JSm 5cWqHVzNa5ZiCPlpGHgSkN7KtWQxf39ruvhwd7sEmBHDti0g4uksxVk63rC7sgKNbLpM rFzg== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t1si16221658qtc.9.2017.05.31.06.11.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:11:32 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3PN-0001Be-VG for patch@linaro.org; Wed, 31 May 2017 09:11:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Md-0007St-8P for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Mc-0003cr-2o for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:39 -0400 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]:34426) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mb-0003cY-RE for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:37 -0400 Received: by mail-lf0-x231.google.com with SMTP id 99so8618602lfu.1 for ; Wed, 31 May 2017 06:08:37 -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 :mime-version:content-transfer-encoding; bh=+8xB72Fd/V/0yQQJdOSrVyVx4BisqTQiYzTSNb9mXGo=; b=jGKSc4BC7iovgH8UCeOutoEBB17eSwygJ+j8Kd5kua3qveU0cinXhY1tZnJ8oxKcAc gUhf4Zu9xjF8VxmVRb7qs66yrBNqD8Odbn/2vPY41YF8HBl/6zFU1gMNN9B5NsWU7/lf PLcp1YiEJTqbcwGM0D8C0uQLlMRWVZXs8bRvI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+8xB72Fd/V/0yQQJdOSrVyVx4BisqTQiYzTSNb9mXGo=; b=GIhXgG36a9b+AFu5fVjDivPA4it+Ob9ZxG2d5aOUJ25YRYPLWXlwBbCwbfGOtRf7UQ ncbbegTo0JF5wsCV15RPym5p/27BLQvbMepkgKyW3xprhmM/2TQwDq9AQbHPB/ikkJZc 66rAqXIQTecGHyiYvLJn/azpaa4o83IpkG1KMw/x3hRruXUoZsZmmARnrhthBcu+V34Y F1jBB6PXIael9DxWZRk9lYl9ZRdr7XdXsEBQOk6oprkxS9PeDVWeE6rFF0ejDdafAznY TfMqwYxQLFE0BwMLC9cwkPNX1QjvuGrc9vFEnStshRHiJeAi0ay09mIymwJViA5THiPH PsKQ== X-Gm-Message-State: AODbwcDuxSJjWxcT4/WOdxq2iOXuc012X88irvYpzArzS+nvhD6Ttnao hiN2S4VLFsMwfQsDnma4uA== X-Received: by 10.25.229.209 with SMTP id i78mr7505134lfk.146.1496236116419; Wed, 31 May 2017 06:08:36 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:35 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:16 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::231 Subject: [Qemu-devel] [PULL 04/15] linux-user: fix inotify 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@linaro.org, Laurent Vivier , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Laurent Vivier When a fd is opened using inotify_init(), a read provides one or more inotify_event structures: struct inotify_event { int wd; uint32_t mask; uint32_t cookie; uint32_t len; char name[]; }; The integer fields must be byte-swapped to the target endianness. Signed-off-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Riku Voipio --- linux-user/syscall.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 671b13a23b..32aba195c5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7693,6 +7693,33 @@ static TargetFdTrans target_eventfd_trans = { .target_to_host_data = swap_data_eventfd, }; +#if (defined(TARGET_NR_inotify_init) && defined(__NR_inotify_init)) || \ + (defined(CONFIG_INOTIFY1) && defined(TARGET_NR_inotify_init1) && \ + defined(__NR_inotify_init1)) +static abi_long host_to_target_data_inotify(void *buf, size_t len) +{ + struct inotify_event *ev; + int i; + uint32_t name_len; + + for (i = 0; i < len; i += sizeof(struct inotify_event) + name_len) { + ev = (struct inotify_event *)((char *)buf + i); + name_len = ev->len; + + ev->wd = tswap32(ev->wd); + ev->mask = tswap32(ev->mask); + ev->cookie = tswap32(ev->cookie); + ev->len = tswap32(name_len); + } + + return len; +} + +static TargetFdTrans target_inotify_trans = { + .host_to_target_data = host_to_target_data_inotify, +}; +#endif + /* do_syscall() should always have a single exit point at the end so that actions, such as logging of syscall results, can be performed. All errnos that do_syscall() returns must be -TARGET_. */ @@ -11736,6 +11763,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #if defined(TARGET_NR_inotify_init) && defined(__NR_inotify_init) case TARGET_NR_inotify_init: ret = get_errno(sys_inotify_init()); + fd_trans_register(ret, &target_inotify_trans); break; #endif #ifdef CONFIG_INOTIFY1 @@ -11743,6 +11771,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, case TARGET_NR_inotify_init1: ret = get_errno(sys_inotify_init1(target_to_host_bitmask(arg1, fcntl_flags_tbl))); + fd_trans_register(ret, &target_inotify_trans); break; #endif #endif From patchwork Wed May 31 13:08:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100747 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp292920obc; Wed, 31 May 2017 06:09:10 -0700 (PDT) X-Received: by 10.55.58.67 with SMTP id h64mr9092226qka.9.1496236150162; Wed, 31 May 2017 06:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236150; cv=none; d=google.com; s=arc-20160816; b=jeAOSsEf9ziAKp1PtGhjCkmwMzVUrEp7GQv74Y5vm3x2srPwnwd1PJstdLvwlX4kQF KBRC8VjirZZbedNt4vC7R8sjbI2W2CtXieVz5mVR6JNumqsdHjfZQ3BRWxDRVwiU3rM+ cdYJC7Iyl0ncRBHI0/Kw5fIQP4vWmNLWQlrfQ+SwSGL2h65zljcUHhFodrMLR1TiWSmr aPKBZnX2Hi0WKT58WyNRdp4hmAICLmXUYGtQNUKckPPTFgnODrLzuEQmL+ajj/KOXflk uDjv2aOCyqRPZGdwOwt8zZBJv79R2M5C5cj+LW12zyDDSoEvik2I5ujBl3vIs+O5awRz ZDew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=sVUFJPyhoMVfwU6dfdh6SzS9wv74DR0CHue3CQwsChU=; b=NJ+iY205hqeRiYHt9LjiSZm3zyE7ue/tALr5m2t60cQgSmvbtttznAx51tj8W1dffW jZEMnnNhJZWaNxWNHlOm7yMT2tHPUK55R7zMxvSm6yN5fYIaMUR/I/4qlMJbgLkz6fmS KKTSBktsAe8TP9YvjfobhE+NP7sCtnetOvfpCTeXnsgr0ZeG7iiHM1k0JWNCZvwjnmko lDeAlvmyHDoASSum3GaAWsJT6scT4dyrLfU8CLJynhY3SBrnWg+inwt0qbZ7jw83q7D8 8Zg1MksihM4cF282CPn7tW9nRNMZqz5BCLf+8Is9mhz7uuuYtF6NHfQz1j/cGwYQVwfH WiYg== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o23si16059755qka.170.2017.05.31.06.09.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:09:10 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3N5-0007a7-IE for patch@linaro.org; Wed, 31 May 2017 09:09:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Me-0007U5-Cz for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Md-0003dC-CP for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:40 -0400 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:34434) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Md-0003cx-4W for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:39 -0400 Received: by mail-lf0-x233.google.com with SMTP id 99so8619103lfu.1 for ; Wed, 31 May 2017 06:08:39 -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=sVUFJPyhoMVfwU6dfdh6SzS9wv74DR0CHue3CQwsChU=; b=UWXUTODk7Fp4ibPSVA0psydCh19Qp7uXGTDNHsBRp3p72+YxsNSo+K/6BSBBwt8bHp zBZfXpFeBcOQgNcGO2/FqY1axdA6UvGEm+1jnMsbJw9AL4HHbGuFRbZrUGPNQOxZuCPD arprKqFGE11Mzp732owvcHA2eJ/VxBYUaYlds= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sVUFJPyhoMVfwU6dfdh6SzS9wv74DR0CHue3CQwsChU=; b=HoeM67tl1BOwjRZMyUxo6i2JblkoCTUDeZPxUNqIO8JBKTBAicMB04tDsnWfkDroZ/ e9o5CrCYRaIHCsrmGNwSyNRWhbXu4cWII3iUejDn+kL1dSPh/R6TgA6qCV40p4uI2cUr LqOains9b7+ioBrbtRsOsrUAEWlCLYiipHnso4LTRXgLMH0FNlbRhS0kxf0sc9FYGSzw uZ9a0JYlp7jET7WnjSbeB+MLSC9dhOoy20smY3BwWBLJdh3S4hgJki9R7DrznkClv2D8 3/9o4n0g/s7KOvASxLET5A/2dLrpwSocvtAzuHEkZDIYBx2YuBilrW7a6rTVJ10c9ymF W5jQ== X-Gm-Message-State: AODbwcA7S6ulQMy14E9CfoHSbg7aeQccAHXtniPW6pZAlBR7gGbV5WiU Uezf4Wd4iLJN7PTuStHNwQ== X-Received: by 10.25.160.75 with SMTP id j72mr7617882lfe.97.1496236117714; Wed, 31 May 2017 06:08:37 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:36 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:17 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::233 Subject: [Qemu-devel] [PULL 05/15] linux-user: allocate heap memory for execve arguments 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@linaro.org, Prasad J Pandit , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit Arguments passed to execve(2) call from user program could be large, allocating stack memory for them via alloca(3) call would lead to bad behaviour. Use 'g_new0' to allocate memory for such arguments. Reported-by: Jann Horn Signed-off-by: Prasad J Pandit Reviewed-by: Eric Blake Signed-off-by: Riku Voipio --- linux-user/syscall.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 32aba195c5..c8f6efc89c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7985,8 +7985,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, envc++; } - argp = alloca((argc + 1) * sizeof(void *)); - envp = alloca((envc + 1) * sizeof(void *)); + argp = g_new0(char *, argc + 1); + envp = g_new0(char *, envc + 1); for (gp = guest_argp, q = argp; gp; gp += sizeof(abi_ulong), q++) { @@ -8047,6 +8047,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; unlock_user(*q, addr, 0); } + + g_free(argp); + g_free(envp); } break; case TARGET_NR_chdir: From patchwork Wed May 31 13:08:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100753 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp295947obc; Wed, 31 May 2017 06:15:27 -0700 (PDT) X-Received: by 10.200.33.149 with SMTP id 21mr31038724qty.223.1496236527865; Wed, 31 May 2017 06:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236527; cv=none; d=google.com; s=arc-20160816; b=oTQXmB9NyzX5PtLzSnHojxJHO+UlP0peOabrKA7EaUVGyYoyTV4NrTLVNUcCctUHoC Cg2e5jATk+T7dUXeCA+J0WzIiXeSo0DGtMzu/cnyQzSd5DsPFq1T4oIIgn118mDTP7Na 1cl60jGCKZPiEwadrwIEYvN44S1H6EeGmvBa7vJ1rFcln5SbS2iqXEK5wuxZyHlPWQDc 96lrK/zbyLlgFw7V9Tp9Y4JMnNpJo2aEBiT81R96E8vEgahevw8UOK1V03GHS6+uD4ld OvMeARZUQmQDx7MpbfMOSckoG/8lqdO2j1kzAufdCXgYmHWy0LhuM6EaP3MqfzKUGN62 EIzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=ATZm5CB9ryGIVvWQK1NlMh3EPLzZPN6G0IkLpUJlvkg=; b=pDJuDzTkWc2kCRvdZjOM9yV0hVIwncGI2g4vPIKr2cfUBrIoi5WXb6mlf/GK5ikRoA zcfaGR14vpL7iR4K8e8dgPRQdG/2rk3JPoDziwpQOTcUhEKwikg6VN4p9QnJORoMQbMI daTB3r99xscrU4jkiiPcV8Uts4FDRvAIFvlhMzUXuAlTmxODswjoDvVixbqCOj1m1Zg/ S0YaY0/hUjW6ABJ4ZB8PZOAqr6ZpxV+F+ZdPUr3Lc6RJ6vKChM170tj2Y7pBMHipnB/I 4VYCN0opZoNKpvJ14BM0uZm0stWYnUvcTilcSExMmEU2Jak6vwLh1PxfqtINw55kO0Kx Hv/Q== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h134si11520494qke.194.2017.05.31.06.15.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:15:27 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3TB-0004ft-4J for patch@linaro.org; Wed, 31 May 2017 09:15:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mg-0007WO-MM for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Mf-0003dx-Ig for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:42 -0400 Received: from mail-lf0-x22d.google.com ([2a00:1450:4010:c07::22d]:33152) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mf-0003da-AO for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:41 -0400 Received: by mail-lf0-x22d.google.com with SMTP id m18so8645280lfj.0 for ; Wed, 31 May 2017 06:08:41 -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=ATZm5CB9ryGIVvWQK1NlMh3EPLzZPN6G0IkLpUJlvkg=; b=VSMpe0DTPw9PkTinWGU+Wf5gLr4btHK/MGn7mP86KZpSeaPGyme7dr4McGrSy2FMhC 9UZitxMC1eq4qAem7UWTpriv5TMmpCiwP7dKlXhDl4eL5khKYesK9q3LyvHhaJDP/tOx Nxd+9L1IXwE1IZ5NnwR0QflhKaKBXAoAnrjZU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ATZm5CB9ryGIVvWQK1NlMh3EPLzZPN6G0IkLpUJlvkg=; b=WTwnPE56kaDbiYW2v7wcstlpbFAtu2fh8+vaMT1gb4VeYH8Uio/B3YbI3pp988/oqW xGZnv1lM3qkeAFnVJ4YcMG+A4lQ9dAZ1i0+cUcTkutaOvfwGshQr/mDRhpnKFiKE70x5 c/ChADLDFne5aNtM5HP6otXW4vrxaNMkwTCUV8MdoFlAuL3dvt7kcZ9MzolRNueCjP4i v3roO51zKJxyfx3aXWnuaYhSE7HF8KhEW6xki0kl9Mj+f8zigv9/DvilT75enSxgp9AG Bjg2tr42mo61OM4buoRDVXQkG6HmpP+U1QWC+D9vbWkMbJR8m7r3DNVtjpROneOMcSuu EJ/A== X-Gm-Message-State: AODbwcAlOsM/3GNIQ6gLflO9wl3vW0RcH9l/3CrWs+61OqZlo7tQPYro w34MwM2ulFEm8njKmP5zpQ== X-Received: by 10.46.19.2 with SMTP id 2mr8428608ljt.132.1496236119829; Wed, 31 May 2017 06:08:39 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:38 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:18 +0300 Message-Id: <58de8b9684cc7b4b1fb3cd47678a04d6924b28de.1496234766.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22d Subject: [Qemu-devel] [PULL 06/15] linux-user: remove all traces of qemu from /proc/self/cmdline 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@linaro.org, stefanha@redhat.com, Andreas Schwab Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Andreas Schwab Instead of post-processing the real contents use the remembered target argv. That removes all traces of qemu, including command line options, and handles QEMU_ARGV0. Signed-off-by: Andreas Schwab Signed-off-by: Riku Voipio --- linux-user/syscall.c | 47 +++++++---------------------------------------- 1 file changed, 7 insertions(+), 40 deletions(-) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c8f6efc89c..909dde6de6 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7358,52 +7358,19 @@ int host_to_target_waitstatus(int status) static int open_self_cmdline(void *cpu_env, int fd) { - int fd_orig = -1; - bool word_skipped = false; - - fd_orig = open("/proc/self/cmdline", O_RDONLY); - if (fd_orig < 0) { - return fd_orig; - } + CPUState *cpu = ENV_GET_CPU((CPUArchState *)cpu_env); + struct linux_binprm *bprm = ((TaskState *)cpu->opaque)->bprm; + int i; - while (true) { - ssize_t nb_read; - char buf[128]; - char *cp_buf = buf; + for (i = 0; i < bprm->argc; i++) { + size_t len = strlen(bprm->argv[i]) + 1; - nb_read = read(fd_orig, buf, sizeof(buf)); - if (nb_read < 0) { - int e = errno; - fd_orig = close(fd_orig); - errno = e; + if (write(fd, bprm->argv[i], len) != len) { return -1; - } else if (nb_read == 0) { - break; - } - - if (!word_skipped) { - /* Skip the first string, which is the path to qemu-*-static - instead of the actual command. */ - cp_buf = memchr(buf, 0, nb_read); - if (cp_buf) { - /* Null byte found, skip one string */ - cp_buf++; - nb_read -= cp_buf - buf; - word_skipped = true; - } - } - - if (word_skipped) { - if (write(fd, cp_buf, nb_read) != nb_read) { - int e = errno; - close(fd_orig); - errno = e; - return -1; - } } } - return close(fd_orig); + return 0; } static int open_self_maps(void *cpu_env, int fd) From patchwork Wed May 31 13:08:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100754 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp295953obc; Wed, 31 May 2017 06:15:28 -0700 (PDT) X-Received: by 10.55.191.67 with SMTP id p64mr26856831qkf.149.1496236528400; Wed, 31 May 2017 06:15:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236528; cv=none; d=google.com; s=arc-20160816; b=q654Xvdioo4maoGuuIzEJhWHKf6ZI3llcuo48YvMmf4FSrh7ndP9gAFfTLii4dq7RY c5usmfObuFCeUdl0bW07ZNoY8VCBLMusJ1bs2O13qxAFy7Q5eFMsYBTZeuN4OgqkoGNC 7Rz8gf/j8EF3T/GmgSYps/ksW5Cj8yDSMbtnIkZqj+PwoOCUdjDHIStIZwhU+tCtir1g 3MxRy9yb8bnPImnb3rxPdVdcMn77/PBRjs6sEYHFQMQip7qoTn5G/3NUi6ntLjkpDxjU 8qpiKqR7PfaucGWHVKngHFdmyjWfFp9wXCVkHXWR62EbdNRkcZls3s8WCfnlNBF8ASr6 iXTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=1sqJrBDYbuJa0uualACoBSo1gpEb7VBM+FM+6yBoJ7I=; b=FTNSsLwp2CC3WT0MMjjgI3UYYWy0VvelJu7v3gnU13sQCIsIldQayGZYy0bhcMi6/a ra2l5VzxSiq7vzcWeDFacwmIW1yxwIR5/9Ju6Ej+i+UQpwy+w8hyDgMXw351/l5gnAvc UISiutR87y2ZZR8LIUPgUWkHHhHGglY2pdTOnoMwUfp2goeNhsHc8+jXFkMtwwYRVAo5 0NjLLvrBFJVoRd12FwHV7VAov66FdmABs8Rs3yIjzu7KEi5F/6EW9eRbtBaGiqMv5KWU SXWtS1H4OKLCIQOLGBOatPVDUniBuUWwz6ybS8ooT+iTy5RB/xAvv4QriiWj1dG4QbfT oUtg== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r2si16357281qtc.37.2017.05.31.06.15.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:15:28 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3TB-0004g3-PY for patch@linaro.org; Wed, 31 May 2017 09:15:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mj-0007Yh-Ep for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Mh-0003eE-2D for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:45 -0400 Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]:33162) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mg-0003e2-Rb for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:43 -0400 Received: by mail-lf0-x235.google.com with SMTP id m18so8645909lfj.0 for ; Wed, 31 May 2017 06:08:42 -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 :mime-version:content-transfer-encoding; bh=1sqJrBDYbuJa0uualACoBSo1gpEb7VBM+FM+6yBoJ7I=; b=VAKi4G4Q2hsSQ0zDIngohXLI4Fh+bsqL+IssmX24u1o8eyK9UEvi3eBwZ1IB3Tjmii XPwcFPnui+zG41/tCY+KXYGJlkLH34+RG559bSHqqdqAZAUuQ0TxxPhYHZdZkltG9BMK MaMQzNBzlZyWm/oyoowEduewYInplAKTlRibo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1sqJrBDYbuJa0uualACoBSo1gpEb7VBM+FM+6yBoJ7I=; b=m7OER2nKa+cp3H5THfmoDaScY7yPGKpyU10/uLAGSWDrziJsM9A3lyWJcm2ptlUWzM odwgJ4v5VhFsVBbbigm10KkD886RoRzMj5Z6fOXlkdmn+DFKA7mau/EYuPlWtOnIY3iP vnCPOQtTeh9BaJ5w2omqae2KCAJzgEr3NKtsaQcmaVtBay1uvuwHynoD+RLnK3/aDGaO i+ZG3VwFWZApw478ZY3qlX03qFPLexW80BM3rM9U8MgJSe1muNc7aX/J0Tpv21IrLANR T0lF8JInhBaNSuX1XT09ZnLZtbNbC9jw321bvBgscYnni39JJqJsioJEs9EedOueTNlz eZCg== X-Gm-Message-State: AODbwcDeSIzWmIiGU2Ri3rIj8s6d5IMfKJo0Ss9RSSINlH9qUc/YEhSb miPGhtIwcGAhGzXyQfMkZQ== X-Received: by 10.46.76.18 with SMTP id z18mr8359227lja.9.1496236121293; Wed, 31 May 2017 06:08:41 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:40 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:19 +0300 Message-Id: <65424cc45696768442c684c1202d21b7f73f1156.1496234766.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::235 Subject: [Qemu-devel] [PULL 07/15] linux-user: add strace for getuid(), gettid(), getppid(), geteuid() 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@linaro.org, =?utf-8?b?TWlsb8WhIFN0b2phbm92acSH?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Miloš Stojanović Improve strace support for syscalls getuid(), gettid(), getppid() and geteuid(). Since these system calls don't have arguments, "%s()" is added in the corresponding strace.list entry so that no arguments are printed. getuid: Prior to this commit, typical strace output used to look like this: 4894 getuid(4894,0,0,274886293296,-3689348814741910323,4832615904) = 1000 After this commit, it looks like this: 4894 getuid() = 1000 gettid: Prior to this commit, typical strace output used to look like this: 8307 gettid(0,0,64,0,4832630528,4832615840) = 8307 After this commit, it looks like this: 8307 gettid() = 8307 getppid: Prior to this commit, typical strace output used to look like this: 20588 getppid(20588,64,0,4832630528,4832615888,0) = 20625 After this commit, it looks like this: 20588 getppid() = 20625 geteuid: Prior to this commit, typical strace output used to look like this: 20588 geteuid(64,0,0,4832615888,0,-9151031864016699136) = 1000 After this commit, it looks like this: 20588 geteuid() = 1000 Signed-off-by: Miloš Stojanović Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Riku Voipio --- linux-user/strace.list | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/linux-user/strace.list b/linux-user/strace.list index 3b1282ec1a..6e33788a17 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -290,7 +290,7 @@ { TARGET_NR_getegid32, "getegid32" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_geteuid -{ TARGET_NR_geteuid, "geteuid" , NULL, NULL, NULL }, +{ TARGET_NR_geteuid, "geteuid" , "%s()", NULL, NULL }, #endif #ifdef TARGET_NR_geteuid32 { TARGET_NR_geteuid32, "geteuid32" , NULL, NULL, NULL }, @@ -338,7 +338,7 @@ { TARGET_NR_getpmsg, "getpmsg" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_getppid -{ TARGET_NR_getppid, "getppid" , NULL, NULL, NULL }, +{ TARGET_NR_getppid, "getppid" , "%s()", NULL, NULL }, #endif #ifdef TARGET_NR_getpriority { TARGET_NR_getpriority, "getpriority", "%s(%#x,%#x)", NULL, NULL }, @@ -381,13 +381,13 @@ NULL, NULL }, #endif #ifdef TARGET_NR_gettid -{ TARGET_NR_gettid, "gettid" , NULL, NULL, NULL }, +{ TARGET_NR_gettid, "gettid" , "%s()", NULL, NULL }, #endif #ifdef TARGET_NR_gettimeofday { TARGET_NR_gettimeofday, "gettimeofday" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_getuid -{ TARGET_NR_getuid, "getuid" , NULL, NULL, NULL }, +{ TARGET_NR_getuid, "getuid" , "%s()", NULL, NULL }, #endif #ifdef TARGET_NR_getuid32 { TARGET_NR_getuid32, "getuid32" , NULL, NULL, NULL }, From patchwork Wed May 31 13:08:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100757 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp296356obc; Wed, 31 May 2017 06:16:24 -0700 (PDT) X-Received: by 10.55.181.194 with SMTP id e185mr27286581qkf.195.1496236584931; Wed, 31 May 2017 06:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236584; cv=none; d=google.com; s=arc-20160816; b=CbVlCzKkLNokJ0L2IMLl96ff3leSb9Xsr9sZQ8PA8bI0yelDKzxkDSlMHQLLz2mlQ6 6UXzGhKYSHOlElVo/hpJurnux8jU7shAlBFnQkZ8pwp5J23EkHgKtEjlPanSVFmLAuUf 7fdpEWZ07PcX1HMPlL5mtZcoapmKzobqVQltV5A1nkPx7eXI1NfdetKmI58/CUdd0uIK 1DvZulwczb1Xjh21pE84t2ndiw038C1QJV8iyAXO7hGCd1QJP3Pw33xQx7Y6jiJNWR+8 7IItbWzebhfiujNJtSbBauBfdzRAT9NiE0Awski6URUH2MeEZaMAWc50tpcqVyKeaMfh 3BzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=ijD14mMOkzFltBDkO8wSyZ5Zpp9Fj3UQ+yM7Z2lDFLo=; b=HwLngKnOhLJrPbPM9VthUIfytAiaSR9LZJfR+oFDmNjP/y8VFXX7fNsPl5TZz6M7IN 68DdTSa3yLQ2+ueMXKj/LISPSAAUz9H3+QDnYFvdZ379Up9sR/DoFo8n500tTVGv+nEi fy+A+kXfgSuRtdbqKz8+cn5nGfYIbZfc5ohcRt51ZzQ+3XfWuGrGB+IAcv+XtKwhDP6Y u2OQjjZKZ2BIi5n0OV0iaGF0KzXGjiOxkv9wh4OzpI29essQbgq3nU9+1ansWpBfKDw/ HN0KjIcSH92NzvOIZorzWNGDxZefchNUPgPRptgMTkI4+s1et0T20GrWi2I/KBT9DDPC 4mMQ== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k28si16411234qtf.298.2017.05.31.06.16.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:16:24 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3U6-0005iq-9M for patch@linaro.org; Wed, 31 May 2017 09:16:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mj-0007Yv-L8 for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Mi-0003ea-G0 for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:45 -0400 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:35966) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mi-0003eK-8l for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:44 -0400 Received: by mail-lf0-x22c.google.com with SMTP id h4so8617308lfj.3 for ; Wed, 31 May 2017 06:08:44 -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 :mime-version:content-transfer-encoding; bh=ijD14mMOkzFltBDkO8wSyZ5Zpp9Fj3UQ+yM7Z2lDFLo=; b=fh93b4fEFk1qhkDlJjAJZwRCzWRA9warSnxrfKFs5Oh/tsWScSmRv/sSj/1dMLS6zR zpTpMdLinuIkk5Tzp0ERyNvVPwOslUww3RGQhY3FNjax4Zv2fYlkbRrlX22lSyd5yJeX 0pf3khmI1nMYFDQmzdSxh25xb4hYPmXBiJKcM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ijD14mMOkzFltBDkO8wSyZ5Zpp9Fj3UQ+yM7Z2lDFLo=; b=W/rGCvc5XKmquLCzV8YFn1D3eaTQC+a4bqY9vIrU1YRsgxOUkiW1sR+7zSIsgCLSP5 hGUdMu7IT2PbQafdsQEKs01RXfbiBMkFn3CPlBQL4NhzqgIrlPfdhxOKQaDR7I3KwDY6 PuDnVBKVvqXtIqPo2NpBPE4NXEJ1P5+zlLgUE/p1cckcTBUUhUeN/n8ahwgDhkl8Bn3a 1UEOGMug0AHOBe3ih1t4WIONsqn4cRP+1CMEjsJokvHGn32zan4blhs7n0j8wTm4o/oI DVCK5GxWfSaVhjxJyeVQB340IolQGPacFNILzIKmrp6IoNjKRDinUv0PyeNNfIrDdAw0 kNaA== X-Gm-Message-State: AODbwcCsO9VkVrcHv9py/Vp3UpaG8itb3Kta+8bGRjAoFtS5D5wAebz6 aFTrolduA7W0rd4Yph2zSg== X-Received: by 10.46.21.79 with SMTP id 15mr8556985ljv.15.1496236122791; Wed, 31 May 2017 06:08:42 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:41 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:20 +0300 Message-Id: <5162264e438cf5efcb101bc8030e5f76feb58635.1496234766.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22c Subject: [Qemu-devel] [PULL 08/15] linux-user: add tkill(), tgkill() and rt_sigqueueinfo() strace 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@linaro.org, =?utf-8?b?TWlsb8WhIFN0b2phbm92acSH?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Miloš Stojanović Improve strace support for syscall tkill(), tgkill() and rt_sigqueueinfo() by implementing print functions that match arguments types of the system calls and add them to the corresponding starce.list entry. tkill: Prior to this commit, typical strace output used to look like this: 4886 tkill(4886,50,0,4832615904,0,-9151031864016699136) = 0 After this commit, it looks like this: 4886 tkill(4886,50) = 0 tgkill: Prior to this commit, typical strace output used to look like this: 4890 tgkill(4890,4890,50,8,4832630528,4832615904) = 0 After this commit, it looks like this: 4890 tgkill(4890,4890,50) = 0 rt_sigqueueinfo: Prior to this commit, typical strace output used to look like this: 8307 rt_sigqueueinfo(8307,50,1996483164,0,0,50) = 0 After this commit, it looks like this: 8307 rt_sigqueueinfo(8307,50,0x00000040007ff6b0) = 0 Signed-off-by: Miloš Stojanović Signed-off-by: Riku Voipio --- linux-user/strace.c | 41 +++++++++++++++++++++++++++++++++++++++++ linux-user/strace.list | 6 +++--- 2 files changed, 44 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/linux-user/strace.c b/linux-user/strace.c index 8fb1b6e252..f6f76a5bd4 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1901,6 +1901,20 @@ print_rt_sigprocmask(const struct syscallname *name, } #endif +#ifdef TARGET_NR_rt_sigqueueinfo +static void +print_rt_sigqueueinfo(const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_raw_param("%d", arg0, 0); + print_signal(arg1, 0); + print_pointer(arg2, 1); + print_syscall_epilogue(name); +} +#endif + #ifdef TARGET_NR_syslog static void print_syslog_action(abi_ulong arg, int last) @@ -2415,6 +2429,33 @@ print_kill(const struct syscallname *name, } #endif +#ifdef TARGET_NR_tkill +static void +print_tkill(const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_raw_param("%d", arg0, 0); + print_signal(arg1, 1); + print_syscall_epilogue(name); +} +#endif + +#ifdef TARGET_NR_tgkill +static void +print_tgkill(const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_raw_param("%d", arg0, 0); + print_raw_param("%d", arg1, 0); + print_signal(arg2, 1); + print_syscall_epilogue(name); +} +#endif + /* * An array of all of the syscalls we know about */ diff --git a/linux-user/strace.list b/linux-user/strace.list index 6e33788a17..373d43689a 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1155,7 +1155,7 @@ { TARGET_NR_rt_sigprocmask, "rt_sigprocmask" , NULL, print_rt_sigprocmask, NULL }, #endif #ifdef TARGET_NR_rt_sigqueueinfo -{ TARGET_NR_rt_sigqueueinfo, "rt_sigqueueinfo" , NULL, NULL, NULL }, +{ TARGET_NR_rt_sigqueueinfo, "rt_sigqueueinfo" , NULL, print_rt_sigqueueinfo, NULL }, #endif #ifdef TARGET_NR_rt_sigreturn { TARGET_NR_rt_sigreturn, "rt_sigreturn" , NULL, NULL, NULL }, @@ -1498,7 +1498,7 @@ { TARGET_NR_tee, "tee" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_tgkill -{ TARGET_NR_tgkill, "tgkill" , NULL, NULL, NULL }, +{ TARGET_NR_tgkill, "tgkill" , NULL, print_tgkill, NULL }, #endif #ifdef TARGET_NR_time { TARGET_NR_time, "time" , NULL, NULL, NULL }, @@ -1534,7 +1534,7 @@ { TARGET_NR_times, "times" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_tkill -{ TARGET_NR_tkill, "tkill" , NULL, NULL, NULL }, +{ TARGET_NR_tkill, "tkill" , NULL, print_tkill, NULL }, #endif #ifdef TARGET_NR_truncate { TARGET_NR_truncate, "truncate" , NULL, NULL, NULL }, From patchwork Wed May 31 13:08:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100752 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp294187obc; Wed, 31 May 2017 06:11:42 -0700 (PDT) X-Received: by 10.55.111.198 with SMTP id k189mr27662596qkc.160.1496236302004; Wed, 31 May 2017 06:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236301; cv=none; d=google.com; s=arc-20160816; b=gTUUBdO+K6Y2oPcTa0QKA187HIBFtDWwbeBvz8HdyPVgSNx6rPmfH18AiVBlRp0d6u DlWqApX357gEesBR450+hmlsawY1KKzT4qaNonhvMqztaQ3hKg9q/uNWPtspmMJ1SNwi xg13BJTldNaO2B3j+rp+KAynQCr4R2I/RbcXyLjmN6wPhl8xB4XFzW0TNpHfCt8VjvQi mn69YnCslSv8OedFyXo9+LJOFPFl0PeMt1S+SSjVzT3KfR9H0/y2S9iW96/pLW/CRcZ2 4RteT0smV09BIAKM7XIvdMqyGEN8dwQAm7PbtEtmVZc1jG9E/HrM12iNsqIl461DnPcy acDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=VG4eZNogBzxWH3wtW9iYiZOiLLqqSsAUGrFh7oRbYWY=; b=Bi6tqhHFp89EjFnDB6YC4GcnztbNbiJkb/lbGjQSjje+9vOhzlPq27UH6ATY8s/NGO k5z4jTeOm7qAzqNSvpD8SJOiVs6Qa/2GzGfchDWFAjjCUKFt5qdrEAt/j6CbdxNuKdel aqOS8HaDnFF0sOqJsj3Mu/zjT9hQFBGiTMAw+UxT/FHmSIM16l7gw7iMYCRYJG0Y15md 1vj7Tj/wNhMeEzicBpXuYbATtyc/2Us9Qks2LH7rzKLFVXMo+G9o+0iD5dfm9MXnILtQ UKBY/seE22PTHTlY7oMonwhpDUy4CKLK4ZzX3R9JoLPTjkylHdWRkymndO20Hl1N9PSU e7og== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g4si15947225qkc.101.2017.05.31.06.11.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:11:41 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3PX-0001KZ-E1 for patch@linaro.org; Wed, 31 May 2017 09:11:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mk-0007Zy-S0 for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Mj-0003ex-PS for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:46 -0400 Received: from mail-lf0-x230.google.com ([2a00:1450:4010:c07::230]:34477) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mj-0003ee-IZ for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:45 -0400 Received: by mail-lf0-x230.google.com with SMTP id 99so8621455lfu.1 for ; Wed, 31 May 2017 06:08:45 -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 :mime-version:content-transfer-encoding; bh=VG4eZNogBzxWH3wtW9iYiZOiLLqqSsAUGrFh7oRbYWY=; b=HIZSg1YGdt5FguNo102SDpzJezuVdKbUFbLxaAjvLZBn9MGFhTxb4WWtZY5axM7wDb 97CUL21/knpKT8+MNnmgjN4bercHzSURIOvuN8clllherOiraeTututW8mtGp2etDxF4 rAUvXJMInV6RznuhGeKdy9DBltqNnE/rrntHw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VG4eZNogBzxWH3wtW9iYiZOiLLqqSsAUGrFh7oRbYWY=; b=muWtUTjI6gaxdefIbou9nm1cJn3JwGkfoAgmut0mg5296vF1NovDIO1OJ0UARel0e4 Iz/DMhW9lakkubxoH44k1O/EVmxNe9Nd+/EZ+y/IPI7RhMew6RS8ffVoOF0KvpHrr2Kz hU9Eqy6tKY6ZkWNC6aWnpN55+vG2Dea8Ovvjzkm4wIeylbXsZLIevRwJZLFMaSSf7XvE /npczWJCWrlvBwAgwe/00jqcdfYInoW7FWGSELCv457szfZVjp1EDJGFq0Dhen/1hnJc x/SP7V6OZbD31FEkdkUCE5bXgxfI4JPeLH1HmAUbrJZO9JT3ZvMezIYQZhOqMEAs+lTY pYmA== X-Gm-Message-State: AODbwcBu+bwRTk++1zNOhx0bkayNTMoozcRYXN0Hz84MZrhJuoh1iG2X G22C08G7ILl9sbetpDUz8A== X-Received: by 10.25.79.3 with SMTP id d3mr7431103lfb.179.1496236124130; Wed, 31 May 2017 06:08:44 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:43 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:21 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::230 Subject: [Qemu-devel] [PULL 09/15] linux-user: fix ssetmask() system call 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@linaro.org, =?utf-8?b?TWlsb8WhIFN0b2phbm92acSH?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Miloš Stojanović Fix the ssetmask() system call by removing the invocation of sigorset(). The ssetmask() system call should replace the old signal mask with the new and return the old mask. It shouldn't combine the old and the new mask with sigorset(). Fetching the old mask for sigorset() is also no longer needed. The problem was detected after running LTP test group syscalls for the MIPS EL 32 R2 architecture where the test ssetmask01 failed with exit code 1. The test passes now that the ssetmask() system call is fixed. Signed-off-by: Miloš Stojanović Signed-off-by: Riku Voipio --- linux-user/syscall.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 909dde6de6..93bc6f679e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8621,17 +8621,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_ssetmask /* not on alpha */ case TARGET_NR_ssetmask: { - sigset_t set, oset, cur_set; + sigset_t set, oset; abi_ulong target_set = arg1; - /* We only have one word of the new mask so we must read - * the rest of it with do_sigprocmask() and OR in this word. - * We are guaranteed that a do_sigprocmask() that only queries - * the signal mask will not fail. - */ - ret = do_sigprocmask(0, NULL, &cur_set); - assert(!ret); target_to_host_old_sigset(&set, &target_set); - sigorset(&set, &set, &cur_set); ret = do_sigprocmask(SIG_SETMASK, &set, &oset); if (!ret) { host_to_target_old_sigset(&target_set, &oset); From patchwork Wed May 31 13:08:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100759 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp319518qge; Wed, 31 May 2017 06:18:49 -0700 (PDT) X-Received: by 10.200.52.221 with SMTP id x29mr31057799qtb.70.1496236729710; Wed, 31 May 2017 06:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236729; cv=none; d=google.com; s=arc-20160816; b=M4X4E2BJvFdWa5AwYFzX+fLTHxBQzioME8Ts1STbUQxk36Ok9IZ1MFhPuXZY2NZqo/ l1pzbC50yROvkBrqscqUpYz9xQsrQtUK1U3vus0Zg2HyxTOZuPzpGIu+qLTbbfFB0Zl2 AhOo/iHvIktDk3AFC/QsucLKi8C64T2R7y2myMUF8cJYKgi1Hbc+TlsKWnHLyJIA+SI/ CyQeInwZR5CHDFoQ4VBh9YkTgZ9fO28wd1Bt+8yNFK8l5JnIgyWidZ8LkBllsN3UhYfm 9OUdbvw4qOUxn0DPRhNy0HllDJ/iKnp1ILfHgEUjNAJ98Rab5+GUk4U2Tqyd5gX5HphR /u/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=rOuXDWCx+5vDcu18Z1MPJTkXc/yxAU1r8hRUrKjGmRI=; b=PGVC2m5fsUEbEEQJyv+9M2hqv69WBy1jweAbGGFLyDe3EsYveEBkZ8JEIohfsobtGG y5FeifSkrNozoNWkm/v3IoAq4QaXmfmvI7iEkk8ugp/3aMbCHoM86xGUJWUeQtWrLA78 mBI804cTby/qCipLMipxdz/ki173yAOvguRSzb4gNLxPhnHLAYaTdVYWULe3ngtqLJgG lnzq8cRyFieXrkhIEcEwxGc3J14pN14SLwRJDQZ27McZtjVVF+fFMj/ZNGFOJX7l9inI UJVRzN5zlr5yYd+MrYbuqHdmryilXYKFq4TvGabZkT49PEjKN1qPziwrNfd1oR5qkWgg XVnw== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p52si15983913qtb.90.2017.05.31.06.18.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:18:49 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59371 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3WR-0007wX-A3 for patch@linaro.org; Wed, 31 May 2017 09:18:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mm-0007bA-53 for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Ml-0003fD-4E for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:48 -0400 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]:33188) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mk-0003f1-TS for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:47 -0400 Received: by mail-lf0-x231.google.com with SMTP id m18so8647387lfj.0 for ; Wed, 31 May 2017 06:08:46 -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 :mime-version:content-transfer-encoding; bh=rOuXDWCx+5vDcu18Z1MPJTkXc/yxAU1r8hRUrKjGmRI=; b=BF1Gl4YYTgL/el3aT6FFb+x/i92xAS52iqBNdxUwAfhXWO3HQHQzVtTCKuc1rof01M 6tsx2M2V/IEgd+q8YBQkKaGIjGdadua/JgPHQUWZLmHwTi80iQu3569FLct8NXwegRUI DUhX6nUav/mPpTsYkDJxZn4iZTodf8zLjUZCQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rOuXDWCx+5vDcu18Z1MPJTkXc/yxAU1r8hRUrKjGmRI=; b=XuF43CE2rd1Wn2EwI+ie7ozwhdFVEuv8xehFFWJW5Wn/E/Mkz3ZvuLR7WwP/0X9uXC /yGcMw5QIDmQrfzDfsiDIHGdiwdYZEzhu1XBMmAED3dAtxUavICKngjXpHhabq0+xmiK 3SEoGuqzfKIe+pMl31fej1HNtxptLx12cuTQArycEX/B83jabxCWi3e+d1Dd7yIQvJ/X 8vh0skesfk3rfHXo7V5iNBcgo9bQVcCWCUwPzHYPacsGbMADPwByhLYrmRvv/CBdrSwF /rYhJQ9BkT2MsZGbj9fRzDzmn64eSulnidWB4grv8GOXEpKHVItTQTySYqp8EvsY+F+i 0QcQ== X-Gm-Message-State: AODbwcAnNv4a2tfz/xYsRkP7h5X5Z9/2KAgt3eVIKUYO+t5mkPc4fwSN n6daaCHOzne1VFwOs80P2g== X-Received: by 10.25.29.7 with SMTP id d7mr7430372lfd.51.1496236125625; Wed, 31 May 2017 06:08:45 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:44 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:22 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::231 Subject: [Qemu-devel] [PULL 10/15] linux-user: fix mismatch of lock/unlock_user() invocations in rt_sigqueinfo() syscall 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@linaro.org, =?utf-8?b?TWlsb8WhIFN0b2phbm92acSH?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Miloš Stojanović Change the unlock_user() argument from arg1 to arg3 to match with lock_user(), since arg3 contains the pointer to the siginfo_t structure. Signed-off-by: Miloš Stojanović Signed-off-by: Riku Voipio --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 93bc6f679e..de85bce167 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8868,7 +8868,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, goto efault; } target_to_host_siginfo(&uinfo, p); - unlock_user(p, arg1, 0); + unlock_user(p, arg3, 0); ret = get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo)); } break; From patchwork Wed May 31 13:08:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100756 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp296032obc; Wed, 31 May 2017 06:15:37 -0700 (PDT) X-Received: by 10.200.9.76 with SMTP id z12mr32830323qth.102.1496236537590; Wed, 31 May 2017 06:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236537; cv=none; d=google.com; s=arc-20160816; b=DgcfW0NbhTQzLGOY9sos4uDfCaLpbCbMGce1g5OuLXk0WbohRKauHx8I/tnsxfaqJz GOOyNi/YFlZLBnH4nWucnNY2fsNoaDYlkgNj5ly66j+N8UJkBFjBtjGZkjZBFTJeYYYG 7zFaEwGoF4qY65Y9jc5OPzlqF/gxWIk24uTpBfMMHwqnfHDrINSgKWX/QwU40gmQmwl3 BLQxUHMWnZZ4iJC7FIMMxUP64amtUN+2BUFHy6S+CscEmP6Limi8uzPGgRpW6TDtswk0 wI//mX/ogDNdScMniaX+7d+BJioe5jMi/IVd/e69vD2zBlkBq4UmV5/O0FwkzZW/+Lk1 VNZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=9slioLAU/+0AtMvYOjHXplF2CioW0NghDJSR891na7s=; b=L2YoXSpYULGhISzAagtKTi+akT1sNsmU7Jb09y84C+lc+D32LBOlldYUfS19OWcjW0 xCayb96fXq1K17J1DoutEzgqhnHAAtSPDXpZSo/6h1B27pifBo1P7JbgePTGVhsGRrh0 LAYxUlys36I276Bu+Qi/MJN8b0CPV4GXhUUfQZvbIPCd9/roCHiu9GV6hCfQTfmcXgnx fdFa2UWe9fm6gRYMugWeq0cldFrwQTJLRq4TKT3gjERS6+Nm865ojaJ6HrWAouQ/H90a fq2OYcGUZydZPh4O9TK1riOMy3N7NDx66QldFwN6sx9Fjv6RK5sPVieinwdOWrZ5wkyU yxdA== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 13si15860072qkm.226.2017.05.31.06.15.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:15:37 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3TK-0004no-Rd for patch@linaro.org; Wed, 31 May 2017 09:15:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mo-0007dX-FY for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Mm-0003fV-KO for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:50 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:33196) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mm-0003fH-CC for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:48 -0400 Received: by mail-lf0-x234.google.com with SMTP id m18so8647865lfj.0 for ; Wed, 31 May 2017 06:08:48 -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 :mime-version:content-transfer-encoding; bh=9slioLAU/+0AtMvYOjHXplF2CioW0NghDJSR891na7s=; b=h/EguJk+jumuQw0nNZpbYLgPQJ8k1fUtjW1npAFHdpi6pNaz1OTBAFDQm/+Liqh12/ pMN9fvVPr1gOL9LcRcPzUA5KU7AuyDcQtLuzsGYQGRllNG2Wg5Gt07EtP5xpc6uszPlW GEjKYGArDuHa2lTcvtNN9hWANeqJcP/KIY8y8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9slioLAU/+0AtMvYOjHXplF2CioW0NghDJSR891na7s=; b=fryLfoXtCH0MbdMYTdZIou7jXFxP+3IP5vyO231qjALU2/457/VxhxkiA4qSzMGost 0wYJj2U/PQapXOP2yyYeWdFylOsmjELzryrZWs6eA3z8fSKxae1SvK3+3KQh6INkTa0v kLmXjzyiXOBUZZpkXuEbJ4Q/4ylO6E5h9py8+eJ1XstkWlRmco42Eiltar0sd2h+ks3q Whi5704Of7i942W+ZvXz5dj/8fgpJ+5FX7nzyQJaVE05zwqCdK86yeTaAjoRIBJ7f+0N yRygUSYZeR69M4lCS4wWdejsD5WzYSNafRPMZy4bL3RjjVFnpdE1h1nWFc+ar6nUamk9 /qXQ== X-Gm-Message-State: AODbwcBjHAw+AdDdwDSKrblGYj7VxRXXjTmzkreBo3Z3OE3Wb6MUIMIK GZoOQFoikT2v4/ayu2wx5Q== X-Received: by 10.25.74.196 with SMTP id x187mr7813253lfa.164.1496236126943; Wed, 31 May 2017 06:08:46 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:46 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:23 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::234 Subject: [Qemu-devel] [PULL 11/15] linux-user: fix argument type declaration of rt_sigqueinfo() syscall 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@linaro.org, =?utf-8?b?TWlsb8WhIFN0b2phbm92acSH?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Miloš Stojanović Change the type of the first argument of rt_sigqueinfo() from int to pid_t in the syscall declaration to match specifications of the system call. Proper spacing is added to satisfy checkpatch.pl. Signed-off-by: Miloš Stojanović Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Riku Voipio --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index de85bce167..3373853bb9 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -274,7 +274,7 @@ _syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, co _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res, uint, wh); #endif -_syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo) +_syscall3(int, sys_rt_sigqueueinfo, pid_t, pid, int, sig, siginfo_t *, uinfo) _syscall3(int,sys_syslog,int,type,char*,bufp,int,len) #ifdef __NR_exit_group _syscall1(int,exit_group,int,error_code) From patchwork Wed May 31 13:08:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100751 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp294125obc; Wed, 31 May 2017 06:11:33 -0700 (PDT) X-Received: by 10.55.44.199 with SMTP id s190mr29486295qkh.211.1496236293036; Wed, 31 May 2017 06:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236293; cv=none; d=google.com; s=arc-20160816; b=bDjRQtqNrdLwuL3TAg9OG0GBERW9Si7r2dAl4u9PeDB79Lnh2RIzB4qgKj9Ra1PUoW d7Hdu3nMXp8T+o81fZJy1tOjrWJvTv35AzGhZ0BRM+GQYx2QJPAoJ6QxsxFp89Ft3+xr 7ZHhNCqfWPmV0X1VUjJW/NClVI90ZLv69ZFLqiBiDqXy/DwKQ3i9EfN0VwjQOTr8I60l xOtt0x5W66VAXUeVCZrlQaqzzUd9wtshI3Kx+hPbrekaC3GLlt5DdKbYFLbI+YjjJekO 84xOB+V9x4I1fJWhD/qTsmsCka51ylWZfpWR2EiiwMROB3OJUKwQ+0CdfK0JdTwhk6+/ VJkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Un363IfAX6y9hiVbXegmwIPScrZmfJR7QE/OxkIGBIg=; b=Z8lSDE+ZnEGk2puqF34+KjAQ7L7oJTjvdhFe/7yLWn/6Ls3Ws8oiRin57gzwBRY2Y3 FQAgKJR3eFSQAc1SCJTuxw5pEA3nbZ7moWdT6gC7idjX1mzsEWt4wF+uViZAo8VTgI5J naXeksLk8V2mFEVcvuJJkadN2y467iAKbDOegmieQH45nvKV1qevW07/j/eBwpfcxWcP sT96sRbNu0jSf2Oq3Cr4m/1sSyf2y6ErZIfowF/khqJ8PGAdgfGML5sK0iTqD/BY3hjw qrwd0BZsSs5gCABBBufrNMKLRVunBtg41l3jAzi22zujLai/busYejDGlV7peQhTNjid CCVg== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k15si16100559qta.66.2017.05.31.06.11.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:11:33 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3PO-0001CK-CD for patch@linaro.org; Wed, 31 May 2017 09:11:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mp-0007eU-4Z for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Mo-0003fj-20 for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:51 -0400 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:36000) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mn-0003fb-Qp for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:49 -0400 Received: by mail-lf0-x22e.google.com with SMTP id h4so8619342lfj.3 for ; Wed, 31 May 2017 06:08:49 -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 :mime-version:content-transfer-encoding; bh=Un363IfAX6y9hiVbXegmwIPScrZmfJR7QE/OxkIGBIg=; b=fPTf0BSViFqtliHCibpEJLgx27ZLwl8OrNZVvu19NtRwXYWwxbh0lSMn+c93O1XjqK yYzzddL4HWJkmYJewswaLFp0s1QETTy9y9w5jbzL21GqDsVcMAciGnA5suGq5ok5Ooe4 /OdvIszr7qTo0uE4lGyPb7KIyve+XRF2dzJqU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Un363IfAX6y9hiVbXegmwIPScrZmfJR7QE/OxkIGBIg=; b=Pt3rKbzxTT+SK2Z1hxJalSZGvKr6BuJL/1ubi18KeJz/XdypuOzf/IZjQObVxCy9H4 3Z/P+IzvfcWAQk4bb3nE3gYaBbEm7FvaT+7P3bEkSbrkZoog7BMXIoATAcRsaWg51p6r vng2xf3Ec5G7odVOC/rnkzkMg/k512alsHISLqW8P2LaDY4iokcXAynv627+TqRJ5/5A YyXVpgV4o382YhccRE0Vz6E7hbeJo+XgXBSHuIEiHspdUg8dI9jWFC+uwDeVcQtK02zI +z990gQSTS1c1YAVON6rq0W2mkzBaomQ6M1ghb4H90tNVRh3K42XC4TTGU48pNw2dRiP ir2A== X-Gm-Message-State: AODbwcBEqzT50Sbern5QlNMJjrbp67l+nyo2IK2Z75SJhfXnee98sX+b PlxWpk9Vkj4S/TT1UIKW8A== X-Received: by 10.25.196.207 with SMTP id u198mr7600383lff.20.1496236128299; Wed, 31 May 2017 06:08:48 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:47 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:24 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22e Subject: [Qemu-devel] [PULL 12/15] linux-user: add support for rt_tgsigqueueinfo() system call 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@linaro.org, =?utf-8?b?TWlsb8WhIFN0b2phbm92acSH?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Miloš Stojanović Add a new system call: rt_tgsigqueueinfo(). This system call is similar to rt_sigqueueinfo(), but instead of sending the signal and data to the whole thread group with the ID equal to the argument tgid, it sends it to a single thread within that thread group. The ID of the thread is specified by the tid argument. The implementation is based on the rt_sigqueueinfo() in linux-user mode, where the tid is added as the second argument and the previous second and third argument become arguments three and four, respectively. Signed-off-by: Miloš Stojanović Conflicts: linux-user/syscall.c Signed-off-by: Riku Voipio --- linux-user/syscall.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.11.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3373853bb9..925ae11ea6 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -238,6 +238,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \ #define __NR_sys_getdents64 __NR_getdents64 #define __NR_sys_getpriority __NR_getpriority #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo +#define __NR_sys_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo #define __NR_sys_syslog __NR_syslog #define __NR_sys_futex __NR_futex #define __NR_sys_inotify_init __NR_inotify_init @@ -275,6 +276,8 @@ _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res, uint, wh); #endif _syscall3(int, sys_rt_sigqueueinfo, pid_t, pid, int, sig, siginfo_t *, uinfo) +_syscall4(int, sys_rt_tgsigqueueinfo, pid_t, pid, pid_t, tid, int, sig, + siginfo_t *, uinfo) _syscall3(int,sys_syslog,int,type,char*,bufp,int,len) #ifdef __NR_exit_group _syscall1(int,exit_group,int,error_code) @@ -8872,6 +8875,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ret = get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo)); } break; + case TARGET_NR_rt_tgsigqueueinfo: + { + siginfo_t uinfo; + + p = lock_user(VERIFY_READ, arg4, sizeof(target_siginfo_t), 1); + if (!p) { + goto efault; + } + target_to_host_siginfo(&uinfo, p); + unlock_user(p, arg4, 0); + ret = get_errno(sys_rt_tgsigqueueinfo(arg1, arg2, arg3, &uinfo)); + } + break; #ifdef TARGET_NR_sigreturn case TARGET_NR_sigreturn: if (block_signals()) { From patchwork Wed May 31 13:08:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100758 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp296365obc; Wed, 31 May 2017 06:16:25 -0700 (PDT) X-Received: by 10.55.118.197 with SMTP id r188mr28158637qkc.234.1496236585673; Wed, 31 May 2017 06:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236585; cv=none; d=google.com; s=arc-20160816; b=A+A3MW+N4+6uBrrCxRacu57qzmhvpP3QbmUkOZO0ASMBzlwHc/lmPZzF9j/24D2P0Y UyB44QoCEck9vHisyfy4YSlvV75TBW9U4oHZPgHr1AaNcL8Fn0+WReTatxcLvSXWOxD/ LxsMLcaDusx2W5NB4HT4dAI+X0PsSqE91J/DLbD+pRfrvVC2PhSybIGi0Qv9rJn9dDTD 8lmeh8PLDRy2vjlPt6/1YGjXSUuvp2lnoVzkZmKuOQBod3eQ0XrQ70y4LpH5Nw8bLOZy vVascYPSIHfr+N6Nn9eIZHg0com0G8LtGhCaJkQOc5+N7jaYEl1NcX+ptgBIyDjPh/nH vwCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=n5HQ3fgf3e/teeHOtsIJQPnKTQjRzhVSrTS2x3ysZ5k=; b=YiOwOdbs7RF6dH4b3MuUPijwi3ndVlZ5yA/4TNQtwdXd/sSNZ+JpQT8TCXCiaEmgx/ 0HkA3z9kB6KOw2Zg5e6UVOZgYwuQJdCXjaAK0ppf9zM2U9dQjl7MzE62M8WNw1H28ieL qsYcZTLEqfl6/z0ZLp8MhCok5tOEyKQUzZ+jPRMPt63SZtk+zyfvNiDXlFng7VGEnWuf DXXmmrhniU4NVti7itqyIVrxkzJ4US8yrbEENe0JocMzLkDshG08ZIqwnMRB6OBEJqcO HrcxG4x75NXDaQismlX72HBM+n+SYrIrIMvj007OBFfFyRbSMTtwHN9gpShoBLVURV8S N24w== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f22si16227256qtc.132.2017.05.31.06.16.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:16:25 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3U6-0005jv-Sc for patch@linaro.org; Wed, 31 May 2017 09:16:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mr-0007gq-RQ for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Mp-0003g4-AC for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:53 -0400 Received: from mail-lf0-x229.google.com ([2a00:1450:4010:c07::229]:34512) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mp-0003fp-3Y for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:51 -0400 Received: by mail-lf0-x229.google.com with SMTP id 99so8623444lfu.1 for ; Wed, 31 May 2017 06:08:51 -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 :mime-version:content-transfer-encoding; bh=n5HQ3fgf3e/teeHOtsIJQPnKTQjRzhVSrTS2x3ysZ5k=; b=h14XFXsTxOxXGBVx9h8YfD8jKvDMtzaUWVnb4DorkZOAhW2HL+HWf9ayBRkhTeBPEZ CG0KXAyJ/HWMk2mSiH5VTpXtEQrbjeippgdlsGVWklIesBCTsN24NoZIYlmOtgMVoQlM gDt4vxKSgDjcILiNXvE9EUzzZ3Cffc7XLBLWY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n5HQ3fgf3e/teeHOtsIJQPnKTQjRzhVSrTS2x3ysZ5k=; b=LdiR4UMv1BXD2FsRNo0AhPv7MsFAD/BLy939IcZff1su2p5j9boPeHBt+zzlQxEwTc Vx4VakSgEIiNzJvZZe9DL81rT2zWE4Th4/iCNpRYHJAvyjtXuNvyEPfp9bFDHuAEdUbl S5aEriRCGty+nD5B8zzZkklj2zEsC1gGdBEzXGAk3WRuJLA+SM8FDhKxRQ4javVcMeLy vIEU1hU7+V8aXUkbpJ0u9KsbuKBm6yETtcnfMeL367O33GL3mxV27AdAOsaQ1KmHpmgm uGEAEy2xHbKQJgFTD96CHMiw8FRNXVDBEJ5MScTLtmwQlhJpi1F5+Fhb9RRngACgD1jm yHqA== X-Gm-Message-State: AODbwcD2bl4+Nh1TIHC8d4R7q+doXCDt0HrGGBMNARRrxYm9I53u9/Pd GHxX0AXsra1XqW74YaKx1A== X-Received: by 10.46.69.130 with SMTP id s124mr7875276lja.44.1496236129785; Wed, 31 May 2017 06:08:49 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:48 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:25 +0300 Message-Id: <243e0fe5506d6b830e01d8da727ff7f20fa38502.1496234767.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::229 Subject: [Qemu-devel] [PULL 13/15] linux-user: add rt_tgsigqueueinfo() strace 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@linaro.org, =?utf-8?b?TWlsb8WhIFN0b2phbm92acSH?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Miloš Stojanović This commit improves strace support for syscall rt_tgsigqueueinfo(). Prior to this commit, typical strace output used to look like this: 7775 rt_tgsigqueueinfo(7775,7775,50,1996483164,0,0) = 0 After this commit, it looks like this: 7775 rt_tgsigqueueinfo(7775,7775,50,0x76ffea5c) = 0 Signed-off-by: Miloš Stojanović Signed-off-by: Riku Voipio --- linux-user/strace.c | 15 +++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/linux-user/strace.c b/linux-user/strace.c index f6f76a5bd4..779cda1a5e 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1915,6 +1915,21 @@ print_rt_sigqueueinfo(const struct syscallname *name, } #endif +#ifdef TARGET_NR_rt_tgsigqueueinfo +static void +print_rt_tgsigqueueinfo(const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_raw_param("%d", arg0, 0); + print_raw_param("%d", arg1, 0); + print_signal(arg2, 0); + print_pointer(arg3, 1); + print_syscall_epilogue(name); +} +#endif + #ifdef TARGET_NR_syslog static void print_syslog_action(abi_ulong arg, int last) diff --git a/linux-user/strace.list b/linux-user/strace.list index 373d43689a..a91e33f7e5 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1167,7 +1167,7 @@ { TARGET_NR_rt_sigtimedwait, "rt_sigtimedwait" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_rt_tgsigqueueinfo -{ TARGET_NR_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" , NULL, NULL, NULL }, +{ TARGET_NR_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" , NULL, print_rt_tgsigqueueinfo, NULL }, #endif #ifdef TARGET_NR_sched_getaffinity { TARGET_NR_sched_getaffinity, "sched_getaffinity" , NULL, NULL, NULL }, From patchwork Wed May 31 13:08:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100755 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp295958obc; Wed, 31 May 2017 06:15:29 -0700 (PDT) X-Received: by 10.55.198.20 with SMTP id b20mr26843561qkj.224.1496236528949; Wed, 31 May 2017 06:15:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236528; cv=none; d=google.com; s=arc-20160816; b=zaHECiHVLrcr5flX3kuwFuVUxPhJbWUzGQeaQ8NNp/v4ITPORnt2YhAVGd4wxfA+I+ FkTR22xnf4QdMsz+aJ4cc5Oi+oWypgeN6njQYr1b92x3KY+sPBru/x4HiyYaG/YxVS8r WHQ/ZB7AGj2jPzRXvKvb5759K7WN03A30QK7fXBYGKue2rXbdrHPiyjJgFBLaHRc8NwO YpK25aUKerQZNgSD1BKAYRK5llE6xdskR6OR6rw8VOIqJOeqOu4hL6Bl6gwsJt0KJMh3 V8SnoRYFn0ue54bayv1CO0djQ1nHJ34XtcKjABQFvFHnGgKETonD1h+ivYKjlAoM0G0X iSbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:references:in-reply-to:mime-version :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=PjOZls7NZMolpNsQ7O8k0by2eAKY9zLTC3EFc4tNE58=; b=ByPBaPgLPwFelx08Ix3teFy1hwmqwdeeVX+ZnMk//4zZaBpBo6Fsaqng2G/qr3RI9D AF21E63bMyaU2qqnB1L0n9/4guFsW4F3KvRVAcQbHI7beZlRuKqveK8XeyV92ttsL2Za hivz2vFSlUwagkjJpC6OE9MJosuQTS4xPVeaDrphoqbmAYopLHjk4hygsJCfHSB4Uz9f GAxhUpT6msmcJ7bNOJZ/+cfv00LPNajUxzZ1NbJse2HrNvon1CXEB5ey/D+6OMfQimUn j+Eam6rReK84Ddioa/5+ui1kTyO+ibMsvz8eZHVonvkBNkh/CMC4fZPxY2SETkvmBRrP Itsw== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t18si15686337qta.84.2017.05.31.06.15.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:15:28 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3TC-0004gk-7r for patch@linaro.org; Wed, 31 May 2017 09:15:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mr-0007gw-SR for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Mq-0003gF-UR for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:53 -0400 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:34521) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Mq-0003g8-NI for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:52 -0400 Received: by mail-lf0-x22b.google.com with SMTP id 99so8623986lfu.1 for ; Wed, 31 May 2017 06:08:52 -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:mime-version:in-reply-to :references:content-transfer-encoding; bh=PjOZls7NZMolpNsQ7O8k0by2eAKY9zLTC3EFc4tNE58=; b=MdQbqeJBVAaLVRzxke25jzOF0b5VC63j09S5z2Fg1+hAHcN6CzVKezdluVaiSg2j+Z 1RTJhViNJlH3mS66t6UFfWWdcpH8h9lWh/RRcgJUzai4Q4Rgh2JqeW6dHGlZfDvS/w1d 4y3fc9OmX7hBFUOZbwj54PQZrMaQWvxpisJ+I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :in-reply-to:references:content-transfer-encoding; bh=PjOZls7NZMolpNsQ7O8k0by2eAKY9zLTC3EFc4tNE58=; b=M+5huGv25y17FEoNBc9CVsY394BcFP1ec3NpDqym7h1Iy775X3iFd8FxhuZBWvxr+J JuwSH3DbehW4um7inqdcUX0YYLi6T7x2eTCJlyTox9iQugXAqOY6oQi9hgeryUUwZvAU ELGrUg2EoFNUGP5B93pibjb5BEbzR6tKUQ7l9SuPcs5Xr42gt8C+CTwCwDuYQpPRCeoT egsRDmrSGUFhNQZSkrY89n5QqKnrJCPipfVcbtaRy5rk8KmO0t75b/ppilUePlUWj0bQ R54eiJsKwDqfLl4QtmBvOFb2iJUGNtnA8414R6JXeBpyKYMpTc1QpRCPNTsrvH6v4mD3 sQmg== X-Gm-Message-State: AODbwcDS2vOI+tNZiDd55Y70pnq8fBgH+qQCzPKplKEtME81eEIgEyZk eyZfaZ2PJVs1yKL0kJwliw== X-Received: by 10.46.83.24 with SMTP id h24mr7947167ljb.84.1496236131151; Wed, 31 May 2017 06:08:51 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:50 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:26 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22b Subject: [Qemu-devel] [PULL 14/15] linux-user: fix inconsistent spaces in print_siginfo() output 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@linaro.org, =?utf-8?b?TWlsb8WhIFN0b2phbm92acSH?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Miloš Stojanović This patch improves the consistentcy of the output from print_siginfo() by removing spaces around the equal sign of si_pid, si_uid, si_timer1, si_timer2, si_band, si_fd, si_addr, si_status and si_sigval. This way they match si_signo and ci_code. Host strace was used as a reference for this chage. Prior to this commit, typical strace output used to look like this: Signed-off-by: Riku Voipio --- linux-user/strace.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.11.0 diff --git a/linux-user/strace.c b/linux-user/strace.c index 779cda1a5e..5fbe067fd5 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -206,26 +206,26 @@ static void print_siginfo(const target_siginfo_t *tinfo) switch (si_type) { case QEMU_SI_KILL: - gemu_log(", si_pid = %u, si_uid = %u", + gemu_log(", si_pid=%u, si_uid=%u", (unsigned int)tinfo->_sifields._kill._pid, (unsigned int)tinfo->_sifields._kill._uid); break; case QEMU_SI_TIMER: - gemu_log(", si_timer1 = %u, si_timer2 = %u", + gemu_log(", si_timer1=%u, si_timer2=%u", tinfo->_sifields._timer._timer1, tinfo->_sifields._timer._timer2); break; case QEMU_SI_POLL: - gemu_log(", si_band = %d, si_fd = %d", + gemu_log(", si_band=%d, si_fd=%d", tinfo->_sifields._sigpoll._band, tinfo->_sifields._sigpoll._fd); break; case QEMU_SI_FAULT: - gemu_log(", si_addr = "); + gemu_log(", si_addr="); print_pointer(tinfo->_sifields._sigfault._addr, 1); break; case QEMU_SI_CHLD: - gemu_log(", si_pid = %u, si_uid = %u, si_status = %d" + gemu_log(", si_pid=%u, si_uid=%u, si_status=%d" ", si_utime=" TARGET_ABI_FMT_ld ", si_stime=" TARGET_ABI_FMT_ld, (unsigned int)(tinfo->_sifields._sigchld._pid), @@ -235,7 +235,7 @@ static void print_siginfo(const target_siginfo_t *tinfo) tinfo->_sifields._sigchld._stime); break; case QEMU_SI_RT: - gemu_log(", si_pid = %u, si_uid = %u, si_sigval = " TARGET_ABI_FMT_ld, + gemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld, (unsigned int)tinfo->_sifields._rt._pid, (unsigned int)tinfo->_sifields._rt._uid, tinfo->_sifields._rt._sigval.sival_ptr); From patchwork Wed May 31 13:08:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 100760 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp320538qge; Wed, 31 May 2017 06:21:10 -0700 (PDT) X-Received: by 10.200.43.33 with SMTP id 30mr30918839qtu.210.1496236870021; Wed, 31 May 2017 06:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496236870; cv=none; d=google.com; s=arc-20160816; b=lkbfDHl58eO2hJzxhV1b3kNRMd1txrEne+soRfsXwDy+qtXYt+s5xKzy9LuoVWUCbx vO2qGnKEqt8i2UUsaYWhYcfw9vKJHJ++Gr7E+V3bsDh8DgnTCfIXcOlaSAvT+CcjykF9 hQU8OQkWOevSUtMIES9RA7GaQhVZVbR//8sbbNFbRNhkGJPyxeIzidngtjHZqWAtG12q zgBmV5zylJUhNZwICXgoYMpyggIro7h2WVYMqWr+dYo816j0F+RmoLi8XBgRN3DaO61T LDlYTfXQQtwTdbNDp3EbKksUOEdYnTJwArMy/zLCbwxntLoxPi/fQ5elgbvDJ/L2gbgw 5xAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Qln/Y/SLcSOZ7IBdcF3riWbOhKW/MenEMZDWin1P/as=; b=QxuoNx14YWwd+TkQ0LqaR9yo4iP5D62mfOLj3zq4ops532V8ntF7UWQlnW6GmdaLZw 4piSaJSReWBnBWUvrFqlfj4Vj/kA6GskXBt7X4rNtjsMdRdFD8RHndn9UE+gO3/fN8QW IhQTtAyLRZTINnF9FxVwS0wwrmI7+8gIBavhxk2UTULEok/1G/LMaVu4FmH0juiVaRIr wiviqFBgD/ViAHVK5m1vS5Amb+FMMNIgSzB7zOfKWjXVGX9eGeCqm4SRAhFcKnWxFzWG 8BxROfYPrCcVh6pg29QHD3xu5VgzFRfiE3wHCTdR1yw+Weu9SgL04lAMqTvQkz9pS/mB SMpA== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i51si16755905qtf.0.2017.05.31.06.21.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 May 2017 06:21:10 -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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Yh-0001Ow-Iw for patch@linaro.org; Wed, 31 May 2017 09:21:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Mu-0007jO-BQ for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG3Ms-0003gk-UQ for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:56 -0400 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:33237) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG3Ms-0003gO-IE for qemu-devel@nongnu.org; Wed, 31 May 2017 09:08:54 -0400 Received: by mail-lf0-x22a.google.com with SMTP id m18so8650218lfj.0 for ; Wed, 31 May 2017 06:08:54 -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 :mime-version:content-transfer-encoding; bh=Qln/Y/SLcSOZ7IBdcF3riWbOhKW/MenEMZDWin1P/as=; b=F9iS11sZFvphtxzdKNdtk0IedELt4KYstHOH5LglT1sgt/0L6ZC0r3Ohhg9IxdoxZJ 4PmS1Df9p5vl65lmcpBHwWCMzoCtGtrmTHHHXHUf3uk6IAGKvsfEd7t5h1+3DoAozjSp 2YpyRqkFY8K3ShT+Hy6VV30k0t5p9N0nSdoPk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qln/Y/SLcSOZ7IBdcF3riWbOhKW/MenEMZDWin1P/as=; b=a2T/3qjMUpxRvXzA10fv1pPiMAICND+c8mqX8qRp5Sypuu34IBusfd94BkBu7YNR3Z jSbnLuCQtQeaFgnuwFwuE0c33mWbfZO6TQrU6bYd7XLRbPAFJMu2317+Yvv9YLRdaI3Q KIrZ+1EDLxY4aUpypWs+CeIk/+NlVgIw/rCmHrYHir/rNwUS8lNeMyqd9RA7vDPaIxhj 3C3Z//h2/qkMGb2OAN904Xr/VJ8xXluvYvoCF4VnYwcAIOuNUVg7hZj+QgvHMQGz+4lr 6AqiiWfhW6B3Bs92g6NglUHmnJPkTo5RhvbOw54y7cnKxjj6Pw916lMT+6ef8bxTJjhV V97g== X-Gm-Message-State: AODbwcCH8uS8O5YoIYyPApeYquBT1rs4ctjNgAktq1DmGtO6Dgj3V9yq X1fmSaR1KQTB4EnqDWltLw== X-Received: by 10.46.13.10 with SMTP id 10mr7917723ljn.58.1496236133085; Wed, 31 May 2017 06:08:53 -0700 (PDT) Received: from localhost.localdomain (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id o101sm3741766lfg.3.2017.05.31.06.08.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2017 06:08:51 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 31 May 2017 16:08:27 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22a Subject: [Qemu-devel] [PULL 15/15] linux-user: add strace support for uinfo structure of rt_sigqueueinfo() and rt_tgsigqueueinfo() 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@linaro.org, =?utf-8?b?TWlsb8WhIFN0b2phbm92acSH?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Miloš Stojanović This commit adds support for printing the content of the target_siginfo_t structure in a similar way to how it is printed by the host strace. The pointer to this structure is sent as the last argument of the rt_sigqueueinfo() and rt_tgsigqueueinfo() system calls. For this purpose, print_siginfo() is used and the get_target_siginfo() function is implemented in order to get the information obtained from the pointer into the form that print_siginfo() expects. The get_target_siginfo() function is based on host_to_target_siginfo_noswap() in linux-user mode, but here both arguments are pointers to target_siginfo_t, so instead of converting the information to siginfo_t it just extracts and copies it to a target_siginfo_t structure. Prior to this commit, typical strace output used to look like this: 8307 rt_sigqueueinfo(8307,50,0x00000040007ff6b0) = 0 After this commit, it looks like this: 8307 rt_sigqueueinfo(8307,50,{si_signo=50, si_code=SI_QUEUE, si_pid=8307, si_uid=1000, si_sigval=17716762128}) = 0 Signed-off-by: Miloš Stojanović Signed-off-by: Riku Voipio --- linux-user/strace.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/linux-user/strace.c b/linux-user/strace.c index 5fbe067fd5..d821d165ff 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -188,6 +188,93 @@ static void print_si_code(int arg) gemu_log("%s", codename); } +static void get_target_siginfo(target_siginfo_t *tinfo, + const target_siginfo_t *info) +{ + abi_ulong sival_ptr; + + int sig; + int si_errno; + int si_code; + int si_type; + + __get_user(sig, &info->si_signo); + __get_user(si_errno, &tinfo->si_errno); + __get_user(si_code, &info->si_code); + + tinfo->si_signo = sig; + tinfo->si_errno = si_errno; + tinfo->si_code = si_code; + + /* Ensure we don't leak random junk to the guest later */ + memset(tinfo->_sifields._pad, 0, sizeof(tinfo->_sifields._pad)); + + /* This is awkward, because we have to use a combination of + * the si_code and si_signo to figure out which of the union's + * members are valid. (Within the host kernel it is always possible + * to tell, but the kernel carefully avoids giving userspace the + * high 16 bits of si_code, so we don't have the information to + * do this the easy way...) We therefore make our best guess, + * bearing in mind that a guest can spoof most of the si_codes + * via rt_sigqueueinfo() if it likes. + * + * Once we have made our guess, we record it in the top 16 bits of + * the si_code, so that print_siginfo() later can use it. + * print_siginfo() will strip these top bits out before printing + * the si_code. + */ + + switch (si_code) { + case SI_USER: + case SI_TKILL: + case SI_KERNEL: + /* Sent via kill(), tkill() or tgkill(), or direct from the kernel. + * These are the only unspoofable si_code values. + */ + __get_user(tinfo->_sifields._kill._pid, &info->_sifields._kill._pid); + __get_user(tinfo->_sifields._kill._uid, &info->_sifields._kill._uid); + si_type = QEMU_SI_KILL; + break; + default: + /* Everything else is spoofable. Make best guess based on signal */ + switch (sig) { + case TARGET_SIGCHLD: + __get_user(tinfo->_sifields._sigchld._pid, + &info->_sifields._sigchld._pid); + __get_user(tinfo->_sifields._sigchld._uid, + &info->_sifields._sigchld._uid); + __get_user(tinfo->_sifields._sigchld._status, + &info->_sifields._sigchld._status); + __get_user(tinfo->_sifields._sigchld._utime, + &info->_sifields._sigchld._utime); + __get_user(tinfo->_sifields._sigchld._stime, + &info->_sifields._sigchld._stime); + si_type = QEMU_SI_CHLD; + break; + case TARGET_SIGIO: + __get_user(tinfo->_sifields._sigpoll._band, + &info->_sifields._sigpoll._band); + __get_user(tinfo->_sifields._sigpoll._fd, + &info->_sifields._sigpoll._fd); + si_type = QEMU_SI_POLL; + break; + default: + /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */ + __get_user(tinfo->_sifields._rt._pid, &info->_sifields._rt._pid); + __get_user(tinfo->_sifields._rt._uid, &info->_sifields._rt._uid); + /* XXX: potential problem if 64 bit */ + __get_user(sival_ptr, &info->_sifields._rt._sigval.sival_ptr); + tinfo->_sifields._rt._sigval.sival_ptr = sival_ptr; + + si_type = QEMU_SI_RT; + break; + } + break; + } + + tinfo->si_code = deposit32(si_code, 16, 16, si_type); +} + static void print_siginfo(const target_siginfo_t *tinfo) { /* Print a target_siginfo_t in the format desired for printing @@ -1907,10 +1994,21 @@ print_rt_sigqueueinfo(const struct syscallname *name, abi_long arg0, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5) { + void *p; + target_siginfo_t uinfo; + print_syscall_prologue(name); print_raw_param("%d", arg0, 0); print_signal(arg1, 0); - print_pointer(arg2, 1); + p = lock_user(VERIFY_READ, arg2, sizeof(target_siginfo_t), 1); + if (p) { + get_target_siginfo(&uinfo, p); + print_siginfo(&uinfo); + + unlock_user(p, arg2, 0); + } else { + print_pointer(arg2, 1); + } print_syscall_epilogue(name); } #endif @@ -1921,11 +2019,22 @@ print_rt_tgsigqueueinfo(const struct syscallname *name, abi_long arg0, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5) { + void *p; + target_siginfo_t uinfo; + print_syscall_prologue(name); print_raw_param("%d", arg0, 0); print_raw_param("%d", arg1, 0); print_signal(arg2, 0); - print_pointer(arg3, 1); + p = lock_user(VERIFY_READ, arg3, sizeof(target_siginfo_t), 1); + if (p) { + get_target_siginfo(&uinfo, p); + print_siginfo(&uinfo); + + unlock_user(p, arg3, 0); + } else { + print_pointer(arg3, 1); + } print_syscall_epilogue(name); } #endif