From patchwork Thu Oct 5 08:28:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 148738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp335604vqb; Thu, 5 Oct 2023 07:26:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLqj1CZM0m4RCB9UJgIWgQpTapjZ1Nc0tngtAoOofHKyy9Lotb+Qw8mTn/49P1UHrezqnd X-Received: by 2002:a05:6830:128c:b0:6b9:c4b1:7a86 with SMTP id z12-20020a056830128c00b006b9c4b17a86mr5724678otp.3.1696515982810; Thu, 05 Oct 2023 07:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696515982; cv=none; d=google.com; s=arc-20160816; b=Vh9q8y8tknKfNrbEURnjhQ6Shb3hWd9lHO0d2nJQnAhmSWaGEQKQ8aNHd06FRcaROU 3aKZ+nuA1mV9aIgfq1QN7ThmzzZM0bUKovuzsUuU/CuEyzEqim/lhUcYPM0KkMbDomn0 5WGubutDj6K1yeTkpGUllJgoH6BrGC3bHwCBrfFOTQR8/nMInwShunPRMymrKNfDkb6L p7h7YtRuby1IAOi+uaoaKoQj0p0oFMvExKdCBsKJ62y1Vf35iExWn1JSKaxTrXslmPBy oFBFrhYblWh53yAKFcyWco3CkVJK/OjBbpcOkAWB18xJG41eIOnOG+4h1Q5hfVXHP21G DTkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=evv78FngNWctCCQEqys9FY9hmwWT89p4vAJNsmIFnPQ=; fh=wFnicNmHvAcvy9ic2dM2Yls9LLSGIrhlsmizWYA3+V0=; b=DTzEMvcwSzKhNBMP6ZgxiGPCcRAXfkomlFIv6NZbO2cqZSytXduBITgDQ2iiSXkME0 aPESqtq6bmpntTvZg3/Pw016aL4s6zx13IcLTtVGPtUuoga5d3WMlHXNAs9cuP/psyHG iypsqCUBNg669k6iPDTa2glymkMGL3HP4Ju4QCAFlXVq0PmIcWwG/6NWgDBn/a8iWs+2 x7NVwGxdOoy1cY9fMHW3KIxrbqxk+ilBM3AJlvfjSo1HekZM/SunCvRePCFd/mmft3I6 rdCq5SqQ4/L9B8GqT0icGpPk501Ic6Rdr4SZ+NRfmRMpBmPmpv7xupwTaiJd8g52hEWO uGaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=aObYPq5u; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m16-20020a63fd50000000b00565eedb1cf8si1531974pgj.825.2023.10.05.07.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:26:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=aObYPq5u; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B6D2180C5918; Thu, 5 Oct 2023 07:25:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234022AbjJEOZY (ORCPT + 19 others); Thu, 5 Oct 2023 10:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234663AbjJEOX2 (ORCPT ); Thu, 5 Oct 2023 10:23:28 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A488A6E; Thu, 5 Oct 2023 01:28:41 -0700 (PDT) Date: Thu, 05 Oct 2023 08:28:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696494517; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=evv78FngNWctCCQEqys9FY9hmwWT89p4vAJNsmIFnPQ=; b=aObYPq5udMMfdIGZTa6kExWAL97kTfvpDf0PUvExGbpnJItcBgr3hihVemDnGJs2xKylUO Ewj5jkyhwpEcOkzfar04mYCplHjOSK/gwOqCh8Jje9a97Js/NiI2HMpJ7FqaUvzL8easUk HCjsyQH/LoJv91BcCcQfg5jLxmp7+R+5GClvXtpJFT/zbGapevsuWuu69uv1/0aKHhp/lZ +81Xv/3T2I7lRKMvQyGDOFYO596MYw0GoAWiL7PLjkA1AVxJAuHiT+vhJaw5wRwp2i7sKz 3KN3xkbJi6Ed6pvQWO7MBxZ//2b9PmM7sHIg/8Jl1y5z/FXKnQgqPsAyZgpjlg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696494517; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=evv78FngNWctCCQEqys9FY9hmwWT89p4vAJNsmIFnPQ=; b=5olFckmS8ifLH2QY1VVYjppNKgUwC/cjygXTXciZV4oXgZmwdU3XCFU8qI/omCPK6myLNi qi1YS26NDE8n40Cg== From: "tip-bot2 for Brian Gerst" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/entry] x86/entry/64: Remove obsolete comment on tracing vs. SYSRET Cc: Brian Gerst , Ingo Molnar , Andy Lutomirski , Denys Vlasenko , "H. Peter Anvin" , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230721161018.50214-2-brgerst@gmail.com> References: <20230721161018.50214-2-brgerst@gmail.com> MIME-Version: 1.0 Message-ID: <169649451666.3135.702628742900040217.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:25:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772050780878678306 X-GMAIL-MSGID: 1778925942738697963 The following commit has been merged into the x86/entry branch of tip: Commit-ID: eb43c9b1517b48e2ff0d3a584aca197338987d7b Gitweb: https://git.kernel.org/tip/eb43c9b1517b48e2ff0d3a584aca197338987d7b Author: Brian Gerst AuthorDate: Fri, 21 Jul 2023 12:10:12 -04:00 Committer: Ingo Molnar CommitterDate: Thu, 05 Oct 2023 10:06:42 +02:00 x86/entry/64: Remove obsolete comment on tracing vs. SYSRET This comment comes from a time when the kernel attempted to use SYSRET on all returns to userspace, including interrupts and exceptions. Ever since commit fffbb5dc ("Move opportunistic sysret code to syscall code path"), SYSRET is only used for returning from system calls. The specific tracing issue listed in this comment is not possible anymore. Signed-off-by: Brian Gerst Signed-off-by: Ingo Molnar Cc: Andy Lutomirski Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Josh Poimboeuf Link: https://lore.kernel.org/r/20230721161018.50214-2-brgerst@gmail.com --- arch/x86/entry/entry_64.S | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index f71664d..7574639 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -166,22 +166,9 @@ SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_GLOBAL) jne swapgs_restore_regs_and_return_to_usermode /* - * SYSCALL clears RF when it saves RFLAGS in R11 and SYSRET cannot - * restore RF properly. If the slowpath sets it for whatever reason, we - * need to restore it correctly. - * - * SYSRET can restore TF, but unlike IRET, restoring TF results in a - * trap from userspace immediately after SYSRET. This would cause an - * infinite loop whenever #DB happens with register state that satisfies - * the opportunistic SYSRET conditions. For example, single-stepping - * this user code: - * - * movq $stuck_here, %rcx - * pushfq - * popq %r11 - * stuck_here: - * - * would never get past 'stuck_here'. + * SYSRET cannot restore RF. It can restore TF, but unlike IRET, + * restoring TF results in a trap from userspace immediately after + * SYSRET. */ testq $(X86_EFLAGS_RF|X86_EFLAGS_TF), %r11 jnz swapgs_restore_regs_and_return_to_usermode