From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Yauheni Kaliuta <yauheni.kaliuta@redhat.com>,
Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH RFC bpf-next 3/5] bpf: Make adjust_subprog_starts() accept variable number of old insns
Date: Thu, 10 Sep 2020 01:34:37 +0200 [thread overview]
Message-ID: <20200909233439.3100292-4-iii@linux.ibm.com> (raw)
In-Reply-To: <20200909233439.3100292-1-iii@linux.ibm.com>
Simply adjust the fast path condition and the delta. No renaming needed
in this case.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
kernel/bpf/verifier.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 077919ac3826..6791a6e1bf76 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -9614,17 +9614,18 @@ static int adjust_insns_aux_data(struct bpf_verifier_env *env,
return 0;
}
-static void adjust_subprog_starts(struct bpf_verifier_env *env, u32 off, u32 len)
+static void adjust_subprog_starts(struct bpf_verifier_env *env, u32 off,
+ u32 len_old, u32 len)
{
int i;
- if (len == 1)
+ if (len == len_old)
return;
/* NOTE: fake 'exit' subprog should be updated as well. */
for (i = 0; i <= env->subprog_cnt; i++) {
if (env->subprog_info[i].start <= off)
continue;
- env->subprog_info[i].start += len - 1;
+ env->subprog_info[i].start += len - len_old;
}
}
@@ -9643,7 +9644,7 @@ static struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 of
}
if (adjust_insns_aux_data(env, new_prog, off, 1, len))
return NULL;
- adjust_subprog_starts(env, off, len);
+ adjust_subprog_starts(env, off, 1, len);
return new_prog;
}
--
2.25.4
next prev parent reply other threads:[~2020-09-10 2:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 23:34 [PATCH RFC bpf-next 0/5] Do not include the original insn in zext patchlet Ilya Leoshkevich
2020-09-09 23:34 ` [PATCH RFC bpf-next 1/5] bpf: Make bpf_patch_insn_single() accept variable number of old insns Ilya Leoshkevich
2020-09-09 23:34 ` [PATCH RFC bpf-next 2/5] bpf: Make adjust_insn_aux_data() " Ilya Leoshkevich
2020-09-09 23:34 ` Ilya Leoshkevich [this message]
2020-09-09 23:34 ` [PATCH RFC bpf-next 4/5] bpf: Make bpf_patch_insn_data() " Ilya Leoshkevich
2020-09-09 23:34 ` [PATCH RFC bpf-next 5/5] bpf: Do not include the original insn in zext patchlet Ilya Leoshkevich
2020-09-10 6:59 ` Yauheni Kaliuta
2020-09-10 9:18 ` Ilya Leoshkevich
2020-09-11 0:25 ` Alexei Starovoitov
2020-09-11 6:33 ` Yauheni Kaliuta
2020-09-11 12:58 ` Ilya Leoshkevich
2020-09-29 20:03 ` Ilya Leoshkevich
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=20200909233439.3100292-4-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=yauheni.kaliuta@redhat.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