Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp563268pxb; Tue, 19 Oct 2021 08:27:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnDy2w8rtfCBtkp1qxmyLzw2HzrTllrqis+E69a2XSrjBzbhcpI73sr639ulZD735IMG30 X-Received: by 2002:a17:906:f109:: with SMTP id gv9mr36450235ejb.184.1634657264922; Tue, 19 Oct 2021 08:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634657264; cv=none; d=google.com; s=arc-20160816; b=asHFiSCvdu1g5oLbZ5Grp43CyjY9K+tmmjyyogPxQlPMgcdKtldBZRugyekIxA1pJv B39fPGOoGkb9+BO2w2junVFhfNf5NiU9/M7HhGkxtZkqM/e/GLFY7kj1LGjusiQ1RVCH DQY2Qm5m5R6YYWcm1zoj7qLyrHaVze5Oh8WDA1U1HbiO1oR+wHVLrLpSfzXGa2gLKG65 GF619QXbbuuqChI5MSNxtdSP7ziru/NzrVCMN/F/68MJVQ4qgdvmtXSjkElEDEDStE7K gjhyROLK0v3cK8Q8iTkWK9e5lssrFxhUvvY/oVPqK0mR6oJ7FdYABdn7abrfQ8YY0dC2 0W7w== 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=8oIhw1V+D9EWudXItX59MZmRyRriR+/LqVGZE2btCEk=; b=flL0s9pRuL2NCIAtcThcqXAofmQjPfnKMHqqVxmHXosZXbIUsg9l1lF9/S5T4rFgE+ vi/BRdSq8N9IcVpxyJkh8BsSYhRzsHDlKpEn4De5kvSDt1HvHnqS1fdCCWGRwl8Sxp4n KKGD7ClAfJyh+iAtcVmV1MdM9UPWltMRQ9v2qC0TI3xpW1rPYylvIkd9dWEKzw+Zmc/W ax95Fywtn4Vn4riZ2kYHv4NYm3L7u6sQfTs6rrmuYFoMgVK0d6Kuhqd/WKasaIrHfrPR 8EJgs59uJIorKvqxwK0EupbPkPehpn5KUBy1y1huFIO3mfrw82lg1DEleAPo7biBrk2k wI9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KDp7Ot57; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si22790490ejv.694.2021.10.19.08.27.21; Tue, 19 Oct 2021 08:27:44 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KDp7Ot57; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233693AbhJSPZT (ORCPT + 99 others); Tue, 19 Oct 2021 11:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233046AbhJSPZS (ORCPT ); Tue, 19 Oct 2021 11:25:18 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55740C06161C; Tue, 19 Oct 2021 08:23:05 -0700 (PDT) Date: Tue, 19 Oct 2021 15:23:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634656983; 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=8oIhw1V+D9EWudXItX59MZmRyRriR+/LqVGZE2btCEk=; b=KDp7Ot57iWyu9oJP8p2yUF3XhhbdtxeVcHu4vdhfdZnwA4TcQZzO1DLTGxhM1uDOmOwL7P +VeFYiOfsDLUaRCAhgYsJdwNfYfxVd+P4f2zGbYFqKZt2kXXusNzpStRBXKi7tUQZ1xNmO ZPo3lXRlPy/b7/Qa1+YVX4eNSi6jqgCA9h/q7ZdlXhBB0XoM9veh5uE09BTbFq2LdXDftf xw36QHEAhh3L7jNWZ8fthEg7rGxhcCAdVQ0RFjJLViUlXzleyIiRoU6KSVkuVwq+5QK2EC +RlND0/j5cSey03MhA+3gqydI3XKPzy3y2ciHHRedeWNzYF5/ottk5IMsyAGxA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634656983; 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=8oIhw1V+D9EWudXItX59MZmRyRriR+/LqVGZE2btCEk=; b=JIZf0/YMxkJBwFI2r/+7QriKKyGmbqHVueO0reofx3ZaBmd4oUyDIG75FSAM5/4aQJF/S0 RtnxQDkP7WFTa8AA== From: "tip-bot2 for Woody Lin" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/scs: Reset the shadow stack when idle_task_exit Cc: Woody Lin , "Peter Zijlstra (Intel)" , Valentin Schneider , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20211012083521.973587-1-woodylin@google.com> References: <20211012083521.973587-1-woodylin@google.com> MIME-Version: 1.0 Message-ID: <163465698182.25758.5265949885721821003.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/urgent branch of tip: Commit-ID: 45dfb89b8f96643268449c25d7025b17de46717c Gitweb: https://git.kernel.org/tip/45dfb89b8f96643268449c25d7025b17de46717c Author: Woody Lin AuthorDate: Tue, 12 Oct 2021 16:35:21 +08:00 Committer: Peter Zijlstra CommitterDate: Mon, 18 Oct 2021 16:58:41 +02:00 sched/scs: Reset the shadow stack when idle_task_exit There was a 'init_idle' that resets scs sp to base, but is removed by f1a0a376ca0c. Without the resetting, the hot-plugging implemented by cpu_psci_cpu_boot will use the previous scs sp as new base when starting up a CPU core, so the usage on scs page is being stacked up until overflow. This only happens on idle task since __cpu_up is using idle task as the main thread to start up a CPU core, so the overflow can be fixed by resetting scs sp to base in 'idle_task_exit'. Fixes: f1a0a376ca0c ("sched/core: Initialize the idle task with preemption disabled") Signed-off-by: Woody Lin Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Link: https://lore.kernel.org/r/20211012083521.973587-1-woodylin@google.com --- kernel/sched/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 1bba412..f21714e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8795,6 +8795,7 @@ void idle_task_exit(void) finish_arch_post_lock_switch(); } + scs_task_reset(current); /* finish_cpu(), as ran on the BP, will clean up the active_mm state */ }