From nobody Fri Jun 26 20:22:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F431C433EF for ; Fri, 18 Feb 2022 13:36:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235783AbiBRNhF (ORCPT ); Fri, 18 Feb 2022 08:37:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232474AbiBRNhC (ORCPT ); Fri, 18 Feb 2022 08:37:02 -0500 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00AF320F6F for ; Fri, 18 Feb 2022 05:36:45 -0800 (PST) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.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 273D840304 for ; Fri, 18 Feb 2022 13:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645191404; bh=H/bO0aBxUyDz5Z1iaHc3hPM9Zt6+vPNG7kqFlweb1Sg=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=doVSvq0XpiLf28mQ6nkMDU7O+44dmL9pBuOe05xIXkeOZzmv34PfgvXhKagkH7q/V y1Sgox/TGi5bqyqsL3LS9YaxYv6PtUGAgbv6AAYpCRCUAJUeAhwLJ1ZE1qo3fPcyT8 jjYd+iuTCrmu5D0ni1BVc4DzzdgNavnmqwCu3P7pTeOVC42VbNHoB6kvVNzBnYnzbH 1l771xw9oFGcE5T2kX/k65r91Fc5srjIOPy+00xwI2ROEC0G9EfDRgV1G/5Cn11wSR 3wha+6WsMrC0Hy8eK8+lZEfYKEEYGo0/HNscGyT+mi9H+oboqySm3vTEEDLQuQZ14y 794L7O6WxgP+w== Received: by mail-wr1-f69.google.com with SMTP id h24-20020adfaa98000000b001e33eb81e71so3578890wrc.9 for ; Fri, 18 Feb 2022 05:36:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H/bO0aBxUyDz5Z1iaHc3hPM9Zt6+vPNG7kqFlweb1Sg=; b=eftvCTNHbx3nlESI0RAiqHzOObFWcOktsVEfXDiURPGiBuXa8bR3qsbq8DlZur5JcZ bX5LVwP5gcTBosev42KizxdR6ijCLMm29OiXOaf0KS6aZu8nqH/iC+SeFaxHmKniTyQG +daZrYIkE7IH47RSI/mtW+m9MqoTfFEl6TGpnpVIgqqWw5NQf1QOAXKIzSCQmfuapYue zgeKoyuGkVO9ByagLnkVPnbz6Pje3/T/08eF9ddvfn3FPTJaAxbrOzd3oeQ4cXFAJ2Fx QmHw7AMfYuTIrirVenBVJSa6PRDEkK7Im+514fLj/Lq/be8npwLJ0fHmlvWwm07Ktvk7 mBuQ== X-Gm-Message-State: AOAM530ij3QiZdN3/MW+6mfznJHwfMziWbGb1fgOIy0G78tSYxVFy3Vy fdh9lz+o6sTmcGJI3a2k3G5kFTwns54ckACo1WKuPdQs6IC7TyzfdZvtx0SL5MAyr+w22n8AGQb L0X5/UTpxHXdR9R3FSrAkeftpJBhGYfVJ7s+8WvFZNg== X-Received: by 2002:adf:c188:0:b0:1e6:8ecb:ea5a with SMTP id x8-20020adfc188000000b001e68ecbea5amr5888271wre.711.1645191402135; Fri, 18 Feb 2022 05:36:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyONeVylq+VBkXW8VpHpa9vSjAFyqnAnqrsQ2M08ZZvxaC3/JU4jOZLRotcih0KkieDFRj/qg== X-Received: by 2002:adf:c188:0:b0:1e6:8ecb:ea5a with SMTP id x8-20020adfc188000000b001e68ecbea5amr5888255wre.711.1645191401906; Fri, 18 Feb 2022 05:36:41 -0800 (PST) Received: from localhost.localdomain (lfbn-gre-1-195-1.w90-112.abo.wanadoo.fr. [90.112.158.1]) by smtp.gmail.com with ESMTPSA id z7sm4146155wml.40.2022.02.18.05.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 05:36:41 -0800 (PST) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Alexandre Ghiti , Aleksandr Nogikh , Nick Hu , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com Subject: [PATCH -fixes 1/4] riscv: Fix is_linear_mapping with recent move of KASAN region Date: Fri, 18 Feb 2022 14:35:10 +0100 Message-Id: <20220218133513.1762929-2-alexandre.ghiti@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220218133513.1762929-1-alexandre.ghiti@canonical.com> References: <20220218133513.1762929-1-alexandre.ghiti@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" KASAN region was recently moved between the linear mapping and the kernel mapping, is_linear_mapping used to check the validity of an address by using the start of the kernel mapping, which is now wrong. Fix this by using the maximum size of the physical memory. Fixes: f7ae02333d13 ("riscv: Move KASAN mapping next to the kernel mapping") Signed-off-by: Alexandre Ghiti Reported-by: kernel test robot --- arch/riscv/include/asm/page.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h index 160e3a1e8f8b..004372f8da54 100644 --- a/arch/riscv/include/asm/page.h +++ b/arch/riscv/include/asm/page.h @@ -119,7 +119,7 @@ extern phys_addr_t phys_ram_base; ((x) >=3D kernel_map.virt_addr && (x) < (kernel_map.virt_addr + kernel_ma= p.size)) =20 #define is_linear_mapping(x) \ - ((x) >=3D PAGE_OFFSET && (!IS_ENABLED(CONFIG_64BIT) || (x) < kernel_map.v= irt_addr)) + ((x) >=3D PAGE_OFFSET && (!IS_ENABLED(CONFIG_64BIT) || (x) < PAGE_OFFSET = + KERN_VIRT_SIZE)) =20 #define linear_mapping_pa_to_va(x) ((void *)((unsigned long)(x) + kernel_m= ap.va_pa_offset)) #define kernel_mapping_pa_to_va(y) ({ \ --=20 2.32.0 From nobody Fri Jun 26 20:22:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49931C433F5 for ; Fri, 18 Feb 2022 13:37:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235792AbiBRNiF (ORCPT ); Fri, 18 Feb 2022 08:38:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232474AbiBRNiD (ORCPT ); Fri, 18 Feb 2022 08:38:03 -0500 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CA3E1AA256 for ; Fri, 18 Feb 2022 05:37:45 -0800 (PST) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.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 E10EA40306 for ; Fri, 18 Feb 2022 13:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645191463; bh=5wR2inrb50SGryPV3ql5qm7RIRt9i7gNq/sby+Clcps=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qZuo+9Csuk+9lm4KjCfI9sOW1y/+M6zZS6c2K7eLmCTFmq7gOMj4jzO1lD+pclrtQ 7RF8NbzT9DWNJbOzZI1lFfv3hfRWMheQyQXkuXXBrnblME10x1269GVi5H8N5Xx6BY cHR31WadHXSYtlqZZBKcQQsStuOO+aqTk/dOERY48V5RNU5U2DvaNKkYu0b5R/tHYD xhZ63bm9Kxz8uGlrq26o33GPw30N0oNRmJ12BegPlzmOqCTWveCGeb+b9iPTbs3d6r v/oSTcD9BYTSWccymiWo8KPHqeUo+5SIo4EMBHR6lwpDCzvoAG79RnT+gRBNKVV8HC y8PJPCvADzAwQ== Received: by mail-wm1-f69.google.com with SMTP id 125-20020a1c0283000000b0037bf720e6a8so5935018wmc.8 for ; Fri, 18 Feb 2022 05:37:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5wR2inrb50SGryPV3ql5qm7RIRt9i7gNq/sby+Clcps=; b=34QPEzkRKqVCPCwhJH8ovzsInp3kBTSFOs15kiAsTvB13W4OwuP4nzptstm5dLufni /deRnS6eOoIYUJl1yg0EhNMTLFNPz/5/n1AgKvaHGVibNiYciAQcNp1KQuMiy3lGxnVr uH4BAz0/pDO6wkjZLQfYpezVHiGC1j9/u+0hltcSG7LUcGOjdc4nHAM2rW1mE8V+eaIc ODOLfi/aUvtY0GgYq2mupGMiBfmrtLnhQ3ZBG5msjYUO9s1+IEkS9GuOU2zqcSyARveU 5EPsdyr4JDGoy3i7k+hXRmkt8YejpgEyeA9tkfKoDtMze8YwwtEj5ciQYFL7aXsQXkKH u06w== X-Gm-Message-State: AOAM530U0/1Xapo5TGyPyoFperfY6Ua2gzt+HlBEdvwLJxrIkPVrBv7u mD+mk3Kf1sBF4p5nuzRl83cM32HDPWejXs7wGEmbAwNHLBEbL19X2ee2L8kxttZPDOM/SQ1YeRt mk04qaBzt3tvGarZcQE4dcyzvQPXQa186E5wPnzP/VQ== X-Received: by 2002:a1c:7715:0:b0:37b:dc94:9eb4 with SMTP id t21-20020a1c7715000000b0037bdc949eb4mr7292831wmi.61.1645191463169; Fri, 18 Feb 2022 05:37:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1rOcJLLe1sMpbmzJaKzZ9MrfRNf1PgF+TEXDfRIfQBwQQMxq9mXwaThHJyZuyQwyiE6VwOg== X-Received: by 2002:a1c:7715:0:b0:37b:dc94:9eb4 with SMTP id t21-20020a1c7715000000b0037bdc949eb4mr7292811wmi.61.1645191463026; Fri, 18 Feb 2022 05:37:43 -0800 (PST) Received: from localhost.localdomain (lfbn-gre-1-195-1.w90-112.abo.wanadoo.fr. [90.112.158.1]) by smtp.gmail.com with ESMTPSA id h21sm4886378wmq.26.2022.02.18.05.37.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 05:37:42 -0800 (PST) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Alexandre Ghiti , Aleksandr Nogikh , Nick Hu , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com Subject: [PATCH -fixes 2/4] riscv: Fix config KASAN && SPARSEMEM && !SPARSE_VMEMMAP Date: Fri, 18 Feb 2022 14:35:11 +0100 Message-Id: <20220218133513.1762929-3-alexandre.ghiti@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220218133513.1762929-1-alexandre.ghiti@canonical.com> References: <20220218133513.1762929-1-alexandre.ghiti@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In order to get the pfn of a struct page* when sparsemem is enabled without vmemmap, the mem_section structures need to be initialized which happens in sparse_init. But kasan_early_init calls pfn_to_page way before sparse_init is called, which then tries to dereference a null mem_section pointer. Fix this by removing the usage of this function in kasan_early_init. Fixes: 8ad8b72721d0 ("riscv: Add KASAN support") Signed-off-by: Alexandre Ghiti --- arch/riscv/mm/kasan_init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c index f61f7ca6fe0f..85e849318389 100644 --- a/arch/riscv/mm/kasan_init.c +++ b/arch/riscv/mm/kasan_init.c @@ -202,8 +202,7 @@ asmlinkage void __init kasan_early_init(void) =20 for (i =3D 0; i < PTRS_PER_PTE; ++i) set_pte(kasan_early_shadow_pte + i, - mk_pte(virt_to_page(kasan_early_shadow_page), - PAGE_KERNEL)); + pfn_pte(virt_to_pfn(kasan_early_shadow_page), PAGE_KERNEL)); =20 for (i =3D 0; i < PTRS_PER_PMD; ++i) set_pmd(kasan_early_shadow_pmd + i, --=20 2.32.0 From nobody Fri Jun 26 20:22:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0F7AC433F5 for ; Fri, 18 Feb 2022 13:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235805AbiBRNjE (ORCPT ); Fri, 18 Feb 2022 08:39:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:54848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235793AbiBRNjC (ORCPT ); Fri, 18 Feb 2022 08:39:02 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D449A20193F for ; Fri, 18 Feb 2022 05:38:45 -0800 (PST) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.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-0.canonical.com (Postfix) with ESMTPS id 970B23F32C for ; Fri, 18 Feb 2022 13:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645191524; bh=cguSXJTSK/jUGjEgH9bI1vq5RLn1H9fQDOjhSSVs79w=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tE6HaCikKClwBjWGiSeGA7qiserKIpPEwggp/sdiNqRJaZRiJuTNI6MHyrXteUBqO wUx98EqXBXXV4FJgmrIJKZmXy4vHJ90oPXBxg4/FGFUUCTBgetA7oR9HVOxifhNEwb QN39NE2GZgJn1MocUl2F7+/woBF9GtXy16dKRGrjtu6EAlIs+eZJfvnglJ9WllIn9M L9HlhEgSnAfKyzCwx2f2B5tvepTYwvMS+nC5gQwMR5lznks4epboN4ZYlJhjsAIr31 rQL1odDTtklzBbzubKnVIjN6d6F/PfMqf8uXTwO/+aqff/8Hl6E17F0GvNE4w8kGSM BFCOdqFurZLyw== Received: by mail-wm1-f69.google.com with SMTP id k36-20020a05600c1ca400b0037ddae32528so2857125wms.6 for ; Fri, 18 Feb 2022 05:38:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cguSXJTSK/jUGjEgH9bI1vq5RLn1H9fQDOjhSSVs79w=; b=Fil+sHM9FRkTHtbG2BBfMhfyPrTtRU0nI4tsSA9Ldfvf22xq4Zas1C9ke9N8ibw4W3 dEhvqrI+M0vbbQktxoRhzt4KkG4UPEpJDaKdie2cfumCTgD+u7kPw911uiTM9I+XCNey gcoZVXq6t5V9NfOFOQGuo6qmDrudjHz+h7InAHBctMTarVds8zrRB1slQbixwFJBtD/a C1/D/FoZeVpV5the7nAswz1UiYIn6eSn6JHWIltEmobBKogF7VVq2yHPYasqrai8U8/D Qs6GENyfZF+B4RCA5JVDG2qboZXill0ijdeYa+DmijI9VwVWF+x7MDHQHJl8egf7xsgt OCAQ== X-Gm-Message-State: AOAM531NkeHuWRRPb+EGHn25q3LIMHWjzmGWlGgQZl65PQOSj1Kqb2EC 9LtTPIBf6JAxRmirULcOw/wHqMeZ3sGitu/VxNwcR3yVmYHBXCfWYXJlcjazV/YWTkeWx6GL5+z PL6pqdOsaUu9YG49sevbU3mR/sBc7pHpjM8It88O4FQ== X-Received: by 2002:a7b:cbc6:0:b0:37b:c56b:9eb9 with SMTP id n6-20020a7bcbc6000000b0037bc56b9eb9mr7250947wmi.17.1645191524258; Fri, 18 Feb 2022 05:38:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwdi9qCsRGOKRf5aFH1Q0xUVlWAkuAr/mtea9chk3ia4coprzZyLiP+xUhMh9Zer9nD237Mg== X-Received: by 2002:a7b:cbc6:0:b0:37b:c56b:9eb9 with SMTP id n6-20020a7bcbc6000000b0037bc56b9eb9mr7250929wmi.17.1645191524072; Fri, 18 Feb 2022 05:38:44 -0800 (PST) Received: from localhost.localdomain (lfbn-gre-1-195-1.w90-112.abo.wanadoo.fr. [90.112.158.1]) by smtp.gmail.com with ESMTPSA id g5sm4282472wmk.38.2022.02.18.05.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 05:38:43 -0800 (PST) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Alexandre Ghiti , Aleksandr Nogikh , Nick Hu , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com Subject: [PATCH -fixes 3/4] riscv: Fix DEBUG_VIRTUAL false warnings Date: Fri, 18 Feb 2022 14:35:12 +0100 Message-Id: <20220218133513.1762929-4-alexandre.ghiti@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220218133513.1762929-1-alexandre.ghiti@canonical.com> References: <20220218133513.1762929-1-alexandre.ghiti@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" KERN_VIRT_SIZE used to encompass the kernel mapping before it was redefined when moving the kasan mapping next to the kernel mapping to only match the maximum amount of physical memory. Then, kernel mapping addresses that go through __virt_to_phys are now declared as wrong which is not true, one can use __virt_to_phys on such addresses. Fix this by redefining the condition that matches wrong addresses. Fixes: f7ae02333d13 ("riscv: Move KASAN mapping next to the kernel mapping") Signed-off-by: Alexandre Ghiti --- arch/riscv/mm/physaddr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/riscv/mm/physaddr.c b/arch/riscv/mm/physaddr.c index e7fd0c253c7b..19cf25a74ee2 100644 --- a/arch/riscv/mm/physaddr.c +++ b/arch/riscv/mm/physaddr.c @@ -8,12 +8,10 @@ =20 phys_addr_t __virt_to_phys(unsigned long x) { - phys_addr_t y =3D x - PAGE_OFFSET; - /* * Boundary checking aginst the kernel linear mapping space. */ - WARN(y >=3D KERN_VIRT_SIZE, + WARN(!is_linear_mapping(x) && !is_kernel_mapping(x), "virt_to_phys used for non-linear address: %pK (%pS)\n", (void *)x, (void *)x); =20 --=20 2.32.0 From nobody Fri Jun 26 20:22:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29B56C433EF for ; Fri, 18 Feb 2022 13:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235809AbiBRNkE (ORCPT ); Fri, 18 Feb 2022 08:40:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235793AbiBRNkD (ORCPT ); Fri, 18 Feb 2022 08:40:03 -0500 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D395C93183 for ; Fri, 18 Feb 2022 05:39:46 -0800 (PST) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (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 AF52F40304 for ; Fri, 18 Feb 2022 13:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645191585; bh=JOP3F1szvziyyHwwb25WbMBDR7/phOdbs80dtO/BlA0=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MtHHO6vU2uXudTT0eRyb9HtTpJSMsmVwB/Om7S8YX9jk82iV7JzupkoF+pcxPmSPf tTMcN11P1kpy3dxOINkCLRYOdp4slQzvmrPZ+BSb1dGspaaNxfSKxeO0vm/v2I8Qiv 4W+K8SSKI4yLtW7WMDDtNJbDTWsjs/oRMWV7YQluJwVYD/J0F0LEm01lLeC0N0YyDJ 5Z9S712bypNnl9n6Ngp5q/TJ8JUNX4ecxfDsiRpn49syB8mx8dk4R5nAGC8pU5WclA oUkFWZF8lk5/QoirWM5/FYMMS86XHEy77CVABptB11WfcFSa1OC/wRsoSGRWUMVEV9 zXNAykb4tKZGA== Received: by mail-wm1-f71.google.com with SMTP id r11-20020a1c440b000000b0037bb51b549aso5161526wma.4 for ; Fri, 18 Feb 2022 05:39:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JOP3F1szvziyyHwwb25WbMBDR7/phOdbs80dtO/BlA0=; b=S38h0aODv+sfKvrijKxl7jPk6SP6OxFWyiTCwBAK5Js8lyOHYGU9XTo1v10eNDD7zZ iz1D2PaZQIP/3xumam98kS1ufqiLhfhNNlwf7f5Km9+FVLBTsPRZpmneFzNC5KR3Sf9T cUniIizgmsX5IXX5g0k1ZNM2gdVc5sZO9eP3OVxkMYETrSNtooBquwbHGgLBGMmXCYUy 5yfdtI38c96Vy7W86U3HwAo1/EhZZK7zvomGcKZyIjSw5M2/XIQiD0ZeuGV25j/7u9Zh oP2rwujscP+Bg4AMfTFU+XDnw9qlu7d5qHDpMnWcqz4szr4teI1F8H7icO6a9PMvH+ox ESIA== X-Gm-Message-State: AOAM530P7bzRpcNrcl06IZOEzMkvVg37xpAhXx0j5gcuF18gfg3gA9CP 7i/KnXRBu9vZ2/9S8ft2bmt9oYeAnPdQnUv+OkRKCuE5M8zecqPxLwF4dgGFvTEYaHDCkYeZBuA mK1YEa7akOCJh1tGDfPXgzTjlEJ5lAXJ7GWKa78nR0Q== X-Received: by 2002:adf:e5d0:0:b0:1da:4dfb:497e with SMTP id a16-20020adfe5d0000000b001da4dfb497emr6489390wrn.282.1645191585233; Fri, 18 Feb 2022 05:39:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwa9rnt86pwmOEJdbUgC/kacrYzPY5oQ4mpvy+Mq/o4FjRWXCIzn6psjVvt7DCwVdslstNNkQ== X-Received: by 2002:adf:e5d0:0:b0:1da:4dfb:497e with SMTP id a16-20020adfe5d0000000b001da4dfb497emr6489383wrn.282.1645191585101; Fri, 18 Feb 2022 05:39:45 -0800 (PST) Received: from localhost.localdomain (lfbn-gre-1-195-1.w90-112.abo.wanadoo.fr. [90.112.158.1]) by smtp.gmail.com with ESMTPSA id x11sm4183619wmi.37.2022.02.18.05.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 05:39:44 -0800 (PST) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Alexandre Ghiti , Aleksandr Nogikh , Nick Hu , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com Subject: [PATCH -fixes 4/4] riscv: Fix config KASAN && DEBUG_VIRTUAL Date: Fri, 18 Feb 2022 14:35:13 +0100 Message-Id: <20220218133513.1762929-5-alexandre.ghiti@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220218133513.1762929-1-alexandre.ghiti@canonical.com> References: <20220218133513.1762929-1-alexandre.ghiti@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" __virt_to_phys function is called very early in the boot process (ie kasan_early_init) so it should not be instrumented by KASAN otherwise it bugs. Fix this by declaring phys_addr.c as non-kasan instrumentable. Signed-off-by: Alexandre Ghiti --- arch/riscv/mm/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/mm/Makefile b/arch/riscv/mm/Makefile index 7ebaef10ea1b..ac7a25298a04 100644 --- a/arch/riscv/mm/Makefile +++ b/arch/riscv/mm/Makefile @@ -24,6 +24,9 @@ obj-$(CONFIG_KASAN) +=3D kasan_init.o ifdef CONFIG_KASAN KASAN_SANITIZE_kasan_init.o :=3D n KASAN_SANITIZE_init.o :=3D n +ifdef CONFIG_DEBUG_VIRTUAL +KASAN_SANITIZE_physaddr.o :=3D n +endif endif =20 obj-$(CONFIG_DEBUG_VIRTUAL) +=3D physaddr.o --=20 2.32.0