From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f178.google.com (mail-dy1-f178.google.com [74.125.82.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41DCF3BB9F5 for ; Fri, 22 May 2026 17:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470022; cv=none; b=GM8CUaKQvpGq9HF0acyi0llQZkj1rPcCiduMqPFRoiz/WPUV4mO0qP0JiIg2DVHYfke4DuJYm4zlvGXik341rCEl6B77JwBuoUEmGB3oBp7BjHnJLq915d5PvNZlC+qOkM2dqgq8W/iU2vJbAXbN2phsxGiz0Umoq2uzz7Lm0Xg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470022; c=relaxed/simple; bh=a+CInxeSB1Zqe7+X7tbNilMFXAdB47JkuFSLHzgtQp0=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=Kd7YUuAdSc3qgRtOFrsg+RFI2LBpkPXaAK2Q5Y20FkGL3eVufk3NjX3Gt61/ztrpfcZXXjw0FL7Z6dNSttSVnynw10f29mf+v+EwUjhhYioS8CejtUWFQj6Olj7AkXSTP3Jaq3EE0NFE46yAiKd9m7CRbSu+/Z7q2AI55phus64= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com; spf=pass smtp.mailfrom=etsalapatis.com; dkim=pass (2048-bit key) header.d=etsalapatis-com.20251104.gappssmtp.com header.i=@etsalapatis-com.20251104.gappssmtp.com header.b=mb5avOus; arc=none smtp.client-ip=74.125.82.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=etsalapatis-com.20251104.gappssmtp.com header.i=@etsalapatis-com.20251104.gappssmtp.com header.b="mb5avOus" Received: by mail-dy1-f178.google.com with SMTP id 5a478bee46e88-2f0ad52830cso9805417eec.1 for ; Fri, 22 May 2026 10:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=etsalapatis-com.20251104.gappssmtp.com; s=20251104; t=1779470020; x=1780074820; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wY4I8lMoFI92sp/KvSm+KBFNyjnf2+5FqBSVyBYIdTY=; b=mb5avOusvH++FgQcBBfSDMOsB1NyLQKilnVtcHQxyJBsnXRzm8q4NnE7ilDv/f/pnL h7SgTyEQyWIQknSdq+vG2gLE0yQyhn5Hdk4du3LBRrVNfY5p4c095DyH2/28wqcdxVgj KABArBH7YfUiM7LF7AAroA/UIdMn5oSDk4+13FWGXmk0UdrpNQzkB6l4idqTrTh8YCIN 2i592+RByhRugCuxZ2YQuWOjRnKhZMPwKQwZFZm2mhXu2/4XITbQS7bEl9bi5oaNd+HL XOIKThbxeedA0VS0iGfhfz80NsrYsQ9xnAvCi0uBKHRCGPvAnsbXzZflULPXAKGgYrGM jb9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779470020; x=1780074820; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=wY4I8lMoFI92sp/KvSm+KBFNyjnf2+5FqBSVyBYIdTY=; b=e+9fBKD1BjdUJklljIgskm4pqmTJZIgmZ2kviPvOd3liFPWXswEYtVaiGtT7s9zsgD fejNEn7k3hLatWqDl3PjStZnq0sc+EsiULVcNlS9ctOjBQVR3BzQNP2UWFmUcjj/D59b CRN10FQYEsbZjQq04pne9gJwloIfFvRK9S+S58/Kn/qVtlexWIJdOnV/cgNps6PIYsb9 uwkMe6NXG3QYiEdT2ugJZyvK/11aoLBp5XypvsJiEtTw/vrwed4vMAqt3quIkmVng4ru 9Jjbq6kZlxK5Mt8Hr56yMfiSZv314dIhxadROmtXmUzNAKhnIqkVNjJ6ZJ78DiHeywxe Dkzg== X-Forwarded-Encrypted: i=1; AFNElJ+EkgHslolK2Gr23Iz1qO9+y0RsI1+gB10qLaU9BzGBbPK15OTiUeBvxgmtVDj9YHVWEQXgcmo=@vger.kernel.org X-Gm-Message-State: AOJu0YwP17PfGbXQQLlxE86ziNGLkis5wnvH6yAH6TJ38DQCMZzh/Myw 5xPaKVgPo7JjD6alxA4Ty+n/jxnCwGB24gTc1U9qxtOvIBD5PxAF6BzAEp1q861jjd8= X-Gm-Gg: Acq92OGaMwoWMVm5DBUYuNMw2TMTxqA/aiLQ/EWhQbkNqsGA72cckywZK/ldh6wsDwV 0kqEzx/guWIitro0T37RboHzKJT3gEbB5L9ZS4H1fKJT5UwAn4JafB+8O/ozXBW3mtbGrP2AkF7 pC87yj3YW4RIQk5VbRgUiLXZ8X57GFMoAM8LJqxhxvB+pMgNYMFKsstCtfEMmpuOgnSpM1mNY4D jde62cTc3V57jRsQdb6nwCSH1qg6szEY7+XC/bDZ4pD//r73XC/FoaJXgSUYQ/HkcZVyBFHF6Bb NkPPvEeQIAb7QZHoy/Na4OhWli+eylzG9QNYbLCORa8Tfet2RJyiU6lcB8KBPbODlCNEVLXBCM8 YXNJkhJILaFksxMf1z2NQlLCA5jyTDv50iHZ9JBHmVuH9V28ibh/MKR6W//LUInrIE7mGFjcqn/ qUhfHX+hRSjsZvNEU= X-Received: by 2002:a05:7301:168b:b0:2be:833c:149d with SMTP id 5a478bee46e88-304491e11fcmr2091389eec.28.1779470020197; Fri, 22 May 2026 10:13:40 -0700 (PDT) Received: from localhost ([2620:10d:c090:600::69da]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30451f3feadsm1872911eec.13.2026.05.22.10.13.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 May 2026 10:13:39 -0700 (PDT) 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 13:13:35 -0400 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" Subject: Re: [PATCH RFC bpf-next 3/8] bpf: add BPF_JIT_KASAN for KASAN instrumentation of JITed programs From: "Emil Tsalapatis" To: =?utf-8?q?Alexis_Lothor=C3=A9?= , "Alexei Starovoitov" 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: On Fri May 22, 2026 at 10:14 AM EDT, Alexis Lothor=C3=A9 wrote: > 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 Fou= ndation) >>> > 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. Having a togglable config knob gives us the option to set up KASAN for the kernel but not for BPF, and I don't see why we'd want that. Imo we are already paying the cost of KASAN for the rest of the kernel, there is no incentive to not run it for the BPF JIT. Having to eat the complexity cost in the selftests seems reasonable if the alternative means a cleaner interface for the user (preventing them from choosing an unreasonable combination of options).