Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp480604lqi; Thu, 7 Mar 2024 03:05:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUooVTz/wDmz2ojjQ9baJGbucn2LyVdKl3lmiwLTAzC4Ov+HVlzL8ddcAljrwgK673/z5bwK1ivGGJ8pLIx0FkctQu1pdL6qXhxF+ijDw== X-Google-Smtp-Source: AGHT+IEV2SzoFjn/+yjertsAjQG3xIBPjAfERe4i+ot+wl84ZuqZluJ41bPVr0x1MNDFBQNP/7+X X-Received: by 2002:a05:6402:1e86:b0:565:3aa7:565f with SMTP id f6-20020a0564021e8600b005653aa7565fmr10957402edf.8.1709809513020; Thu, 07 Mar 2024 03:05:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709809513; cv=pass; d=google.com; s=arc-20160816; b=IBe5BMEUaqyvLKrl2i6qf8g5e+K01vo3w6l4cKRZPS4pkYAVILyXtbdEk5JHUcWT1g 57mHjGgElBiGALxxqCJi4IZ7i6mBz/3v1oMx9f6kVEPRv3SDLlDf5b9GqcS6pcZJ0NLw vxyFyMwersP7P8WciiRuoBaGcQlcNCtPJV0R9cCnJf4RmLtksjPcWy+Rrvsnx7yD7Ghk uSJpfha0hZXUfpwgpl6VxK8f+y+lV4unks4sp8LKg2nS01I4swyWiV06uv3Ed4Qba6tj 1M/vjqUYUw0gH4Gqh5KKzyxZPKCpsS7wOcsVG4CJijv3jkUxmaNGcQ59+wNHXqmHIvth JoiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=vdyP2JtRhbiv6tYNm/WH+U05mCm+Ipea64ow94GYdIw=; fh=tmXlk3leOomORpSO4TuL1A47A6qR0jUHYzcIWZkJZN4=; b=c5sPRawHbjvyGSMuwARz502fTd4Al/MIlylI4QZJij+VjxejlZRjONnwynIp4yDDw7 wVvMqoDxdFVisebxBuzV9eppUCccT55Z2VIt3yyCW4EjsJ3B3wV0wyEOXr3651sT0OqA jXPLMQnqTIC5bxB6EJCK0IKH6XLfNUjijeuHIexnyei3gt5vYkSS/EkOugZzY69VOB5L 16roajWJ/IjIdWelp/rexAMPYncy7XAoQgkkt861YphqZOVmyw6JQCUKIw9kDqHQIcO5 KBITQ6NlkmVG6Z4XgM0R/Cp5m4LLbl1YRveoAMPo5gXrLRd8cuX8+B46qzyjMnzzDKkv BaOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wSj6yqwI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=mABmpsMR; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-95374-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95374-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dg19-20020a0564021d1300b005656bbcd1bcsi6877816edb.591.2024.03.07.03.05.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 03:05:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95374-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wSj6yqwI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=mABmpsMR; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-95374-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95374-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 99E641F2417D for ; Thu, 7 Mar 2024 11:05:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1E1F1272DD; Thu, 7 Mar 2024 11:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wSj6yqwI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mABmpsMR" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72AB9125DC; Thu, 7 Mar 2024 11:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709809504; cv=none; b=MCO3oaUDf59n8VaGTZn8upgnFJgJFUOgRZIwrvttsjJA6344hfdNgdowqCLMD1Fgq/TcluMYeikn4zt9kYcOBHCeMFR2x0c+zb21c4LR9NalhfFPX9amq+p6JtgNkY0uRYZdOJiODBi1CbWs3dNepJpaspVN1cwtYng1u33fbo0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709809504; c=relaxed/simple; bh=F3t8FaPQ09tQDMQog6mg69yl7F1+FtKNnDjllV7epLE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=ZqQPfUxg1oAdecqRBhtrLc1YG89tXOwrFUVKUmwYgL5SbS9Gqn9F5TD6VaR90qZVM5Pr5zVs+3qwJjObI7m6GbNs/f0V5UTVEJK0MbE5FlP1CLaJLEopswblJiQiPv/uR39qC0azNUWUgxPky8g02UZOZcS48Sew2sGgSGPzubM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wSj6yqwI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mABmpsMR; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Thu, 07 Mar 2024 11:04:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1709809500; 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=vdyP2JtRhbiv6tYNm/WH+U05mCm+Ipea64ow94GYdIw=; b=wSj6yqwIdwPSoQICbU0XwTTLxnHNwdTKrNg28WqGuzs8bJ2LV3StZSbabNJBmPhgFu8eTH xdhGZaGGXPdqVRk7sfrsYVEBxUARyj1mQ1L/iSLVmQNTVpLNtpnJP3YO6WNy9WeJ4KvYFh Do5thwA3qFWz5i2cugdZ5/NuI1Z6Ox27MSwAo6zZOiv8JGAfWeY/E3C+w0wu05AXs9pJhK EpMJMUFAiDnrCmMJuifiauVAVAQtu7cjEikMAXdNCddRHimL5qxLgcsfcJitsmd+J9/8Dp sUELTMwtPyz/W87mVu/7BiYM84RKwscoOizpMsMaSUm/henztfnUfIiHeTg8vA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709809500; 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=vdyP2JtRhbiv6tYNm/WH+U05mCm+Ipea64ow94GYdIw=; b=mABmpsMRfq1/ykpXNLGyr8rSOEWH9HWQnqp9DGMDrQtrFFEo2+zj9/nGwa4jppdX9FG0JD n2yExLotoYYqR5BA== From: "tip-bot2 for Xin Li (Intel)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/fred] x86/fred: Fix init_task thread stack pointer initialization Cc: kernel test robot , "Xin Li (Intel)" , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240304083333.449322-1-xin@zytor.com> References: <20240304083333.449322-1-xin@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170980949947.398.16492968721974685258.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/fred branch of tip: Commit-ID: c416b5bac6ad6ffe21e36225553b82ff2ec1558c Gitweb: https://git.kernel.org/tip/c416b5bac6ad6ffe21e36225553b82ff2ec1558c Author: Xin Li (Intel) AuthorDate: Mon, 04 Mar 2024 00:33:33 -08:00 Committer: Thomas Gleixner CommitterDate: Thu, 07 Mar 2024 11:55:36 +01:00 x86/fred: Fix init_task thread stack pointer initialization As TOP_OF_KERNEL_STACK_PADDING was defined as 0 on x86_64, it went unnoticed that the initialization of the .sp field in INIT_THREAD and some calculations in the low level startup code do not take the padding into account. FRED enabled kernels require a 16 byte padding, which means that the init task initialization and the low level startup code use the wrong stack offset. Subtract TOP_OF_KERNEL_STACK_PADDING in all affected places to adjust for this. Fixes: 65c9cc9e2c14 ("x86/fred: Reserve space for the FRED stack frame") Fixes: 3adee777ad0d ("x86/smpboot: Remove initial_stack on 64-bit") Reported-by: kernel test robot Signed-off-by: Xin Li (Intel) Signed-off-by: Thomas Gleixner Closes: https://lore.kernel.org/oe-lkp/202402262159.183c2a37-lkp@intel.com Link: https://lore.kernel.org/r/20240304083333.449322-1-xin@zytor.com --- arch/x86/include/asm/processor.h | 6 ++++-- arch/x86/kernel/head_64.S | 3 ++- arch/x86/xen/xen-head.S | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 26620d7..17fe819 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -664,8 +664,10 @@ static __always_inline void prefetchw(const void *x) #else extern unsigned long __end_init_task[]; -#define INIT_THREAD { \ - .sp = (unsigned long)&__end_init_task - sizeof(struct pt_regs), \ +#define INIT_THREAD { \ + .sp = (unsigned long)&__end_init_task - \ + TOP_OF_KERNEL_STACK_PADDING - \ + sizeof(struct pt_regs), \ } extern unsigned long KSTK_ESP(struct task_struct *task); diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index d4918d0..c38e435 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S @@ -26,6 +26,7 @@ #include #include #include +#include /* * We are not able to switch in one step to the final KERNEL ADDRESS SPACE @@ -66,7 +67,7 @@ SYM_CODE_START_NOALIGN(startup_64) mov %rsi, %r15 /* Set up the stack for verify_cpu() */ - leaq (__end_init_task - PTREGS_SIZE)(%rip), %rsp + leaq (__end_init_task - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp leaq _text(%rip), %rdi diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S index a0ea285..04101b9 100644 --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -49,7 +49,7 @@ SYM_CODE_START(startup_xen) ANNOTATE_NOENDBR cld - leaq (__end_init_task - PTREGS_SIZE)(%rip), %rsp + leaq (__end_init_task - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp /* Set up %gs. *