diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-01-22 13:53:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-01-22 13:53:06 -0500 |
commit | f8de05ca38b7bce4079b52002a6817e9582e3e01 (patch) | |
tree | 0b1e149e0841efec7c30c29fed1dd2b2fc3a5e29 /arch/s390 | |
parent | fcb237317f225f5bae1ab72a42f1f5a9c57ba3d5 (diff) | |
parent | fe82bbae36943fbead5e326aab1665d001a87dd7 (diff) |
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)
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/net/bpf_jit.S | 28 | ||||
-rw-r--r-- | arch/s390/net/bpf_jit_comp.c | 9 |
2 files changed, 19 insertions, 18 deletions
diff --git a/arch/s390/net/bpf_jit.S b/arch/s390/net/bpf_jit.S index 7e45d13816c1..ba44c9f55346 100644 --- a/arch/s390/net/bpf_jit.S +++ b/arch/s390/net/bpf_jit.S | |||
@@ -22,8 +22,8 @@ | |||
22 | * skb_copy_bits takes 4 parameters: | 22 | * skb_copy_bits takes 4 parameters: |
23 | * %r2 = skb pointer | 23 | * %r2 = skb pointer |
24 | * %r3 = offset into skb data | 24 | * %r3 = offset into skb data |
25 | * %r4 = length to copy | 25 | * %r4 = pointer to temp buffer |
26 | * %r5 = pointer to temp buffer | 26 | * %r5 = length to copy |
27 | */ | 27 | */ |
28 | #define SKBDATA %r8 | 28 | #define SKBDATA %r8 |
29 | 29 | ||
@@ -44,8 +44,9 @@ ENTRY(sk_load_word) | |||
44 | 44 | ||
45 | sk_load_word_slow: | 45 | sk_load_word_slow: |
46 | lgr %r9,%r2 # save %r2 | 46 | lgr %r9,%r2 # save %r2 |
47 | lhi %r4,4 # 4 bytes | 47 | lgr %r3,%r1 # offset |
48 | la %r5,160(%r15) # pointer to temp buffer | 48 | la %r4,160(%r15) # pointer to temp buffer |
49 | lghi %r5,4 # 4 bytes | ||
49 | brasl %r14,skb_copy_bits # get data from skb | 50 | brasl %r14,skb_copy_bits # get data from skb |
50 | l %r5,160(%r15) # load result from temp buffer | 51 | l %r5,160(%r15) # load result from temp buffer |
51 | ltgr %r2,%r2 # set cc to (%r2 != 0) | 52 | ltgr %r2,%r2 # set cc to (%r2 != 0) |
@@ -69,8 +70,9 @@ ENTRY(sk_load_half) | |||
69 | 70 | ||
70 | sk_load_half_slow: | 71 | sk_load_half_slow: |
71 | lgr %r9,%r2 # save %r2 | 72 | lgr %r9,%r2 # save %r2 |
72 | lhi %r4,2 # 2 bytes | 73 | lgr %r3,%r1 # offset |
73 | la %r5,162(%r15) # pointer to temp buffer | 74 | la %r4,162(%r15) # pointer to temp buffer |
75 | lghi %r5,2 # 2 bytes | ||
74 | brasl %r14,skb_copy_bits # get data from skb | 76 | brasl %r14,skb_copy_bits # get data from skb |
75 | xc 160(2,%r15),160(%r15) | 77 | xc 160(2,%r15),160(%r15) |
76 | l %r5,160(%r15) # load result from temp buffer | 78 | l %r5,160(%r15) # load result from temp buffer |
@@ -95,8 +97,9 @@ ENTRY(sk_load_byte) | |||
95 | 97 | ||
96 | sk_load_byte_slow: | 98 | sk_load_byte_slow: |
97 | lgr %r9,%r2 # save %r2 | 99 | lgr %r9,%r2 # save %r2 |
98 | lhi %r4,1 # 1 bytes | 100 | lgr %r3,%r1 # offset |
99 | la %r5,163(%r15) # pointer to temp buffer | 101 | la %r4,163(%r15) # pointer to temp buffer |
102 | lghi %r5,1 # 1 byte | ||
100 | brasl %r14,skb_copy_bits # get data from skb | 103 | brasl %r14,skb_copy_bits # get data from skb |
101 | xc 160(3,%r15),160(%r15) | 104 | xc 160(3,%r15),160(%r15) |
102 | l %r5,160(%r15) # load result from temp buffer | 105 | l %r5,160(%r15) # load result from temp buffer |
@@ -104,11 +107,11 @@ sk_load_byte_slow: | |||
104 | lgr %r2,%r9 # restore %r2 | 107 | lgr %r2,%r9 # restore %r2 |
105 | br %r8 | 108 | br %r8 |
106 | 109 | ||
107 | /* A = (*(u8 *)(skb->data+K) & 0xf) << 2 */ | 110 | /* X = (*(u8 *)(skb->data+K) & 0xf) << 2 */ |
108 | ENTRY(sk_load_byte_msh) | 111 | ENTRY(sk_load_byte_msh) |
109 | llgfr %r1,%r3 # extend offset | 112 | llgfr %r1,%r3 # extend offset |
110 | clr %r11,%r3 # hlen < offset ? | 113 | clr %r11,%r3 # hlen < offset ? |
111 | jle sk_load_byte_slow | 114 | jle sk_load_byte_msh_slow |
112 | lhi %r12,0 | 115 | lhi %r12,0 |
113 | ic %r12,0(%r1,%r10) # get byte from skb | 116 | ic %r12,0(%r1,%r10) # get byte from skb |
114 | nill %r12,0x0f | 117 | nill %r12,0x0f |
@@ -118,8 +121,9 @@ ENTRY(sk_load_byte_msh) | |||
118 | 121 | ||
119 | sk_load_byte_msh_slow: | 122 | sk_load_byte_msh_slow: |
120 | lgr %r9,%r2 # save %r2 | 123 | lgr %r9,%r2 # save %r2 |
121 | lhi %r4,2 # 2 bytes | 124 | lgr %r3,%r1 # offset |
122 | la %r5,162(%r15) # pointer to temp buffer | 125 | la %r4,163(%r15) # pointer to temp buffer |
126 | lghi %r5,1 # 1 byte | ||
123 | brasl %r14,skb_copy_bits # get data from skb | 127 | brasl %r14,skb_copy_bits # get data from skb |
124 | xc 160(3,%r15),160(%r15) | 128 | xc 160(3,%r15),160(%r15) |
125 | l %r12,160(%r15) # load result from temp buffer | 129 | l %r12,160(%r15) # load result from temp buffer |
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 524496d47ef5..bbd1981cc150 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c | |||
@@ -448,15 +448,12 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter, | |||
448 | mask = 0x800000; /* je */ | 448 | mask = 0x800000; /* je */ |
449 | kbranch: /* Emit compare if the branch targets are different */ | 449 | kbranch: /* Emit compare if the branch targets are different */ |
450 | if (filter->jt != filter->jf) { | 450 | if (filter->jt != filter->jf) { |
451 | if (K <= 16383) | 451 | if (test_facility(21)) |
452 | /* chi %r5,<K> */ | ||
453 | EMIT4_IMM(0xa75e0000, K); | ||
454 | else if (test_facility(21)) | ||
455 | /* clfi %r5,<K> */ | 452 | /* clfi %r5,<K> */ |
456 | EMIT6_IMM(0xc25f0000, K); | 453 | EMIT6_IMM(0xc25f0000, K); |
457 | else | 454 | else |
458 | /* c %r5,<d(K)>(%r13) */ | 455 | /* cl %r5,<d(K)>(%r13) */ |
459 | EMIT4_DISP(0x5950d000, EMIT_CONST(K)); | 456 | EMIT4_DISP(0x5550d000, EMIT_CONST(K)); |
460 | } | 457 | } |
461 | branch: if (filter->jt == filter->jf) { | 458 | branch: if (filter->jt == filter->jf) { |
462 | if (filter->jt == 0) | 459 | if (filter->jt == 0) |