From mboxrd@z Thu Jan 1 00:00:00 1970 From: ldv@altlinux.org (Dmitry V. Levin) Date: Wed, 21 Nov 2018 22:00:10 +0300 Subject: [PATCH v2 16/15] syscall_get_arch: add "struct task_struct *" argument In-Reply-To: <20181121184004.jro532jopnbmru2m@pburton-laptop> References: <20181107042751.3b519062@akathisia> <20181120001128.GA11300@altlinux.org> <20181121004422.GA29053@altlinux.org> <20181121184004.jro532jopnbmru2m@pburton-laptop> Message-ID: <20181121190009.GA10301@altlinux.org> To: linux-riscv@lists.infradead.org List-Id: linux-riscv.lists.infradead.org Hi Paul, On Wed, Nov 21, 2018 at 06:40:06PM +0000, Paul Burton wrote: > Hi Dmitry, > > On Wed, Nov 21, 2018 at 03:44:22AM +0300, Dmitry V. Levin wrote: > > This argument is required to extend the generic ptrace API > > with PTRACE_GET_SYSCALL_INFO request: syscall_get_arch() is going to be > > called from ptrace_request() along with other syscall_get_* functions > > with a tracee as their argument. > > > > This change partially reverts commit 5e937a9ae913 ("syscall_get_arch: > > remove useless function arguments"). > > > >% > > > > diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h > > index 0170602a1e4e..52b633f20abd 100644 > > --- a/arch/mips/include/asm/syscall.h > > +++ b/arch/mips/include/asm/syscall.h > > @@ -73,7 +73,7 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg, > > #ifdef CONFIG_64BIT > > case 4: case 5: case 6: case 7: > > #ifdef CONFIG_MIPS32_O32 > > - if (test_thread_flag(TIF_32BIT_REGS)) > > + if (test_ti_thread_flag(task_thread_info(task), TIF_32BIT_REGS)) > > return get_user(*arg, (int *)usp + n); > > else > > #endif > > This ought to be test_tsk_thread_flag(task, TIF_32BIT_REGS) instead of > open-coding test_tsk_thread_flag. This will be corrected, thanks for letting me know. > More fundamentally though, this change doesn't seem to be (directly) > related to the change you describe in the commit message - it's not > syscall_get_arch being modified here. I suspect this should be a > separate commit, or if not please explain in the commit message why this > change is included. Good point, this is a fix that should not have been included into this commit. The bug was found while preparing the syscall_get_arch change, and this hunk just slipped in. I'll send it as a separate commit. > Compounding the lack of clarity is the fact that I only received this > patch, not the whole series, so I can't view the change in the context > of the rest of the series. > > > @@ -140,14 +140,14 @@ extern const unsigned long sys_call_table[]; > > extern const unsigned long sys32_call_table[]; > > extern const unsigned long sysn32_call_table[]; > > > > -static inline int syscall_get_arch(void) > > +static inline int syscall_get_arch(struct task_struct *task) > > { > > int arch = AUDIT_ARCH_MIPS; > > #ifdef CONFIG_64BIT > > - if (!test_thread_flag(TIF_32BIT_REGS)) { > > + if (!test_ti_thread_flag(task_thread_info(task), TIF_32BIT_REGS)) { > > arch |= __AUDIT_ARCH_64BIT; > > /* N32 sets only TIF_32BIT_ADDR */ > > - if (test_thread_flag(TIF_32BIT_ADDR)) > > + if (test_ti_thread_flag(task_thread_info(task), TIF_32BIT_ADDR)) > > arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; > > } > > #endif > > This does seem like the described change, but there are 2 more instances > of open-coding test_tsk_thread_flag which ought to be cleaned up. This will be cleaned up, thanks for letting me know. -- ldv -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AF59C43441 for ; Wed, 21 Nov 2018 19:00:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A962214D9 for ; Wed, 21 Nov 2018 19:00:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VpXFO5ew" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A962214D9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7VNVnpadMy/jd4MXDGN1vAivSjNV/cmI+FGuetLQaxU=; b=VpXFO5ewD1WaMN1uTOWgaUI2U uYO2D0+7pa/6ZE5E+1C4LiUTY96eZgbEhyTktYKJfDJhzdY8YpXtXhObPkHwnvf84DIvzL/JRfQFN H79u3/9x1ffI5+fFnjspL5KEmokOrYkZGItmLAa4D7EqZHvGsSxAo4KdBW/wmxrSUBGSwb6ZqAJkb JVlZAap1RDCjGxg7opeuVTqOBuWY8PMbMUC9+0sbcm57LXNOUBWaB6L/vfA0d7I3kdngjKA6azWaN enHWSkBsMoDpml+e28NIZFl7EMcJsGQJImiO2mkWjBBNSQTnU8NfNvP12Wb8cUnTSCO8qGSKWeDTW mn8bSI3jA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPXjj-0000Ti-VF; Wed, 21 Nov 2018 19:00:31 +0000 Received: from vmicros1.altlinux.org ([194.107.17.57]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPXjZ-0000K3-V9; Wed, 21 Nov 2018 19:00:24 +0000 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 6D78872CC66; Wed, 21 Nov 2018 22:00:10 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 5510A7CD20A; Wed, 21 Nov 2018 22:00:10 +0300 (MSK) Date: Wed, 21 Nov 2018 22:00:10 +0300 From: "Dmitry V. Levin" To: Paul Burton Subject: Re: [PATCH v2 16/15] syscall_get_arch: add "struct task_struct *" argument Message-ID: <20181121190009.GA10301@altlinux.org> References: <20181107042751.3b519062@akathisia> <20181120001128.GA11300@altlinux.org> <20181121004422.GA29053@altlinux.org> <20181121184004.jro532jopnbmru2m@pburton-laptop> MIME-Version: 1.0 In-Reply-To: <20181121184004.jro532jopnbmru2m@pburton-laptop> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181121_110022_385763_0865C15F X-CRM114-Status: GOOD ( 19.78 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Paul Moore , linux-hexagon@vger.kernel.org, x86@kernel.org, Eugene Syromyatnikov , Elvira Khabirova , linux-snps-arc@lists.infradead.org, uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, linux-um@lists.infradead.org, linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Andy Lutomirski , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-parisc@vger.kernel.org, Oleg Nesterov , Eric Paris , linux-audit@redhat.com, linux-alpha@vger.kernel.org, nios2-dev@lists.rocketboards.org, linuxppc-dev@lists.ozlabs.org Content-Type: multipart/mixed; boundary="===============6879438493075412069==" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org Message-ID: <20181121190010.X-SfvqYEJvJDTzq5ZQhHK2zFRJX7rxTRsoVSk8RSEhc@z> --===============6879438493075412069== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BXVAT5kNtrzKuDFl" Content-Disposition: inline --BXVAT5kNtrzKuDFl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Paul, On Wed, Nov 21, 2018 at 06:40:06PM +0000, Paul Burton wrote: > Hi Dmitry, >=20 > On Wed, Nov 21, 2018 at 03:44:22AM +0300, Dmitry V. Levin wrote: > > This argument is required to extend the generic ptrace API > > with PTRACE_GET_SYSCALL_INFO request: syscall_get_arch() is going to be > > called from ptrace_request() along with other syscall_get_* functions > > with a tracee as their argument. > >=20 > > This change partially reverts commit 5e937a9ae913 ("syscall_get_arch: > > remove useless function arguments"). > >=20 > >% > >=20 > > diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/sy= scall.h > > index 0170602a1e4e..52b633f20abd 100644 > > --- a/arch/mips/include/asm/syscall.h > > +++ b/arch/mips/include/asm/syscall.h > > @@ -73,7 +73,7 @@ static inline unsigned long mips_get_syscall_arg(unsi= gned long *arg, > > #ifdef CONFIG_64BIT > > case 4: case 5: case 6: case 7: > > #ifdef CONFIG_MIPS32_O32 > > - if (test_thread_flag(TIF_32BIT_REGS)) > > + if (test_ti_thread_flag(task_thread_info(task), TIF_32BIT_REGS)) > > return get_user(*arg, (int *)usp + n); > > else > > #endif >=20 > This ought to be test_tsk_thread_flag(task, TIF_32BIT_REGS) instead of > open-coding test_tsk_thread_flag. This will be corrected, thanks for letting me know. > More fundamentally though, this change doesn't seem to be (directly) > related to the change you describe in the commit message - it's not > syscall_get_arch being modified here. I suspect this should be a > separate commit, or if not please explain in the commit message why this > change is included. Good point, this is a fix that should not have been included into this comm= it. The bug was found while preparing the syscall_get_arch change, and this hunk just slipped in. I'll send it as a separate commit. > Compounding the lack of clarity is the fact that I only received this > patch, not the whole series, so I can't view the change in the context > of the rest of the series. >=20 > > @@ -140,14 +140,14 @@ extern const unsigned long sys_call_table[]; > > extern const unsigned long sys32_call_table[]; > > extern const unsigned long sysn32_call_table[]; > > =20 > > -static inline int syscall_get_arch(void) > > +static inline int syscall_get_arch(struct task_struct *task) > > { > > int arch =3D AUDIT_ARCH_MIPS; > > #ifdef CONFIG_64BIT > > - if (!test_thread_flag(TIF_32BIT_REGS)) { > > + if (!test_ti_thread_flag(task_thread_info(task), TIF_32BIT_REGS)) { > > arch |=3D __AUDIT_ARCH_64BIT; > > /* N32 sets only TIF_32BIT_ADDR */ > > - if (test_thread_flag(TIF_32BIT_ADDR)) > > + if (test_ti_thread_flag(task_thread_info(task), TIF_32BIT_ADDR)) > > arch |=3D __AUDIT_ARCH_CONVENTION_MIPS64_N32; > > } > > #endif >=20 > This does seem like the described change, but there are 2 more instances > of open-coding test_tsk_thread_flag which ought to be cleaned up. This will be cleaned up, thanks for letting me know. --=20 ldv --BXVAT5kNtrzKuDFl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJb9as5AAoJEAVFT+BVnCUIMwEQAK/kFQPbOlZh1qWyjUznc+u9 B2U2LJjbOkYfYnr9QwrWQpg/TjvxgUN35dpVOsv/im0GsqFEY2Rzc7tI70ENrEeU q6QXC13R/sIvKRDMEzNyZRaXhHsc0KAhq7LolCTAxeK8t/Fv5Zz9j3TJFWQ9DwDz NVDn67xoF2I1U1grwrJFrOrmPTr3B0jQKGekfMwoj+efsP09U8U6mOAbJ4WF3DW4 zJXbMREy/PNA4g/usZzp0ckgLrceTql83DdogIPaCytZrDNteKgXgGUW/MPCty1C 4hWReW1CumdXr9ULf2cbiwrvBnG+Sa9lN2QTeaIH892Ln9sToAfRX2D1YMH5mfcP FDHeP0jpZgLqXmiiAVVXXV1Al2DnAR3ohZlmyRyT06thhiVWptG/KjrgcRM3G9hZ vVzvRv8kBaj+6WzpW+hS97lHeqbg3s0AMBTy8rWaLyGJMUUAUQ0jOcN3faZbegI6 L7AsGZiHRxjLIwuXIRh93/rPrmyWbY9zli4BDaufbvYRiJK3TYyEBeQB95X6mmiA DuUIR5hOaMafxWExgknG1NRuBnrhmpkokyvEAClQyg7zvWflHMOd9trQJXFfSKI8 A3e+hTMBRs9HXfqdXe9QUj6f7pQIpRh3xSXKyePA1kFj6DuJMe+dLKQGQEeCE1bf pqgRdoGWKyibD9iR9c1/ =hLdr -----END PGP SIGNATURE----- --BXVAT5kNtrzKuDFl-- --===============6879438493075412069== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv --===============6879438493075412069==--