Received: by 10.213.65.68 with SMTP id h4csp933324imn; Sun, 18 Mar 2018 07:56:08 -0700 (PDT) X-Google-Smtp-Source: AG47ELtQeAuS0xzV52+HndcGHPgM3FR0hK3IQb7uq+UdqsMqIC9tY7a5ZoLx4d/gzzWU7sPBF4OI X-Received: by 10.99.112.92 with SMTP id a28mr6567816pgn.17.1521384968655; Sun, 18 Mar 2018 07:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521384968; cv=none; d=google.com; s=arc-20160816; b=kW5ZPN0hs2/zM9F4L3jHtOxfg2SJvbZZ3Vh7wlaNgejuS7nrUTKzD0+l8vbwIhv7Qm css1PD2vxln42ez7Gwh66723DuxwNdYlsyUvuDBPj5cznYHGBLgdcYpit3gYb/KdSwvx 7sc49Zh1sH2FTxyZdoHplJUqz0Niny40oW+21RqifD8x67cbGJ1k+QnctQatpEHmYPW1 6okk9bxa1QNpqJukcB1kZxevo8+VFzXa5OSzaSNHZF/4K1Drc3n6P3Jy8OQiGIzGMVmF 3n2n45l8I204oR3cgSvRk9eqQcX+4gOeQUJcrkscGcbAz5/ZcGPfDpyD5n1lPmxbzI7t SgCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=fp77YgKQR2ugM7bZ/yRj2zkG4ldOsRILgcaiCpIAFY8=; b=Rkc+zW0326OvfiV4bVtn9Ewu9or599ldryY5bj/Q/bL0RuH2OCQTj0G/HQd1GkDRJg QfCp5LDfS3f70AM++nDi4U9kDVVGV3dzWkPRXpj9gaQZ6m24IZv9PR4mOupqD11AdjaI cpnU0am7msVcT4BSRXs56WUVDlZg9GrLEFiZN68BNLLz9u0SDjCv6v9O47mtMueu1y8M G+ABL13zJJMX9e/NmbSlP4E6MYylnf2z8xkQCPa1oEHq0Em3UvdejzK5l89LowBaoZuL O/E9aZjzJPFWXcfCJGy4D18WZlej4oNznySrdAYmdOwjYgE5HTLRrGXT8plhLYXbSATL X87A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=dlu8f08U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15si8277069pgr.167.2018.03.18.07.55.54; Sun, 18 Mar 2018 07:56:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=dlu8f08U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754606AbeCROxv (ORCPT + 99 others); Sun, 18 Mar 2018 10:53:51 -0400 Received: from mail-sn1nam01on0076.outbound.protection.outlook.com ([104.47.32.76]:46799 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754357AbeCROxe (ORCPT ); Sun, 18 Mar 2018 10:53:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fp77YgKQR2ugM7bZ/yRj2zkG4ldOsRILgcaiCpIAFY8=; b=dlu8f08UFlCrD5sI+NT6mX0JiFrgI6WKiXQLgjpwY78vzNKdGJAiO1bVuH940ykUwXbrB1ViyIN+up3+SnJLPGYTm/G3e7NnEKMeLUrEiYnXDOQ7PCLwB5mwmqKUJLSJX0IbPzB5suB1DW4QASXHWwdjU+6qb497fjuA+4yOzVk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (36.85.197.25) by MWHPR07MB2910.namprd07.prod.outlook.com (2603:10b6:300:1e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Sun, 18 Mar 2018 14:49:40 +0000 Date: Sun, 18 Mar 2018 17:48:44 +0300 From: Yury Norov To: Chris Metcalf Cc: Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andrew Morton , Rik van Riel , Tejun Heo , Frederic Weisbecker , Thomas Gleixner , "Paul E. McKenney" , Christoph Lameter , Viresh Kumar , Catalin Marinas , Will Deacon , Andy Lutomirski , Mark Rutland , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Francis Giraldeau Subject: Re: [PATCH v16 10/13] arch/arm: enable task isolation functionality Message-ID: <20180318144844.ehkbx7npszfreyeh@yury-thinkpad> References: <1509728692-10460-1-git-send-email-cmetcalf@mellanox.com> <1509728692-10460-11-git-send-email-cmetcalf@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1509728692-10460-11-git-send-email-cmetcalf@mellanox.com> User-Agent: NeoMutt/20170609 (1.8.3) X-Originating-IP: [36.85.197.25] X-ClientProxiedBy: LO2P265CA0127.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9f::19) To MWHPR07MB2910.namprd07.prod.outlook.com (2603:10b6:300:1e::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 875a7d63-ede7-4fe6-c946-08d58ce0042a X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:MWHPR07MB2910; X-Microsoft-Exchange-Diagnostics: 1;MWHPR07MB2910;3:im8ynZC2SaUlSdSQTUvVp7Nnl54E3x4BtsiKAgMnlBI7W481tDOx1Ys+L21cO3gulVKki9XZm7/hurjPAkrRUgQ7pvdtpSc/b0NVTL/PeC5iISOgR1+ylZaJSu7jNiLa2fpmkaWLA2EKJOYp7HJ/dYqSFZZE3sl9poYNkIhlFGCuBKfFiU8X/l1s2MUxq2/F5r0zkLS3R6MpUV+/GJJvE4PqHBXQpSYzx/gA/ZKjFj8vqPN95N1c0T48iRJe8zcs;25:G4wAAlZluN3vjWRuQcWMyHCNTLdegeqRokcWhmWJFJhrQxCUr3FPhbV/L3FGCSGERZCSaErDcvCY5nhqGT9RCrpAase9RwRW2zuzkE+O6AP10MXsWsk0myMR3oouvHL1kVVQJF4sL7ssd9SIM3CU2QKiW+ecSxXfXg8+iVeoOauLON6Sg0qspzQOK9EzRQq7SFtYuBjAUFT2wXvNzmMB2ZU5lUjvrA+Y+vQwYODn19MxqKTeoSKq4ba5+4Es2Ui2TWe2C4a1LFK4RUyyxH0TLtKQC0nFfY75r0tmWC3g+rvRBbtffFKOeun5KhBapIaAKsbFQDBN0Xc5EY+FA/Vytw==;31:o2vyZaARcZjWNyq4eKa+FtjESd7WwFLJbMBgFLq2V47NmseGV/5hF4p25U2dkvEgm+mh+K5Wvc4ucnItCKfK/I0zTWzLfAqOhpVmfYdyXyyUEWSqZgxXQBvsvEMbGNr7YrXZRlDGcixAmjUHi/Nc0Gcqh67SllDw+6yj2a14PnW0bQxj8e1X6ioy4NsjDpcX0HCkWsP2qg7VFwi5jAC8HwBLEzbJmNMn2MiKz0pIlz0= X-MS-TrafficTypeDiagnostic: MWHPR07MB2910: X-Microsoft-Exchange-Diagnostics: 1;MWHPR07MB2910;20:ZnOi27t6TdDQUB6e/Unr153GT1bD3ZRDlH5NoJFwJ6uEkyuWCtw1ZU3z2ytywbigEB8TxEc7AcAVv5bWdFPSN0yjFEDd8sGLYfYEXDmwlcXr/fS4sEV4HfqEGFMheNSkS+zRnDR2bTNyQBctMTOk8OPVGyczHYiUAtCGxPSyQHeWJucxbfMVs3JKpWoMXWVPOa2YkUEGeh48+SXVp28xc6cAdBNW5xrHjWxh30CTXfUIm4pkVXBVTZ58G+FooTuDqtm7O9mEwyQBP8jUDbfwgdyTRx7CkrSiYCSO0DB9OV7w524gLwcbgYrHgsbPl/fS8wTkKVW4SsrGCRl0TWtWWuzuIwvLm7sETIpGR1kRBtA8tmimSJocTSZmIPkdEMUzjRJuq1s8FuUoYZ30I8cqYhKACKjW0NkkrBp7nHJE9N7HO6uf/jMVylugtIOvTMWqKx/edqszrIplRT2MWixpDgh/DoFdKXBcrHqtfvx1r8rvAX+T3XhF3kslFN3+9c6mA6rrfOk+woeTF4XsC868c+75kMMn3pj0xeoUJh/EEQ0LThrrMxzcTMcAsfNvCnQrknMil3aQ66U+4ZLvL4r04uIbkcrOVRypGuCbZ/5I+dY=;4:wnOB7iuQ9QGhzT5XW8lz3EQBRdb1BqE7CRrtHgWgIgamgqqBwbEI2nHkb1HsEwMOs0JU7gIlbKCO7eokYN4I9Baiqoa7KiPBGi/E0SDhroktkZGmEynLNJsaQc98Fs4XzM+x0YN2Sg1VYSsBeBTD9lPlPeRNvTDMMQPW82dW+g2ss1V8/iWb004QyW4M/j44eoLs0USs7Hzqrw2OYu0lVCoHbtRFPmuXyrmoXxLhjzSJBqiYSo1T3n8lo1oWpJx/3mf0ont1umZGYUYw/VaTC3E30esgoMuZ84fatjnm1P2YvVIT4y64RZdrEc+wodzv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3002001)(3231221)(944501300)(52105095)(10201501046)(6041310)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:MWHPR07MB2910;BCL:0;PCL:0;RULEID:;SRVR:MWHPR07MB2910; X-Forefront-PRVS: 06157D541C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(7916004)(39850400004)(366004)(396003)(39380400002)(346002)(376002)(189003)(199004)(5660300001)(4326008)(9686003)(66066001)(76506005)(25786009)(39060400002)(105586002)(6486002)(2906002)(6246003)(50466002)(53936002)(97736004)(52116002)(72206003)(478600001)(3846002)(186003)(16526019)(6116002)(23726003)(6496006)(33896004)(106356001)(7416002)(8936002)(58126008)(81166006)(8676002)(229853002)(1076002)(33716001)(81156014)(42882007)(7736002)(305945005)(316002)(47776003)(68736007)(16586007)(6916009)(2950100002)(26005)(76176011)(386003)(54906003)(55236004);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR07MB2910;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR07MB2910;23:dRNaIvEo+OnoGDltVVbc+BaPJD2W4MjGu66PjbglC?= =?us-ascii?Q?Yx+g/r08tyI+MtH5P1IK5pmKHONZ3o3Veqh0OG5NoT9OyogAgRZS7h/u+Mmv?= =?us-ascii?Q?O2Y08kmaYYdf2PSyQK6xTO8llHicq1+dA4DTNH6p680qv2tfrQBMOfY0ADaM?= =?us-ascii?Q?3bcxrj3Ie6Gr5mumlwvI70wO8ziv9cbaa0ELWpo4+wzSeD7rRhSjC0p5fRjS?= =?us-ascii?Q?ID3rNpKBymMjjGWmgFinMup1h8sngUjU7BzqIiEPPyL1rzhOABqHUL5n4ZDJ?= =?us-ascii?Q?h2zTlVH3If9E/sKeIH0/DfSA2wA8GYsjENqV0h57txRBVaM1J8Af4X+Oi9kQ?= =?us-ascii?Q?w+O4O6YIhZmj3SDEktyomGuy5CoS1yA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Zb22LKGACWrphakHhY4iWPDGVVjbKoplxyGxQa1sP7tkL49vn+eyQIYpuAtU/Zmw8BezLvK0zvWEcvXuxopN+dVep0JBlt8iqOc04Qrskvi7rmeJL5Tu6a6fFb4xAtYbUCC/thbX4hsAtajK2DpkGniaY0U4ZqhbBR+Rl6+JeAawe SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2018 14:49:40.7255 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 875a7d63-ede7-4fe6-c946-08d58ce0042a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB2910 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Francis, Chris, On Fri, Nov 03, 2017 at 01:04:49PM -0400, Chris Metcalf wrote: > From: Francis Giraldeau > > This patch is a port of the task isolation functionality to the arm 32-bit > architecture. The task isolation needs an additional thread flag that > requires to change the entry assembly code to accept a bitfield larger than > one byte. The constants _TIF_SYSCALL_WORK and _TIF_WORK_MASK are now > defined in the literal pool. The rest of the patch is straightforward and > reflects what is done on other architectures. > > To avoid problems with the tst instruction in the v7m build, we renumber > TIF_SECCOMP to bit 8 and let TIF_TASK_ISOLATION use bit 7. > > Signed-off-by: Francis Giraldeau > Signed-off-by: Chris Metcalf [with modifications] [...] > --- > diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c > index 58e3771e4c5b..0cfcba5a93df 100644 > --- a/arch/arm/kernel/ptrace.c > +++ b/arch/arm/kernel/ptrace.c > @@ -27,6 +27,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -936,6 +937,15 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) > if (test_thread_flag(TIF_SYSCALL_TRACE)) > tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); > > + /* > + * In task isolation mode, we may prevent the syscall from > + * running, and if so we also deliver a signal to the process. > + */ > + if (test_thread_flag(TIF_TASK_ISOLATION)) { > + if (task_isolation_syscall(scno) == -1) > + return -1; > + } I think it would make sense to load thread flags to local variable because later in the code test_thread_flag() is called again to check TIF_SYSCALL_TRACEPOINT flag, and we can avoid it, like this: unsigned long work = READ_ONCE(current_thread_info()->flags); Also, all other architectures cache thread flags to local variable before use; so doing this would make sense for the sake of unification. Yury