From: Daniel Borkmann <daniel@iogearbox.net>
To: Puranjay Mohan <puranjay12@gmail.com>,
Jonas Rebmann <jre@pengutronix.de>
Cc: Alexei Starovoitov <ast@kernel.org>,
Russell King <linux@armlinux.org.uk>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
Subject: Re: XDP BPF JIT memory leak on armv7
Date: Fri, 17 Apr 2026 13:24:53 +0200 [thread overview]
Message-ID: <8a34a3da-45c3-4968-9c51-0ecb865d8f9f@iogearbox.net> (raw)
In-Reply-To: <CANk7y0h42MFVGpTwNxGPRnUbW6r7uB8EqWR-PGWAd7UJVLqSOw@mail.gmail.com>
On 4/17/26 11:56 AM, Puranjay Mohan wrote:
>> On 2026-04-16 16:36, Daniel Borkmann wrote:
>>> I don't have access to arm32, but it looks like its completely missing the
>>> ability to do BPF to BPF calls.. you would need something like the below
>>> (uncompiled / untested).
>>
>> Applying your Patch to latest master leads to a paging error [1] and
>> segmentation fault in xdp_program__attach when I run
>> ./xdp_pass_user -d lo
>>
>>> I think the problem is that BPF to BPF calls are not supported but the
>>> JIT doesn't reject them as well, so the best way to fix this would be
>>> to do:
>>>
>>> diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
>>> index deeb8f292454..91fef10e88bc 100644
>>> --- a/arch/arm/net/bpf_jit_32.c
>>> +++ b/arch/arm/net/bpf_jit_32.c
>>> @@ -2047,6 +2047,8 @@ static int build_insn(const struct bpf_insn
>>> *insn, struct jit_ctx *ctx)
>>> /* function call */
>>> case BPF_JMP | BPF_CALL:
>>> {
>>> + if (insn->src_reg == BPF_PSEUDO_CALL)
>>> + goto notyet;
>>> const s8 *r0 = bpf2a32[BPF_REG_0];
>>> const s8 *r1 = bpf2a32[BPF_REG_1];
>>> const s8 *r2 = bpf2a32[BPF_REG_2];
>>>
>>> This will cause the memory to be freed properly.
>>
>> This works for me and resolves the issue.
>>
>> Tested-by: Jonas Rebmann <jre@pengutronix.de>
>
> Thanks for testing, let me send the patch to the list.
Sounds good, I think it might also be worth to check the other
JITs which are not mainstream to see if they have the extra
pass and if not then adding similar not-yet bailout to them.
Cheers,
Daniel
next prev parent reply other threads:[~2026-04-17 11:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 14:05 Jonas Rebmann
2026-04-16 14:36 ` Daniel Borkmann
2026-04-16 15:58 ` Puranjay Mohan
2026-04-17 9:47 ` Jonas Rebmann
2026-04-17 9:56 ` Puranjay Mohan
2026-04-17 11:24 ` Daniel Borkmann [this message]
2026-04-17 11:35 ` Daniel Borkmann
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=8a34a3da-45c3-4968-9c51-0ecb865d8f9f@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jre@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=puranjay12@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
all inboxes | Powered by JetHome®