Re: [PATCH v4 13/18] kasan: arm64: x86: Handle int3 for inline KASAN reports
From: Maciej Wieczor-Retman
Date: Mon Aug 18 2025 - 01:57:45 EST
On 2025-08-13 at 15:49:15 +0100, Ada Couprie Diaz wrote:
>Hi,
>
>On 12/08/2025 14:23, Maciej Wieczor-Retman wrote:
>> [...]
>>
>> Make part of that hook - which decides whether to die or recover from a
>> tag mismatch - arch independent to avoid duplicating a long comment on
>> both x86 and arm64 architectures.
>>
>> Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
>> ---
>> [...]
>> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
>> index f528b6041f6a..b9bdabc14ad1 100644
>> --- a/arch/arm64/kernel/traps.c
>> +++ b/arch/arm64/kernel/traps.c
>> @@ -1068,22 +1068,7 @@ int kasan_brk_handler(struct pt_regs *regs, unsigned long esr)
>> kasan_report(addr, size, write, pc);
>> - /*
>> - * The instrumentation allows to control whether we can proceed after
>> - * a crash was detected. This is done by passing the -recover flag to
>> - * the compiler. Disabling recovery allows to generate more compact
>> - * code.
>> - *
>> - * Unfortunately disabling recovery doesn't work for the kernel right
>> - * now. KASAN reporting is disabled in some contexts (for example when
>> - * the allocator accesses slab object metadata; this is controlled by
>> - * current->kasan_depth). All these accesses are detected by the tool,
>> - * even though the reports for them are not printed.
>> - *
>> - * This is something that might be fixed at some point in the future.
>> - */
>> - if (!recover)
>> - die("Oops - KASAN", regs, esr);
>> + kasan_inline_recover(recover, "Oops - KASAN", regs, esr);
>It seems that `die` is missing as the last argument, otherwise
>CONFIG_KASAN_SW_TAGS will not build on arm64.
>With the fix, it builds fully without further issues.
>
>Thanks,
>Ada
Oh right, thank you!
--
Kind regards
Maciej Wieczór-Retman