Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934145AbcCIVNv (ORCPT ); Wed, 9 Mar 2016 16:13:51 -0500 Received: from mail-am1on0082.outbound.protection.outlook.com ([157.56.112.82]:64775 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752167AbcCIVNn (ORCPT ); Wed, 9 Mar 2016 16:13:43 -0500 Authentication-Results: infradead.org; dkim=none (message not signed) header.d=none;infradead.org; dmarc=none action=none header.from=mellanox.com; Subject: Re: [PATCH v10 09/12] arch/x86: enable task isolation functionality To: Andy Lutomirski References: <1456949376-4910-1-git-send-email-cmetcalf@ezchip.com> <1456949376-4910-10-git-send-email-cmetcalf@ezchip.com> <56D895EA.1060301@mellanox.com> <56DDE9C9.5060900@mellanox.com> <56DF38BA.9030007@mellanox.com> <56E09031.8050007@mellanox.com> CC: Kees Cook , Thomas Gleixner , Christoph Lameter , Andrew Morton , Viresh Kumar , Ingo Molnar , Steven Rostedt , Tejun Heo , "Gilad Ben Yossef" , Will Deacon , Rik van Riel , Frederic Weisbecker , "Paul E. McKenney" , "linux-kernel@vger.kernel.org" , X86 ML , "H. Peter Anvin" , Catalin Marinas , Peter Zijlstra From: Chris Metcalf Message-ID: <56E091F5.6090509@mellanox.com> Date: Wed, 9 Mar 2016 16:13:25 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [173.76.23.146] X-ClientProxiedBy: BLUPR11CA0051.namprd11.prod.outlook.com (10.141.30.19) To AM4PR05MB1684.eurprd05.prod.outlook.com (25.165.246.7) X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1684;2:NrMyik2txVmjMDHadCccxxHz7JbBggKEkdeibhdhai3773B+hZuYfLwF4G34L+LTHekrluMc9PAmcjH+s3fvD5u8ui/RnT5XYKtMA+noLXi4gOCEzTOCvvTquTUmpl24/ZsRrwS+eEEe+SfWX53CuQ==;3:7HQNSGZbqWz9thwxBCD7BP4Szy0bmEUxttga0ukphDB5p8J8TySlIUSVdfzF0AJ4w+MzT2CDPmSHRZzFCgJq/4IbX8rXIhREgvgnJHOR/nAgD1JRaXnomjzdAnzIkRuz;25:6KCqU7pYME4ko9OcVqhzWT+R8OH9rYcgub6mbpXFHir8yfNMNzOlMpD2Tg++i7pZb/qvNIY5myjQ2RrducD0G1GPPXBZZ4iZmuzigC2Bju+bWyKB+v0LXcUirgiyuXF8aYQ7St75jCrWh4anM6Src7YEJXZZIVJX7llPdSUDyPxnkPYhD8NcsRwSLpYJV1JnNvLg/JSsJAZ0nTY+9GED2bpeph9nJ9zLfgX9M5QWtI8MtyvNuNKHw0g9PWg366NzwbmnYA3isy7eLYR0bnZ6EWKzHkpJ9on2DjgbQUmApwNw8LufIaOKyZFWFrpKDCRnaKoVne4Oe2CpzrF8mM0MDA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM4PR05MB1684; X-MS-Office365-Filtering-Correlation-Id: bbdbbd32-3862-4dd3-c06a-08d3485faf40 X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1684;20:qZLJA8pYJ525ZNoQHtGwORXmSJXh5gtnDNFgkyj6k+B8B47kWdrQ/QPzxlv8VcM/+gq2R2HAvr2+Qajz8hJKpgWLGALzWkcVmQRMKsyenciW0slMzeELL3pHI/YGbYKytnRgc3+EWNNe6xj1+159rLOBKHJeuhmSafPoKWhQuASFNkEg6J+rVHKgszozjbhepAOmPhPQy/SH485eEbYPH/xG97pADOgnwRYd6o1ULJgI6MIysJYQrZ3Fg7dgHWRJDFZl+36wTHW7LWtlDg8L2qm9tB7goGh8T+alWnQpG+mUw+gS3YypblHIYnYZMcNxLp+0aiixU1Z+s5uV1+kd83TmyJQECxN+Iz3MCXSHsd9x2ZJK/vHJD2WukxK4047o6L1xYaVCH9Rk3pZFOVBq71Iavrwbw4gSAlzkHa+/RrRXWXXYIUtFUKrAa77NTn5NXTuvh62b0mf9RmY/9oezn4EUjOd4fH/BvCecKHMW/KYSbh8PnRuD5zP926JufZd3;4:JAv9TkOhfCvlz0GL6FlL7VXyQIrpsq/OlTKRWsz+WCPUGT7KNRmi+pJuONGGSh8zXK7yc/UEJa0ITuXcyNz4JmEOF5HYKvM9trRvgPd6avu9/gd5rzWXz/mWllvbt5OhsdyGWu9FwsXXCrZ+7bCw5pKbhWNRnXn6BlI2jhA3ycleF3MU1ULD5kYHEhguwUkkmOGv4n+fVstm+eepbD3fzhvGlsDWmsJ/g7x1YLmCRvLna0DFpF6nMPkb5oecJpMzEkbBTLoLXh3cMeXD40JCfwA/nSW8YVmWv3LV2KtZRmXcoeoqOcgSh7/tdO38FHKrhlvg6V89xaAvcFaj/Y31Rm8Ak4kqG3/INqCA765QDCmSbYlh/EIWNgjsbcZ1vPtD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:AM4PR05MB1684;BCL:0;PCL:0;RULEID:;SRVR:AM4PR05MB1684; X-Forefront-PRVS: 0876988AF0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(479174004)(24454002)(377454003)(65956001)(77096005)(2906002)(23676002)(47776003)(86362001)(117156001)(15975445007)(59896002)(65806001)(42186005)(5004730100002)(3846002)(586003)(19580405001)(33656002)(93886004)(5008740100001)(6116002)(83506001)(36756003)(66066001)(65816999)(92566002)(64126003)(189998001)(2950100001)(110136002)(19580395003)(4326007)(80316001)(50466002)(1096002)(81166005)(230700001)(54356999)(76176999)(50986999)(87266999)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR05MB1684;H:[192.168.1.158];FPR:;SPF:None;MLV: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4AGR1CatphroTdGsol61fR/SsfuqKiqkNMy+zNuvYCD1e1b8ECwzdB/chTROsrzstkL8ApnvQ9L/RpBlJaIrnnEkcQ==;24:g0Z3L52Uk3AiBbMMwwnD4crhp2NvQx7G0Upz2JEV+qWw4WyBj3SeU7KvKMtRgQ40UeYcit765ow45KabsRyDLZqFHZNCeHi2ajlj5VC7jE4= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2016 21:13:35.7938 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB1684 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1859 Lines: 37 On 3/9/2016 4:07 PM, Andy Lutomirski wrote: > On Wed, Mar 9, 2016 at 1:05 PM, Chris Metcalf wrote: >> On 3/9/2016 3:58 PM, Andy Lutomirski wrote: >>>> My preference would be not to have to require all task-isolation users >>>>> to also figure out all the complexities of creating BPF programs, so >>>>> my intention is to have task isolation automatically generate a BPF >>>>> program (just allowing prctl/exit/exit_group and failing everything >>>>> else with SIGSYS). To support having it work this way, I open up >>>>> the seccomp stuff a little so that kernel clients can effectively >>>>> push/pop a BPF program into seccomp: >>> That sounds like a great use case for the new libtaskisolation that >>> someone is surely writing:) >> >> Happily, task isolation is so simple an API that all that is needed is a >> prctl(). >> >> ... Unless somehow a requirement to inflict a huge blob of eBPF into the >> kernel just to use task isolation safely is added, of course :-) > BPF, not eBPF. Also, it's a tiny blob. > > And this still has nothing to do with using it safely. This has to do > with catching your own bugs. Fair enough, I suppose. But I was exaggerating for effect: I still think that this is something that can be easily hidden under the prctl() to avoid adding a noticeable burden on users who want to be able to catch bugs. (And those bugs can come from third-party libraries in complex code; the amount of code in a task-isolation driver is not always easily audited, so having this kind of a backstop can be pretty useful.) If you think the basic direction of the previous patch is sound, I'll spin up the code that hooks it into task isolation, and we can see more directly whether the tradeoff of a bit more code in the kernel seems worth it. -- Chris Metcalf, Mellanox Technologies http://www.mellanox.com