]> git.baikalelectronics.ru Git - kernel.git/commit
x86: bpf_jit_comp: secure bpf jit against spraying attacks
authorEric Dumazet <edumazet@google.com>
Fri, 17 May 2013 16:37:03 +0000 (16:37 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 May 2013 06:55:41 +0000 (23:55 -0700)
commit51d1d536b5aa38d07e82c8f122773a153f0700c7
treec73c7e79c25024f6865f8e349789ac62d66776b8
parent032afc764fdfb8b299b944fbe796fe2b8217f16f
x86: bpf_jit_comp: secure bpf jit against spraying attacks

hpa bringed into my attention some security related issues
with BPF JIT on x86.

This patch makes sure the bpf generated code is marked read only,
as other kernel text sections.

It also splits the unused space (we vmalloc() and only use a fraction of
the page) in two parts, so that the generated bpf code not starts at a
known offset in the page, but a pseudo random one.

Refs:
http://mainisusuallyafunction.blogspot.com/2012/11/attacking-hardened-linux-systems-with.html

Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/x86/net/bpf_jit_comp.c