]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix unlocking of jited image when module ronx not set
authorDaniel Borkmann <daniel@iogearbox.net>
Tue, 21 Feb 2017 15:09:34 +0000 (16:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Feb 2017 18:30:14 +0000 (13:30 -0500)
commit0c1315ab47157337f37f7a45c3f58b83b57b893d
tree954aa0e71dbb2fc5fad9d6a77ca6477a873ffbe6
parent1365c9ff4e3c3e7f13e7714db66bafb12e06b06e
bpf: fix unlocking of jited image when module ronx not set

Eric and Willem reported that they recently saw random crashes when
JIT was in use and bisected this to 487a429673a4 ("bpf: make jited
programs visible in traces"). Issue was that the consolidation part
added bpf_jit_binary_unlock_ro() that would unlock previously made
read-only memory back to read-write. However, DEBUG_SET_MODULE_RONX
cannot be used for this to test for presence of set_memory_*()
functions. We need to use ARCH_HAS_SET_MEMORY instead to fix this;
also add the corresponding bpf_jit_binary_lock_ro() to filter.h.

Fixes: 487a429673a4 ("bpf: make jited programs visible in traces")
Reported-by: Eric Dumazet <edumazet@google.com>
Reported-by: Willem de Bruijn <willemb@google.com>
Bisected-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/arm64/net/bpf_jit_comp.c
arch/s390/net/bpf_jit_comp.c
arch/x86/net/bpf_jit_comp.c
include/linux/filter.h