x86: bpf_jit: support negative offsets
Subsystems (5)
PATCH 1/1 x86: bpf_jit: support negative offsets
Commit a998d4342337 claimed to introduce negative offset support to x86 jit, but it couldn't be working, since at the time of the execution of LD+ABS or LD+IND instructions via call into bpf_internal_load_pointer_neg_helper() the %edx (3rd argument of this func) had junk value instead of access size in bytes (1 or 2 or 4).
Store size into %edx instead of %ecx (what original commit intended to do)
--
This is a single bit patch. Is there a leaderboard of shortest patches? ;)
arch/x86/net/bpf_jit.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/net/bpf_jit.S +1 -1
@@ -140,7 +140,7 @@ bpf_slow_path_byte_msh: push %r9; \ push SKBDATA; \ /* rsi already has offset */ \ - mov $SIZE,%ecx; /* size */ \ + mov $SIZE,%edx; /* size */ \ call bpf_internal_load_pointer_neg_helper; \ test %rax,%rax; \ pop SKBDATA; \
Signature · 1 line
1.7.9.5
Quoted 6 lines · Alexei Starovoitov
Commit
a998d4342337claimed to introduce negative offset support to x86 jit, but it couldn't be working, since at the time of the execution of LD+ABS or LD+IND instructions via call intobpf_internal_load_pointer_neg_helper()the %edx (3rd argument of this func) had junk value instead of access size in bytes (1 or 2 or 4).
Quoted 8 lines
Store size into %edx instead of %ecx (what original commit intended to do)
Fixes a998d4342337 ("bpf jit: Let the x86 jit handle negative offsets")Signed-off-by Alexei Starovoitov <[email protected]>Cc Jan Seiffert <[email protected]>Cc Eric Dumazet <[email protected]>--
This is a single bit patch. Is there a leaderboard of shortest patches? ;)
Its actually a 1 byte or 3-bit patch ;)
'c' is 0x63, and 'd' is 0x64 ;)
From: Alexei Starovoitov
Quoted 1 line
This is a single bit patch. Is there a leaderboard of shortest patches? ;)
The shortest patches will be the ones that invert a conditional branch. Unless the compiler reorders the code they will be 1-bit (on most archs). Since that is a common error, there will be a few of them.
Now a 1/2bit patch would be a challenge:-)
David
David Miller
maintainerFrom: Alexei Starovoitov <[email protected]>
Date: Mon, 10 Mar 2014 15:56:51 -0700
Quoted 6 lines
Commit
a998d4342337claimed to introduce negative offset support to x86 jit, but it couldn't be working, since at the time of the execution of LD+ABS or LD+IND instructions via call intobpf_internal_load_pointer_neg_helper()the %edx (3rd argument of this func) had junk value instead of access size in bytes (1 or 2 or 4).
Quoted 6 lines
Store size into %edx instead of %ecx (what original commit intended to do)
Fixes a998d4342337 ("bpf jit: Let the x86 jit handle negative offsets")Signed-off-by Alexei Starovoitov <[email protected]>Cc Jan Seiffert <[email protected]>Cc Eric Dumazet <[email protected]>
Applied and queued up for -stable, thanks.