From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D840EC4338F for ; Wed, 25 Aug 2021 14:31:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C08B8610C7 for ; Wed, 25 Aug 2021 14:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241732AbhHYOcf (ORCPT ); Wed, 25 Aug 2021 10:32:35 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:18040 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232168AbhHYOce (ORCPT ); Wed, 25 Aug 2021 10:32:34 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GvpH001z6zbj5X; Wed, 25 Aug 2021 22:27:56 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 25 Aug 2021 22:31:46 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 25 Aug 2021 22:31:45 +0800 Subject: Re: [PATCH 3/4] ARM: Support KFENCE for ARM To: ownia CC: Russell King , Alexander Potapenko , Marco Elver , Andrew Morton , Dmitry Vyukov , , , References: <20210825092116.149975-1-wangkefeng.wang@huawei.com> <20210825092116.149975-4-wangkefeng.wang@huawei.com> <51b02ecd-0f3d-99b0-c943-1d4da26174d0@gmail.com> From: Kefeng Wang Message-ID: <8531455d-3198-96cd-e26b-03156f95ac80@huawei.com> Date: Wed, 25 Aug 2021 22:31:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <51b02ecd-0f3d-99b0-c943-1d4da26174d0@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/8/25 21:18, ownia wrote: > On 2021/8/25 17:21, Kefeng Wang wrote: >> Add architecture specific implementation details for KFENCE and enable >> KFENCE on ARM. In particular, this implements the required interface in >> . >> >> KFENCE requires that attributes for pages from its memory pool can >> individually be set. Therefore, force the kfence pool to be mapped >> at page granularity. >> >> Testing this patch using the testcases in kfence_test.c and all passed >> with or without ARM_LPAE. >> >> Signed-off-by: Kefeng Wang ... >> +#endif /* __ASM_ARM_KFENCE_H */ >> diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c >> index f7ab6dabe89f..9fa221ffa1b9 100644 >> --- a/arch/arm/mm/fault.c >> +++ b/arch/arm/mm/fault.c >> @@ -17,6 +17,7 @@ >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -131,10 +132,14 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, >> /* >> * No handler, we'll have to terminate things with extreme prejudice. >> */ >> - if (addr < PAGE_SIZE) >> + if (addr < PAGE_SIZE) { >> msg = "NULL pointer dereference"; >> - else >> + } else { >> + if (kfence_handle_page_fault(addr, is_write_fault(fsr), regs)) >> + return; >> + >> msg = "paging request"; >> + } > > I think here should do some fixup to follow upstream mainline code. Yes, the fixup is still there, as the cover-letter said, NOTE: The context of patch2/3 changes in arch/arm/mm/fault.c is based on link[1], which make some refactor and cleanup about page fault. ... [1]https://lore.kernel.org/linux-arm-kernel/20210610123556.171328-1-wangkefeng.wang@huawei.com/ > >> >> die_kernel_fault(msg, mm, addr, fsr, regs); >> } > . >