Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3285931pxj; Mon, 24 May 2021 03:10:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeD+yRX+ZthQ2qxRR9fv3GdHw/limY+cZ5Td2HJuoty7fkyV6P8L6TYSX4iKloSP0Qkd/c X-Received: by 2002:a17:906:2b57:: with SMTP id b23mr22170998ejg.294.1621851000425; Mon, 24 May 2021 03:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621851000; cv=none; d=google.com; s=arc-20160816; b=o57YXBlnjy5+AI2jRgvMb8y79qE/A6kfCm24AJweLfpQk2WlpH7UbYOjBp+idgcgYb 6cRSAk2zkxMFOFTF70NgsSlKWp+KRe2U78R/rzREEfiWZVtB83UAPKib6rBnVoXf60Gm 7kzN3uuyN/2fKG+dGWdgf3jXj5xKOzmRxrDN47hnuf2lW9/evfPBuD+FtieP8opNUlrn jj8kVj7CkSj5yeiCnO5NY6QspAEPB/yYpARXFcHeAQeX1mkc+ryPxjLAJR1JcoyAEO6V geJgi3M57eK6M8ICt+G2ys/YB9xQvXXLBJdXwP2vEe/ret/y1+DKyDfZc9h4Qnxsbxq0 XxKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KaEg544EKx/sjtrVBFvlwQggf1fXOzDvqUwgwSzvzl4=; b=EBVYvPSvKDh9oSLl2FgKQIvFqu9czm7jeJ4TV7mdfO03UEUQAGKax7hkTeIeIquWQ5 je5tbrsAI5Y57U3E3P5UA5aSQb75Ht39r7jq+ABeemFgqSh3cSWyaE0aZlbkKfv7Zw6v gPfFCE4+nbWA4wlyjWEt9AOz/CrQFJwjq/FsZbKPDhCYSpW0Byf0f8nK9BQ8AtqXsqNY opHMEMtcdlkyyTegNn5qNPouMu2KE34vlTmuDT2b5d4f/k+1ipbnAXnE+l4Oz0Ykv+2H JLzi0tPm5S6BHkh6d6M98ewu9pmyrUyBxYpo0FUbuy4MZI1g/Zje8Q9I9FUlWShPRFUG LFBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=EeLT1pDP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id va16si12643417ejb.325.2021.05.24.03.09.38; Mon, 24 May 2021 03:10:00 -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=@google.com header.s=20161025 header.b=EeLT1pDP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232422AbhEXKHK (ORCPT + 99 others); Mon, 24 May 2021 06:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232596AbhEXKHE (ORCPT ); Mon, 24 May 2021 06:07:04 -0400 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DCBCC06138C for ; Mon, 24 May 2021 03:05:33 -0700 (PDT) Received: by mail-ot1-x32a.google.com with SMTP id i14-20020a9d624e0000b029033683c71999so13535207otk.5 for ; Mon, 24 May 2021 03:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KaEg544EKx/sjtrVBFvlwQggf1fXOzDvqUwgwSzvzl4=; b=EeLT1pDPker87k7YUNV9CUERwTgGs2rryic2+BmmUeIoJPp21eW/ngSn3LgajEXlve vWLBa84mnlHz0KGCdxmaHWTElGUdmxHFvSIz+6BkG4HMsjJTjvNPaMsRHWYOvj87BFMr 22+Zqi/AU88HxSNhEq35ItxHrYsRogrLXf2zTK84hOwysRpUkiegoiBsym3u4/Sc4EfC qexSrbywI613fXcxXpmkaKBqOidiLsNGR8Y2wY1iAcNb7BjPdjvWcMMvdnGNTaO0ojiV W0gh4TxxznlnDQy+A11HL0VYPPa0b6xeRuwWcMb/sej9iAtKSn6H0SKD2uU71FKGxL22 q9AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KaEg544EKx/sjtrVBFvlwQggf1fXOzDvqUwgwSzvzl4=; b=G6XEFn+O0bj5mpsAkOLlMkA4/nUIFmhtKKVPfJEZgOSiabRzxCVK8z1eKI3yq6ppGL /4Pfq/v8Sev4c+E8Da45qj8sEEJsw6lW8Obh1fbTd1Hv8vuB5/a+bG43OzKhAEKzsTnL VJqWfrwDlOOeUdm5Df/hX1qt04KSm3gdFOS4ahX3rY59fx8MrHBmRvGaUOtHmDdLiHvX 0RQDcotXcYADjTg3+kAJY/qfqUT0ywfPdkaxkFy9hinTvLSvZVoiGJMJgsn9jiY5zYy0 dI9CI3TyQl2uv/4IQBG0u8kij6c3QQpHUgVFGxCMFqE2NsWpsx0NmH9LMNMOss3plNDf o1qA== X-Gm-Message-State: AOAM533aMUZniTPbCBNlXQjKDsgY3LUbElm7PEFyHRAQLO8X7QIEhYQ2 +UnlFc8OtkFKQRWF6HfbngJwbLUbcHBcDBdGFTKfhA== X-Received: by 2002:a05:6830:3154:: with SMTP id c20mr526619ots.233.1621850732396; Mon, 24 May 2021 03:05:32 -0700 (PDT) MIME-Version: 1.0 References: <20210524153659.58a707a9@xhacker.debian> In-Reply-To: <20210524153659.58a707a9@xhacker.debian> From: Marco Elver Date: Mon, 24 May 2021 12:05:21 +0200 Message-ID: Subject: Re: [PATCH] arm64: mm: don't use CON and BLK mapping if KFENCE is enabled To: Jisheng Zhang Cc: Catalin Marinas , Will Deacon , Alexander Potapenko , Linux ARM , LKML , Mark Rutland Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 May 2021 at 09:38, Jisheng Zhang wrote: > > Fix below warning if KFENCE=y but RODATA_FULL=n: > Is this patch still relevant given you just sent "arm64: remove page granularity limitation from KFENCE" ? > [ 0.000000] ------------[ cut here ]------------ > [ 0.000000] WARNING: CPU: 0 PID: 0 at mm/memory.c:2462 apply_to_pmd_range+0xec/0x190 > [ 0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.13.0-rc1+ #10 > [ 0.000000] Hardware name: linux,dummy-virt (DT) > [ 0.000000] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO BTYPE=--) > [ 0.000000] pc : apply_to_pmd_range+0xec/0x190 > [ 0.000000] lr : __apply_to_page_range+0x94/0x170 > [ 0.000000] sp : ffffffc010573e20 > [ 0.000000] x29: ffffffc010573e20 x28: ffffff801f400000 x27: ffffff801f401000 > [ 0.000000] x26: 0000000000000001 x25: ffffff801f400fff x24: ffffffc010573f28 > [ 0.000000] x23: ffffffc01002b710 x22: ffffffc0105fa450 x21: ffffffc010573ee4 > [ 0.000000] x20: ffffff801fffb7d0 x19: ffffff801f401000 x18: 00000000fffffffe > [ 0.000000] x17: 000000000000003f x16: 000000000000000a x15: ffffffc01060b940 > [ 0.000000] x14: 0000000000000000 x13: 0098968000000000 x12: 0000000098968000 > [ 0.000000] x11: 0000000000000000 x10: 0000000098968000 x9 : 0000000000000001 > [ 0.000000] x8 : 0000000000000000 x7 : ffffffc010573ee4 x6 : 0000000000000001 > [ 0.000000] x5 : ffffffc010573f28 x4 : ffffffc01002b710 x3 : 0000000040000000 > [ 0.000000] x2 : ffffff801f5fffff x1 : 0000000000000001 x0 : 007800005f400705 > [ 0.000000] Call trace: > [ 0.000000] apply_to_pmd_range+0xec/0x190 > [ 0.000000] __apply_to_page_range+0x94/0x170 > [ 0.000000] apply_to_page_range+0x10/0x20 > [ 0.000000] __change_memory_common+0x50/0xdc > [ 0.000000] set_memory_valid+0x30/0x40 > [ 0.000000] kfence_init_pool+0x9c/0x16c > [ 0.000000] kfence_init+0x20/0x98 > [ 0.000000] start_kernel+0x284/0x3f8 > > Fixes: 840b23986344 ("arm64, kfence: enable KFENCE for ARM64") > Signed-off-by: Jisheng Zhang > --- > arch/arm64/mm/mmu.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 6dd9369e3ea0..89b66ef43a0f 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -515,7 +515,8 @@ static void __init map_mem(pgd_t *pgdp) > */ > BUILD_BUG_ON(pgd_index(direct_map_end - 1) == pgd_index(direct_map_end)); > > - if (rodata_full || crash_mem_map || debug_pagealloc_enabled()) > + if (rodata_full || crash_mem_map || debug_pagealloc_enabled() || > + IS_ENABLED(CONFIG_KFENCE)) > flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; > > /* > -- > 2.31.0 >