From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755523AbdKJBWf (ORCPT ); Thu, 9 Nov 2017 20:22:35 -0500 Received: from mga01.intel.com ([192.55.52.88]:38072 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755255AbdKJBWe (ORCPT ); Thu, 9 Nov 2017 20:22:34 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,371,1505804400"; d="scan'208";a="989709" Subject: Re: [PATCH 24/30] x86, kaiser: disable native VSYSCALL To: Andy Lutomirski References: <20171108194646.907A1942@viggo.jf.intel.com> <20171108194731.AB5BDA01@viggo.jf.intel.com> <6871f284-b7e9-f843-608f-5345f9d03396@linux.intel.com> <27b55108-1e72-cb3d-d5d8-ffe0238245aa@linux.intel.com> Cc: "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , moritz.lipp@iaik.tugraz.at, Daniel Gruss , michael.schwarz@iaik.tugraz.at, richard.fellner@student.tugraz.at, Linus Torvalds , Kees Cook , Hugh Dickins , X86 ML From: Dave Hansen Message-ID: <4c8c441e-d65c-fcec-7718-6997bd010971@linux.intel.com> Date: Thu, 9 Nov 2017 17:22:33 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/09/2017 05:04 PM, Andy Lutomirski wrote: > On Thu, Nov 9, 2017 at 4:57 PM, Dave Hansen wrote: >> On 11/09/2017 04:53 PM, Andy Lutomirski wrote: >>>> The KAISER code attempts to "poison" the user portion of the kernel page >>>> tables. It detects the entries pages that it wants that it wants to >>>> poison in two ways: >>>> * Looking for addresses >= PAGE_OFFSET >>>> * Looking for entries without _PAGE_USER set >>> What do you mean "poison"? >> >> I meant the _PAGE_NX magic that we do in here: >> >> https://git.kernel.org/pub/scm/linux/kernel/git/daveh/x86-kaiser.git/commit/?h=kaiser-414rc7-20171108&id=c4f7d0819170761f092fcf2327b85b082368e73a >> >> to ensure that userspace is unable to run on the kernel PGD. > > Aha, I get it. Why not just drop the _PAGE_USER check? You could > instead warn if you see a _PAGE_USER page that doesn't have the > correct address for the vsyscall. The _PAGE_USER check helps us with kernel things that want to create mappings below PAGE_OFFSET. The EFI code was the prime user for this. Without this, we poison the EFI mappings and the EFI calls die. I think there might have also been a case for the secondary CPU bringup that needed hacking if we didn't do this.