From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236223376952.4555342089294; Wed, 31 May 2017 06:10:23 -0700 (PDT) Received: from localhost ([::1]:59326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3OE-000096-Tj for importer@patchew.org; Wed, 31 May 2017 09:10:18 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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(-) 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 =3D lock_user(VERIFY_READ, arg2, arg3, 1))) goto efault; - ret =3D get_errno(safe_write(arg1, p, arg3)); + if (fd_trans_target_to_host_data(arg1)) { + void *copy =3D g_malloc(arg3); + memcpy(copy, p, arg3); + ret =3D fd_trans_target_to_host_data(arg1)(copy, arg3); + if (ret >=3D 0) { + ret =3D get_errno(safe_write(arg1, copy, ret)); + } + g_free(copy); + } else { + ret =3D get_errno(safe_write(arg1, p, arg3)); + } unlock_user(p, arg2, 0); break; #ifdef TARGET_NR_open --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236224268579.4681448184749; Wed, 31 May 2017 06:10:24 -0700 (PDT) Received: from localhost ([::1]:59324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3OE-000086-DQ for importer@patchew.org; Wed, 31 May 2017 09:10:18 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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(-) 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; } =20 +static abi_long swap_data_eventfd(void *buf, size_t len) +{ + uint64_t *counter =3D buf; + int i; + + if (len < sizeof(uint64_t)) { + return -EINVAL; + } + + for (i =3D 0; i < len; i +=3D sizeof(uint64_t)) { + *counter =3D tswap64(*counter); + counter++; + } + + return len; +} + +static TargetFdTrans target_eventfd_trans =3D { + .host_to_target_data =3D swap_data_eventfd, + .target_to_host_data =3D 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_lon= g arg1, #if defined(TARGET_NR_eventfd) case TARGET_NR_eventfd: ret =3D 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_lon= g arg1, host_flags |=3D O_CLOEXEC; } ret =3D get_errno(eventfd(arg1, host_flags)); - fd_trans_unregister(ret); + fd_trans_register(ret, &target_eventfd_trans); break; } #endif --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236375388323.0243864378958; Wed, 31 May 2017 06:12:55 -0700 (PDT) Received: from localhost ([::1]:59339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Qg-0002KO-M0 for importer@patchew.org; Wed, 31 May 2017 09:12:50 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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(+) 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_lo= ng arg1, =20 #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 =3D arg2; + arg2 =3D arg3; + arg3 =3D arg4; + arg4 =3D arg5; + arg5 =3D arg6; + arg6 =3D 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_lon= g arg1, arg5 =3D arg6; arg6 =3D arg7; } +#endif ret =3D -host_to_target_errno(posix_fadvise(arg1, target_offset64(arg2, ar= g3), target_offset64(arg4, ar= g5), --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236374230537.9983822625367; Wed, 31 May 2017 06:12:54 -0700 (PDT) Received: from localhost ([::1]:59337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Qg-0002Jh-5K for importer@patchew.org; Wed, 31 May 2017 09:12:50 -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) 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) 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) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 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=C3=A9 Signed-off-by: Riku Voipio --- linux-user/syscall.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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 =3D { .target_to_host_data =3D swap_data_eventfd, }; =20 +#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 =3D 0; i < len; i +=3D sizeof(struct inotify_event) + name_len)= { + ev =3D (struct inotify_event *)((char *)buf + i); + name_len =3D ev->len; + + ev->wd =3D tswap32(ev->wd); + ev->mask =3D tswap32(ev->mask); + ev->cookie =3D tswap32(ev->cookie); + ev->len =3D tswap32(name_len); + } + + return len; +} + +static TargetFdTrans target_inotify_trans =3D { + .host_to_target_data =3D 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_lon= g arg1, #if defined(TARGET_NR_inotify_init) && defined(__NR_inotify_init) case TARGET_NR_inotify_init: ret =3D 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_lon= g arg1, case TARGET_NR_inotify_init1: ret =3D get_errno(sys_inotify_init1(target_to_host_bitmask(arg1, fcntl_flags_tbl))); + fd_trans_register(ret, &target_inotify_trans); break; #endif #endif --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236232396878.6329095905404; Wed, 31 May 2017 06:10:32 -0700 (PDT) Received: from localhost ([::1]:59328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3OO-0000HT-VC for importer@patchew.org; Wed, 31 May 2017 09:10:29 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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(-) 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++; } =20 - argp =3D alloca((argc + 1) * sizeof(void *)); - envp =3D alloca((envc + 1) * sizeof(void *)); + argp =3D g_new0(char *, argc + 1); + envp =3D g_new0(char *, envc + 1); =20 for (gp =3D guest_argp, q =3D argp; gp; gp +=3D 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: --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236517003646.3018831109441; Wed, 31 May 2017 06:15:17 -0700 (PDT) Received: from localhost ([::1]:59348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3T0-0004ft-EH for importer@patchew.org; Wed, 31 May 2017 09:15:14 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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(-) 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) =20 static int open_self_cmdline(void *cpu_env, int fd) { - int fd_orig =3D -1; - bool word_skipped =3D false; - - fd_orig =3D open("/proc/self/cmdline", O_RDONLY); - if (fd_orig < 0) { - return fd_orig; - } + CPUState *cpu =3D ENV_GET_CPU((CPUArchState *)cpu_env); + struct linux_binprm *bprm =3D ((TaskState *)cpu->opaque)->bprm; + int i; =20 - while (true) { - ssize_t nb_read; - char buf[128]; - char *cp_buf =3D buf; + for (i =3D 0; i < bprm->argc; i++) { + size_t len =3D strlen(bprm->argv[i]) + 1; =20 - nb_read =3D read(fd_orig, buf, sizeof(buf)); - if (nb_read < 0) { - int e =3D errno; - fd_orig =3D close(fd_orig); - errno =3D e; + if (write(fd, bprm->argv[i], len) !=3D len) { return -1; - } else if (nb_read =3D=3D 0) { - break; - } - - if (!word_skipped) { - /* Skip the first string, which is the path to qemu-*-static - instead of the actual command. */ - cp_buf =3D memchr(buf, 0, nb_read); - if (cp_buf) { - /* Null byte found, skip one string */ - cp_buf++; - nb_read -=3D cp_buf - buf; - word_skipped =3D true; - } - } - - if (word_skipped) { - if (write(fd, cp_buf, nb_read) !=3D nb_read) { - int e =3D errno; - close(fd_orig); - errno =3D e; - return -1; - } } } =20 - return close(fd_orig); + return 0; } =20 static int open_self_maps(void *cpu_env, int fd) --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236516390529.971325799729; Wed, 31 May 2017 06:15:16 -0700 (PDT) Received: from localhost ([::1]:59349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3T0-0004g3-Tu for importer@patchew.org; Wed, 31 May 2017 09:15:14 -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) 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) 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) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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?q?Milo=C5=A1=20Stojanovi=C4=87?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Milo=C5=A1 Stojanovi=C4=87 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) =3D 1000 After this commit, it looks like this: 4894 getuid() =3D 1000 gettid: Prior to this commit, typical strace output used to look like this: 8307 gettid(0,0,64,0,4832630528,4832615840) =3D 8307 After this commit, it looks like this: 8307 gettid() =3D 8307 getppid: Prior to this commit, typical strace output used to look like this: 20588 getppid(20588,64,0,4832630528,4832615888,0) =3D 20625 After this commit, it looks like this: 20588 getppid() =3D 20625 geteuid: Prior to this commit, typical strace output used to look like this: 20588 geteuid(64,0,0,4832615888,0,-9151031864016699136) =3D 1000 After this commit, it looks like this: 20588 geteuid() =3D 1000 Signed-off-by: Milo=C5=A1 Stojanovi=C4=87 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Riku Voipio --- linux-user/strace.list | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 }, --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14962366697301018.453901041; Wed, 31 May 2017 06:17:49 -0700 (PDT) Received: from localhost ([::1]:59368 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3VT-000706-9I for importer@patchew.org; Wed, 31 May 2017 09:17:47 -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) 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) 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) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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?q?Milo=C5=A1=20Stojanovi=C4=87?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Milo=C5=A1 Stojanovi=C4=87 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) =3D 0 After this commit, it looks like this: 4886 tkill(4886,50) =3D 0 tgkill: Prior to this commit, typical strace output used to look like this: 4890 tgkill(4890,4890,50,8,4832630528,4832615904) =3D 0 After this commit, it looks like this: 4890 tgkill(4890,4890,50) =3D 0 rt_sigqueueinfo: Prior to this commit, typical strace output used to look like this: 8307 rt_sigqueueinfo(8307,50,1996483164,0,0,50) =3D 0 After this commit, it looks like this: 8307 rt_sigqueueinfo(8307,50,0x00000040007ff6b0) =3D 0 Signed-off-by: Milo=C5=A1 Stojanovi=C4=87 Signed-off-by: Riku Voipio --- linux-user/strace.c | 41 +++++++++++++++++++++++++++++++++++++++++ linux-user/strace.list | 6 +++--- 2 files changed, 44 insertions(+), 3 deletions(-) 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 =20 +#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 =20 +#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_sigqueuein= fo, 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 }, --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236382620863.1274690854711; Wed, 31 May 2017 06:13:02 -0700 (PDT) Received: from localhost ([::1]:59341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Qq-0002SS-0E for importer@patchew.org; Wed, 31 May 2017 09:13:00 -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) 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) 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) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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?q?Milo=C5=A1=20Stojanovi=C4=87?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Milo=C5=A1 Stojanovi=C4=87 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=C5=A1 Stojanovi=C4=87 Signed-off-by: Riku Voipio --- linux-user/syscall.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) 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 =3D 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 =3D do_sigprocmask(0, NULL, &cur_set); - assert(!ret); target_to_host_old_sigset(&set, &target_set); - sigorset(&set, &set, &cur_set); ret =3D do_sigprocmask(SIG_SETMASK, &set, &oset); if (!ret) { host_to_target_old_sigset(&target_set, &oset); --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236808634594.7716403665419; Wed, 31 May 2017 06:20:08 -0700 (PDT) Received: from localhost ([::1]:59378 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Xg-0000P4-4V for importer@patchew.org; Wed, 31 May 2017 09:20:04 -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) 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) 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) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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?q?Milo=C5=A1=20Stojanovi=C4=87?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Milo=C5=A1 Stojanovi=C4=87 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=C5=A1 Stojanovi=C4=87 Signed-off-by: Riku Voipio --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 =3D get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo)); } break; --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236527560119.63845920865447; Wed, 31 May 2017 06:15:27 -0700 (PDT) Received: from localhost ([::1]:59352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3T9-0004no-Ti for importer@patchew.org; Wed, 31 May 2017 09:15:23 -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) 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) 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) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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?q?Milo=C5=A1=20Stojanovi=C4=87?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Milo=C5=A1 Stojanovi=C4=87 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=C5=A1 Stojanovi=C4=87 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Riku Voipio --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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_d= irent64 *, 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 *, uin= fo) _syscall3(int,sys_syslog,int,type,char*,bufp,int,len) #ifdef __NR_exit_group _syscall1(int,exit_group,int,error_code) --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236376380154.34632442318275; Wed, 31 May 2017 06:12:56 -0700 (PDT) Received: from localhost ([::1]:59340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Qg-0002Kx-NR for importer@patchew.org; Wed, 31 May 2017 09:12:50 -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) 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) 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) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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?q?Milo=C5=A1=20Stojanovi=C4=87?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Milo=C5=A1 Stojanovi=C4=87 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=C5=A1 Stojanovi=C4=87 Conflicts: linux-user/syscall.c Signed-off-by: Riku Voipio --- linux-user/syscall.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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,type= 4 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, l= o, loff_t *, res, uint, wh); #endif _syscall3(int, sys_rt_sigqueueinfo, pid_t, pid, int, sig, siginfo_t *, uin= fo) +_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 =3D get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo)); } break; + case TARGET_NR_rt_tgsigqueueinfo: + { + siginfo_t uinfo; + + p =3D 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 =3D get_errno(sys_rt_tgsigqueueinfo(arg1, arg2, arg3, &uin= fo)); + } + break; #ifdef TARGET_NR_sigreturn case TARGET_NR_sigreturn: if (block_signals()) { --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236672228660.5845245953981; Wed, 31 May 2017 06:17:52 -0700 (PDT) Received: from localhost ([::1]:59369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3VU-00070y-O5 for importer@patchew.org; Wed, 31 May 2017 09:17:48 -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) 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) 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) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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?q?Milo=C5=A1=20Stojanovi=C4=87?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Milo=C5=A1 Stojanovi=C4=87 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) =3D 0 After this commit, it looks like this: 7775 rt_tgsigqueueinfo(7775,7775,50,0x76ffea5c) =3D 0 Signed-off-by: Milo=C5=A1 Stojanovi=C4=87 Signed-off-by: Riku Voipio --- linux-user/strace.c | 15 +++++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) 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 =20 +#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_tgsigq= ueueinfo, NULL }, #endif #ifdef TARGET_NR_sched_getaffinity { TARGET_NR_sched_getaffinity, "sched_getaffinity" , NULL, NULL, NULL }, --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236518040682.214509426747; Wed, 31 May 2017 06:15:18 -0700 (PDT) Received: from localhost ([::1]:59350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3T1-0004gk-IC for importer@patchew.org; Wed, 31 May 2017 09:15:15 -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) 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) 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) 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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?q?Milo=C5=A1=20Stojanovi=C4=87?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Milo=C5=A1 Stojanovi=C4=87 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(-) 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 *tin= fo) =20 switch (si_type) { case QEMU_SI_KILL: - gemu_log(", si_pid =3D %u, si_uid =3D %u", + gemu_log(", si_pid=3D%u, si_uid=3D%u", (unsigned int)tinfo->_sifields._kill._pid, (unsigned int)tinfo->_sifields._kill._uid); break; case QEMU_SI_TIMER: - gemu_log(", si_timer1 =3D %u, si_timer2 =3D %u", + gemu_log(", si_timer1=3D%u, si_timer2=3D%u", tinfo->_sifields._timer._timer1, tinfo->_sifields._timer._timer2); break; case QEMU_SI_POLL: - gemu_log(", si_band =3D %d, si_fd =3D %d", + gemu_log(", si_band=3D%d, si_fd=3D%d", tinfo->_sifields._sigpoll._band, tinfo->_sifields._sigpoll._fd); break; case QEMU_SI_FAULT: - gemu_log(", si_addr =3D "); + gemu_log(", si_addr=3D"); print_pointer(tinfo->_sifields._sigfault._addr, 1); break; case QEMU_SI_CHLD: - gemu_log(", si_pid =3D %u, si_uid =3D %u, si_status =3D %d" + gemu_log(", si_pid=3D%u, si_uid=3D%u, si_status=3D%d" ", si_utime=3D" TARGET_ABI_FMT_ld ", si_stime=3D" 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 =3D %u, si_uid =3D %u, si_sigval =3D " TARGET_A= BI_FMT_ld, + gemu_log(", si_pid=3D%u, si_uid=3D%u, si_sigval=3D" TARGET_ABI_FMT= _ld, (unsigned int)tinfo->_sifields._rt._pid, (unsigned int)tinfo->_sifields._rt._uid, tinfo->_sifields._rt._sigval.sival_ptr); --=20 2.11.0 From nobody Mon Apr 29 17:44:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496236937237271.2306333479156; Wed, 31 May 2017 06:22:17 -0700 (PDT) Received: from localhost ([::1]:59395 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG3Zm-0002EY-H1 for importer@patchew.org; Wed, 31 May 2017 09:22:14 -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) 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) 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) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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?q?Milo=C5=A1=20Stojanovi=C4=87?= , stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Milo=C5=A1 Stojanovi=C4=87 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) =3D 0 After this commit, it looks like this: 8307 rt_sigqueueinfo(8307,50,{si_signo=3D50, si_code=3DSI_QUEUE, si_pid=3D8= 307, si_uid=3D1000, si_sigval=3D17716762128}) =3D 0 Signed-off-by: Milo=C5=A1 Stojanovi=C4=87 Signed-off-by: Riku Voipio --- linux-user/strace.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 111 insertions(+), 2 deletions(-) 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); } =20 +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 =3D sig; + tinfo->si_errno =3D si_errno; + tinfo->si_code =3D 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._pi= d); + __get_user(tinfo->_sifields._kill._uid, &info->_sifields._kill._ui= d); + si_type =3D 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 =3D 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 =3D QEMU_SI_POLL; + break; + default: + /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */ + __get_user(tinfo->_sifields._rt._pid, &info->_sifields._rt._pi= d); + __get_user(tinfo->_sifields._rt._uid, &info->_sifields._rt._ui= d); + /* XXX: potential problem if 64 bit */ + __get_user(sival_ptr, &info->_sifields._rt._sigval.sival_ptr); + tinfo->_sifields._rt._sigval.sival_ptr =3D sival_ptr; + + si_type =3D QEMU_SI_RT; + break; + } + break; + } + + tinfo->si_code =3D 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 *nam= e, 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 =3D 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 *n= ame, 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 =3D 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 --=20 2.11.0