bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Hengqi Chen <hengqi.chen@gmail.com>,
	chenhuacai@kernel.org, jianghaoran@kylinos.cn,
	duanchenghao@kylinos.cn, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org, martin.lau@linux.dev, vincent.mc.li@gmail.com
Cc: bpf@vger.kernel.org, loongarch@lists.linux.dev
Subject: Re: [PATCH 2/3] LoongArch: BPF: Sign extend struct ops return values properly
Date: Thu, 21 Aug 2025 21:52:20 +0800	[thread overview]
Message-ID: <b4abb062-f11b-2246-ac9e-02c871e68e86@loongson.cn> (raw)
In-Reply-To: <20250821091003.404870-3-hengqi.chen@gmail.com>

On 2025/8/21 下午5:10, Hengqi Chen wrote:
> The ns_bpf_qdisc selftest triggers a kernel panic:
...

> The bpf_fifo_dequeue prog returns a skb which is a pointer.
> The pointer is treated as a 32bit value and sign extend to
> 64bit in epilogue. This behavior is right for most bpf prog
> types but wrong for struct ops which requires LoongArch ABI.
> 
> So let's sign extend struct ops return values according to
> the return value spec in function model.
> 
> Fixes: 6abf17d690d8 ("LoongArch: BPF: Add struct ops support for trampoline")
> Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>

The following related testcases passed on LoongArch:

   sudo modprobe test_bpf
   sudo ./test_progs -a ns_bpf_qdisc
   sudo ./test_progs -t struct_ops -d struct_ops_multi_pages

Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn>

Thanks,
Tiezhu


  reply	other threads:[~2025-08-21 13:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21  9:10 [PATCH 0/3] LoongArch: Fix BPF trampoline related issues Hengqi Chen
2025-08-21  9:10 ` [PATCH 1/3] LoongArch: BPF: Remove duplicated flags check Hengqi Chen
2025-08-21 13:48   ` Tiezhu Yang
2025-08-21  9:10 ` [PATCH 2/3] LoongArch: BPF: Sign extend struct ops return values properly Hengqi Chen
2025-08-21 13:52   ` Tiezhu Yang [this message]
2025-08-21  9:10 ` [PATCH 3/3] LoongArch: BPF: No support of struct argument in trampoline programs Hengqi Chen
2025-08-21 13:57   ` Tiezhu Yang
2025-08-25  2:11 ` [PATCH 0/3] LoongArch: Fix BPF trampoline related issues Vincent Li

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=b4abb062-f11b-2246-ac9e-02c871e68e86@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=duanchenghao@kylinos.cn \
    --cc=hengqi.chen@gmail.com \
    --cc=jianghaoran@kylinos.cn \
    --cc=loongarch@lists.linux.dev \
    --cc=martin.lau@linux.dev \
    --cc=vincent.mc.li@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).