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

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

s390/bpf: Fix JMP_JGE_X (A > X) and JMP_JGT_X (A >= X)



Currently the signed COMPARE (cr) instruction is used to compare "A"
with "X". This is not correct because "A" and "X" are both unsigned.
To fix this use the unsigned COMPARE LOGICAL (clr) instruction instead.

Signed-off-by: default avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent df3eed3d
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -502,8 +502,8 @@ branch: if (filter->jt == filter->jf) {
xbranch:	/* Emit compare if the branch targets are different */
xbranch:	/* Emit compare if the branch targets are different */
		if (filter->jt != filter->jf) {
		if (filter->jt != filter->jf) {
			jit->seen |= SEEN_XREG;
			jit->seen |= SEEN_XREG;
			/* cr %r5,%r12 */
			/* clr %r5,%r12 */
			EMIT2(0x195c);
			EMIT2(0x155c);
		}
		}
		goto branch;
		goto branch;
	case BPF_JMP | BPF_JSET | BPF_X: /* ip += (A & X) ? jt : jf */
	case BPF_JMP | BPF_JSET | BPF_X: /* ip += (A & X) ? jt : jf */