From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752681AbdK0Wl2 (ORCPT ); Mon, 27 Nov 2017 17:41:28 -0500 Received: from mga03.intel.com ([134.134.136.65]:6670 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752351AbdK0Wl0 (ORCPT ); Mon, 27 Nov 2017 17:41:26 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,465,1505804400"; d="scan'208";a="10289462" Subject: Re: [PATCH 1/5] x86/mm/kaiser: Alternative ESPFIX To: Peter Zijlstra , linux-kernel@vger.kernel.org References: <20171127223110.479550152@infradead.org> <20171127223405.181647306@infradead.org> Cc: Andy Lutomirski , Ingo Molnar , Borislav Petkov , Brian Gerst , Denys Vlasenko , "H. Peter Anvin" , Josh Poimboeuf , Linus Torvalds , Rik van Riel , daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, linux-mm@kvack.org, michael.schwarz@iaik.tugraz.at, moritz.lipp@iaik.tugraz.at, richard.fellner@student.tugraz.at From: Dave Hansen Message-ID: <7ba63732-8824-bb2b-d66b-bddd823de8e8@linux.intel.com> Date: Mon, 27 Nov 2017 14:41:24 -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: <20171127223405.181647306@infradead.org> 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/27/2017 02:31 PM, Peter Zijlstra wrote: > Change the asm to do the CR3 switcheroo so we can remove the magic > mappings. > > Since RDI is unused after SWAPGS we can use it as a scratch reg for > SWITCH_TO_KERNEL. And once we've computed the new RSP (in RAX) we no > longer need RDI and can again use it as scratch reg for > SWITCH_TO_USER. This definitely looks like the right thing. Either I missed something obvious before, or Andy's entry rework made this much more obviously correct to do the simple thing here.