Received: by 10.223.185.116 with SMTP id b49csp3095617wrg; Mon, 5 Mar 2018 14:07:06 -0800 (PST) X-Google-Smtp-Source: AG47ELuIOzmIYnUKYQ6a2OhTRxgU1fhzWtImvLUwqpDkZrGNrA8ge02T2NJIgJa9lzbxp41t09sj X-Received: by 10.99.0.207 with SMTP id 198mr13478806pga.364.1520287626570; Mon, 05 Mar 2018 14:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520287626; cv=none; d=google.com; s=arc-20160816; b=LCXW87djfR4nZGEX7SAYVTq4KaPoZd2ql5mcSbhMzPDvXOF9pg3GRVTVq47lazxpqt 6YqV+kPRP8Bi8XGLOXb4wINCBkwJQKc07I/GgZdAUwHA5wiPWtbwhfxpY4VtnSERf6v9 A7+jY+DHHzCzxEXH0dUZR/kZNLmuRm9+FOZauLNKmQOCZSgIofv8NO8pPaL2Lf2TMULe uSCfAZ5QjdLyB217qzumquVkKjLxO4pTJejXE2qHmWOTKnlpM1EexqbV+mjGS0niVd4Y iXy6ukCMfWzfxJU19SUwMvEVeS5Of8X43idtZoEeOFZS7CiHwrIoB7pyMjmMc2MsMraz 3TFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=w4JdNVpVsABRvqE0ppguRRdKYI9Z+Z9UJfxVRuWA4p4=; b=W9NINpm0LfdrK+uFLqj9D5pFjHA5XaD65ZdaAMMWfxJ8SFhm16TQoQVLnD1IidmoRW dfobKMzdr5hzS1aof1IJz+tC3jJajEgiVgsdMe7HqAmSILdiOhg6XkZM6ELxAiEwRneW Liof5hn5oGBSdocM4gNuh6od4twr1SNmklhCgE+OK5aw7fNHk0rUBK/ftYCfDYwD8gy+ UfXglv8X2IWYOw+VWfpQOz3NgtNU5es5xVelVLC89qQ9E7JaebFCegS9W4X/++qHBqvC XexHNSOrzDe0J7HdwvjhHvSHZJP0+hygqPf2TxhDEf+TmolLmOwkDRjWBGMugRDUP4Ka 6chA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3-v6si9931707plb.480.2018.03.05.14.06.52; Mon, 05 Mar 2018 14:07:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753303AbeCEWFu (ORCPT + 99 others); Mon, 5 Mar 2018 17:05:50 -0500 Received: from terminus.zytor.com ([198.137.202.136]:45349 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752063AbeCEWFt (ORCPT ); Mon, 5 Mar 2018 17:05:49 -0500 Received: from carbon-x1.hos.anvin.org (c-24-5-245-234.hsd1.ca.comcast.net [24.5.245.234] (may be forged)) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id w25M3tTq023635 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 5 Mar 2018 14:03:55 -0800 Subject: Re: [PATCH 07/34] x86/entry/32: Restore segments before int registers To: Linus Torvalds , Joerg Roedel Cc: Brian Gerst , Thomas Gleixner , Ingo Molnar , the arch/x86 maintainers , Linux Kernel Mailing List , linux-mm , Andrew Lutomirski , Dave Hansen , Josh Poimboeuf , =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , David Laight , Denys Vlasenko , Eduardo Valentin , Greg Kroah-Hartman , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Pavel Machek , Joerg Roedel References: <1520245563-8444-1-git-send-email-joro@8bytes.org> <1520245563-8444-8-git-send-email-joro@8bytes.org> <20180305131231.GR16484@8bytes.org> <20180305213550.GV16484@8bytes.org> From: "H. Peter Anvin" Message-ID: <12c11262-5e0f-2987-0a74-3bde4b66c352@zytor.com> Date: Mon, 5 Mar 2018 14:03:49 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/05/18 13:58, Linus Torvalds wrote: > On Mon, Mar 5, 2018 at 1:35 PM, Joerg Roedel wrote: >> On Mon, Mar 05, 2018 at 12:50:33PM -0800, Linus Torvalds wrote: >>> >>> Ahh, good. So presumably Joerg actually did check it, just didn't even notice ;) >> >> Yeah, sort of. I ran the test, but it didn't catch the failure case in >> previous versions which was return to user with kernel-cr3 :) > > Ahh. Yes, that's bad. The NX protection to guarantee that you don't > return to user mode was really good on x86-64. > > So some other case could slip through, because user code can happily > run with the kernel page tables. > >> I could probably add some debug instrumentation to check for that in my >> future testing, as there is no NX protection in the user address-range >> for the kernel-cr3. > > Does not NX work with PAE? > > Oh, it looks like the NX bit is marked as "RSVD (must be 0)" in the > PDPDT. Oh well. > On NX-enabled hardware NX works with PDE, but the PDPDT in general doesn't have permission bits (it's really more of a set of four CR3s than a page table level.) -hpa