Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755727AbbHZPKw (ORCPT ); Wed, 26 Aug 2015 11:10:52 -0400 Received: from mail-db3on0077.outbound.protection.outlook.com ([157.55.234.77]:51597 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752821AbbHZPKs (ORCPT ); Wed, 26 Aug 2015 11:10:48 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=cmetcalf@ezchip.com; Subject: Re: [PATCH v6 3/6] task_isolation: support PR_TASK_ISOLATION_STRICT mode To: Will Deacon References: <1440532555-15492-1-git-send-email-cmetcalf@ezchip.com> <1440532555-15492-4-git-send-email-cmetcalf@ezchip.com> <20150826103651.GA30466@arm.com> CC: Gilad Ben Yossef , 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 , "linux-doc@vger.kernel.org" , "linux-api@vger.kernel.org" , "linux-kernel@vger.kernel.org" From: Chris Metcalf Message-ID: <55DDD6EA.3070307@ezchip.com> Date: Wed, 26 Aug 2015 11:10:34 -0400 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150826103651.GA30466@arm.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: BLUPR07CA0031.namprd07.prod.outlook.com (10.255.223.144) To VI1PR02MB0784.eurprd02.prod.outlook.com (25.162.14.146) X-Microsoft-Exchange-Diagnostics: 1;VI1PR02MB0784;2:KRLOMysEL86m6NUmpRGYttPY0ecBEZmJdUFHjvx9Xa8W/HMTyhbqx/Hguk6UXhyAXJH1ocRiYjX4JCOAyiT1I4yLdVKApOR1SarB0U2KEy50LUw6ILup6EpyjBxIBCGLp+JskvDhGzQoKYxlZ3/VooqYACOstCW4uYKfNu/Mnb0=;3:yXaKr3WxBeV2bZ9y+ZZ8QxRDmSPR8aR37edvkHsVSnEhUzf1IkjDzWcteMuroJivNzfdCLG7kFkYLcZ9ze3dRRI/TIIYodxjxwAp6km87jcKga43xh2S5Jypz4jxquuIXumYs7/R87Bj0wJoA/FKDw==;25:I5GUYpVpMoAzPMGY49D22T2qX342sdg7syAtctPLXuK5zhsCV520B+aVHT3HITjMNuEnG1xSUqiZAGp/X/S92Rns65R4Vv2kNtC5rFJIH9dgXOkQzzxXPKkH0apk4v2mCKney3efK6K8RqsGW4bs7ufwnprmL3WnFiyK5YX2+Xqy/kIQVhIMaWFOS7pxiuDcPDTWQVR3ddLOQ0sgc2Y07phVwa8dzUeuMUPoF6rpHUno76T3Kb68DFZ7nRPrNdpbSt/W4LOkH8SlKLT1qOlfVg==;20:Zu0/5oXe75Y5JcH3MWvkkXjfQm55MNCuQilXiTpHEvmnH+FW2w0jPqmE+K/ozW13l6Yy9bv8s39Nj0ESq3JFCHfIi7ypRilKZK24XY3JRDilULm2WPrxYI5ebH4NKlf2hhnwDGLRm0U3ZAxSokWeSQiGPCxa9oPQ3gPITb6VwGQ= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB0784; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(8121501046)(5005006)(3002001);SRVR:VI1PR02MB0784;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB0784; X-Microsoft-Exchange-Diagnostics: 1;VI1PR02MB0784;4:X7lCLWwV1OoGFgV/tq0Q3RHXuDu8bu3vC38oi74npmCOBrv8/prA+q+7FhvzQKOOO5ezRI3+AnMpbik+ZwVj2fyt/HFvrd36gfG7M3q+Gmv9poYMgULIoY6X0OX9MMaR8Lg3qpz9O0lOl3By78L+pUF1o5jX0Q7wc6w+p/rxEmAQzrHRZTHTyefo7qCWOJyijmD0Ta7Y/5ks68HhN/Vaod4t9WFbX/grA3LKhGPvyYr36vA93PSx/dshiBe5LeAd01vdaqWZj9JVYUsdhmbSjiNS1uJJ5wIB0kl3pwJ3KRmxcomB+i4/uwuYAHR6ZgCc X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(6049001)(199003)(189002)(377454003)(76104003)(24454002)(479174004)(50466002)(5001830100001)(92566002)(4001540100001)(81156007)(33656002)(2950100001)(15975445007)(23746002)(80316001)(105586002)(77096005)(65956001)(110136002)(42186005)(40100003)(68736005)(106356001)(5001960100002)(189998001)(5004730100002)(65806001)(36756003)(66066001)(47776003)(62966003)(59896002)(64706001)(5001860100001)(122386002)(46102003)(64126003)(77156002)(97736004)(83506001)(4001350100001)(86362001)(101416001)(5007970100001)(76176999)(87266999)(50986999)(54356999)(19580395003)(65816999)(87976001)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR02MB0784;H:[10.7.0.41];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;VI1PR02MB0784;23:pWgwd6KLNKUhwWwBfBacXmTBxztqW7YITSy5r?= =?Windows-1252?Q?2+Fz/VQHpCrktqqcAv2ayk2y3qFl44x/UVbW1te8lTRApkUDWz4ySFq1?= =?Windows-1252?Q?1lzepoFXnJkSRmSmVosNIcQIuK2r+LjYqJH+k5+zFdhv+Exs3Rfv1uai?= =?Windows-1252?Q?PzPt9YpqyxL8TPAYiLO38i0kjAlvAwtWyY07ey297o5y6ERpIGuolIuo?= =?Windows-1252?Q?2tTM/s5mvuLxIPKRIu933/aeqFpfyQtzCuMUHLR/6knFtPHW3rC1QJKv?= =?Windows-1252?Q?cn+hZcnxwiyB4bw0CQcNt30U2c1emQQ8KWuIWQR0P2h96rdj5FD+7xBA?= =?Windows-1252?Q?DuCdD7Q+q6tWISCaeVQ/8IIFO/aSEQG7xuXU5Sz/L9gKFOwAOR/ClDjE?= =?Windows-1252?Q?OClWGZtSCdCjVyylh3Kth5Yoha3xcfoRP3Ph6xc21e3kawATrR2rztO0?= =?Windows-1252?Q?0NypRGhqxX2btj+cr4Zy6KoLTYVoEWx4VlcBLCVj3gNEWS3jWINSmYOq?= =?Windows-1252?Q?WDdqv9NQPbspmUqtf0TfPn2bmG2ao/oUDo4ZzWIbO2i8m7UtdOWO4X3o?= =?Windows-1252?Q?FwrYsgr27ttnyXTwYIy9jlC6VDnIPngjka+RV5eAToudx7KlQE6uH36G?= =?Windows-1252?Q?QybAgbR0RZP7Sggbkgw1f78lYf8pI2G+r0BlTbLf78yQQJUb1+e8UPIL?= =?Windows-1252?Q?TML8OselcCRdckopq1/tFM1SUN2YJGDrwrEyXk8Nfe7fHQyVhNdRJ2ms?= =?Windows-1252?Q?1mDqPZmLJuV7/DtOCA3vkiSIQosubClgJRhKZdazXXvnxFUjzXqFSEdf?= =?Windows-1252?Q?IyM7haGjNILo3NqjA9Lq98XLCXP4urwWKb44Gz1wmKOtzgGtVOCnM7jn?= =?Windows-1252?Q?Jo4uRTdKpuhVCEDZkrszCzI9YfZ/CyqtkpnlsVGjqybCgqjTJ9M9WsZT?= =?Windows-1252?Q?/c6lStt+Z5X1ODf9Pw266Hpx0Ql/mxn1J07alm5l6nZLYPI7Y0hgt9Z1?= =?Windows-1252?Q?0m9R/nF4rWC6utFNsxZIq36OyEmBxWg9kFSmVDmSpY6rsHxqNHTz9Lt2?= =?Windows-1252?Q?fx7v+pdfCX0e9MW3GqHRVesgum8sjlsPWj863RoCho3UmSRso7anNLb5?= =?Windows-1252?Q?rYHNMUDnMzz2KlbXnzgadIAp+W2ViFG1azLjsT6kQxMHAzRYjserLQER?= =?Windows-1252?Q?3ViwWZPF36tz2kU3F1gSi/AeyDex4JP6vwKk753kCpFBF3MCr/xrMo/S?= =?Windows-1252?Q?HUyI7X0+9Rd0b+kExJ1usgCgQY/4S+xyqLPFyvJ63xxdFXFlmUcKv0Sa?= =?Windows-1252?Q?htvpDUpgvdKJJ8YFzmmOUOGJbOAGEnGc62gGw68LFIg9E+NY4Gc+qV6A?= =?Windows-1252?Q?wNG+r8kDXf+FR80+nCconDhQCwhHC5/KNfqa2RSEJIdQm2AoZofBEXEE?= =?Windows-1252?Q?p7cG/QbTt82Ow8w5oHYOuQaaFTUPdHBKexRjBVQfovsIoVLSbcVv/m/2?= =?Windows-1252?Q?50TA5Xmw2iNbsfEupsayZRJXdlWYRxkKNK2QXW6GZ1Xr4iWTt1fe/ppi?= =?Windows-1252?Q?iHMiZfaF4t/C8A=3D?= X-Microsoft-Exchange-Diagnostics: 1;VI1PR02MB0784;5:MpFLRrqu+lCOHL5oNExnlgY/tSpWzcjr44TiFtCPi3b//qcEM/r9zzzPnee5xwQRWZEr6D9JtkIMRvU3t2UpYibkxRm1rdujj9opio09VRymbxLCHKx3Wi47CBsHcLphF/gpfl/cP8bAXL8WM4cwfw==;24:X9jNm341cgtWSpCMdx3IVyJdoGCznBjyShikR1vpSg1r2zzsHkeSAf9jUuIT7gdStSDAHEkZi0lzC2OY8qHaZY1acGoHdVTAT2Rq+HetIMs=;20:qo0PI3AEfjMmkyHAT9rEWTJz7XIMqjaBs+22KnYPY4fx9kOELprfJnBMA7cLX17d4oxEAdaHkQbSq8lqB+l2LA== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2015 15:10:42.8215 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB0784 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2718 Lines: 64 On 08/26/2015 06:36 AM, Will Deacon wrote: > Hi Chris, > > On Tue, Aug 25, 2015 at 08:55:52PM +0100, Chris Metcalf wrote: >> diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c >> index d882b833dbdb..e3d83a12f3cf 100644 >> --- a/arch/arm64/kernel/ptrace.c >> +++ b/arch/arm64/kernel/ptrace.c >> @@ -37,6 +37,7 @@ >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -1150,6 +1151,10 @@ static void tracehook_report_syscall(struct pt_regs *regs, >> >> asmlinkage int syscall_trace_enter(struct pt_regs *regs) >> { >> + /* Ensure we report task_isolation violations in all circumstances. */ >> + if (test_thread_flag(TIF_NOHZ) && task_isolation_strict()) > This is going to force us to check TIF_NOHZ on the syscall slowpath even > when CONFIG_TASK_ISOLATION=n. Yes, good catch. I was thinking the "&& false" would suppress the TIF test but I forgot that test_bit() takes a volatile argument, so it gets evaluated even though the result isn't actually used. But I don't want to just reorder the two tests, because when isolation is enabled, testing TIF_NOHZ first is better. I think probably the right solution is just to put an #ifdef CONFIG_TASK_ISOLATION around that test, even though that is a little crufty. The alternative is to provide a task_isolation_configured() macro that just returns true or false, and make it a three-part "&&" test with that new macro first, but that seems a little crufty as well. Do you have a preference? >> + task_isolation_syscall(regs->syscallno); >> + >> /* Do the secure computing check first; failures should be fast. */ > Here we have the usual priority problems with all the subsystems that > hook into the syscall path. If a prctl is later rewritten to a different > syscall, do you care about catching it? Either way, the comment about > doing secure computing "first" needs fixing. I admit I am unclear on the utility of rewriting prctl. My instinct is that we are trying to catch userspace invocations of prctl and allow them, and fail most everything else, so doing it pre-rewrite seems OK. I'm not sure if it makes sense to catch it before or after the secure computing check, though. On reflection maybe doing it afterwards makes more sense - what do you think? Thanks! -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/