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)
This commit is contained in:
Коммит
f8de05ca38
|
@ -22,8 +22,8 @@
|
|||
* skb_copy_bits takes 4 parameters:
|
||||
* %r2 = skb pointer
|
||||
* %r3 = offset into skb data
|
||||
* %r4 = length to copy
|
||||
* %r5 = pointer to temp buffer
|
||||
* %r4 = pointer to temp buffer
|
||||
* %r5 = length to copy
|
||||
*/
|
||||
#define SKBDATA %r8
|
||||
|
||||
|
@ -44,8 +44,9 @@ ENTRY(sk_load_word)
|
|||
|
||||
sk_load_word_slow:
|
||||
lgr %r9,%r2 # save %r2
|
||||
lhi %r4,4 # 4 bytes
|
||||
la %r5,160(%r15) # pointer to temp buffer
|
||||
lgr %r3,%r1 # offset
|
||||
la %r4,160(%r15) # pointer to temp buffer
|
||||
lghi %r5,4 # 4 bytes
|
||||
brasl %r14,skb_copy_bits # get data from skb
|
||||
l %r5,160(%r15) # load result from temp buffer
|
||||
ltgr %r2,%r2 # set cc to (%r2 != 0)
|
||||
|
@ -69,8 +70,9 @@ ENTRY(sk_load_half)
|
|||
|
||||
sk_load_half_slow:
|
||||
lgr %r9,%r2 # save %r2
|
||||
lhi %r4,2 # 2 bytes
|
||||
la %r5,162(%r15) # pointer to temp buffer
|
||||
lgr %r3,%r1 # offset
|
||||
la %r4,162(%r15) # pointer to temp buffer
|
||||
lghi %r5,2 # 2 bytes
|
||||
brasl %r14,skb_copy_bits # get data from skb
|
||||
xc 160(2,%r15),160(%r15)
|
||||
l %r5,160(%r15) # load result from temp buffer
|
||||
|
@ -95,8 +97,9 @@ ENTRY(sk_load_byte)
|
|||
|
||||
sk_load_byte_slow:
|
||||
lgr %r9,%r2 # save %r2
|
||||
lhi %r4,1 # 1 bytes
|
||||
la %r5,163(%r15) # pointer to temp buffer
|
||||
lgr %r3,%r1 # offset
|
||||
la %r4,163(%r15) # pointer to temp buffer
|
||||
lghi %r5,1 # 1 byte
|
||||
brasl %r14,skb_copy_bits # get data from skb
|
||||
xc 160(3,%r15),160(%r15)
|
||||
l %r5,160(%r15) # load result from temp buffer
|
||||
|
@ -104,11 +107,11 @@ sk_load_byte_slow:
|
|||
lgr %r2,%r9 # restore %r2
|
||||
br %r8
|
||||
|
||||
/* A = (*(u8 *)(skb->data+K) & 0xf) << 2 */
|
||||
/* X = (*(u8 *)(skb->data+K) & 0xf) << 2 */
|
||||
ENTRY(sk_load_byte_msh)
|
||||
llgfr %r1,%r3 # extend offset
|
||||
clr %r11,%r3 # hlen < offset ?
|
||||
jle sk_load_byte_slow
|
||||
jle sk_load_byte_msh_slow
|
||||
lhi %r12,0
|
||||
ic %r12,0(%r1,%r10) # get byte from skb
|
||||
nill %r12,0x0f
|
||||
|
@ -118,8 +121,9 @@ ENTRY(sk_load_byte_msh)
|
|||
|
||||
sk_load_byte_msh_slow:
|
||||
lgr %r9,%r2 # save %r2
|
||||
lhi %r4,2 # 2 bytes
|
||||
la %r5,162(%r15) # pointer to temp buffer
|
||||
lgr %r3,%r1 # offset
|
||||
la %r4,163(%r15) # pointer to temp buffer
|
||||
lghi %r5,1 # 1 byte
|
||||
brasl %r14,skb_copy_bits # get data from skb
|
||||
xc 160(3,%r15),160(%r15)
|
||||
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,
|
|||
mask = 0x800000; /* je */
|
||||
kbranch: /* Emit compare if the branch targets are different */
|
||||
if (filter->jt != filter->jf) {
|
||||
if (K <= 16383)
|
||||
/* chi %r5,<K> */
|
||||
EMIT4_IMM(0xa75e0000, K);
|
||||
else if (test_facility(21))
|
||||
if (test_facility(21))
|
||||
/* clfi %r5,<K> */
|
||||
EMIT6_IMM(0xc25f0000, K);
|
||||
else
|
||||
/* c %r5,<d(K)>(%r13) */
|
||||
EMIT4_DISP(0x5950d000, EMIT_CONST(K));
|
||||
/* cl %r5,<d(K)>(%r13) */
|
||||
EMIT4_DISP(0x5550d000, EMIT_CONST(K));
|
||||
}
|
||||
branch: if (filter->jt == filter->jf) {
|
||||
if (filter->jt == 0)
|
||||
|
|
Загрузка…
Ссылка в новой задаче