Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754897AbeAHBdx (ORCPT + 1 other); Sun, 7 Jan 2018 20:33:53 -0500 Received: from sonic302-26.consmr.mail.gq1.yahoo.com ([98.137.68.152]:41652 "EHLO sonic302-26.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754803AbeAHBdv (ORCPT ); Sun, 7 Jan 2018 20:33:51 -0500 X-YMail-OSG: 3Koyl_IVM1k4guQNRbLDAyEbbtqOaSMpj_DgMrtWtfNH1SMT9.49AEuX8rzNDYW GAfLlPEoxrPJQRXRRIvOqBhNH5zLRi11SFy_uKHNF5r2aS8_Szeir_pWvOieY00RqhaU0vAqhLMl G7NrjRisVv2ZY24nfX7Xi9sm414U3T8KhKczZrLI87_zCfDHNX5J7VqvdOX82HNLVn7iq4YEg8n7 YAULCeahqcRhlI.EoSenDNc9AcQlZ8o23ST45rFSNobcfH_jI5.0129BtTUuEHVNTZAPNuQyAByX HjJp4ZbcDovitjs1Cx9oMNBT.2c_7wj_L.GmGnmtyHW.W8GkbtycdJn9Y6HsbFI7V_PsF1VSSQHJ wlZmLcc7JM23WY379TOwIiEIQA5ip7Km50X2HFCzUWhicOmLZprlRskrDTQqM3qnYiRqq3uqob3p kca0SnFQGqRurC97V8lMIk5BEzlT_JNdNPRD0Tr.auIgVfguFkxh_cUogMxMrPtsS9dfO_YIVGx1 zft_jJycDnbbgcfTrQBR4lbciPUOfqhDJ3Q-- Subject: Re: Proposal: CAP_PAYLOAD to reduce Meltdown and Spectre mitigation costs To: Avi Kivity , "linux-kernel@vger.kernel.org" , LSM References: From: Casey Schaufler Message-ID: <19dd9dfc-88c5-530c-67eb-3c9822b2be43@schaufler-ca.com> Date: Sun, 7 Jan 2018 17:33:48 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 1/6/2018 11:33 AM, Avi Kivity wrote: > Meltdown and Spectre mitigations focus on protecting the kernel from a hostile userspace. However, it's not a given that the kernel is the most important target in the system. It is common in server workloads that a single userspace application contains the valuable data on a system, and if it were hostile, the game would already be over, without the need to compromise the kernel. > > > In these workloads, a single application performs most system calls, and so it pays the cost of protection, without benefiting from it directly (since it is the target, rather than the kernel). > > > I propose to create a new capability, CAP_PAYLOAD, that allows the system administrator to designate an application as the main workload in that system. Other processes (like sshd or monitoring daemons) exist to support it, and so it makes sense to protect the rest of the system from their being compromised. As one of the authors of the POSIX 1003.1e/2c WITHDRAWN DRAFT capability specification I emphatically NAK this proposal. This is nothing like what capabilities are for. It doesn't fit the use model and it isn't in any way related to enforcing system security policy. > When the kernel switches to user mode of a CAP_PAYLOAD process, it doesn't switch page tables and instead leaves the kernel mapped into the adddress space (still with supervisor protection, of course). This reduces context switch cost, and will also reduce interrupt costs if the interrupt happens while that process executes. Since a CAP_PAYLOAD process is likely to consume the majority of CPU time, the costs associated with Meltdown mitigation are almost completely nullified. This is a horrible hack. The potential for exploitable edge cases is enormous. > CAP_PAYLOAD has potential to be abused; Yet another really, really good reason not to implement it. > every software vendor will be absolutely certain that their application is the reason the universe (let alone that server) exists and they will turn it on, so init systems will have to work to make it doesn't get turned on without administrator opt-in. It's also not perfect, since if there is a payload application compromise, in addition to stealing the application's data ssh keys can be stolen too. But I think it's better than having to choose between significantly reduced performance and security. You get performance for your important application, and protection against the possibility that a remote exploit against a supporting process turns into a remote exploit against that important application. This is just not a viable use of the capability mechanism. I am not at liberty to comment on any aspect of the exploits du'jour, so suggesting alternatives is not something I can do just now.