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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AC86F9D0EF for ; Tue, 14 Apr 2026 18:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:To: From:Cc:Subject:Message-Id:Date:Content-Type:Content-Transfer-Encoding: Mime-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PIr13OXyvqQI13ILw4f4y0L0essgxoSoxIUr/ZMmVb4=; b=YlHTB4PPw3cpvd/ZpxSEFHdk87 TPdX3wfwNsUoB8Gwx3/XmZ+l2GoX+sQKmJHyEt5bMBankwSSVyqcrpQsLTECSn3PIBupDfakvr7mu D973hxC0RRI7y61reALUxk5yjRzxKotq5yPaRUurY4QC1hirWzL9C8PawBCHWPDnOFfHooHKoalMc C+F7Hfdv0BAfVD/jddZu6K5EAHs449UzMuIGLVZaYbkOXAb1lVydG1K16DGcdNp5NUxcKQx1vRby6 ye3X+DQwLuuUBNzz5b/de8eichA68RNUCjY2LB5IuXJWDJdFulMj8LLzDrs9f+VypNs8Lo9VUHyD+ W6yIU+aQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wCii6-000000006yi-1iKw; Tue, 14 Apr 2026 18:42:06 +0000 Received: from smtpout-04.galae.net ([185.171.202.116]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wCii2-000000006xn-264s for linux-arm-kernel@lists.infradead.org; Tue, 14 Apr 2026 18:42:05 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id F0576C5AAB4; Tue, 14 Apr 2026 18:42:34 +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== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260414_114202_996981_1839B439 X-CRM114-Status: GOOD ( 19.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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