Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753648AbeAQPZL (ORCPT + 1 other); Wed, 17 Jan 2018 10:25:11 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:42310 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753550AbeAQPZG (ORCPT ); Wed, 17 Jan 2018 10:25:06 -0500 Subject: Re: [PATCH 02/16] x86/entry/32: Enter the kernel via trampoline stack To: Andrew Cooper , Joerg Roedel Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long , jroedel@suse.de References: <1516120619-1159-1-git-send-email-joro@8bytes.org> <1516120619-1159-3-git-send-email-joro@8bytes.org> <476d7100-2414-d09e-abf1-5aa4d369a3b7@oracle.com> <20180117090238.GH28161@8bytes.org> <97298add-9484-7d83-50a3-1c668ce3107d@citrix.com> From: Boris Ostrovsky Message-ID: Date: Wed, 17 Jan 2018 10:22:24 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <97298add-9484-7d83-50a3-1c668ce3107d@citrix.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8776 signatures=668653 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801170219 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 01/17/2018 09:04 AM, Andrew Cooper wrote: > On 17/01/18 09:02, Joerg Roedel wrote: >> Hi Boris, >> >> thanks for testing this :) >> >> On Tue, Jan 16, 2018 at 09:47:06PM -0500, Boris Ostrovsky wrote: >>> On 01/16/2018 11:36 AM, Joerg Roedel wrote: >>>> +.macro SWITCH_TO_KERNEL_STACK nr_regs=0 check_user=0 >>> This (and next patch's SWITCH_TO_ENTRY_STACK) need X86_FEATURE_PTI check. >>> >>> With those macros fixed I was able to boot 32-bit Xen PV guest. >> Hmm, on bare metal the stack switch happens regardless of the >> X86_FEATURE_PTI feature being set, because we always program tss.sp0 >> with the systenter stack. How is the kernel entry stack setup on xen-pv? >> I think something is missing there instead. > There is one single stack registered with Xen, on which you get a normal > exception frame in all cases, even via the registered (virtual) > syscall/sysenter/failsafe handlers. And so the check should be at least against X86_FEATURE_XENPV, not necessarily X86_FEATURE_PTI. But I guess you can still check against X86_FEATURE_PTI since without it there is not much reason to switch stacks? -boris