lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ffbyaler57cdwgs5axtdpnwg52jtwx7tx2rykjro755c45mihl@czmbriuhg3to>
Date: Fri, 21 Feb 2025 16:27:16 +0100
From: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
To: Andrey Konovalov <andreyknvl@...il.com>
CC: <kees@...nel.org>, <julian.stecklina@...erus-technology.de>,
	<kevinloughlin@...gle.com>, <peterz@...radead.org>, <tglx@...utronix.de>,
	<justinstitt@...gle.com>, <catalin.marinas@....com>,
	<wangkefeng.wang@...wei.com>, <bhe@...hat.com>, <ryabinin.a.a@...il.com>,
	<kirill.shutemov@...ux.intel.com>, <will@...nel.org>, <ardb@...nel.org>,
	<jason.andryuk@....com>, <dave.hansen@...ux.intel.com>,
	<pasha.tatashin@...een.com>, <ndesaulniers@...gle.com>,
	<guoweikang.kernel@...il.com>, <dwmw@...zon.co.uk>, <mark.rutland@....com>,
	<broonie@...nel.org>, <apopple@...dia.com>, <bp@...en8.de>,
	<rppt@...nel.org>, <kaleshsingh@...gle.com>, <richard.weiyang@...il.com>,
	<luto@...nel.org>, <glider@...gle.com>, <pankaj.gupta@....com>,
	<pawan.kumar.gupta@...ux.intel.com>, <kuan-ying.lee@...onical.com>,
	<tony.luck@...el.com>, <tj@...nel.org>, <jgross@...e.com>,
	<dvyukov@...gle.com>, <baohua@...nel.org>, <samuel.holland@...ive.com>,
	<dennis@...nel.org>, <akpm@...ux-foundation.org>,
	<thomas.weissschuh@...utronix.de>, <surenb@...gle.com>,
	<kbingham@...nel.org>, <ankita@...dia.com>, <nathan@...nel.org>,
	<ziy@...dia.com>, <xin@...or.com>, <rafael.j.wysocki@...el.com>,
	<andriy.shevchenko@...ux.intel.com>, <cl@...ux.com>, <jhubbard@...dia.com>,
	<hpa@...or.com>, <scott@...amperecomputing.com>, <david@...hat.com>,
	<jan.kiszka@...mens.com>, <vincenzo.frascino@....com>, <corbet@....net>,
	<maz@...nel.org>, <mingo@...hat.com>, <arnd@...db.de>, <ytcoode@...il.com>,
	<xur@...gle.com>, <morbo@...gle.com>, <thiago.bauermann@...aro.org>,
	<linux-doc@...r.kernel.org>, <kasan-dev@...glegroups.com>,
	<linux-kernel@...r.kernel.org>, <llvm@...ts.linux.dev>, <linux-mm@...ck.org>,
	<linux-arm-kernel@...ts.infradead.org>, <x86@...nel.org>
Subject: Re: [PATCH v2 13/14] x86: runtime_const used for KASAN_SHADOW_END

On 2025-02-21 at 16:10:54 +0100, Maciej Wieczor-Retman wrote:
>On 2025-02-20 at 00:31:08 +0100, Andrey Konovalov wrote:
>>On Tue, Feb 18, 2025 at 9:20 AM Maciej Wieczor-Retman
>><maciej.wieczor-retman@...el.com> wrote:
>>>
>>> On x86, generic KASAN is setup in a way that needs a single
>>> KASAN_SHADOW_OFFSET value for both 4 and 5 level paging. It's required
>>> to facilitate boot time switching and it's a compiler ABI so it can't be
>>> changed during runtime.
>>>
>>> Software tag-based mode doesn't tie shadow start and end to any linear
>>> addresses as part of the compiler ABI so it can be changed during
>>> runtime.
>>
>>KASAN_SHADOW_OFFSET is passed to the compiler via
>>hwasan-mapping-offset, see scripts/Makefile.kasan (for the INLINE
>>mode). So while we can change its value, it has to be known at compile
>>time. So I don't think using a runtime constant would work.
>
>I don't know about arm64, but this doesn't seem to work right now on x86. I
>think I recall that hwasan-mapping-offset isn't implemented on the x86 LLVM or
>something like that? I'm sure I saw some note about it a while ago on the
>internet but I couldn't find it today.
>
>Anyway if KASAN_SHADOW_OFFSET is not set at compile time it defaults to nothing
>and just doesn't get passed into kasan-params a few lines below. I assume that
>result seems a little too makeshift for runtime const to make sense here?
>
>>
>>Which means that KASAN_SHADOW_OFFSET has to have such a value that
>>works for both 4 and 5 level page tables. This possibly means we might
>>need something different than the first patch in this series.
>
>I'll think again about doing one offset for both paging levels so that it's as
>optimal as possible.
>

Also I was wondering if you know what "hwasan-mapping-offset-dynamic" option is?
I noticed it in the llvm docs but can't find a good description what it does,
even from looking at the code in HWAddressSanitizer.cpp. If
hwasan-mapping-offset is not implemeneted for x86 I doubt this is but maybe it
could help in a cleaner makefile for x86 at least? Especially once these options
will be working in x86 llvm.

-- 
Kind regards
Maciej Wieczór-Retman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ