From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933763AbdKAWME (ORCPT ); Wed, 1 Nov 2017 18:12:04 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:51418 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933411AbdKAWL5 (ORCPT ); Wed, 1 Nov 2017 18:11:57 -0400 Date: Wed, 1 Nov 2017 23:11:53 +0100 (CET) From: Thomas Gleixner To: Dave Hansen cc: Andy Lutomirski , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , moritz.lipp@iaik.tugraz.at, Daniel Gruss , michael.schwarz@iaik.tugraz.at, Linus Torvalds , Kees Cook , Hugh Dickins , X86 ML Subject: Re: [PATCH 02/23] x86, kaiser: do not set _PAGE_USER for init_mm page tables In-Reply-To: Message-ID: References: <20171031223146.6B47C861@viggo.jf.intel.com> <20171031223150.AB41C68F@viggo.jf.intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Nov 2017, Dave Hansen wrote: > On 11/01/2017 02:28 PM, Thomas Gleixner wrote: > > On Wed, 1 Nov 2017, Andy Lutomirski wrote: > >> The vsyscall page is _PAGE_USER and lives in init_mm via the fixmap. > > > > Groan, forgot about that abomination, but still there is no point in having > > it marked PAGE_USER in the init_mm at all, kaiser or not. > > So shouldn't this patch effectively make the vsyscall page unusable? > Any idea why that didn't show up in any of the x86 selftests? vsyscall is the legacy mechanism. Halfways modern userspace does not need it at all. The default for it is EMULATE except you set it to NATIVE either via Kconfig or on the kernel command line. Distros ship it with EMULATE set. The emulation does not use the fixmap, it traps the access and emulates it. But that aside. The point is that the fixmap exists in the init_mm and if vsyscall is enabled then its also established in the process mappings. So this can be done as a general correctness change: - Prevent USER mappings in init_mm - Make sure the fixmap gets the USER bit in the process mapping when vsyscall is in native mode. We can avoid the latter by just removing the native vsyscall support and only support emulation and none. It's about time to kill that stuff anyway. Thanks, tglx From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f199.google.com (mail-wr0-f199.google.com [209.85.128.199]) by kanga.kvack.org (Postfix) with ESMTP id F3A2C6B0261 for ; Wed, 1 Nov 2017 18:11:59 -0400 (EDT) Received: by mail-wr0-f199.google.com with SMTP id f27so1954358wra.9 for ; Wed, 01 Nov 2017 15:11:59 -0700 (PDT) Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id m5si1569811wme.22.2017.11.01.15.11.58 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 01 Nov 2017 15:11:58 -0700 (PDT) Date: Wed, 1 Nov 2017 23:11:53 +0100 (CET) From: Thomas Gleixner Subject: Re: [PATCH 02/23] x86, kaiser: do not set _PAGE_USER for init_mm page tables In-Reply-To: Message-ID: References: <20171031223146.6B47C861@viggo.jf.intel.com> <20171031223150.AB41C68F@viggo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Dave Hansen Cc: Andy Lutomirski , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , moritz.lipp@iaik.tugraz.at, Daniel Gruss , michael.schwarz@iaik.tugraz.at, Linus Torvalds , Kees Cook , Hugh Dickins , X86 ML On Wed, 1 Nov 2017, Dave Hansen wrote: > On 11/01/2017 02:28 PM, Thomas Gleixner wrote: > > On Wed, 1 Nov 2017, Andy Lutomirski wrote: > >> The vsyscall page is _PAGE_USER and lives in init_mm via the fixmap. > > > > Groan, forgot about that abomination, but still there is no point in having > > it marked PAGE_USER in the init_mm at all, kaiser or not. > > So shouldn't this patch effectively make the vsyscall page unusable? > Any idea why that didn't show up in any of the x86 selftests? vsyscall is the legacy mechanism. Halfways modern userspace does not need it at all. The default for it is EMULATE except you set it to NATIVE either via Kconfig or on the kernel command line. Distros ship it with EMULATE set. The emulation does not use the fixmap, it traps the access and emulates it. But that aside. The point is that the fixmap exists in the init_mm and if vsyscall is enabled then its also established in the process mappings. So this can be done as a general correctness change: - Prevent USER mappings in init_mm - Make sure the fixmap gets the USER bit in the process mapping when vsyscall is in native mode. We can avoid the latter by just removing the native vsyscall support and only support emulation and none. It's about time to kill that stuff anyway. Thanks, tglx -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org