Skip to contentSkip to conversation

bpf: Follow up on gen_epilogue

PATCH Applied Martin KaFai Lau 3 participants 5 messages Sep 4, 2024

Subsystems (2)
lore
Share & tools
lore

Martin KaFai Lau

author reviewer
#0 lore raw

cover bpf: Follow up on gen_epilogue

From: Martin KaFai Lau <[email protected]>

The set addresses some follow ups on the earlier gen_epilogue patch set.

Martin KaFai Lau (2):
bpf: Remove the insn_buf array stack usage from the inline_bpf_loop()
bpf: Fix indentation issue in epilogue_idx

 include/linux/bpf_verifier.h |  2 +-
 kernel/bpf/verifier.c        | 85 ++++++++++++++++++------------------
 2 files changed, 44 insertions(+), 43 deletions(-)
Signature · 1 line
2.43.5
author reviewer
#1 lore raw

PATCH 1/2 bpf: Remove the insn_buf array stack usage from the inline_bpf_loop()

From: Martin KaFai Lau <[email protected]>

This patch removes the insn_buf array stack usage from the inline_bpf_loop(). Instead, the env->insn_buf is used. The usage in inline_bpf_loop() needs more than 16 insn, so the INSN_BUF_SIZE needs to be increased from 16 to 32. The compiler stack size warning on the verifier is gone after this change.

---
 include/linux/bpf_verifier.h |  2 +-
 kernel/bpf/verifier.c        | 83 ++++++++++++++++++------------------
 2 files changed, 43 insertions(+), 42 deletions(-)
include/linux/bpf_verifier.h +1 -1
index 2e20207315a9..8458632824a4 100644
@@ -24,7 +24,7 @@
  */
 #define TMP_STR_BUF_LEN 320
 /* Patch buffer size */
-#define INSN_BUF_SIZE 16
+#define INSN_BUF_SIZE 32
 
 /* Liveness marks, used for registers and spilled-regs (in stack slots).
  * Read marks propagate upwards until they find a write mark; they record that
kernel/bpf/verifier.c +42 -41

104 lines not on this page · raw message

Signature · 1 line
2.43.5
author reviewer
#2 lore raw

PATCH 2/2 bpf: Fix indentation issue in epilogue_idx

In reply to Martin KaFai Lau

From: Martin KaFai Lau <[email protected]>

There is a report on new indentation issue in epilogue_idx. This patch fixed it.

Fixes 169c31761c8d ("bpf: Add gen_epilogue to bpf_verifier_ops")
---
 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
index 8bfb14d1eb7a..b806afeba212 100644
@@ -19800,7 +19800,7 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env)
 				 * least one ctx ptr saving insn before the
 				 * epilogue.
 				 */
-				 epilogue_idx = i + delta;
+				epilogue_idx = i + delta;
 			}
 			goto patch_insn_buf;
 		} else {
Signature · 1 line
2.43.5
#4 lore raw
In reply to Martin KaFai Lau
This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Quoted 10 lines · On Wed, 4 Sep 2024 11:08:43 -0700 you wrote:

From: Martin KaFai Lau <[email protected]>

The set addresses some follow ups on the earlier gen_epilogue patch set.

Martin KaFai Lau (2):
bpf: Remove the insn_buf array stack usage from the inline_bpf_loop()
bpf: Fix indentation issue in epilogue_idx

[...]

Here is the summary with links:
- [bpf-next,1/2] bpf: Remove the insn_buf array stack usage from the inline_bpf_loop()

    https://git.kernel.org/bpf/bpf-next/c/940ce73bdec5
  - [bpf-next,2/2] bpf: Fix indentation issue in epilogue_idx
    https://git.kernel.org/bpf/bpf-next/c/00750788dfc6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html