diff options
author | Alexei Starovoitov <ast@plumgrid.com> | 2014-09-23 13:50:10 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-24 15:04:07 -0400 |
commit | 35607b02dbef304fa5037236a3b43c1d8ab2aa52 (patch) | |
tree | c219ac28ef9d9691122fb445be7a6dfbcf120a3d /kernel/user-return-notifier.c | |
parent | 543a2dff5edfab3ea53f3e16f4a876a00bf8023b (diff) |
sparc: bpf_jit: fix loads from negative offsets
- fix BPF_LD|ABS|IND from negative offsets:
make sure to sign extend lower 32 bits in 64-bit register
before calling C helpers from JITed code, otherwise 'int k'
argument of bpf_internal_load_pointer_neg_helper() function
will be added as large unsigned integer, causing packet size
check to trigger and abort the program.
It's worth noting that JITed code for 'A = A op K' will affect
upper 32 bits differently depending whether K is simm13 or not.
Since small constants are sign extended, whereas large constants
are stored in temp register and zero extended.
That is ok and we don't have to pay a penalty of sign extension
for every sethi, since all classic BPF instructions have 32-bit
semantics and we only need to set correct upper bits when
transitioning from JITed code into C.
- though instructions 'A &= 0' and 'A *= 0' are odd, JIT compiler
should not optimize them out
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/user-return-notifier.c')
0 files changed, 0 insertions, 0 deletions