From: Greg KH <greg@kroah.com>
To: Puranjay Mohan <pjy@amazon.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Russell King <russell.king@oracle.com>,
Alan Maguire <alan.maguire@oracle.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
stable@vger.kernel.org, puranjay@kernel.org,
puranjay12@gmail.com
Subject: Re: [PATCH 5.10] arm64/bpf: Remove 128MB limit for BPF JIT programs
Date: Thu, 18 Jul 2024 08:55:23 +0200 [thread overview]
Message-ID: <2024071834-chalice-renewal-3412@gregkh> (raw)
In-Reply-To: <20240701114659.39539-1-pjy@amazon.com>
On Mon, Jul 01, 2024 at 11:46:59AM +0000, Puranjay Mohan wrote:
> From: Russell King <russell.king@oracle.com>
>
> [ Upstream commit b89ddf4cca43f1269093942cf5c4e457fd45c335 ]
>
> Commit 91fc957c9b1d ("arm64/bpf: don't allocate BPF JIT programs in module
> memory") restricts BPF JIT program allocation to a 128MB region to ensure
> BPF programs are still in branching range of each other. However this
> restriction should not apply to the aarch64 JIT, since BPF_JMP | BPF_CALL
> are implemented as a 64-bit move into a register and then a BLR instruction -
> which has the effect of being able to call anything without proximity
> limitation.
>
> The practical reason to relax this restriction on JIT memory is that 128MB of
> JIT memory can be quickly exhausted, especially where PAGE_SIZE is 64KB - one
> page is needed per program. In cases where seccomp filters are applied to
> multiple VMs on VM launch - such filters are classic BPF but converted to
> BPF - this can severely limit the number of VMs that can be launched. In a
> world where we support BPF JIT always on, turning off the JIT isn't always an
> option either.
>
> Fixes: 91fc957c9b1d ("arm64/bpf: don't allocate BPF JIT programs in module memory")
> Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Signed-off-by: Russell King <russell.king@oracle.com>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Tested-by: Alan Maguire <alan.maguire@oracle.com>
> Link: https://lore.kernel.org/bpf/1636131046-5982-2-git-send-email-alan.maguire@oracle.com
> [Replace usage of in_bpf_jit() with is_bpf_text_address()]
> Signed-off-by: Puranjay Mohan <pjy@amazon.com>
> ---
> arch/arm64/include/asm/extable.h | 9 ---------
> arch/arm64/include/asm/memory.h | 5 +----
> arch/arm64/kernel/traps.c | 2 +-
> arch/arm64/mm/extable.c | 3 ++-
> arch/arm64/mm/ptdump.c | 2 --
> arch/arm64/net/bpf_jit_comp.c | 7 ++-----
> 6 files changed, 6 insertions(+), 22 deletions(-)
>
This is reported to cause problems:
https://lore.kernel.org/r/CA+G9fYtfAbfcQ9J9Hzq-e6yoBVG3t_iHZ=bS2eJbO_aiOcquXQ@mail.gmail.com
so I will drop it now.
How did you test this?
And if you really need this feature, why not move to a more modern
kernel version?
thanks,
greg k-h
next prev parent reply other threads:[~2024-07-18 6:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 11:46 [PATCH 5.10] arm64/bpf: Remove 128MB limit for BPF JIT programs Puranjay Mohan
2024-07-16 12:36 ` Puranjay Mohan
2024-07-16 12:58 ` Greg Kroah-Hartman
2024-07-16 13:01 ` Puranjay Mohan
2024-07-18 6:55 ` Greg KH [this message]
2024-07-18 11:23 ` Puranjay Mohan
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=2024071834-chalice-renewal-3412@gregkh \
--to=greg@kroah.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=pjy@amazon.com \
--cc=puranjay12@gmail.com \
--cc=puranjay@kernel.org \
--cc=russell.king@oracle.com \
--cc=stable@vger.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