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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 685ECC10F03 for ; Mon, 4 Mar 2019 09:36:39 +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 3252D21019 for ; Mon, 4 Mar 2019 09:36:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kSYZyh3t"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="N5xrQSqv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3252D21019 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=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-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+6BNSSZJykosUPKLb7uuYQPBRvqbWadzJmWMXHlBVo8=; b=kSYZyh3t4kDcLa slCPj4QYhRtvlfgAQs38lN3ptuYGih8V1vgbzSHMqnbfhy8aZa3R8tyKIMHtmxgJ3OQbP5o8PjBRW FYCSL7m+q+ek1qaKBPFsWcXJ/APEg6DxUqUVKem/MtOeZWz+tHZS3Xu7E0secRUYXWYU2RnGcGqMX CwWUShYKL9gpqY/F+GO/uRgc1fhkDDd0LQe/jd4cl7us/Ab05oX9RnHcGLXLKMQVJNrYz5RVAw12m P86lxevS6K8ab9GxQndSlAMGybx4RZhiUkPLnbSYm5DXBhperI8i0U8stALV2kfRvPsVP2TF4Xr/9 e4m9HCEkcABcfmSGI/iQ==; 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 1h0k1T-0000WG-R8; Mon, 04 Mar 2019 09:36:35 +0000 Received: from mail-eopbgr140087.outbound.protection.outlook.com ([40.107.14.87] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h0k1P-0000VW-L4 for linux-arm-kernel@lists.infradead.org; Mon, 04 Mar 2019 09:36:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ix6PL2RLxmEElZZBfefBkcCi+qQCg4mBO8ebmVZgUZs=; b=N5xrQSqvEFIhIyFgOxGoWURhivJaHKOAKtzrymRkh9A9SThssEhp+Gdhenm1T5cno1CoMd/O3GmIAUC2nCnqgNARGx6RFiGfadpm9b9GVrEqpvFVeEgr9+XkfXvS7pWxIp0Eh//5jnrPhXonPOhDMSvYKJsD0vh5mAhLrQwYBrY= Received: from AM4PR08MB2929.eurprd08.prod.outlook.com (10.171.190.138) by AM4PR08MB0914.eurprd08.prod.outlook.com (10.166.133.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.16; Mon, 4 Mar 2019 09:36:27 +0000 Received: from AM4PR08MB2929.eurprd08.prod.outlook.com ([fe80::e522:c03f:3d0c:f4ce]) by AM4PR08MB2929.eurprd08.prod.outlook.com ([fe80::e522:c03f:3d0c:f4ce%4]) with mapi id 15.20.1665.020; Mon, 4 Mar 2019 09:36:27 +0000 From: "Haibo Xu (Arm Technology China)" To: Sudeep Holla , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" Subject: Re: [PATCH 4/6] powerpc: use common ptrace_syscall_enter hook to handle _TIF_SYSCALL_EMU Thread-Topic: [PATCH 4/6] powerpc: use common ptrace_syscall_enter hook to handle _TIF_SYSCALL_EMU Thread-Index: AQHUz5QAshJAlHpcr0CXdooSV3Nef6X7PESA Date: Mon, 4 Mar 2019 09:36:27 +0000 Message-ID: <247371ae-3360-95e2-bf1d-21eb9332c31c@arm.com> References: <20190228183220.15626-1-sudeep.holla@arm.com> <20190228183220.15626-5-sudeep.holla@arm.com> In-Reply-To: <20190228183220.15626-5-sudeep.holla@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK2PR04CA0045.apcprd04.prod.outlook.com (2603:1096:202:14::13) To AM4PR08MB2929.eurprd08.prod.outlook.com (2603:10a6:205:c::10) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 927f047c-9517-4e2b-da14-08d6a084dfe7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR08MB0914; x-ms-traffictypediagnostic: AM4PR08MB0914: x-microsoft-exchange-diagnostics: 1; AM4PR08MB0914; 20:ZDpqkHrYV8lc9DYu9Fm3nQ3CRk/Ppv/PAhrSDMWoA5ad7zMKWa6CyPiqNyCBJz/WCt6xF3f50vrrLDUdk64pTsZK16lJ+z1YXO+TYYnWWjjb2Xer7HjnfsWylBLl5Un5CtB4oS3VtQBZwWCjHX0kkzTSJjzddxMbHScXet3VIN0= x-microsoft-antispam-prvs: x-forefront-prvs: 09669DB681 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(136003)(396003)(376002)(366004)(39860400002)(199004)(189003)(40434004)(76176011)(6346003)(81156014)(305945005)(81166006)(8676002)(31696002)(97736004)(7736002)(52116002)(105586002)(386003)(6506007)(53546011)(4326008)(31686004)(106356001)(229853002)(2616005)(316002)(68736007)(55236004)(86362001)(102836004)(486006)(11346002)(476003)(446003)(2201001)(8936002)(25786009)(66066001)(7416002)(186003)(6486002)(6436002)(14444005)(5024004)(6246003)(71200400001)(71190400001)(54906003)(110136005)(2906002)(6116002)(3846002)(256004)(5660300002)(99286004)(478600001)(36756003)(2501003)(6512007)(72206003)(14454004)(53936002)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB0914; H:AM4PR08MB2929.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Haibo.Xu@arm.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: EMZVIm1a3RqedGhTxr8HaLe5WM81CLwLfiQwns/c2+8fwcsGF+0a1lv98hdsJ1Z2NtStjBQHuCMVrq+9wUCV1LyVHWayFlHO+GOy4fe34ESEZj98Ssm8BCq89D+znNfBpCCx0jRXC/L6+uk2J15ro6hwRN/51NUpO8aapQdoRveh/bmqRt/HhKl2z7mw/o+th6KR9SOQFlVgq/2qgFKLKuhFxR/pIcIvyblNYX6WXM38MeCkWme9dK10eNBUo8kbZ0KINelgCwzRA5eh3thDFsQ+mQSb66TJcbD/kaxQQFGmWSCdIqBlAc0r0sBjeJfFEy91lPGeCVNkXAFNk2YUCL676Y84OHr+AKSdMkJzpbxFe5V2t8lVchO78i9/h05PCWbFkYbAwMUIBKIqit89JiMSZaMWUGrqhUc6QXbY7hE= Content-ID: <64CA2990D7904E4A9DCD3B1E0C8401F3@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 927f047c-9517-4e2b-da14-08d6a084dfe7 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Mar 2019 09:36:27.7278 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB0914 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190304_013631_741814_B9FEDCB8 X-CRM114-Status: GOOD ( 22.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Steve Capper , Catalin Marinas , "jdike@addtoit.com" , Will Deacon , Oleg Nesterov , "Bin Lu \(Arm Technology China\)" , Richard Weinberger , Ingo Molnar , Paul Mackerras , Michael Ellerman , Thomas Gleixner Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2019/3/1 2:32, Sudeep Holla wrote: > Now that we have a new hook ptrace_syscall_enter that can be called from > syscall entry code and it handles PTRACE_SYSEMU in generic code, we > can do some cleanup using the same in do_syscall_trace_enter. > > Cc: Oleg Nesterov > Cc: Paul Mackerras > Cc: Michael Ellerman > Signed-off-by: Sudeep Holla > --- > arch/powerpc/kernel/ptrace.c | 50 ++++++++++++++++-------------------- > 1 file changed, 22 insertions(+), 28 deletions(-) > > diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c > index cb7e1439cafb..978cd2aac29e 100644 > --- a/arch/powerpc/kernel/ptrace.c > +++ b/arch/powerpc/kernel/ptrace.c > @@ -3264,37 +3264,31 @@ long do_syscall_trace_enter(struct pt_regs *regs) > { > u32 flags; > > -user_exit(); We'd better keep the user_exit() at here in case both context tracking and SYSCALL_EMU are enabled. > - > -flags = READ_ONCE(current_thread_info()->flags) & > -(_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE); > +if (unlikely(ptrace_syscall_enter(regs))) { > +/* > + * A nonzero return code from tracehook_report_syscall_entry() > + * tells us to prevent the syscall execution, but we are not > + * going to execute it anyway. > + * > + * Returning -1 will skip the syscall execution. We want to > + * avoid clobbering any registers, so we don't goto the skip > + * label below. > + */ > +return -1; > +} > > -if (flags) { > -int rc = tracehook_report_syscall_entry(regs); > +user_exit(); > > -if (unlikely(flags & _TIF_SYSCALL_EMU)) { > -/* > - * A nonzero return code from > - * tracehook_report_syscall_entry() tells us to prevent > - * the syscall execution, but we are not going to > - * execute it anyway. > - * > - * Returning -1 will skip the syscall execution. We want > - * to avoid clobbering any registers, so we don't goto > - * the skip label below. > - */ > -return -1; > -} > +flags = READ_ONCE(current_thread_info()->flags) & _TIF_SYSCALL_TRACE; > > -if (rc) { > -/* > - * The tracer decided to abort the syscall. Note that > - * the tracer may also just change regs->gpr[0] to an > - * invalid syscall number, that is handled below on the > - * exit path. > - */ > -goto skip; > -} > +if (flags && tracehook_report_syscall_entry(regs)) { > +/* > + * The tracer decided to abort the syscall. Note that > + * the tracer may also just change regs->gpr[0] to an > + * invalid syscall number, that is handled below on the > + * exit path. > + */ > +goto skip; > } > > /* Run seccomp after ptrace; allow it to set gpr[3]. */ > IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel