From patchwork Wed Jan 11 10:18:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 41884 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3242240wrt; Wed, 11 Jan 2023 02:33:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXuuQdM12lKFfocariloGupv8G23E3ZPCA/gvGOtYA+sgxOZKCIbcPCg0LdnStnYcT/4C8sZ X-Received: by 2002:a17:907:d602:b0:7c1:286a:d87c with SMTP id wd2-20020a170907d60200b007c1286ad87cmr61711808ejc.65.1673433235798; Wed, 11 Jan 2023 02:33:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673433235; cv=none; d=google.com; s=arc-20160816; b=l/qyN8KFpa2pbDPm1D0KjqGrakosfOKkXH55Z60GhkldkpIQb3lxs9u6Je8C3dnlS1 mfbLExogo877WkD2VVakJe4K7n6rJgbZ2jxUhWaz1E42fhcs0tKpILJvcl/A2WIshWfp aDVEoKjcRpw9SjzuMnv54F09Y9sb0tjrExnh1RxMMyGqUA/366FVimy0h/hyXkn7Vrhr hLAiB8bjx1KzYVXnUW6YyaBT9Ft9jyQ8QuEOZyfxCaAvgGJ6zzDAWaIBy7X3lXtq2abH mJCTFS7PMMHKH8A2SH6phGEwMVvS5mzv9X0msCRXzph8k052jv7lTMkrvo+jMaZyeM61 pKzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=PBX6ktcO3Ge095CwaOXemPHb5zPjrq8Ho5XrQZ9Bxvg=; b=kp+BIuf3gb6XVAbDSNLZ24lI3rs62Q7xc0fowRvfV/MDMBM5TevFfW3QArbHh0aKze RyF3umVCKXKfcVOZ/eSHUPicFIedemWojLn6l0F+Uh+KeCnBkY62iqkggA2ranME1ZHB AwlC3pdVwveD7Eq0aZ9yeaZKNb60liBMfZkm2Mh3vd6ImBvzSYwsp5ZmMXqKeMJfGkgq U/moK7RK05b0vS5NdyLb1F8k7Mi3W1CbTxLaBxOeFXLN3sZeBgSh5F2FufKz+CmUU/+X URG5Vna/sP8EimnvY3Xml07U0MNK/GiJIHcgyFIP8+HTbzaRMtYaRO0vYNkzXZgrmu8+ uldA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=bqqcT2FV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv13-20020a17090760cd00b0084c464789aesi15051640ejc.764.2023.01.11.02.33.26; Wed, 11 Jan 2023 02:33:55 -0800 (PST) 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=@google.com header.s=20210112 header.b=bqqcT2FV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231982AbjAKKSq (ORCPT + 99 others); Wed, 11 Jan 2023 05:18:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232511AbjAKKSP (ORCPT ); Wed, 11 Jan 2023 05:18:15 -0500 Received: from mail-lf1-x149.google.com (mail-lf1-x149.google.com [IPv6:2a00:1450:4864:20::149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B52D56 for ; Wed, 11 Jan 2023 02:18:12 -0800 (PST) Received: by mail-lf1-x149.google.com with SMTP id g28-20020a0565123b9c00b004cc8a085997so1957753lfv.13 for ; Wed, 11 Jan 2023 02:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=PBX6ktcO3Ge095CwaOXemPHb5zPjrq8Ho5XrQZ9Bxvg=; b=bqqcT2FVFiBu6f8kPh3KoIxAbk+mVUFALhsHjDK0hMLgCUAdL5me7vcjnxCx80rB9b Gzc07MjHzzZo2816B4wC2RA92p8pDRX3MjCVW2puJ8lsqZJ4YmrjEHfOC70KP6UXPbxX e/veF5hWoeXz34SghDx7p8yLY+6r5LH0SkgCVbwfO3yTG+xXz+LeBoSYVzS53I0tLfuq iotLNjTOjTzEF2CA4U+JNPCmQpps+cdfwJLD6VlPGQQkdbwBbiZIH7RvH21wDqyvtbls ZurKCqsftSnNBDyiSKGOMNsuSKEAtMiavAPDWCpK1HgxVuf50KTKSQSPvn1OgI0A4x1V uWWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=PBX6ktcO3Ge095CwaOXemPHb5zPjrq8Ho5XrQZ9Bxvg=; b=i5/bqWiwzWTvj3yc9s/odiauuJ+EDi8LsYTXcGtIXoWHo0gVVHGzbj5sdZkQrCR7AG 0T15/U4KU+Cb/cbQAJhtzqzu7wd/AfwwjNRGWkTO96AQOAtggYGO5Jh+1DG8XDTs2LS7 amAddOcmc+UqN9g+iAZt+I+eHT+I9QdkqLwwWh3fOmrnVJ7cm1Uwio0Avs+lsv/DevJX 1zfHEZME/sDjDuhz9ctI6f7ZlZQKmkF0JlnuC+FleDrtJ+tft3FdMEWP/NpBREeYbrNs 59gIIfmI6MhqW3CVlpajl1F1WHNsqvTDGNWl9zpHhn4S0q+FKtoLqS00seQN6UkU8UUS u+7g== X-Gm-Message-State: AFqh2ko+Wtf3lcNx9H/uGze4kEeK1qG9JgWLk/bMZdyn5jyrNCvmfVns Vo0uA1VSuldClzgQqewPYYv0DJckUPE= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:c1cc:851a:3d0:4d31]) (user=glider job=sendgmr) by 2002:a05:6512:3b07:b0:4b6:f1af:4263 with SMTP id f7-20020a0565123b0700b004b6f1af4263mr3407142lfv.114.1673432291206; Wed, 11 Jan 2023 02:18:11 -0800 (PST) Date: Wed, 11 Jan 2023 11:18:06 +0100 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230111101806.3236991-1-glider@google.com> Subject: [PATCH] Revert "x86: kmsan: sync metadata pages on page fault" From: Alexander Potapenko To: glider@google.com Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, peterz@infradead.org, mingo@redhat.com, elver@google.com, dvyukov@google.com, linux-mm@kvack.org, kasan-dev@googlegroups.com, luto@kernel.org, tglx@linutronix.de, x86@kernel.org, Qun-Wei Lin X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754721928576968924?= X-GMAIL-MSGID: =?utf-8?q?1754721928576968924?= This reverts commit 3f1e2c7a9099c1ed32c67f12cdf432ba782cf51f. As noticed by Qun-Wei Lin, arch_sync_kernel_mappings() in arch/x86/mm/fault.c is only used with CONFIG_X86_32, whereas KMSAN is only supported on x86_64, where this code is not compiled. The patch in question dates back to downstream KMSAN branch based on v5.8-rc5, it sneaked into upstream unnoticed in v6.1. Reported-by: Qun-Wei Lin Link: https://github.com/google/kmsan/issues/91 Signed-off-by: Alexander Potapenko --- arch/x86/mm/fault.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 7b0d4ab894c8b..a498ae1fbe665 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -260,7 +260,7 @@ static noinline int vmalloc_fault(unsigned long address) } NOKPROBE_SYMBOL(vmalloc_fault); -static void __arch_sync_kernel_mappings(unsigned long start, unsigned long end) +void arch_sync_kernel_mappings(unsigned long start, unsigned long end) { unsigned long addr; @@ -284,27 +284,6 @@ static void __arch_sync_kernel_mappings(unsigned long start, unsigned long end) } } -void arch_sync_kernel_mappings(unsigned long start, unsigned long end) -{ - __arch_sync_kernel_mappings(start, end); -#ifdef CONFIG_KMSAN - /* - * KMSAN maintains two additional metadata page mappings for the - * [VMALLOC_START, VMALLOC_END) range. These mappings start at - * KMSAN_VMALLOC_SHADOW_START and KMSAN_VMALLOC_ORIGIN_START and - * have to be synced together with the vmalloc memory mapping. - */ - if (start >= VMALLOC_START && end < VMALLOC_END) { - __arch_sync_kernel_mappings( - start - VMALLOC_START + KMSAN_VMALLOC_SHADOW_START, - end - VMALLOC_START + KMSAN_VMALLOC_SHADOW_START); - __arch_sync_kernel_mappings( - start - VMALLOC_START + KMSAN_VMALLOC_ORIGIN_START, - end - VMALLOC_START + KMSAN_VMALLOC_ORIGIN_START); - } -#endif -} - static bool low_pfn(unsigned long pfn) { return pfn < max_low_pfn;