BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
	eddyz87@gmail.com, kernel-team@fb.com, leon.hwang@linux.dev,
	martin.lau@kernel.org, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf 1/2] bpf: Reject >8 byte return values on return-reading trampoline paths
Date: Fri, 10 Jul 2026 08:47:49 -0700	[thread overview]
Message-ID: <a08eb4ac-30de-4ddb-a65a-6d2d09883b58@linux.dev> (raw)
In-Reply-To: <a45c78cf3167aa868b8a50fae2a4979c09f21890212e2013e05303b1fff30add@mail.kernel.org>



On 7/10/26 8:45 AM, bot+bpf-ci@kernel.org wrote:
>> diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c
>> index 51b16e5f5534..bbb44ef8f87a 100644
>> --- a/kernel/bpf/bpf_struct_ops.c
>> +++ b/kernel/bpf/bpf_struct_ops.c
>> @@ -445,6 +445,18 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
>>   		goto errout;
>>   	}
>>
>> +	/*
>> +	 * A >8 byte return value is passed back in the R0:R2 register
>                                                                    ^^^^
>
> Does this comment have the correct register pair? Looking at the commit
> message, it states the second half of the return value is "RDX / R3", and
> in arch/x86/net/bpf_jit_comp.c reg2hex[] shows BPF_REG_0 = RAX and
> BPF_REG_3 = RDX, while BPF_REG_2 = RSI (an argument register).
>
> Should this be R0:R3 instead of R0:R2 to match the x86-64 ABI return pair?

It should be R0:R3. My commit message is correct, but I forgot to update
the comments. Will fix the comment.

>
>> +	 * pair, which the struct_ops trampoline does not preserve (only
>> +	 * 8 bytes of the return value are saved and restored).
>> +	 */
>> +	if (st_ops->func_models[i].ret_size > 8) {
>> +		pr_warn("func ptr %s in struct %s has a >8 byte return value, which is not supported\n",
>> +			mname, st_ops->name);
>> +		err = -EOPNOTSUPP;
>> +		goto errout;
>> +	}
>> +
>>   	stub_func_addr = *(void **)(st_ops->cfi_stubs + moff);
>>   	err = prepare_arg_info(btf, st_ops->name, mname,
>>   			       func_proto, stub_func_addr,
> [ ... ]
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/29101893933


  reply	other threads:[~2026-07-10 15:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 14:44 [PATCH bpf 1/2] bpf: Reject >8 byte return values on return-reading trampoline paths Yonghong Song
2026-07-10 14:44 ` [PATCH bpf 2/2] selftests/bpf: Add test for >8 byte return value on fexit attach Yonghong Song
2026-07-10 15:29   ` Leon Hwang
2026-07-10 15:43     ` Yonghong Song
2026-07-10 14:58 ` [PATCH bpf 1/2] bpf: Reject >8 byte return values on return-reading trampoline paths sashiko-bot
2026-07-10 15:45   ` Yonghong Song
2026-07-10 15:45 ` bot+bpf-ci
2026-07-10 15:47   ` Yonghong Song [this message]
2026-07-10 16:37 ` Leon Hwang
2026-07-10 17:45   ` Yonghong Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a08eb4ac-30de-4ddb-a65a-6d2d09883b58@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@fb.com \
    --cc=leon.hwang@linux.dev \
    --cc=martin.lau@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox