Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df3eed3d authored by Michael Holzheu's avatar Michael Holzheu Committed by Martin Schwidefsky
Browse files

s390/bpf: Fix ALU_NEG (A = -A)



Currently the LOAD NEGATIVE (lnr) instruction is used for ALU_NEG. This
instruction always loads the negative value. Therefore, if A is already
negative, it remains unchanged. To fix this use LOAD COMPLEMENT (lcr)
instead.

Signed-off-by: default avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent fbc89c95
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -431,8 +431,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
		EMIT4_DISP(0x88500000, K);
		EMIT4_DISP(0x88500000, K);
		break;
		break;
	case BPF_ALU | BPF_NEG: /* A = -A */
	case BPF_ALU | BPF_NEG: /* A = -A */
		/* lnr %r5,%r5 */
		/* lcr %r5,%r5 */
		EMIT2(0x1155);
		EMIT2(0x1355);
		break;
		break;
	case BPF_JMP | BPF_JA: /* ip += K */
	case BPF_JMP | BPF_JA: /* ip += K */
		offset = addrs[i + K] + jit->start - jit->prg;
		offset = addrs[i + K] + jit->start - jit->prg;