All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "s390/bpf: Fix backward jumps" has been added to the 4.1-stable tree
@ 2015-07-08  7:24 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-07-08  7:24 UTC (permalink / raw)
  To: holzheu, gregkh, schwidefsky; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    s390/bpf: Fix backward jumps

to the 4.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     s390-bpf-fix-backward-jumps.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From b035b60ded132592055c0f9bd1cc280259c7de4b Mon Sep 17 00:00:00 2001
From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Date: Thu, 21 May 2015 15:39:31 +0200
Subject: s390/bpf: Fix backward jumps

From: Michael Holzheu <holzheu@linux.vnet.ibm.com>

commit b035b60ded132592055c0f9bd1cc280259c7de4b upstream.

Currently all backward jumps crash for JITed s390x eBPF programs
with an illegal instruction program check and kernel panic. Because
for negative values the opcode of the jump instruction is overriden
by the negative branch offset an illegal instruction is generated
by the JIT:

 000003ff802da378: c01100000002   lgfi    %r1,2
 000003ff802da37e: fffffff52065   unknown <-- illegal instruction
 000003ff802da384: b904002e       lgr     %r2,%r14

So fix this and mask the offset in order not to damage the opcode.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/s390/net/bpf_jit_comp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -227,7 +227,7 @@ static inline void reg_set_seen(struct b
 ({								\
 	/* Branch instruction needs 6 bytes */			\
 	int rel = (addrs[i + off + 1] - (addrs[i + 1] - 6)) / 2;\
-	_EMIT6(op1 | reg(b1, b2) << 16 | rel, op2 | mask);	\
+	_EMIT6(op1 | reg(b1, b2) << 16 | (rel & 0xffff), op2 | mask);	\
 	REG_SET_SEEN(b1);					\
 	REG_SET_SEEN(b2);					\
 })


Patches currently in stable-queue which might be from holzheu@linux.vnet.ibm.com are

queue-4.1/s390-kdump-fix-regset_vx_low-vector-register-elf-notes.patch
queue-4.1/s390-bpf-fix-backward-jumps.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-08  7:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08  7:24 Patch "s390/bpf: Fix backward jumps" has been added to the 4.1-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.