From: flyingpenghao@gmail.com
To: ast@kernel.org
Cc: bpf@vger.kernel.org, Peng Hao <flyingpeng@tencent.com>
Subject: [PATCH v2] bpf: make function do_misc_fixups as noinline_for_stack
Date: Thu, 11 Jul 2024 13:45:25 +0800 [thread overview]
Message-ID: <20240711054525.20748-1-flyingpeng@tencent.com> (raw)
From: Peng Hao <flyingpeng@tencent.com>
When KASAN is enabled and built with clang:
kernel/bpf/verifier.c:21486:5: error: stack frame size (2264) exceeds limit (2048) in 'bpf_check' [-Werror,-Wframe-larger-than]
int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr, __u32 uattr_size)
^
By tracing the call chain, we found that do_misc_fixups consumed a lot
of stack space. mark it as noinline_for_stack to prevent it from spreading
to bpf_check's stack size.
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
kernel/bpf/verifier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 48f3a9acdef3..ba1bf742a33d 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -19791,7 +19791,7 @@ static int add_hidden_subprog(struct bpf_verifier_env *env, struct bpf_insn *pat
/* Do various post-verification rewrites in a single program pass.
* These rewrites simplify JIT and interpreter implementations.
*/
-static int do_misc_fixups(struct bpf_verifier_env *env)
+static noinline_for_stack int do_misc_fixups(struct bpf_verifier_env *env)
{
struct bpf_prog *prog = env->prog;
enum bpf_attach_type eatype = prog->expected_attach_type;
--
2.27.0
next reply other threads:[~2024-07-11 5:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 5:45 flyingpenghao [this message]
2024-07-12 16:43 ` [PATCH v2] bpf: make function do_misc_fixups as noinline_for_stack Alexei Starovoitov
2024-07-25 6:18 ` Hao Peng
2024-07-25 15:34 ` 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=20240711054525.20748-1-flyingpeng@tencent.com \
--to=flyingpenghao@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=flyingpeng@tencent.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