Patch "bpf: extract same_callsites() as utility function" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bpf: extract same_callsites() as utility function

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bpf-extract-same_callsites-as-utility-function.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 4c97259abc9bc8df7712f76f58ce385581876857 Mon Sep 17 00:00:00 2001
From: Eduard Zingerman <eddyz87@xxxxxxxxx>
Date: Tue, 24 Oct 2023 03:09:12 +0300
Subject: bpf: extract same_callsites() as utility function

From: Eduard Zingerman <eddyz87@xxxxxxxxx>

commit 4c97259abc9bc8df7712f76f58ce385581876857 upstream.

Extract same_callsites() from clean_live_states() as a utility function.
This function would be used by the next patch in the set.

Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx>
Link: https://lore.kernel.org/r/20231024000917.12153-3-eddyz87@xxxxxxxxx
Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 kernel/bpf/verifier.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -1799,6 +1799,20 @@ static struct bpf_verifier_state_list **
 	return &env->explored_states[(idx ^ state->callsite) % state_htab_size(env)];
 }
 
+static bool same_callsites(struct bpf_verifier_state *a, struct bpf_verifier_state *b)
+{
+	int fr;
+
+	if (a->curframe != b->curframe)
+		return false;
+
+	for (fr = a->curframe; fr >= 0; fr--)
+		if (a->frame[fr]->callsite != b->frame[fr]->callsite)
+			return false;
+
+	return true;
+}
+
 static void update_branch_counts(struct bpf_verifier_env *env, struct bpf_verifier_state *st)
 {
 	while (st) {
@@ -15521,18 +15535,14 @@ static void clean_live_states(struct bpf
 			      struct bpf_verifier_state *cur)
 {
 	struct bpf_verifier_state_list *sl;
-	int i;
 
 	sl = *explored_state(env, insn);
 	while (sl) {
 		if (sl->state.branches)
 			goto next;
 		if (sl->state.insn_idx != insn ||
-		    sl->state.curframe != cur->curframe)
+		    !same_callsites(&sl->state, cur))
 			goto next;
-		for (i = 0; i <= cur->curframe; i++)
-			if (sl->state.frame[i]->callsite != cur->frame[i]->callsite)
-				goto next;
 		clean_verifier_state(env, &sl->state);
 next:
 		sl = sl->next;


Patches currently in stable-queue which might be from eddyz87@xxxxxxxxx are

queue-6.6/bpf-move-explored_state-closer-to-the-beginning-of-verifier.c.patch
queue-6.6/bpf-verify-callbacks-as-if-they-are-called-unknown-number-of-times.patch
queue-6.6/selftests-bpf-test-widening-for-iterating-callbacks.patch
queue-6.6/bpf-keep-track-of-max-number-of-bpf_loop-callback-iterations.patch
queue-6.6/bpf-extract-setup_func_entry-utility-function.patch
queue-6.6/selftests-bpf-tests-with-delayed-read-precision-makrs-in-loop-body.patch
queue-6.6/selftests-bpf-track-string-payload-offset-as-scalar-in-strobemeta.patch
queue-6.6/bpf-print-full-verifier-states-on-infinite-loop-detection.patch
queue-6.6/selftests-bpf-track-tcp-payload-offset-as-scalar-in-xdp_synproxy.patch
queue-6.6/bpf-extract-__check_reg_arg-utility-function.patch
queue-6.6/bpf-extract-same_callsites-as-utility-function.patch
queue-6.6/bpf-widening-for-callback-iterators.patch
queue-6.6/selftests-bpf-test-if-state-loops-are-detected-in-a-tricky-case.patch
queue-6.6/bpf-correct-loop-detection-for-iterators-convergence.patch
queue-6.6/selftests-bpf-tests-for-iterating-callbacks.patch
queue-6.6/bpf-exact-states-comparison-for-iterator-convergence-checks.patch
queue-6.6/selftests-bpf-check-if-max-number-of-bpf_loop-iterations-is-tracked.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux