From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754291AbdHURYk (ORCPT ); Mon, 21 Aug 2017 13:24:40 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:46726 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754233AbdHURYh (ORCPT ); Mon, 21 Aug 2017 13:24:37 -0400 Date: Mon, 21 Aug 2017 19:24:25 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Andy Lutomirski , Will Deacon , Mark Rutland , Matt Fleming , Ard Biesheuvel , Sai Praneeth Prakhya , "linux-efi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , joeyli , Borislav Petkov , "Michael S. Tsirkin" , "Neri, Ricardo" , "Ravi V. Shankar" Subject: Re: [PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with cr3 Message-ID: <20170821172425.5axqiwnef5gkaz23@hirez.programming.kicks-ass.net> References: <20170816095338.GB17270@leverpostej> <20170816100709.GG12845@arm.com> <20170816110321.GC17270@leverpostej> <20170816125715.GB3384@codeblueprint.co.uk> <20170815223541.GA25778@remoulade> <20170817103514.GC27872@arm.com> <20170821103359.jt2xf2cx5wxjldau@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 21, 2017 at 06:56:01AM -0700, Andy Lutomirski wrote: > There are two ways this could be a problem. One is that u privileged > user apps shouldn't be able to read from EFI memory. The other is > that, if EFI were to have IO memory mapped at a "user" address, perf > could end up reading it. So assuming the efi_switch_mm() case from the calling thread context, I don't see how we can avoid it at all. Suppose we have a free running PEBS counter (PEBS puts samples in DS buffer and only raises PMI when 'full'). This can easily cover the entire efi_switch_mm() and back swizzle, and then we have 'userspace' samples that don't correspond to actual userspace. EFI (pretending to be userspace) is a giant trainwreck.