From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 3291931714A for ; Fri, 5 Jun 2026 01:29:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780622996; cv=none; b=ARwdOp8/r87dFtv0m1eyW0c8bhNgMdAUYDWCq1wSuXSlcp9MlOmCoo6OVkJEqOvjxZ2XFi7Pm1k3pXQkceaJfes80bTcsmpPJf6rBk4a5W7Bsn7QMuBsWiFgiPOrkv1CXU6LzZKfnCDUe4eTWnWkHJbzOQ+1/WdSw139cjhulEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780622996; c=relaxed/simple; bh=YKmllrWaSmYsL4IaBLOvWmpUXRvOPAOLT+u/THSBB+g=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=hzAFR3JfhevC1BHbHOctgZMDnLVM7p/80O8zvWbC5ZUA+dv8BUvUojH5PLyiZUOEOKA866/DvUH9eHRkDRdqTSSBlq+CoDIb5cYpxb2GmBcZzSo9i0UiSnL5252fUXV5WgiskhyH1VJuHLVV1eW+Ha2/SPtxmUop9n+ksDF4N+M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=o+vitJCg; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o+vitJCg" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-c8589498839so618094a12.2 for ; Thu, 04 Jun 2026 18:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780622990; x=1781227790; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=ZQWEjwaD6ayUqvAs37UMwrhcgTQN1s7ArIN5zCVLscY=; b=o+vitJCgI5e/XGUk32kqhH4y/VTXsfUZIWZKlssfLUsyjceRXrlveXkHTCIDAqMklA 6C3+cwKEdz3WcmZip1cJoBaI2ujgublJ//lGB9U5JoGxzPiMmBf1tTGMnrTFJgTLuJUZ 9wUGbOeRFhLQOIp11EkGw4jfY++Nf7zKmbB7dYceNSzMXloXL8rKwSJP1mfXfKZFsvkH Q5ynEQEQKRKwvr7uLGcDGwNQLMIds6Wnter6q4k+GmjQcAtnDugCLms/9uve47HhA3Xq ztvr3MKahtgfkUsD2aJMS+viaRJIbLeMWaTSs9ieuDHUlawKH6cUHXRjr8uA+0qivwyC K9fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780622990; x=1781227790; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZQWEjwaD6ayUqvAs37UMwrhcgTQN1s7ArIN5zCVLscY=; b=nPlv/VFylNDkVsIhlQpM5937wHmOM8dOlhlC6ebhDf28Ta+rBMPFymbi8o3YO7VP17 zTpRY7n3vzZK+U/9mNRZb3P+pOz9mwXlAM90UxgIj4szLyxOc8u+Eg2prVz7t05VtLh/ sXtUqkifaDReRgRMfSWnWd0opluPbkmTS6HHz2mpTtx+Jc7INxu/dzJfjG0DmB/2KK1o k5XzaZgXLTguaM+RvSoSOEtLez86rtY5Xkcyl3vgsr2dkm/e7DEz++Lkj5PX20QJtjMR CmSURyBmX9ia9Psn6RM6rC23LkP1ZoXu5Git4ARmL+KchdewIVVlm6Kt0C/5L1fN5+/H 93pA== X-Forwarded-Encrypted: i=1; AFNElJ/ixqVByO3JlHSNPmyG1vMyeN6esYzsSKp+IHTfLn+7iYJJbMXKqTS+OhYoGfuCkqifCW/nrhi7ss/aG7M=@vger.kernel.org X-Gm-Message-State: AOJu0Ywt/Bs3++q4OZa9STTsf6fsWa45/3rJpoCFL7sS7AgNtjs93Ywd UrqZ+SUJy4JBNtz/QS2P5Ni0AohRp8yTad/28efiqXO+f+sFyJFtBUdE X-Gm-Gg: Acq92OG7Xt1EBQNBlcBF701ECaVX2SdY2rBj4U+daPlCGpTdViIRt54FxFYPelK99rr kWBFGdqtqYshaH9ZIrWFIwg+6duLFsUCj8CjJJSUUF3tVLO4BHiBswwKML9zBPidlznr0+VPlir URIx4LEkbk1MKBMCHdDXA24FmtqC05P5PbirYeZcMXoZS0Zi/+MKSTr66QRp4LG+/vme6IiUiCl Y8tLo7w4V40Al7K4MfshX7137OEzR1zXdfgI3OOhnNHlCqO2yX9CBsQAjrowvg/m9BqekTAKWLf rIwyIkiInn7o1Ke+lxI+gs2USmL6pI2VivjzCGKUjJzLQXulszYlwyn0STi4Md6vYD2tn7iqw3a c28ScKNRIq8KBdnvQnl0IumHu9MMrr9f28+/vzIUBztmej4k+NB9Nipdri+MKuyiQtYBA6cTOWn UUC0iWX/KQBHBhWo2HcXu5ubDYYPi32+DH5wXQsTA68/khRwKLuBlpVNGjeXcfU8FXMuwJBbFf X-Received: by 2002:a05:6300:197:b0:3b4:7880:10c9 with SMTP id adf61e73a8af0-3b4cd0a20d9mr1597912637.43.1780622990326; Thu, 04 Jun 2026 18:29:50 -0700 (PDT) Received: from [192.168.0.13] ([38.34.87.7]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-842828daf76sm7648388b3a.42.2026.06.04.18.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 18:29:49 -0700 (PDT) Message-ID: Subject: Re: [PATCH bpf v4 2/2] selftests/bpf: Add regression test for kfunc implicit arg injection From: Eduard Zingerman To: chenyuan_fl@163.com, yonghong.song@linux.dev Cc: andrii@kernel.org, ast@kernel.org, bot+bpf-ci@kernel.org, bpf@vger.kernel.org, chenyuan@kylinos.cn, clm@meta.com, daniel@iogearbox.net, ihor.solodrai@linux.dev, jolsa@kernel.org, linux-kernel@vger.kernel.org, martin.lau@kernel.org, martin.lau@linux.dev, memxor@gmail.com, song@kernel.org Date: Thu, 04 Jun 2026 18:29:46 -0700 In-Reply-To: <20260602093836.2632714-3-chenyuan_fl@163.com> References: <535798105630b24033f33f532051b93dc853bc0d.camel@gmail.com> <20260602093836.2632714-1-chenyuan_fl@163.com> <20260602093836.2632714-3-chenyuan_fl@163.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2-9 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2026-06-02 at 17:38 +0800, chenyuan_fl@163.com wrote: > From: Yuan Chen >=20 > The preceding patch fixes a silent fallthrough in check_kfunc_args() > that could cause the verifier to skip bpf_prog_aux injection for > KF_IMPLICIT_ARGS kfuncs when module BTF is inconsistent with vmlinux > (e.g. pahole 1.30 breaking distilled base dedup). >=20 > Add a positive regression test that verifies the injection path works > correctly under normal conditions (pahole 1.31+).=C2=A0 The test contamin= ates > BPF R2 with a magic value 0xDEAD via inline assembly before calling a > KF_IMPLICIT_ARGS kfunc associated with a struct_ops map.=C2=A0 The kfunc > validates that the kernel overwrote R2 with the real bpf_prog_aux > pointer rather than leaving the stale value. >=20 > The specific pahole 1.30 BTF mismatch scenario cannot be tested with > CI (which uses pahole 1.31), but this test ensures the injection > mechanism remains correct and does not regress. >=20 > Signed-off-by: Yuan Chen > --- I think that such test makes sense, it allows to verify if implicit struct bpf_prog_aux parameter works as expected when kfunc is defined in a module. However, I'd suggest to hijack bpf_testmod.c:bpf_kfunc_implicit_arg() and verify a field like aux->name. Hence making sure that bpf_prog_aux is passed correctly. E.g.: int bpf_kfunc_implicit_arg(int a, struct bpf_prog_aux *aux) { if (strcmp(aux->name, "...expected name...") =3D=3D 0 && a > 0) return a; return -EINVAL; } Thus keeping the changes to a minimum. [...]