From patchwork Sun Sep 3 23:46:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cengiz Can X-Patchwork-Id: 1829251 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=K+qLe+ZV; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rf7hV4GPzz26jL for ; Mon, 4 Sep 2023 09:46:34 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qcwnR-0000Uz-SL; Sun, 03 Sep 2023 23:46:25 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qcwnP-0000Tc-4O for kernel-team@lists.ubuntu.com; Sun, 03 Sep 2023 23:46:23 +0000 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id F10833F11C for ; Sun, 3 Sep 2023 23:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1693784783; bh=kok3Maf7ySfofPjpsySNBnFDr18p2qg2KuqdHmWqhh0=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=K+qLe+ZVZdhQPc/mZ8W1CX3InE0c+8T94PO/dcNcelboATT+w/ZzqKvwrr3sX8XPX QHnr8oItiZogtDnViO8bkXFpmTAGoZwD9D7KdMHBeGlYfWMdfhRXvWdhY8J7cMseyn EGJal71WXPaqbepVu3/sDw+K2pWlW/Tp6rnSHjTJpQJxrheZbpxbGZ2sZ5CtzZspe/ 5SY089tW2iEbpeT5E0fUDk+OcoFxT9nYOYYt+bhl2lPkMI6e6Ft1pXdwDOD5KiKVWh MWoStShVVeE6qeCcYADFrZxYYdoBPmHnhxgVNX6hOSl7u3xOjZYSJmv1CLjJtrdwnu ixpNng01sx3Rw== Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-94a355cf318so63201166b.2 for ; Sun, 03 Sep 2023 16:46:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693784782; x=1694389582; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kok3Maf7ySfofPjpsySNBnFDr18p2qg2KuqdHmWqhh0=; b=XCp6+KMtmdC1JxTvBnwYrPHSYa6RTsxydUdyacGd2/Rx/ISqBaMgSvv5/jWds3j42t TK0xgAXJhhxNMyn3QkV3d3u+rwM2SZB5afh4PBTlnjqeSqpX5qnrLFhS2lDix/jcaksI xCnLELNDsfnYWYAR6sQlwKJEhY46QFISJz4rXOAzxpEOu+636nxiaap6Evou7yvE9jKj dGdDf/EwS9PvxxJqebhpbmn73smV/TmkaNXVIr4H9nOg7dUG3MkJqSy62xQYR5wQr64r gKaYipJFzEHDwkQ8uhz/88Lma0wV0+QUhxUR3IOSDf8Gu2Zq3KIREUC2yXH/Y0zEwWq3 tbTQ== X-Gm-Message-State: AOJu0Yw3KfOkMj+pZ+7GdhCIkgLxReH/V0mu0fQTbfbUx1Q/Ho7yfBcG cXPNi/SQ+FjXpuVSP8nOnFilDHi4MCY4bkVQIpyHJ39eFCJrqP4Pu3xQCMTAsMR2zCm4usFv3sK LumzlDiW40MzYBRv6VtMSLRCrvRAF8eImM/vR2uh84oga14ItnRog X-Received: by 2002:a17:906:3014:b0:992:a836:a194 with SMTP id 20-20020a170906301400b00992a836a194mr5785691ejz.59.1693784782366; Sun, 03 Sep 2023 16:46:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEh2NOXThACPYnWlILhjG+0AUU7UbHzME6cnRnJo8R3dd3s0f1UiJFjapi1FPqGxJyD27oJvw== X-Received: by 2002:a17:906:3014:b0:992:a836:a194 with SMTP id 20-20020a170906301400b00992a836a194mr5785688ejz.59.1693784782068; Sun, 03 Sep 2023 16:46:22 -0700 (PDT) Received: from localhost ([24.133.89.143]) by smtp.gmail.com with ESMTPSA id p27-20020a17090635db00b00991d54db2acsm5326696ejb.44.2023.09.03.16.46.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 16:46:21 -0700 (PDT) From: Cengiz Can To: kernel-team@lists.ubuntu.com Subject: [SRU Focal 4/6] x86/mm: Recompute physical address for every page of per-CPU CEA mapping Date: Mon, 4 Sep 2023 02:46:01 +0300 Message-Id: <20230903234603.859937-5-cengiz.can@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903234603.859937-1-cengiz.can@canonical.com> References: <20230903234603.859937-1-cengiz.can@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Sean Christopherson Recompute the physical address for each per-CPU page in the CPU entry area, a recent commit inadvertantly modified cea_map_percpu_pages() such that every PTE is mapped to the physical address of the first page. Fixes: 9fd429c28073 ("x86/kasan: Map shadow for percpu pages on demand") Signed-off-by: Sean Christopherson Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Andrey Ryabinin Link: https://lkml.kernel.org/r/20221110203504.1985010-2-seanjc@google.com (cherry picked from commit 80d72a8f76e8f3f0b5a70b8c7022578e17bde8e7) CVE-2023-0597 [cengizcan: fixes the prerequisite commit] Signed-off-by: Cengiz Can --- arch/x86/mm/cpu_entry_area.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/cpu_entry_area.c b/arch/x86/mm/cpu_entry_area.c index e7a201f3fa65..bfd8f15e6b59 100644 --- a/arch/x86/mm/cpu_entry_area.c +++ b/arch/x86/mm/cpu_entry_area.c @@ -97,7 +97,7 @@ cea_map_percpu_pages(void *cea_vaddr, void *ptr, int pages, pgprot_t prot) early_pfn_to_nid(PFN_DOWN(pa))); for ( ; pages; pages--, cea_vaddr+= PAGE_SIZE, ptr += PAGE_SIZE) - cea_set_pte(cea_vaddr, pa, prot); + cea_set_pte(cea_vaddr, per_cpu_ptr_to_phys(ptr), prot); } static void __init percpu_setup_debug_store(unsigned int cpu)