Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1605102ybz; Sun, 26 Apr 2020 00:02:16 -0700 (PDT) X-Google-Smtp-Source: APiQypIqyQ4rcpmj4JTOt+efubfLfML5aoT5QMjXXZSHhPBqKXpq83TBVyb/jzYASn3xbW7pl7lQ X-Received: by 2002:a17:906:bb07:: with SMTP id jz7mr13908455ejb.317.1587884536297; Sun, 26 Apr 2020 00:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587884536; cv=none; d=google.com; s=arc-20160816; b=1Izlnqexfb3leyfqlMA9ddgb83GxcjLjsZuTC2jvUErS5MES0AZxC1+hGrs5oIPi/z Ub7J7RAVxkHKIevwoqI8IWxsdXv/e+SNiiy1qqQq1F8UsWQIpnFC3WlrrZaS8xMdjeQq jkUk2omBqEOiygYU2CC43l7EoFWqi3FWGS8+6mVehQXsPueWeXP2Hv8jQyj3Ua49azux /116BCyflN3pU7JZLHs7tQm4oeUBRz5IC2utfYFRVAFGHPKEUU8kss8USJHcvyMZICsS EcNqi78ke4KGJ+1d6+yxENdZOeixLa6rG21h1NTfce5tgR6STonSVRe9f04GARWMEyNL PiWQ== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=HDL+tHo+UHqTyew7SA/XIigV0EkQUNFyRtGwp3Pi0CU=; b=ObW48zDXOKmI0Uf3pwiP6RbPFiqHg90UatXZcHn8GGcENM7FLNYhnlW+JtzTMcx70+ klg9o6HiVbWujQ85dLw1kY29DNCs+tEDJV/yBWwmvgIy7JTg96KRB1Rf52G0CmeIXDjh C2jfwXYstQ9Vd8VfLt4OVVsAFJlYxkWtXHvab11/RPELm8CfkH7GQjN9dtdIJJA1fSbl NL/QGGj2rsWsKc7quoFVQmpjDNGbBijQZ9EcOqAMfguWa5UMICE4B0MMwOywtPwcokgK OBxeg5G+sdHKFwT8aszMxqs/5MOT1W55QM6kPA9eobjhSM1fX1wG1pCa+yXwwsjTHRZX U3Lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a23si6181716ejv.375.2020.04.26.00.01.53; Sun, 26 Apr 2020 00:02:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726323AbgDZGry (ORCPT + 99 others); Sun, 26 Apr 2020 02:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726251AbgDZGrx (ORCPT ); Sun, 26 Apr 2020 02:47:53 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 135F0C061A0E; Sat, 25 Apr 2020 23:47:53 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jSb4p-0008Uj-NN; Sun, 26 Apr 2020 08:47:43 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 5849F1C0330; Sun, 26 Apr 2020 08:47:43 +0200 (CEST) Date: Sun, 26 Apr 2020 06:47:42 -0000 From: "tip-bot2 for Josh Poimboeuf" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/entry/64: Fix unwind hints in kernel exit path Cc: Vince Weaver , Dave Jones , "Dr. David Alan Gilbert" , Joe Mario , Jann Horn , Linus Torvalds , Miroslav Benes , Josh Poimboeuf , Ingo Molnar , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , x86 , LKML In-Reply-To: <60ea8f562987ed2d9ace2977502fe481c0d7c9a0.1587808742.git.jpoimboe@redhat.com> References: <60ea8f562987ed2d9ace2977502fe481c0d7c9a0.1587808742.git.jpoimboe@redhat.com> MIME-Version: 1.0 Message-ID: <158788366294.28353.13038416307044000632.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 1fb143634a38095b641a3a21220774799772dc4c Gitweb: https://git.kernel.org/tip/1fb143634a38095b641a3a21220774799772dc4c Author: Josh Poimboeuf AuthorDate: Sat, 25 Apr 2020 05:03:02 -05:00 Committer: Ingo Molnar CommitterDate: Sat, 25 Apr 2020 12:22:27 +02:00 x86/entry/64: Fix unwind hints in kernel exit path In swapgs_restore_regs_and_return_to_usermode, after the stack is switched to the trampoline stack, the existing UNWIND_HINT_REGS hint is no longer valid, which can result in the following ORC unwinder warning: WARNING: can't dereference registers at 000000003aeb0cdd for ip swapgs_restore_regs_and_return_to_usermode+0x93/0xa0 For full correctness, we could try to add complicated unwind hints so the unwinder could continue to find the registers, but when when it's this close to kernel exit, unwind hints aren't really needed anymore and it's fine to just use an empty hint which tells the unwinder to stop. For consistency, also move the UNWIND_HINT_EMPTY in entry_SYSCALL_64_after_hwframe to a similar location. Fixes: 3e3b9293d392 ("x86/entry/64: Return to userspace from the trampoline stack") Reported-by: Vince Weaver Reported-by: Dave Jones Reported-by: Dr. David Alan Gilbert Reported-by: Joe Mario Reported-by: Jann Horn Reported-by: Linus Torvalds Reviewed-by: Miroslav Benes Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Link: https://lore.kernel.org/r/60ea8f562987ed2d9ace2977502fe481c0d7c9a0.1587808742.git.jpoimboe@redhat.com --- arch/x86/entry/entry_64.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 0e9504f..6b0d679 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -249,7 +249,6 @@ SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_GLOBAL) */ syscall_return_via_sysret: /* rcx and r11 are already restored (see code above) */ - UNWIND_HINT_EMPTY POP_REGS pop_rdi=0 skip_r11rcx=1 /* @@ -258,6 +257,7 @@ syscall_return_via_sysret: */ movq %rsp, %rdi movq PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %rsp + UNWIND_HINT_EMPTY pushq RSP-RDI(%rdi) /* RSP */ pushq (%rdi) /* RDI */ @@ -637,6 +637,7 @@ SYM_INNER_LABEL(swapgs_restore_regs_and_return_to_usermode, SYM_L_GLOBAL) */ movq %rsp, %rdi movq PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %rsp + UNWIND_HINT_EMPTY /* Copy the IRET frame to the trampoline stack. */ pushq 6*8(%rdi) /* SS */