lkml.org 
[lkml]   [2021]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/4] ARM: Support KFENCE for ARM
From
Date

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
>> <asm/kfence.h>.
>>
>> 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 <wangkefeng.wang@huawei.com>
...
>> +#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 <linux/sched/debug.h>
>> #include <linux/highmem.h>
>> #include <linux/perf_event.h>
>> +#include <linux/kfence.h>
>>
>> #include <asm/system_misc.h>
>> #include <asm/system_info.h>
>> @@ -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);
>> }
> .
>

\
 
 \ /
  Last update: 2021-08-25 16:32    [W:0.105 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site