Message ID | 167950808805.5837.638304039500769110.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2491071wrt; Wed, 22 Mar 2023 11:17:04 -0700 (PDT) X-Google-Smtp-Source: AK7set91YqOVeKk+i/qtUQkgF9dTJE2xiEHq+tmtiVsV9o/GbCFYZGc2ALy04bInLyVJJ1Wn+UWU X-Received: by 2002:a17:906:641:b0:90b:167e:304b with SMTP id t1-20020a170906064100b0090b167e304bmr7430156ejb.45.1679509024326; Wed, 22 Mar 2023 11:17:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679509024; cv=none; d=google.com; s=arc-20160816; b=O3cffZBudlQT41MfikREiz8XbWA8bmrVNZleVQcqtpue2hMI1d6ih0j7CruaVDxaYm OUAP5HNxLXNVUO4K8LAAruHRZ8RkDV3Nk1dKR3YXuUXiYnckALhy7d4M2S6zpg9Yw32q BYWjA9EFZLzrRAfJ0jZYrweYuHrGb20qi0MMvZ3ihB9doLNep497A1gFZuL9PW3Jnwt5 9c4I3xzghrzEAdJUSMrwtrTfLgJ7nbYZV9iF5nVa/MdNaIj9dMu7hDy/sfmlgV/RTfp3 zF+NbZWvZmlM6v+UaTG18oGy+TcetkPmM7jVfsBIqiYi86Q+7scweQ+vk61SVg/DSo8+ Axyw== 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:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=5PgEDmro4yjI2UKRUYxXDJNpNbStexhsQitnTZusH+Q=; b=0FXBSdA65Q7gZlRq1gYP6brYVTHhiR4j05Pjm/47Figpb/cMciNfXS3uguYd84Cvb4 UaeQktjDsxXGT3mYN9dwGtXzShS17tahGluAowYUbAUvt1UY3x8K1hcWeMo7sTyp1W30 iP5XXhtDguMosFcMhjB6/0/XSqzrmpowxugWJzGFYNdGd18Hs1uzjBBKbLH2Sn/2Lw8d U8RYzIKPUc9n3K4CFLkAv42kWcjX+iLVkFjEgqTVOkHI26CZD1tXP7jtVbP83C4UgFca 722PaPLisc/WVXTFFpTUtgdcQXrnlGAuxbZwZBJTjfAir3QSesD4G1fb4D32PFkRhESr WuyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hDCQBhCO; dkim=neutral (no key) header.i=@linutronix.de; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 15-20020a170906328f00b008d02052ed2asi17404096ejw.637.2023.03.22.11.16.41; Wed, 22 Mar 2023 11:17:04 -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=hDCQBhCO; dkim=neutral (no key) header.i=@linutronix.de; 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 S229809AbjCVSBm (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Wed, 22 Mar 2023 14:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230396AbjCVSBb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Mar 2023 14:01:31 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1798B62FF4; Wed, 22 Mar 2023 11:01:29 -0700 (PDT) Date: Wed, 22 Mar 2023 18:01:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1679508088; 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; bh=5PgEDmro4yjI2UKRUYxXDJNpNbStexhsQitnTZusH+Q=; b=hDCQBhCO/OuDoULIKRwyVWns1Bj5daKW2trAzdA3ebmbUWm5/Qck/cQVUapCyRBIU4Vvy+ 2T2I7oo+vKc+ApGwrlIZkzBFb7WZsFpLzP+cgJKzRdk79TeZSMAINb62STSqEEIpI56eE4 jb/cAntlU5j9eoNqEq4O3iqpllW5F8CLg5rxO+C18bBD8xVQSn0JxkHt3ujy3NZio3yBh7 nK63V2hQ62qNuZ+TDhkK8Ip62Dd2n66clkOmRtMBpckpFCKB3gFs7vmaidNPGy9qzNh8SH 5tYfDA6RhQ4DFeREnKnQSyn6L/o2rGZZNbCXXszcij8DxHQ26UnN7mFg4Slqyg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1679508088; 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; bh=5PgEDmro4yjI2UKRUYxXDJNpNbStexhsQitnTZusH+Q=; b=25xBVLzHo1BGnw8kKlEJyzYaHa79YGuoEANTrryyQlxc0bG2u2KXu1YL63o/X75FCRGBod iLDijwa7kpsVSQDQ== From: tip-bot2 for Michal =?utf-8?q?Koutn=C3=BD?= <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/mm: Do not shuffle CPU entry areas without KASLR Cc: mkoutny@suse.com, Dave Hansen <dave.hansen@linux.intel.com>, stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <167950808805.5837.638304039500769110.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761092854649462159?= X-GMAIL-MSGID: =?utf-8?q?1761092854649462159?= |
Series |
[tip:,x86/urgent] x86/mm: Do not shuffle CPU entry areas without KASLR
|
|
Commit Message
tip-bot2 for Thomas Gleixner
March 22, 2023, 6:01 p.m. UTC
The following commit has been merged into the x86/urgent branch of tip: Commit-ID: a3f547addcaa10df5a226526bc9e2d9a94542344 Gitweb: https://git.kernel.org/tip/a3f547addcaa10df5a226526bc9e2d9a94542344 Author: Michal Koutný <mkoutny@suse.com> AuthorDate: Mon, 06 Mar 2023 20:31:44 +01:00 Committer: Dave Hansen <dave.hansen@linux.intel.com> CommitterDate: Wed, 22 Mar 2023 10:42:47 -07:00 x86/mm: Do not shuffle CPU entry areas without KASLR The commit 97e3d26b5e5f ("x86/mm: Randomize per-cpu entry area") fixed an omission of KASLR on CPU entry areas. It doesn't take into account KASLR switches though, which may result in unintended non-determinism when a user wants to avoid it (e.g. debugging, benchmarking). Generate only a single combination of CPU entry areas offsets -- the linear array that existed prior randomization when KASLR is turned off. Since we have 3f148f331814 ("x86/kasan: Map shadow for percpu pages on demand") and followups, we can use the more relaxed guard kasrl_enabled() (in contrast to kaslr_memory_enabled()). Fixes: 97e3d26b5e5f ("x86/mm: Randomize per-cpu entry area") Signed-off-by: Michal Koutný <mkoutny@suse.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20230306193144.24605-1-mkoutny%40suse.com --- arch/x86/mm/cpu_entry_area.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/x86/mm/cpu_entry_area.c b/arch/x86/mm/cpu_entry_area.c index 7316a82..e91500a 100644 --- a/arch/x86/mm/cpu_entry_area.c +++ b/arch/x86/mm/cpu_entry_area.c @@ -10,6 +10,7 @@ #include <asm/fixmap.h> #include <asm/desc.h> #include <asm/kasan.h> +#include <asm/setup.h> static DEFINE_PER_CPU_PAGE_ALIGNED(struct entry_stack_page, entry_stack_storage); @@ -29,6 +30,12 @@ static __init void init_cea_offsets(void) unsigned int max_cea; unsigned int i, j; + if (!kaslr_enabled()) { + for_each_possible_cpu(i) + per_cpu(_cea_offset, i) = i; + return; + } + max_cea = (CPU_ENTRY_AREA_MAP_SIZE - PAGE_SIZE) / CPU_ENTRY_AREA_SIZE; /* O(sodding terrible) */