-
Notifications
You must be signed in to change notification settings - Fork 127
powerpc/bpf: fix JIT code size calculation of bpf trampoline #8821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bpf-next_base
Are you sure you want to change the base?
Conversation
Upstream branch: 5709be4 |
27c7945
to
4f05866
Compare
Upstream branch: be2fea9 |
867f260
to
7f379ec
Compare
4f05866
to
e9b7177
Compare
Upstream branch: 5cffad0 |
7f379ec
to
074cf3a
Compare
e9b7177
to
f106256
Compare
Upstream branch: 53ebef5 |
074cf3a
to
d1fbd11
Compare
f106256
to
8b59228
Compare
Upstream branch: 6aca583 |
d1fbd11
to
a7687d2
Compare
8b59228
to
9c93586
Compare
Upstream branch: b9c09fb |
a7687d2
to
78ed4df
Compare
9c93586
to
ca1daab
Compare
Upstream branch: 60400cd |
78ed4df
to
da229b4
Compare
ca1daab
to
cad9039
Compare
Upstream branch: 4cc2048 |
da229b4
to
f595a5c
Compare
cad9039
to
c7849f3
Compare
Upstream branch: 46eb012 |
f595a5c
to
42a7892
Compare
c7849f3
to
a041a61
Compare
Upstream branch: 91dbac4 |
42a7892
to
ea045d4
Compare
a041a61
to
b2666a3
Compare
Upstream branch: 224ee86 |
ea045d4
to
6620142
Compare
b2666a3
to
9afa005
Compare
Upstream branch: 8e64c38 |
6620142
to
d33bb6c
Compare
9afa005
to
993c0c1
Compare
Upstream branch: 38d976c |
d33bb6c
to
925f194
Compare
993c0c1
to
97831b9
Compare
Upstream branch: 358b1c0 |
925f194
to
13489e7
Compare
97831b9
to
c60a0e6
Compare
Upstream branch: 358b1c0 |
arch_bpf_trampoline_size() provides JIT size of the BPF trampoline before the buffer for JIT'ing it is allocated. The total number of instructions emitted for BPF trampoline JIT code depends on where the final image is located. So, the size arrived at with the dummy pass in arch_bpf_trampoline_size() can vary from the actual size needed in arch_prepare_bpf_trampoline(). When the instructions accounted in arch_bpf_trampoline_size() is less than the number of instructions emitted during the actual JIT compile of the trampoline, the below warning is produced: WARNING: CPU: 8 PID: 204190 at arch/powerpc/net/bpf_jit_comp.c:981 __arch_prepare_bpf_trampoline.isra.0+0xd2c/0xdcc which is: /* Make sure the trampoline generation logic doesn't overflow */ if (image && WARN_ON_ONCE(&image[ctx->idx] > (u32 *)rw_image_end - BPF_INSN_SAFETY)) { So, during the dummy pass, instead of providing some arbitrary image location, account for maximum possible instructions if and when there is a dependency with image location for JIT'ing. Fixes: d243b62 ("powerpc64/bpf: Add support for bpf trampolines") Reported-by: Venkat Rao Bagalkote <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Cc: [email protected] # v6.13+ Acked-by: Naveen N Rao (AMD) <[email protected]> Tested-by: Venkat Rao Bagalkote <[email protected]> Signed-off-by: Hari Bathini <[email protected]>
13489e7
to
ae71349
Compare
Pull request for series with
subject: powerpc/bpf: fix JIT code size calculation of bpf trampoline
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=955580