From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 69-171-232-180.mail-mxout.facebook.com (69-171-232-180.mail-mxout.facebook.com [69.171.232.180]) (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 16D1A40F754 for ; Fri, 4 Sep 2026 05:10:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=69.171.232.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788498632; cv=none; b=EI4RIoWjRrIKBkyRwyFBB5hWql6ypU9sD2XtnkxvNUSH4fk9XolGzDl38v3zW5NUdliXJ4tWdmh4Wc5wIw6+xpoatC882KJMQn8a9XZ4eMxh19qSbWY+ZG9y/XsRqjjfD2tILLCuyuJNTTOlSQdQEtwn6lfSOmuwhr2RioXBLxI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788498632; c=relaxed/simple; bh=g9V7rcV7z/Tr8t+D6rEVIM4ZISxCMrWvQ2ALBINV5ps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oXzxhgzxEpPIErkieg8UBZT28YK9ZjYScVySOZJYBr1B4FVp/wx14549BpKXyiAmiFvj+i4k4Z7bF48pUHFsP6cKkMbb68f9QjeAn6zeP3RQ8otfoikonOWp1TJC/24vkf+QQGrrkM62FOoGw5jQhCW14MI9FCyqkPSb7HADJ5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev; spf=fail smtp.mailfrom=linux.dev; arc=none smtp.client-ip=69.171.232.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=linux.dev Received: by devvm16039.vll0.facebook.com (Postfix, from userid 128203) id 2C17B28813170B; Thu, 3 Sep 2026 22:10:18 -0700 (PDT) From: Yonghong Song To: bpf@vger.kernel.org Cc: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Eduard Zingerman , kernel-team@fb.com Subject: [PATCH bpf-next 04/12] bpf: Support __int128 as a by-value function argument Date: Thu, 3 Sep 2026 22:10:18 -0700 Message-ID: <20260904051018.3978585-1-yonghong.song@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260904050957.3976119-1-yonghong.song@linux.dev> References: <20260904050957.3976119-1-yonghong.song@linux.dev> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable A 128-bit integer follows the same calling convention as a 16-byte by-value struct: LLVM emits it as a 16-byte BTF_KIND_INT and passes it in two consecutive argument registers. So a __int128 gets its two slots. The test added at the start of the series, which recorded the wrong register map as an R4 !read_ok rejection, now passes and is flipped to __success. Signed-off-by: Yonghong Song --- kernel/bpf/btf.c | 9 +++------ tools/testing/selftests/bpf/progs/verifier_int128_arg.c | 7 +------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index dbd64cee1b27..6c391449e298 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -8235,11 +8235,7 @@ int btf_prepare_func_args(struct bpf_verifier_env = *env, int subprog) bpf_log(log, "arg#%d has pointer tag, but is not a pointer type\n", i= ); return -EINVAL; } - if (btf_type_is_int(t) || btf_is_any_enum(t)) { - sub->args[slots_used++].arg_type =3D ARG_ANYTHING; - continue; - } - if (btf_type_is_struct(t)) { + if (btf_type_is_int(t) || btf_is_any_enum(t) || btf_type_is_struct(t))= { u32 nslots; =20 if (!t->size || t->size > 2 * BPF_REG_SIZE) { @@ -8251,7 +8247,8 @@ int btf_prepare_func_args(struct bpf_verifier_env *= env, int subprog) i, btf_type_str(t), tname, t->size, 2 * BPF_REG_SIZE); return -EINVAL; } - if (!btf_struct_is_composed_of(env, btf, t, BTF_MEMBER_SCALAR)) { + if (btf_type_is_struct(t) && + !btf_struct_is_composed_of(env, btf, t, BTF_MEMBER_SCALAR)) { if (!is_global) return -EINVAL; bpf_log(log, "Arg#%d type %s in %s() is not composed of scalars\n", diff --git a/tools/testing/selftests/bpf/progs/verifier_int128_arg.c b/to= ols/testing/selftests/bpf/progs/verifier_int128_arg.c index 419851f2d8d0..044fc4a80055 100644 --- a/tools/testing/selftests/bpf/progs/verifier_int128_arg.c +++ b/tools/testing/selftests/bpf/progs/verifier_int128_arg.c @@ -15,12 +15,7 @@ __noinline __u64 take_i128_global(int a, u128 v, int c= ) } =20 SEC("tc") -/* - * The verifier counts one argument register for the __int128 and marks = only - * R1 through R3 at the entry of take_i128_global(), while the compiler = passed - * a in R1, v in R2:R3 and c in R4. - */ -__failure __msg("R4 !read_ok") +__success __retval(0) int aggregate_arg_int128_c_test(struct __sk_buff *skb) { __u64 a =3D skb->len ^ MIX_A; --=20 2.53.0-Meta