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=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 95141C43381 for ; Tue, 12 Mar 2019 01:35:24 +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 3B769214D8 for ; Tue, 12 Mar 2019 01:35:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C+of+umX"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="DPU9JSEW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B769214D8 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=qD/n0C2gqUUekPRv5ZXZcy8NjaGzpIZ47XAmzX+xsIM=; b=C+of+umXJgP2I3 69hAwbQhyVeO1PYftdF/fUUejeMNvAbBUFzuFC85Y0bo2Wqpqj2fKiaZK2ikoSZe5DziUV1XiDHbN qlSuZe2rI5t9uBisEdly26M5GJ26Q9UhfXvsYajlfeyNoq1EC6KJKF0D+d1HebSB0HODnpVOE4BVa EiFTwoCkBNWN6GT7goYCBYyQz1wDeTZA+fmerA/4EzAHqnoiBeb025/EyMeofjscNCi1ohBNDdZy3 xo6KfTggW9L2eMx/cZyCT/bMuT1BDypLbF9qmZ9SqfKi7SChSrw9ltZC1dmWluslbpXkFmI8hxxr2 7f4ZclXqKttvueVaMU6w==; 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 1h3WK1-0000B9-Ja; Tue, 12 Mar 2019 01:35:13 +0000 Received: from mail-am5eur02on062b.outbound.protection.outlook.com ([2a01:111:f400:fe07::62b] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3WJx-00088t-8X for linux-arm-kernel@lists.infradead.org; Tue, 12 Mar 2019 01:35:11 +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=JtxqqtMg0mtNwODkrTI4yLRXkpzI+Ahn54L9/mLVH28=; b=DPU9JSEWJMq3Zf0F/9XWBz7+QoBMHffDk0O1VPiRmgm7nCyO8vwTL/raDXLRQD8Rg3P6rU+//1jBH1j/fWdN75t90J0PnwDjsUOFWLkvaKZo06D2Y82CsYVgymPswS8+YzJQ01D7mfUeDgmUGtEjcQf/uRMf/Nfw+OWNCzOAjNM= Received: from AM4PR08MB2929.eurprd08.prod.outlook.com (10.171.190.138) by AM4PR08MB0755.eurprd08.prod.outlook.com (10.164.82.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Tue, 12 Mar 2019 01:34:44 +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.1686.021; Tue, 12 Mar 2019 01:34:44 +0000 From: "Haibo Xu (Arm Technology China)" To: Sudeep Holla Subject: Re: [PATCH 3/6] x86: clean up _TIF_SYSCALL_EMU handling using ptrace_syscall_enter hook Thread-Topic: [PATCH 3/6] x86: clean up _TIF_SYSCALL_EMU handling using ptrace_syscall_enter hook Thread-Index: AQHUz5P9ZKULSdDQbEW1h9vbYNE6xaX7KHCAgAAd14CAAQzrgIAKf6aAgAB1ewA= Date: Tue, 12 Mar 2019 01:34:44 +0000 Message-ID: <65b00ea1-f784-4fb4-2a98-49fa44d9fa8f@arm.com> References: <20190228183220.15626-1-sudeep.holla@arm.com> <20190228183220.15626-4-sudeep.holla@arm.com> <20190304101205.GA1504@e107155-lin> <96d59a68-e5e2-86d9-c707-a79aad438b76@arm.com> <20190311183403.GA31062@e107155-lin> In-Reply-To: <20190311183403.GA31062@e107155-lin> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK2PR0302CA0011.apcprd03.prod.outlook.com (2603:1096:202::21) To AM4PR08MB2929.eurprd08.prod.outlook.com (2603:10a6:205:c::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Haibo.Xu@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fef0931c-6e28-422a-8e2a-08d6a68ae7b3 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:AM4PR08MB0755; x-ms-traffictypediagnostic: AM4PR08MB0755: x-microsoft-exchange-diagnostics: 1; AM4PR08MB0755; 20:sa024CKCUP9ygamxCffnfnGzSUtIY6f71NbBS4cbExAALXdZzTEpUU3Jitcezf+FfwuyPYzDTZSK4GN3ZxKURSyQPZCBUYwPcsbg5NXGw71hzJtEV5FwMexLVgPh584dZJyHQ7uRvse+zsef87zDGz9FJVKv2pgDm/HAnl1Nnh8= x-microsoft-antispam-prvs: x-forefront-prvs: 09749A275C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(346002)(376002)(366004)(39860400002)(189003)(199004)(40434004)(52116002)(6506007)(386003)(71200400001)(99286004)(6636002)(76176011)(71190400001)(8936002)(53936002)(31686004)(229853002)(186003)(53546011)(6486002)(478600001)(72206003)(6436002)(6512007)(14454004)(256004)(26005)(55236004)(5024004)(14444005)(102836004)(7736002)(305945005)(25786009)(36756003)(4326008)(81156014)(81166006)(31696002)(8676002)(3846002)(6862004)(7416002)(68736007)(86362001)(5660300002)(106356001)(486006)(2616005)(11346002)(316002)(446003)(6116002)(105586002)(6246003)(476003)(37006003)(97736004)(54906003)(93886005)(2906002)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB0755; H:AM4PR08MB2929.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: pEbiBfy7XcTMnKLK49xK9k03MxcDh+YzEFQsi4oQMddSssaIJp8zO2sb9H4KfM/KY5nC2SPtKVi4PBGkqWLIUW5PhP2oDqU2fJrPGJRLI7Mzd/hLwLqxO/Fcx3Qge7O8UQ3z3UyvJpEjglEdb+WiJUjPcEFLL7dG65Mx3um2d5bacDhDYQ1S5ZFqqq9wWd7xJNvTmUf6796hOlIoEJbUdsyR41MPz7eOtt+piXppZ4j3qmjrXokeZw1Oj5e506F90pAromPcgwy+h7jOMTNzdsF6PCjEjvhn9E3YZLUy781TgLOsllt6WKJ/hOKcVE6zlB5Uib3qnEg4G5hKZvbviXauGomKzBSAoRTPm8PGsFLGghf0ajj0mZ9KygXHrxZbdGvnigmpCruw4YZKD4uZKqB2aZVqr1zkufLB2RuysdQ= Content-ID: <57866709C2BE224FA97105DAF41E7E6A@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: fef0931c-6e28-422a-8e2a-08d6a68ae7b3 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Mar 2019 01:34:44.4617 (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: AM4PR08MB0755 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190311_183509_349135_BBBC3EB5 X-CRM114-Status: GOOD ( 23.34 ) 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" , "x86@kernel.org" , Will Deacon , "linux-kernel@vger.kernel.org" , Oleg Nesterov , Richard Weinberger , Ingo Molnar , Paul Mackerras , Andy Lutomirski , Michael Ellerman , Borislav Petkov , Thomas Gleixner , "Bin Lu \(Arm Technology China\)" , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" 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/12 2:34, Sudeep Holla wrote: > (I thought I had sent this email, last Tuesday itself, but saw this in my > draft today, something went wrong, sorry for the delay) > > On Tue, Mar 05, 2019 at 02:14:47AM +0000, Haibo Xu (Arm Technology China) wrote: >> On 2019/3/4 18:12, Sudeep Holla wrote: >>> On Mon, Mar 04, 2019 at 08:25:28AM +0000, Haibo Xu (Arm Technology China) wrote: >>>> 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 syscall_trace_enter. >>>>> >>>>> Further the extra logic to find single stepping PTRACE_SYSEMU_SINGLESTEP >>>>> in syscall_slow_exit_work seems unnecessary. Let's remove the same. >>>> >>>> I think we should not change the logic here. Is so, it will double the report of syscall >>>> when PTRACE_SYSEMU_SINGLESTEP is enabled. >>>> >>> >>> I don't think that should happen, but I may be missing something. >>> Can you explain how ? >>> >> >> When PTRACE_SYSEMU_SINGLESTEP is enabled, both the _TIF_SYSCALL_EMU and >> _TIF_SINGLESTEP flags are set, but ptrace only need to report(send SIGTRAP) >> at the entry of a system call, no need to report at the exit of a system >> call. >> > Sorry, but I still not get it, we have: > > step = ((flags & (_TIF_SINGLESTEP | _TIF_SYSCALL_EMU)) == _TIF_SINGLESTEP); > > For me, this is same as: > step = ((flags & _TIF_SINGLESTEP) == _TIF_SINGLESTEP) > or > if (flags & _TIF_SINGLESTEP) > step = true; > I don't think so! As I mentioned in the last email loop, when PTRACE_SYSEMU_SINGLESTEP is enabled, both the _TIF_SYSCALL_EMU and _TIF_SINGLESTEP flags are set, in which case the step should be "false" for the old logic. But with the new logic, the step is "true". > So when PTRACE_SYSEMU_SINGLESTEP, _TIF_SYSCALL_EMU and _TIF_SINGLESTEP > are set and step evaluates to true. > > So dropping _TIF_SYSCALL_EMU here should be fine. Am I still missing > something ? > > -- > Regards, > Sudeep > For the PTRACE_SYSEMU_SINGLESTEP request, ptrace only need to report(send SIGTRAP) at the entry of a system call, no need to report at the exit of a system call.That's why the old logic-{step = ((flags & (_TIF_SINGLESTEP | _TIF_SYSCALL_EMU)) == _TIF_SINGLESTEP)} here try to filter out the special case(PTRACE_SYSEMU_SINGLESTEP). Another way to make sure the logic is fine, you can run some tests with respect to both logic, and to check whether they have the same behavior. Regards, Haibo 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