Commit f8de05ca authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fixes from Martin Schwidefsky:
 "Five more bug fixes from Michael for the s390 BPF jit"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/bpf: Zero extend parameters before calling C function
  s390/bpf: Fix sk_load_byte_msh()
  s390/bpf: Fix offset parameter for skb_copy_bits()
  s390/bpf: Fix skb_copy_bits() parameter passing
  s390/bpf: Fix JMP_JGE_K (A >= K) and JMP_JGT_K (A > K)
parents fcb23731 fe82bbae
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
* skb_copy_bits takes 4 parameters: * skb_copy_bits takes 4 parameters:
* %r2 = skb pointer * %r2 = skb pointer
* %r3 = offset into skb data * %r3 = offset into skb data
* %r4 = length to copy * %r4 = pointer to temp buffer
* %r5 = pointer to temp buffer * %r5 = length to copy
*/ */
#define SKBDATA %r8 #define SKBDATA %r8
...@@ -44,8 +44,9 @@ ENTRY(sk_load_word) ...@@ -44,8 +44,9 @@ ENTRY(sk_load_word)
sk_load_word_slow: sk_load_word_slow:
lgr %r9,%r2 # save %r2 lgr %r9,%r2 # save %r2
lhi %r4,4 # 4 bytes lgr %r3,%r1 # offset
la %r5,160(%r15) # pointer to temp buffer la %r4,160(%r15) # pointer to temp buffer
lghi %r5,4 # 4 bytes
brasl %r14,skb_copy_bits # get data from skb brasl %r14,skb_copy_bits # get data from skb
l %r5,160(%r15) # load result from temp buffer l %r5,160(%r15) # load result from temp buffer
ltgr %r2,%r2 # set cc to (%r2 != 0) ltgr %r2,%r2 # set cc to (%r2 != 0)
...@@ -69,8 +70,9 @@ ENTRY(sk_load_half) ...@@ -69,8 +70,9 @@ ENTRY(sk_load_half)
sk_load_half_slow: sk_load_half_slow:
lgr %r9,%r2 # save %r2 lgr %r9,%r2 # save %r2
lhi %r4,2 # 2 bytes lgr %r3,%r1 # offset
la %r5,162(%r15) # pointer to temp buffer la %r4,162(%r15) # pointer to temp buffer
lghi %r5,2 # 2 bytes
brasl %r14,skb_copy_bits # get data from skb brasl %r14,skb_copy_bits # get data from skb
xc 160(2,%r15),160(%r15) xc 160(2,%r15),160(%r15)
l %r5,160(%r15) # load result from temp buffer l %r5,160(%r15) # load result from temp buffer
...@@ -95,8 +97,9 @@ ENTRY(sk_load_byte) ...@@ -95,8 +97,9 @@ ENTRY(sk_load_byte)
sk_load_byte_slow: sk_load_byte_slow:
lgr %r9,%r2 # save %r2 lgr %r9,%r2 # save %r2
lhi %r4,1 # 1 bytes lgr %r3,%r1 # offset
la %r5,163(%r15) # pointer to temp buffer la %r4,163(%r15) # pointer to temp buffer
lghi %r5,1 # 1 byte
brasl %r14,skb_copy_bits # get data from skb brasl %r14,skb_copy_bits # get data from skb
xc 160(3,%r15),160(%r15) xc 160(3,%r15),160(%r15)
l %r5,160(%r15) # load result from temp buffer l %r5,160(%r15) # load result from temp buffer
...@@ -104,11 +107,11 @@ sk_load_byte_slow: ...@@ -104,11 +107,11 @@ sk_load_byte_slow:
lgr %r2,%r9 # restore %r2 lgr %r2,%r9 # restore %r2
br %r8 br %r8
/* A = (*(u8 *)(skb->data+K) & 0xf) << 2 */ /* X = (*(u8 *)(skb->data+K) & 0xf) << 2 */
ENTRY(sk_load_byte_msh) ENTRY(sk_load_byte_msh)
llgfr %r1,%r3 # extend offset llgfr %r1,%r3 # extend offset
clr %r11,%r3 # hlen < offset ? clr %r11,%r3 # hlen < offset ?
jle sk_load_byte_slow jle sk_load_byte_msh_slow
lhi %r12,0 lhi %r12,0
ic %r12,0(%r1,%r10) # get byte from skb ic %r12,0(%r1,%r10) # get byte from skb
nill %r12,0x0f nill %r12,0x0f
...@@ -118,8 +121,9 @@ ENTRY(sk_load_byte_msh) ...@@ -118,8 +121,9 @@ ENTRY(sk_load_byte_msh)
sk_load_byte_msh_slow: sk_load_byte_msh_slow:
lgr %r9,%r2 # save %r2 lgr %r9,%r2 # save %r2
lhi %r4,2 # 2 bytes lgr %r3,%r1 # offset
la %r5,162(%r15) # pointer to temp buffer la %r4,163(%r15) # pointer to temp buffer
lghi %r5,1 # 1 byte
brasl %r14,skb_copy_bits # get data from skb brasl %r14,skb_copy_bits # get data from skb
xc 160(3,%r15),160(%r15) xc 160(3,%r15),160(%r15)
l %r12,160(%r15) # load result from temp buffer l %r12,160(%r15) # load result from temp buffer
......
...@@ -448,15 +448,12 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter, ...@@ -448,15 +448,12 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
mask = 0x800000; /* je */ mask = 0x800000; /* je */
kbranch: /* Emit compare if the branch targets are different */ kbranch: /* Emit compare if the branch targets are different */
if (filter->jt != filter->jf) { if (filter->jt != filter->jf) {
if (K <= 16383) if (test_facility(21))
/* chi %r5,<K> */
EMIT4_IMM(0xa75e0000, K);
else if (test_facility(21))
/* clfi %r5,<K> */ /* clfi %r5,<K> */
EMIT6_IMM(0xc25f0000, K); EMIT6_IMM(0xc25f0000, K);
else else
/* c %r5,<d(K)>(%r13) */ /* cl %r5,<d(K)>(%r13) */
EMIT4_DISP(0x5950d000, EMIT_CONST(K)); EMIT4_DISP(0x5550d000, EMIT_CONST(K));
} }
branch: if (filter->jt == filter->jf) { branch: if (filter->jt == filter->jf) {
if (filter->jt == 0) if (filter->jt == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment