From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 6F7CA421EED; Fri, 22 May 2026 14:15:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779459311; cv=none; b=Jf7Ik2QeHcPAtbT1KFHcMs7Wg6NLzePzvYpz6afIUT7fgE8wD77z9S4NQFmvrEZieKcBo+KfohJ1e8MZxjiLfwHg6bBNv5uMgd6qBbNcTkFcULlkbTZnyyDnZLXhppXIzhGJgF1xBeMGGuun9/i5FlQhpKo8tSX0TMjhooLqtCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779459311; c=relaxed/simple; bh=iUfrRNrL8o05DROqoAZ/tpBV/SaDUV4QX0kt8nQ2MpI=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:From:To:Subject: References:In-Reply-To; b=R81hoIC7HhoyKBWiv9Dq6nu+uULrKjesPn3Mn5vK2ZSILG2gr9mSJg063mNCFGq3UjnQrxZ/UK06ZuMOkKWVZ0nQyOyykCCh+01BFIupvqwYyfZbyVJYDDwLhfdUnHZdxxDeggI0MBeamBqw6drAjSn1Sc/vV91mgGMNLi88wN4= 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=y5oLDx4M; arc=none smtp.client-ip=185.171.202.116 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="y5oLDx4M" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id AB689C2C65D; Fri, 22 May 2026 14:15:51 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 02B006003C; Fri, 22 May 2026 14:14:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5BB6F108114CA; Fri, 22 May 2026 16:14:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1779459294; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MCr0vkGm9xcy3EIrUUYMtpoAG6We8dBTUowneJJEzqk=; b=y5oLDx4MGy2qc7YsUG7iHN1xn8YtdnwJTaS+MweXzZYeTNKztTrSK6FkTS5hegoJZRjtx/ +KPJ88pozLnoBFId69yh0BFSmYr2Oid0fQhr2rdZXSEViLMGh37HZ3wFYq3sXIwaltcL4H Ru8nuWXTFrJ7XB1LT7TKvjf55JQe+Wwr57sEwswqTCVrHvSyCZl6RSGSFe4rzRp/5LcBlt U9OC+4uUcAsfHb7a6LexLMZh7y7JlLFFF5SVyh2/PQsumMTUzuN7QBIlOn2LRCblqP/6xx dRGN6BEjblEu7ydOpdyrpOiH0emrXZ12KjrfkRuxO1yuH60EFy2zP3F5X5BPHQ== Precedence: bulk X-Mailing-List: netdev@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: Fri, 22 May 2026 16:14:38 +0200 Message-Id: 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?= Subject: Re: [PATCH RFC bpf-next 3/8] bpf: add BPF_JIT_KASAN for KASAN instrumentation of JITed programs X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20260413-kasan-v1-0-1a5831230821@bootlin.com> <20260413-kasan-v1-3-1a5831230821@bootlin.com> In-Reply-To: X-Last-TLS-Session-Version: TLSv1.3 On Tue Apr 14, 2026 at 4:38 PM CEST, Alexei Starovoitov wrote: > On Tue, Apr 14, 2026 at 6:24=E2=80=AFAM Alexis Lothor=C3=A9 > wrote: >> >> On Tue Apr 14, 2026 at 12:20 AM CEST, Andrey Konovalov wrote: >> > On Mon, Apr 13, 2026 at 8:29=E2=80=AFPM Alexis Lothor=C3=A9 (eBPF Foun= dation) >> > wrote: [...] >> >> +config BPF_JIT_KASAN >> >> + bool >> >> + depends on HAVE_EBPF_JIT_KASAN >> >> + default y if BPF_JIT && KASAN_GENERIC >> > >> > Should this be "depends on KASAN && KASAN_GENERIC"? >> >> Meaning, making it an explicit user-selectable option ? >> >> If so, the current design choice is voluntary and based on the feedback >> received on the original RFC, where I have been suggested to >> automatically enable the KASAN instrumentation in BPF programs if KASAN >> support is enabled in the kernel ([1]). But if a user-selectable toggle >> is eventually a better solution, I'm fine with changing it. > > Let's not add more config knobs. > Even this patch looks redundant. > Inside JIT do instrumentation when KASAN_GENERIC is set. (with quite some delay) I think it would be better to keep this new BPF_JIT_KASAN, because aside from the possibility to use it in bpf_jit_comp.c, it allows to update tests affected by KASAN instrumentation in a nicer way. For example, the test_loader subtests that monitor JITted instructions are confused by KASAN. I can either skip them or make them smarter when KASAN is enabled for BPF, but in both cases, it would be nicer to just adapt the behavior based on a generic CONFIG_BPF_JIT_KASAN, rather than sprinkling some "if jit_enabled AND CONFIG_KASAN_GENERIC AND ARCH_X86" in selftests. That still does not make it a config knob, that just creates an internal Kconfig option that is automatically turned on when KASAN and JIT are enabled at build time. --=20 Alexis Lothor=C3=A9, Bootlin Embedded Linux and Kernel engineering https://bootlin.com