From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f53.google.com (mail-dl1-f53.google.com [74.125.82.53]) (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 126BD221FA0 for ; Tue, 20 Jan 2026 02:44:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768877092; cv=none; b=nO2cBOz0J9enwyn+CK7OX4kw+PKwiE7pOyyEAyOGalY9+TBzzeDJkOAIjlv3uyoYWxPrEzpTt+zuJgBQQaNcnbRtQ4sYCD0/f2+fflb5ll1V9ELY2N/7kIueyemst0vwAKCIJ/NfNYoLR//kRpsMezHMB5EjOJjjTCkUWm3cs0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768877092; c=relaxed/simple; bh=If41zOkOP0scm5TZMIBjYL64Hb+I+qeK3M1HiwITHfA=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=C26NwXaSMamp1pAVsswd4mH9XrCKNSEVLsTthtXEMg4lCXnu2YAdnjosUmV266mDC3W/x/zTpFyUOoHo9x1qBer2hsXOHMtLNB0cuYBC2tGbE14ijr7lvczY/zT7O3wWA0rHz5w/asveWmLsee/HIjWLc2mtCdTbkJu0P7b5ZUg= 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=SqFl3sKE; arc=none smtp.client-ip=74.125.82.53 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="SqFl3sKE" Received: by mail-dl1-f53.google.com with SMTP id a92af1059eb24-11f1fb91996so11235545c88.1 for ; Mon, 19 Jan 2026 18:44:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768877090; x=1769481890; 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=3odNBdrf6aEyMBCFvJIVDjybvUoKRUaMAkhxu2qWeKU=; b=SqFl3sKEX6wVbFF1e9+pamWxv5wYt1PK+TDbWJ80wut2KpTYEnQ9IT4A4XuAk8/Q6q sV2AiUOm1Q68oDV64ltB1nmh/dwZxBGsw+oakvrzrTVW/PpoEQPLSeBBQOFo6pEHDe0r 6U12+Z1bSt7PhCQDERlfEvj3N+4Smll2Re68NVMq9UAKpyidHiCT5B9onA3hRBYtvOFD ZQKbdOKOtPJCZluryNY6iBIrex+pFnB7tSTslSou2GJu+qONC7Kcvrsx5/Lda65o688P JpURZAhFexbVg+0m0MbdDw0zVmvBpuT9xqW2mbBJXkt4FhQfLo7+3biUoJvkfD0EfMk1 7rGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768877090; x=1769481890; 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=3odNBdrf6aEyMBCFvJIVDjybvUoKRUaMAkhxu2qWeKU=; b=gm/YjiAl7mUzMzObsJiBcxvwh0nLObPR2IuJkXZ/9Fnd3jF34V1wVavrKkk16mhBEt JSPUk8Erjept6FAsH2ROUzexRvpHMw7MK9nSOfFOEMGmy58lhIsAheP5PZn8AwDuDB9W lHZdMgaTIn+YILRAA+wcEkjEb+5VVlvd5ZxVuzIfPI6OAEe+XiBLAlmEI+Llsv1YP3Iw h5OdcedJMUrEMBwjiCfDusbVZnq5kz3m9IowqgTHAVFXuH1U3/9eAHqP1nm8kU4IWjyt bRy8isjgtKfEmlda1eHGwIQRlb2xhfzYcdAZXpWgvSFvF1+g2LIVaQNbZX/DqGX/2Uht XG8w== X-Forwarded-Encrypted: i=1; AJvYcCXrZWEO3Hp7cgRNeiqe5ejhvoR1zsj4p1es8KGflSu4Ew4jB7VGnM1TVdUDVJfaVJ/KgPfwQr9ZcSBMzSI=@vger.kernel.org X-Gm-Message-State: AOJu0YxaHvkqrkMZGzFpziXx9xs4djb06JqbTV5ZhTLPtxXh8BdhkHD6 Gp4UVZ9ldbOYuuZjRvK00GfWjCxqows0/cgu1Z/ZOinCvlj7HGA03Mjg X-Gm-Gg: AY/fxX6j6TkjomlyKcHwOCEqtHCshzYs1V8Jvf2nX1/T0tLMpa1fIQ6oqp5sCcMZQf2 +YyMgudiI6LhbFZmFR1Ckk8Hb3orraJiDGJTDVL+PJOWnkh/Uq3fFWu5yXGJrpofVYWJ95fwSfg ZR+fa5omUynXJk4RIHUpShMC99JarK2chTAQIw65apLSQtsq+ijZeZJtCzPINs8efsr7685KR7S oCJMatJy1uKhbsfCoyS6V4k0OtzdLPnC0I9FX19KANSOJfbX3gJGRQ2kNXvkgQKbWkpIwMh2gcC hXM+SwA9c9nkyVyBxpKGCKL+EOGConlf1D+6sIXO2/oai47gaFanqxSAcEKWlFig2oYZIqOdgO2 zMN62GvEXAzUOV8SMrBjn6V8/m+H4gMjLmupRANj3tap5AsjsGdy8ivH+h+3HmR8HgdTtnDc2j3 S4h3bQhsNna4w34zsdteYIXF+o75dFpQL8RSPUT6cdQd2Vv/CgS3TAZphNVEtKJZgaomzoU4cBt LQx X-Received: by 2002:a05:7022:6084:b0:11b:9386:a3bf with SMTP id a92af1059eb24-1244b394b96mr9022978c88.42.1768870562325; Mon, 19 Jan 2026 16:56:02 -0800 (PST) Received: from ?IPv6:2a03:83e0:115c:1:4cd6:17bf:3333:255f? ([2620:10d:c090:500::aa81]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1244ad740c5sm19462181c88.8.2026.01.19.16.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jan 2026 16:56:01 -0800 (PST) Message-ID: Subject: Re: [PATCH bpf-next v2 05/13] resolve_btfids: Support for KF_IMPLICIT_ARGS From: Eduard Zingerman To: Ihor Solodrai , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau Cc: Mykyta Yatsenko , Tejun Heo , Alan Maguire , Benjamin Tissoires , Jiri Kosina , Amery Hung , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, sched-ext@lists.linux.dev Date: Mon, 19 Jan 2026 16:55:59 -0800 In-Reply-To: <20260116201700.864797-6-ihor.solodrai@linux.dev> References: <20260116201700.864797-1-ihor.solodrai@linux.dev> <20260116201700.864797-6-ihor.solodrai@linux.dev> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 (3.58.2-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2026-01-16 at 12:16 -0800, Ihor Solodrai wrote: > Implement BTF modifications in resolve_btfids to support BPF kernel > functions with implicit arguments. >=20 > For a kfunc marked with KF_IMPLICIT_ARGS flag, a new function > prototype is added to BTF that does not have implicit arguments. The > kfunc's prototype is then updated to a new one in BTF. This prototype > is the intended interface for the BPF programs. >=20 > A _impl function is added to BTF to make the original kfunc > prototype searchable for the BPF verifier. If a _impl > function already exists in BTF, its interpreted as a legacy case, and > this step is skipped. >=20 > Whether an argument is implicit is determined by its type: > currently only `struct bpf_prog_aux *` is supported. >=20 > As a result, the BTF associated with kfunc is changed from >=20 > __bpf_kfunc bpf_foo(int arg1, struct bpf_prog_aux *aux); >=20 > into >=20 > bpf_foo_impl(int arg1, struct bpf_prog_aux *aux); > __bpf_kfunc bpf_foo(int arg1); >=20 > For more context see previous discussions and patches [1][2]. >=20 > [1] https://lore.kernel.org/dwarves/ba1650aa-fafd-49a8-bea4-bdddee7c38c9@= linux.dev/ > [2] https://lore.kernel.org/bpf/20251029190113.3323406-1-ihor.solodrai@li= nux.dev/ >=20 > Signed-off-by: Ihor Solodrai > --- Patch logic looks good to me, modulo LLM's memory management concern and nit from Andrii. Acked-by: Eduard Zingerman > @@ -837,6 +854,369 @@ static int dump_raw_btf(struct btf *btf, const char= *out_path) > return 0; > } > =20 > +static const struct btf_type *btf_type_skip_qualifiers(const struct btf = *btf, s32 type_id) > +{ > + const struct btf_type *t =3D btf__type_by_id(btf, type_id); > + > + while (btf_is_mod(t)) > + t =3D btf__type_by_id(btf, t->type); > + > + return t; > +} > + > +static const struct btf_decl_tag *btf_type_decl_tag(const struct btf_typ= e *t) > +{ > + return (const struct btf_decl_tag *)(t + 1); > +} Nit: there is a utility function btf_decl_tag() in bpf/btf.h which does exactly the same. [...]