[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <nuzda7g3l2e4qeqdh6m4bmhlux6ywnrrh4ktivldljm2od7vou@z4wtuggklxei>
Date: Mon, 18 Aug 2025 08:26:11 +0200
From: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: <nathan@...nel.org>, <arnd@...db.de>, <broonie@...nel.org>,
<Liam.Howlett@...cle.com>, <urezki@...il.com>, <will@...nel.org>,
<kaleshsingh@...gle.com>, <rppt@...nel.org>, <leitao@...ian.org>,
<coxu@...hat.com>, <surenb@...gle.com>, <akpm@...ux-foundation.org>,
<luto@...nel.org>, <jpoimboe@...nel.org>, <changyuanl@...gle.com>,
<hpa@...or.com>, <dvyukov@...gle.com>, <kas@...nel.org>, <corbet@....net>,
<vincenzo.frascino@....com>, <smostafa@...gle.com>,
<nick.desaulniers+lkml@...il.com>, <morbo@...gle.com>,
<andreyknvl@...il.com>, <alexander.shishkin@...ux.intel.com>,
<thiago.bauermann@...aro.org>, <catalin.marinas@....com>,
<ryabinin.a.a@...il.com>, <jan.kiszka@...mens.com>, <jbohac@...e.cz>,
<dan.j.williams@...el.com>, <joel.granados@...nel.org>, <baohua@...nel.org>,
<kevin.brodsky@....com>, <nicolas.schier@...ux.dev>, <pcc@...gle.com>,
<andriy.shevchenko@...ux.intel.com>, <wei.liu@...nel.org>, <bp@...en8.de>,
<ada.coupriediaz@....com>, <xin@...or.com>, <pankaj.gupta@....com>,
<vbabka@...e.cz>, <glider@...gle.com>, <jgross@...e.com>, <kees@...nel.org>,
<jhubbard@...dia.com>, <joey.gouly@....com>, <ardb@...nel.org>,
<thuth@...hat.com>, <pasha.tatashin@...een.com>,
<kristina.martsenko@....com>, <bigeasy@...utronix.de>,
<lorenzo.stoakes@...cle.com>, <jason.andryuk@....com>, <david@...hat.com>,
<graf@...zon.com>, <wangkefeng.wang@...wei.com>, <ziy@...dia.com>,
<mark.rutland@....com>, <dave.hansen@...ux.intel.com>,
<samuel.holland@...ive.com>, <kbingham@...nel.org>,
<trintaeoitogc@...il.com>, <scott@...amperecomputing.com>,
<justinstitt@...gle.com>, <kuan-ying.lee@...onical.com>, <maz@...nel.org>,
<tglx@...utronix.de>, <samitolvanen@...gle.com>, <mhocko@...e.com>,
<nunodasneves@...ux.microsoft.com>, <brgerst@...il.com>,
<willy@...radead.org>, <ubizjak@...il.com>, <mingo@...hat.com>,
<sohil.mehta@...el.com>, <linux-mm@...ck.org>,
<linux-kbuild@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<x86@...nel.org>, <llvm@...ts.linux.dev>, <kasan-dev@...glegroups.com>,
<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 13/18] kasan: arm64: x86: Handle int3 for inline KASAN
reports
On 2025-08-13 at 17:17:02 +0200, Peter Zijlstra wrote:
>On Tue, Aug 12, 2025 at 03:23:49PM +0200, Maciej Wieczor-Retman wrote:
>> Inline KASAN on x86 does tag mismatch reports by passing the faulty
>> address and metadata through the INT3 instruction - scheme that's setup
>> in the LLVM's compiler code (specifically HWAddressSanitizer.cpp).
>>
>> Add a kasan hook to the INT3 handling function.
>>
>> Disable KASAN in an INT3 core kernel selftest function since it can raise
>> a false tag mismatch report and potentially panic the kernel.
>>
>> 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@...el.com>
>
>Can we please split this into an arm64 and x86 patch. Also, why use int3
>here rather than a #UD trap, which we use for all other such cases?
Sure, two patches seem okay. I'll first add all the new functions and modify the
x86 code, then add the arm64 patch which will replace its die() + comment with
kasan_inline_recover().
About INT3 I'm not sure, it's just how it's written in the LLVM code. I didn't
see any justification why it's not #UD. My guess is SMD describes INT3 as an
interrupt for debugger purposes while #UD is described as "for software
testing". So from the documentation point INT3 seems to have a stronger case.
Does INT3 interfere with something? Or is #UD better just because of
consistency?
--
Kind regards
Maciej Wieczór-Retman
Powered by blists - more mailing lists