From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752982AbbJPWni (ORCPT ); Fri, 16 Oct 2015 18:43:38 -0400 Received: from mail.kernel.org ([198.145.29.136]:39573 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752769AbbJPWnD (ORCPT ); Fri, 16 Oct 2015 18:43:03 -0400 From: Andy Lutomirski To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Brian Gerst , Denys Vlasenko , Borislav Petkov , Andy Lutomirski Subject: [PATCH v2 2/2] x86/entry/32: Fix FS and GS restore in opportunistic SYSEXIT Date: Fri, 16 Oct 2015 15:42:55 -0700 Message-Id: <461e5c7d8fa3821529893a4893ac9c4bc37f9e17.1445035014.git.luto@kernel.org> X-Mailer: git-send-email 2.4.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We either need to restore them before popping and thus changing ESP, or we need to adjust the offsets. The former is simpler. Fixes: 5f310f739b4c x86/entry/32: ("Re-implement SYSENTER using the new C path") Signed-off-by: Andy Lutomirski --- arch/x86/entry/entry_32.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index ba0dad937be9..e3ede42d30e2 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -315,6 +315,8 @@ sysenter_past_esp: TRACE_IRQS_ON /* User mode traces as IRQs on. */ movl PT_EIP(%esp), %edx /* pt_regs->ip */ movl PT_OLDESP(%esp), %ecx /* pt_regs->sp */ +1: mov PT_FS(%esp), %fs + PTGS_TO_GS popl %ebx /* pt_regs->bx */ popl %eax /* skip pt_regs->cx */ popl %eax /* skip pt_regs->dx */ @@ -322,8 +324,6 @@ sysenter_past_esp: popl %edi /* pt_regs->di */ popl %ebp /* pt_regs->bp */ popl %eax /* pt_regs->ax */ -1: mov PT_FS(%esp), %fs - PTGS_TO_GS /* * Return back to the vDSO, which will pop ecx and edx. -- 2.4.3