* [PATCH] s390: bpf: fix JMP32 code-gen
@ 2019-02-04 15:44 Heiko Carstens
2019-02-04 16:15 ` Jiong Wang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Heiko Carstens @ 2019-02-04 15:44 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: Martin Schwidefsky, Jiong Wang, linux-s390, netdev
Commit 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32") added
JMP32 code-gen support for s390. However it triggers the warning below
due to some unusual gotos in the original s390 bpf jit code.
Add a couple of additional "is_jmp32" initializations to fix this.
Also fix the wrong opcode for the "llilf" instruction that was
introduced with the same commit.
arch/s390/net/bpf_jit_comp.c: In function 'bpf_jit_insn':
arch/s390/net/bpf_jit_comp.c:248:55: warning: 'is_jmp32' may be used uninitialized in this function [-Wmaybe-uninitialized]
_EMIT6(op1 | reg(b1, b2) << 16 | (rel & 0xffff), op2 | mask); \
^
arch/s390/net/bpf_jit_comp.c:1211:8: note: 'is_jmp32' was declared here
bool is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
Fixes: 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32")
Cc: Jiong Wang <jiong.wang@netronome.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
arch/s390/net/bpf_jit_comp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index ce9defdff62a..51dd0267d014 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -1154,7 +1154,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
mask = 0x7000; /* jnz */
if (BPF_CLASS(insn->code) == BPF_JMP32) {
/* llilf %w1,imm (load zero extend imm) */
- EMIT6_IMM(0xc0010000, REG_W1, imm);
+ EMIT6_IMM(0xc00f0000, REG_W1, imm);
/* nr %w1,%dst */
EMIT2(0x1400, REG_W1, dst_reg);
} else {
@@ -1216,6 +1216,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
REG_W1, dst_reg, src_reg);
goto branch_oc;
branch_ks:
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
/* lgfi %w1,imm (load sign extend imm) */
EMIT6_IMM(0xc0010000, REG_W1, imm);
/* crj or cgrj %dst,%w1,mask,off */
@@ -1223,6 +1224,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
dst_reg, REG_W1, i, off, mask);
break;
branch_ku:
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
/* lgfi %w1,imm (load sign extend imm) */
EMIT6_IMM(0xc0010000, REG_W1, imm);
/* clrj or clgrj %dst,%w1,mask,off */
@@ -1230,11 +1232,13 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
dst_reg, REG_W1, i, off, mask);
break;
branch_xs:
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
/* crj or cgrj %dst,%src,mask,off */
EMIT6_PCREL(0xec000000, (is_jmp32 ? 0x0076 : 0x0064),
dst_reg, src_reg, i, off, mask);
break;
branch_xu:
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
/* clrj or clgrj %dst,%src,mask,off */
EMIT6_PCREL(0xec000000, (is_jmp32 ? 0x0077 : 0x0065),
dst_reg, src_reg, i, off, mask);
--
2.16.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] s390: bpf: fix JMP32 code-gen
2019-02-04 15:44 [PATCH] s390: bpf: fix JMP32 code-gen Heiko Carstens
@ 2019-02-04 16:15 ` Jiong Wang
2019-02-04 17:15 ` David Miller
2019-02-04 17:46 ` Alexei Starovoitov
2 siblings, 0 replies; 4+ messages in thread
From: Jiong Wang @ 2019-02-04 16:15 UTC (permalink / raw)
To: Heiko Carstens
Cc: Alexei Starovoitov, Martin Schwidefsky, Jiong Wang, linux-s390,
netdev
Heiko Carstens writes:
> Commit 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32") added
> JMP32 code-gen support for s390. However it triggers the warning below
> due to some unusual gotos in the original s390 bpf jit code.
>
> Add a couple of additional "is_jmp32" initializations to fix this.
> Also fix the wrong opcode for the "llilf" instruction that was
> introduced with the same commit.
>
> arch/s390/net/bpf_jit_comp.c: In function 'bpf_jit_insn':
> arch/s390/net/bpf_jit_comp.c:248:55: warning: 'is_jmp32' may be used uninitialized in this function [-Wmaybe-uninitialized]
> _EMIT6(op1 | reg(b1, b2) << 16 | (rel & 0xffff), op2 | mask); \
> ^
> arch/s390/net/bpf_jit_comp.c:1211:8: note: 'is_jmp32' was declared here
> bool is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
>
> Fixes: 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32")
> Cc: Jiong Wang <jiong.wang@netronome.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Thanks for fixing this.
Acked-by: Jiong Wang <jiong.wang@netronome.com>
Regards,
Jiong
> ---
> arch/s390/net/bpf_jit_comp.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
> index ce9defdff62a..51dd0267d014 100644
> --- a/arch/s390/net/bpf_jit_comp.c
> +++ b/arch/s390/net/bpf_jit_comp.c
> @@ -1154,7 +1154,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
> mask = 0x7000; /* jnz */
> if (BPF_CLASS(insn->code) == BPF_JMP32) {
> /* llilf %w1,imm (load zero extend imm) */
> - EMIT6_IMM(0xc0010000, REG_W1, imm);
> + EMIT6_IMM(0xc00f0000, REG_W1, imm);
> /* nr %w1,%dst */
> EMIT2(0x1400, REG_W1, dst_reg);
> } else {
> @@ -1216,6 +1216,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
> REG_W1, dst_reg, src_reg);
> goto branch_oc;
> branch_ks:
> + is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
> /* lgfi %w1,imm (load sign extend imm) */
> EMIT6_IMM(0xc0010000, REG_W1, imm);
> /* crj or cgrj %dst,%w1,mask,off */
> @@ -1223,6 +1224,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
> dst_reg, REG_W1, i, off, mask);
> break;
> branch_ku:
> + is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
> /* lgfi %w1,imm (load sign extend imm) */
> EMIT6_IMM(0xc0010000, REG_W1, imm);
> /* clrj or clgrj %dst,%w1,mask,off */
> @@ -1230,11 +1232,13 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
> dst_reg, REG_W1, i, off, mask);
> break;
> branch_xs:
> + is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
> /* crj or cgrj %dst,%src,mask,off */
> EMIT6_PCREL(0xec000000, (is_jmp32 ? 0x0076 : 0x0064),
> dst_reg, src_reg, i, off, mask);
> break;
> branch_xu:
> + is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
> /* clrj or clgrj %dst,%src,mask,off */
> EMIT6_PCREL(0xec000000, (is_jmp32 ? 0x0077 : 0x0065),
> dst_reg, src_reg, i, off, mask);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] s390: bpf: fix JMP32 code-gen
2019-02-04 15:44 [PATCH] s390: bpf: fix JMP32 code-gen Heiko Carstens
2019-02-04 16:15 ` Jiong Wang
@ 2019-02-04 17:15 ` David Miller
2019-02-04 17:46 ` Alexei Starovoitov
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-02-04 17:15 UTC (permalink / raw)
To: heiko.carstens; +Cc: ast, schwidefsky, jiong.wang, linux-s390, netdev
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Date: Mon, 4 Feb 2019 16:44:55 +0100
> Commit 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32") added
> JMP32 code-gen support for s390. However it triggers the warning below
> due to some unusual gotos in the original s390 bpf jit code.
>
> Add a couple of additional "is_jmp32" initializations to fix this.
> Also fix the wrong opcode for the "llilf" instruction that was
> introduced with the same commit.
>
> arch/s390/net/bpf_jit_comp.c: In function 'bpf_jit_insn':
> arch/s390/net/bpf_jit_comp.c:248:55: warning: 'is_jmp32' may be used uninitialized in this function [-Wmaybe-uninitialized]
> _EMIT6(op1 | reg(b1, b2) << 16 | (rel & 0xffff), op2 | mask); \
> ^
> arch/s390/net/bpf_jit_comp.c:1211:8: note: 'is_jmp32' was declared here
> bool is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
>
> Fixes: 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32")
> Cc: Jiong Wang <jiong.wang@netronome.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] s390: bpf: fix JMP32 code-gen
2019-02-04 15:44 [PATCH] s390: bpf: fix JMP32 code-gen Heiko Carstens
2019-02-04 16:15 ` Jiong Wang
2019-02-04 17:15 ` David Miller
@ 2019-02-04 17:46 ` Alexei Starovoitov
2 siblings, 0 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2019-02-04 17:46 UTC (permalink / raw)
To: Heiko Carstens
Cc: Alexei Starovoitov, Martin Schwidefsky, Jiong Wang, linux-s390,
netdev
On Mon, Feb 04, 2019 at 04:44:55PM +0100, Heiko Carstens wrote:
> Commit 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32") added
> JMP32 code-gen support for s390. However it triggers the warning below
> due to some unusual gotos in the original s390 bpf jit code.
>
> Add a couple of additional "is_jmp32" initializations to fix this.
> Also fix the wrong opcode for the "llilf" instruction that was
> introduced with the same commit.
>
> arch/s390/net/bpf_jit_comp.c: In function 'bpf_jit_insn':
> arch/s390/net/bpf_jit_comp.c:248:55: warning: 'is_jmp32' may be used uninitialized in this function [-Wmaybe-uninitialized]
> _EMIT6(op1 | reg(b1, b2) << 16 | (rel & 0xffff), op2 | mask); \
> ^
> arch/s390/net/bpf_jit_comp.c:1211:8: note: 'is_jmp32' was declared here
> bool is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
>
> Fixes: 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32")
> Cc: Jiong Wang <jiong.wang@netronome.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Applied to bpf-next. Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-04 17:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-04 15:44 [PATCH] s390: bpf: fix JMP32 code-gen Heiko Carstens
2019-02-04 16:15 ` Jiong Wang
2019-02-04 17:15 ` David Miller
2019-02-04 17:46 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).