From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48CF431DD97; Tue, 14 Apr 2026 18:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776192126; cv=none; b=UG8fBCL12zgx6VWBfjuSywLf28OzJnQ0Rkmp68Xntj67DmbHTspP7DWEY+yAL7pkXprG1ox5+88wj+vGZXySJFwzCA0c0XGZmiYiWFY0rVuCeqnJcINtpoT52QndQigOkNVOpyd3XYZJ8VsCUh5jLjGWtqHqRfTazIvOux8Xiuo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776192126; c=relaxed/simple; bh=PIr13OXyvqQI13ILw4f4y0L0essgxoSoxIUr/ZMmVb4=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:From:To: References:In-Reply-To; b=IUC1+kv4Q2lIvuwsawFNpZeFqJdFNS7aPRoZ2JXYI+c0Dfg+i6uUgq/pMjXx8WaDA2z+cBT0zOIS7FYMrxXAO6qoE3cxhStcsbmiXucgnqTbWsuJq9aI8wdsebyssLvyMEjuDNn3InA5gdSxwexz79X9y/88Cx9SZD9HhJyGF00= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=LJlMRDg+; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="LJlMRDg+" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id D3EB64E425B6; Tue, 14 Apr 2026 18:41:57 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9A0AB60410; Tue, 14 Apr 2026 18:41:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E8DF710451333; Tue, 14 Apr 2026 20:41:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1776192115; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=PIr13OXyvqQI13ILw4f4y0L0essgxoSoxIUr/ZMmVb4=; b=LJlMRDg+IR59Wd/DECLqU70wLASm1Z510eZOEYERg65QVMD7HevQcKcFSFn4ExyLIN9Wcu eZPRoEPIMbNNyEhW6ixrnG0gP6QRyaA64iP3a4hxRrbhU/QWuTCH4aZ36RE+uK8FYkyljL QUiKvI64VGrTMaDSQRwQ6Ot3AorBs1Y5UNJBo0jNrCvmEasqN+jIVXValz6c8fRSFOmKfs XAO75NGEjOi4zCGbhKMOvpz1fZ6pOrJyAVLNyiELzgr5CNVU14ocpDTafsWCkxnjHktiJr Q77KcdFV9qwJPOElw6PEmuEU5ULPjUTGDVeUrl1tC4ffCCtjAg2sugdc6CutDw== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 14 Apr 2026 20:41:42 +0200 Message-Id: Subject: Re: [PATCH RFC bpf-next 1/8] kasan: expose generic kasan helpers Cc: "Andrey Konovalov" , "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" , , "Bastien Curutchet" , "Thomas Petazzoni" , "Xu Kuohai" , "bpf" , "LKML" , "Network Development" , "open list:KERNEL SELFTEST FRAMEWORK" , , "linux-arm-kernel" , "kasan-dev" , "linux-mm" From: =?utf-8?q?Alexis_Lothor=C3=A9?= To: "Alexei Starovoitov" , =?utf-8?q?Alexis_Lothor=C3=A9?= X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20260413-kasan-v1-0-1a5831230821@bootlin.com> <20260413-kasan-v1-1-1a5831230821@bootlin.com> In-Reply-To: X-Last-TLS-Session-Version: TLSv1.3 On Tue Apr 14, 2026 at 4:36 PM CEST, Alexei Starovoitov wrote: > On Tue, Apr 14, 2026 at 6:13=E2=80=AFAM Alexis Lothor=C3=A9 > wrote: >> >> Hi Andrey, thanks for the prompt review ! >> >> On Tue Apr 14, 2026 at 12:19 AM CEST, Andrey Konovalov wrote: >> > On Mon, Apr 13, 2026 at 8:29=E2=80=AFPM Alexis Lothor=C3=A9 (eBPF Foun= dation) >> > wrote: >> >> >> >> [...] >> >> >> +#ifdef CONFIG_KASAN_GENERIC >> >> +void __asan_load1(void *p); >> >> +void __asan_store1(void *p); >> >> +void __asan_load2(void *p); >> >> +void __asan_store2(void *p); >> >> +void __asan_load4(void *p); >> >> +void __asan_store4(void *p); >> >> +void __asan_load8(void *p); >> >> +void __asan_store8(void *p); >> >> +void __asan_load16(void *p); >> >> +void __asan_store16(void *p); >> >> +#endif /* CONFIG_KASAN_GENERIC */ >> > >> > This looks ugly, let's not do this unless it's really required. >> > >> > You can just use kasan_check_read/write() instead - these are public >> > wrappers around the same shadow memory checking functions. And they >> > also work with the SW_TAGS mode, in case the BPF would want to use >> > that mode at some point. (For HW_TAGS, we only have kasan_check_byte() >> > that checks a single byte, but it can be extended in the future if >> > required to be used by BPF.) >> >> ACK, I'll try to use those kasan_check_read and kasan_check_write rather >> than __asan_{load,store}X. > > No. The performance penalty will be too high. Since we are mentioning it, I did not consider yet any performance comparision/benchmarking (and I am not really familiar with usual bpf performance validation practices for new bpf features). Is there any existing test I should take a look at for this ? Maybe some specific benches in tools/testing/selftests/bpf/bench ?=20 > hw_tags won't work without corresponding JIT work. > I see no point sacrificing performance for aesthetics. > __asan_load/storeX is what compilers emit. > In that sense JIT is a compiler it should emit exactly the same. --=20 Alexis Lothor=C3=A9, Bootlin Embedded Linux and Kernel engineering https://bootlin.com