From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 66-220-155-178.mail-mxout.facebook.com (66-220-155-178.mail-mxout.facebook.com [66.220.155.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 6B14438DC7B for ; Sat, 12 Sep 2026 19:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.220.155.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242751; cv=none; b=OCccGr17Q197mn86ePNAsUASD/o1StcLG8bBH9GDJmKLKpRLrEmDucggfIxLpq/Zyha/anVNUo9KQugBHOru58Xss5UHRQmF4YBp4Pzrfl6vVSs/KCQeuL2kvlxB5vR0NPd+zYe2bDRTKVKMY33VCcjadKfw8nPxV6uFC/KOOa4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242751; c=relaxed/simple; bh=/W7HexWNN7oEJYv09nd7uGxAvVD1kNJ/gEPWcWfGZ08=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a3EtMqpp1VVdvVhKD1T+VxoIlvP2ucCbbDlBGgiqN6UeWxbrRQjrzalHwduo1tkT0Ygm26vxcwDGhPWDK0PQnD5zB4e8UvE3+DADhJwvtqgwcn3OUyYGy+jrz5c3mY+MHO3gUK247wOcTPRoiWJyPRN6WMvUxh62ZHfyO1ful8o= 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=66.220.155.178 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 18D982A58A0D1E; Sat, 12 Sep 2026 12:52:27 -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 v4 06/15] bpf: Support __int128 as a by-value function argument Date: Sat, 12 Sep 2026 12:52:27 -0700 Message-ID: <20260912195227.987991-1-yonghong.song@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260912195156.980886-1-yonghong.song@linux.dev> References: <20260912195156.980886-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 +++------ .../testing/selftests/bpf/progs/verifier_aggregate_arg.c | 7 +------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index c560ee0c4347..9f8a4e4aac3b 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -8264,11 +8264,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_SCALAR; - 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) { @@ -8280,7 +8276,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_aggregate_arg.c b= /tools/testing/selftests/bpf/progs/verifier_aggregate_arg.c index d90f754396d0..fc7c1b18bc40 100644 --- a/tools/testing/selftests/bpf/progs/verifier_aggregate_arg.c +++ b/tools/testing/selftests/bpf/progs/verifier_aggregate_arg.c @@ -17,12 +17,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