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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B255FF885A for ; Fri, 24 Apr 2026 23:31:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89F9C6B0005; Fri, 24 Apr 2026 19:31:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 850056B008A; Fri, 24 Apr 2026 19:31:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73EF66B008C; Fri, 24 Apr 2026 19:31:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 61CD16B0005 for ; Fri, 24 Apr 2026 19:31:52 -0400 (EDT) Received: from smtpin02.hostedemail.com (lb01b-stub [10.200.18.250]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EB7284015A for ; Fri, 24 Apr 2026 23:31:51 +0000 (UTC) X-FDA: 84695049222.02.A1B4CEA Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) by imf15.hostedemail.com (Postfix) with ESMTP id D237CA000C for ; Fri, 24 Apr 2026 23:31:49 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FWyOdMQC; spf=pass (imf15.hostedemail.com: domain of ihor.solodrai@linux.dev designates 95.215.58.188 as permitted sender) smtp.mailfrom=ihor.solodrai@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1777073510; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zyUuyE7w6pvvtI2U755rVQDGqOG1TjZmAAoWkbcJ3pw=; b=VAwvZFSqkFsI/48CwdbyDkMAwDyJKbpLLy1065vml47jAZCB+CibcoJAkbU8j+Az6ZCD68 G+hCSjg9KJM6khnsd7C0Wpr9afjhseZN9cdZkPoqup9tBANiFvPWYzPt9p66zYdbmKWVsg PPtq0C3gUDWZ/VLG7/DV9GkbEh6DER8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1777073510; a=rsa-sha256; cv=none; b=ZeW+e9JXyHQ8N0dwZ6yD4DNux69+/G8aR1s2U4zSrFh3oHKwr7LJRF7KRDuYDfj2VEKCbd VMUSrSkV5CdmVPDCHL/M5DNcge2E9dAzwOpMOSI5YQmbqNJ0R+OOJdheEyvYjQycz3wq+/ +V64XQBvSBMX3bQWgmTRgyj74cqSZxA= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FWyOdMQC; spf=pass (imf15.hostedemail.com: domain of ihor.solodrai@linux.dev designates 95.215.58.188 as permitted sender) smtp.mailfrom=ihor.solodrai@linux.dev; dmarc=pass (policy=none) header.from=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1777073506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zyUuyE7w6pvvtI2U755rVQDGqOG1TjZmAAoWkbcJ3pw=; b=FWyOdMQChNJACKlHSUigRbF+UkaZINGXAnfgG0l27LLGRf/hYjHu/Lxkyy0R7Svov/3cgV ca7lKrp+oJsiAffpgj9aIdrEaU8SwwAp8RbrsigFrfnx1EjvABSU63IFjcjHzxaGMsifyR FfCrsxV2p8KUbJc33PxkbcHVFDmYG7c= Date: Fri, 24 Apr 2026 16:31:29 -0700 MIME-Version: 1.0 Subject: Re: [PATCH RFC bpf-next 1/8] kasan: expose generic kasan helpers To: Alexei Starovoitov , Andrey Konovalov Cc: =?UTF-8?Q?Alexis_Lothor=C3=A9?= , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , John Fastabend , "David S. Miller" , David Ahern , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" , Shuah Khan , Maxime Coquelin , Alexandre Torgue , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Vincenzo Frascino , Andrew Morton , ebpf@linuxfoundation.org, Bastien Curutchet , Thomas Petazzoni , Xu Kuohai , bpf , LKML , Network Development , "open list:KERNEL SELFTEST FRAMEWORK" , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel , kasan-dev , linux-mm References: <20260413-kasan-v1-0-1a5831230821@bootlin.com> <20260413-kasan-v1-1-1a5831230821@bootlin.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Ihor Solodrai In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D237CA000C X-Stat-Signature: wmzuw3d49jyhd4nqtfxgd1n7go3fq7uf X-Rspam-User: X-HE-Tag: 1777073509-583222 X-HE-Meta: U2FsdGVkX1/jfd4sIYYvimQ63zWj5Ac+lq0JHAEWuzQ3EYpnxXwpiSJ8L+z+INp458GmVYKcOl0z5Oio2jMqH2+I/V7pac+vosvbVedBFUOFrHoQnNB6uIwiPL6f6S6To3jqLEBUxUkGGS2ftC5eW8cIUGFuL9QLQIoJ77r+6qcCn0KPFmqP/Zt5f0Sa2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d/p7gf/5QZvGVR06uh9AGeX210H4AHk1nPIk94kQIXcmTFUfmLkQPg6jXWcGZzuD8ytUxirnlG5pRYk/DfBzAFe9NCqI762gD4K7V/aj3+7HzuaQDnWfpRNyQZNpxiFeOAAMVIAnmMxLTQ8IfHBsTerKVdTA== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 4/19/26 3:51 PM, Alexei Starovoitov wrote: > On Sun, Apr 19, 2026 at 2:49 PM Andrey Konovalov wrote: >> >> On Tue, Apr 14, 2026 at 5:58 PM Alexei Starovoitov >> wrote: >>> >>> I think we're talking past each other. >>> We're not interested in KASAN_SW_TAGS or KASAN_HW_TAGS. >>> We're not going to modify arm64 JIT at all. >>> >>> This is purely KASAN_GENRIC and only on x86-64. >>> JIT will emit exactly what compilers emit for generic >>> which is __asan_load/store. This is as stable ABI as it can get >>> and we don't want to deviate from it. >> >> OK, I supposed that's fair. You did throw me off point with your >> performance comment. But if you decide to add SW_TAGS support at some >> point, I think this discussion needs to be revisited. >> >> But please add a comment saying that those functions are only exposed >> for BPF JIT and they are not supposed to be used by other parts of the >> kernel. And in case you do end up adding a new config option, guard >> the public declarations by a corresponding ifdef. > > I feel concerns of misuse are overblown. > Being in include/linux/kasan.h doesn't make them free-for-all > all of a sudden, but if you prefer we can just copy paste: > +void __asan_load1(void *p); > +void __asan_store1(void *p); > into bpf_jit_comp.c > >>> The goal here is to find bugs in the verifier. >>> If something got past it, that shouldn't have, >>> kasan generic on x86-64 is enough. >> >> FWIW, I suspect HW_TAGS KASAN already just works with JITed BPF code. > > Ohh. Good point. Looks like modern arm64 cpus in public clouds > don't have that enabled, so one would need pixel phone to > catch verifier bugs via hw_tags. This comment got me curious, and acckktually if we *really* want to, we can get some KASAN_HW_TAGS testing for BPF already. The first option is emulation, since QEMU supports MTE [1], e.g.: qemu-system-aarch64 -machine virt,mte=on ... This is of course slow, because it runs in software, so it's infeasible to run this for every signle patch on BPF CI. But we could run it on schedule on the base branches or smth like that. [1] https://qemu-project.gitlab.io/qemu/system/arm/virt.html The second option is set up an AmpereOne machine on Oracle Cloud (assuming they are available, haven't checked), because apparently [2] those CPUs run with MTE. It's a bunch of infra work and spending, but it is doable if it was a priority. [2] https://arxiv.org/abs/2511.17773 > So we still need this x86-specific jit kasan. > I guess eventually it can be removed when hw_tags support is widespread.