Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35048814rwd; Mon, 10 Jul 2023 01:37:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlEfAFEfzVgfNaB9qCdhPFJ4H8Hm3T8i5Ot+1GtCtxS+rXoHaWA9ITbUg55me9BYT+GH6fLc X-Received: by 2002:a17:906:51cd:b0:993:d6e8:2386 with SMTP id v13-20020a17090651cd00b00993d6e82386mr8220755ejk.16.1688978246406; Mon, 10 Jul 2023 01:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688978246; cv=none; d=google.com; s=arc-20160816; b=r+D/y8tdAt/YRSHcnvxXBqoktTr26xLMjJxEapKejnti+Prgt4q9g86oPkWMFZeSgR QS0jdKbc21K33Q+oD/OS5dqV6vR2EwgG7ywoh2I2etCrd0rH71UYmq/YkA1F0Jj4dwcD 6bmSuI2iwfDr5P4krim6e9ZfKPmNs1GUrIxZUOmq6tvttzHPPY6Tki7QEGbvrCgaBXH+ fufgRwuK/MCz3pSN6+RDnkfuz/ngRvzwt7z8MHoESMfGdCXd9bATeFv5soRhdbk+yV7c Lgp0TJo4MT/gruB1WhFMOQodXq+hNCHCkoehduAAEnR64uXyfTdR1Yn2m/H/yYnM2CxB yZxQ== 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=EOtDsWidxulmTHHJmhH5S2A/34jwRP1wgHitph7bleo=; fh=PK9Ni4Z6k2JNEZEkuWt1R7XDlExCoWxEbGPoLHJ2kjM=; b=MklWIoja7HHQiXHkJLmROtYUI7+PcuOoPaHmWFNxilZb6tet5vi+8/2+jbluofUdjZ TLcWWtXOU0p/OfrBZsJxeyw7PbqjIiu7WKNw9RmJ3TcWbKdhoTcKWtY0bnwsMWKY3SO/ MEm+mh3HJ8sybi8CaTXHwdoRdslpn5moOdlGmNVFYZk89Yg/ipx3sQKHsPS5ovQdz2aZ nz2uovKTv2cp5tk50ZB8j/yS0M0UVIfJUv3VAA4fyYQSW8HkjWDXAjAMMJr2SfsXejoO dBXfx5IOh59qH/xLBikKdPvgVevxiR0d2UPIHwtX2eMnZzIboRyd5LD1jNHEs9aAbiii bEfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CMAFuLvV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=UoE61XaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id le15-20020a170906ae0f00b00992d262fb29si8550671ejb.992.2023.07.10.01.37.02; Mon, 10 Jul 2023 01:37:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CMAFuLvV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=UoE61XaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232851AbjGJIPl (ORCPT + 99 others); Mon, 10 Jul 2023 04:15:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232674AbjGJIN7 (ORCPT ); Mon, 10 Jul 2023 04:13:59 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AFB3E7; Mon, 10 Jul 2023 01:13:58 -0700 (PDT) Date: Mon, 10 Jul 2023 08:13:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1688976837; 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=EOtDsWidxulmTHHJmhH5S2A/34jwRP1wgHitph7bleo=; b=CMAFuLvV6wWa7N1QaRCCIF/B4d4m3lIIsKs2JoZZ3w0NO+tCfCLRs9S8AQ0H99eZ43avSq L+EBT1WhAFH7fGUxx37mV0Nm66i6xsKVAqUMwWuWC7TlEQ9tUhvaQ3GcDEYS/48ch6hDr4 Bx8gmoB0PBcz5G3HNkfkKt5XWUXGjUJpbQWTroZpol6HlKN9EU6Nvf8UEqiQtL710eHfBh ADAcMv+hHPuy0qRhSHxyVZCF/boW5ECqAZyWFNKDqGza4UzlYd6axujCpD9xybWc1BKPHR K1cGNDQs03lFnQ3POYrAYdS42/WnI3oY+MtSxqndPhkgNc6ozO3tJn4yygGPMQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1688976837; 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=EOtDsWidxulmTHHJmhH5S2A/34jwRP1wgHitph7bleo=; b=UoE61XaP+CqBT7jo5KbtTwuTHuI6MnB4xwFKnqpGlwqwNAeujkEEP53JPZgekTZuxpDt2M g96cji8O0w5zM/Cg== 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/urgent] x86/32: Remove schedule_tail_wrapper() Cc: Brian Gerst , "Peter Zijlstra (Intel)" , Kees Cook , Sami Tolvanen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230623225529.34590-2-brgerst@gmail.com> References: <20230623225529.34590-2-brgerst@gmail.com> MIME-Version: 1.0 Message-ID: <168897683652.404.733058783899665441.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 81f755d561f365f544795fad92f05a085ea4f292 Gitweb: https://git.kernel.org/tip/81f755d561f365f544795fad92f05a085ea4f292 Author: Brian Gerst AuthorDate: Fri, 23 Jun 2023 18:55:28 -04:00 Committer: Peter Zijlstra CommitterDate: Mon, 10 Jul 2023 09:52:24 +02:00 x86/32: Remove schedule_tail_wrapper() The unwinder expects a return address at the very top of the kernel stack just below pt_regs and before any stack frame is created. Instead of calling a wrapper, set up a return address as if ret_from_fork() was called from the syscall entry code. Signed-off-by: Brian Gerst Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Kees Cook Reviewed-by: Sami Tolvanen Link: https://lkml.kernel.org/r/20230623225529.34590-2-brgerst@gmail.com --- arch/x86/entry/entry_32.S | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index 91397f5..e56123f 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -720,26 +720,6 @@ SYM_CODE_END(__switch_to_asm) .popsection /* - * The unwinder expects the last frame on the stack to always be at the same - * offset from the end of the page, which allows it to validate the stack. - * Calling schedule_tail() directly would break that convention because its an - * asmlinkage function so its argument has to be pushed on the stack. This - * wrapper creates a proper "end of stack" frame header before the call. - */ -.pushsection .text, "ax" -SYM_FUNC_START(schedule_tail_wrapper) - FRAME_BEGIN - - pushl %eax - call schedule_tail - popl %eax - - FRAME_END - RET -SYM_FUNC_END(schedule_tail_wrapper) -.popsection - -/* * A newly forked process directly context switches into this address. * * eax: prev task we switched from @@ -748,16 +728,23 @@ SYM_FUNC_END(schedule_tail_wrapper) */ .pushsection .text, "ax" SYM_CODE_START(ret_from_fork) - call schedule_tail_wrapper + /* return address for the stack unwinder */ + pushl $.Lsyscall_32_done + + FRAME_BEGIN + pushl %eax + call schedule_tail + addl $4, %esp + FRAME_END testl %ebx, %ebx jnz 1f /* kernel threads are uncommon */ 2: /* When we fork, we trace the syscall return in the child, too. */ - movl %esp, %eax + leal 4(%esp), %eax call syscall_exit_to_user_mode - jmp .Lsyscall_32_done + RET /* kernel thread */ 1: movl %edi, %eax