linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v14 01/13] sk_run_filter: add BPF_S_ANC_SECCOMP_LD_W
@ 2012-03-12 21:28 Will Drewry
  2012-03-12 21:28 ` [PATCH v14 02/13] net/compat.c,linux/filter.h: share compat_sock_fprog Will Drewry
                   ` (13 more replies)
  0 siblings, 14 replies; 40+ messages in thread
From: Will Drewry @ 2012-03-12 21:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, linux-doc, kernel-hardening, netdev, x86, arnd,
	davem, hpa, mingo, oleg, peterz, rdunlap, mcgrathr, tglx, luto,
	eparis, serge.hallyn, djm, scarybeasts, indan, pmoore, akpm,
	corbet, eric.dumazet, markus, coreyb, keescook, Will Drewry

Introduces a new BPF ancillary instruction that all LD calls will be
mapped through when skb_run_filter() is being used for seccomp BPF.  The
rewriting will be done using a secondary chk_filter function that is run
after skb_chk_filter.

The code change is guarded by CONFIG_SECCOMP_FILTER which is added,
along with the seccomp_bpf_load() function later in this series.

This is based on http://lkml.org/lkml/2012/3/2/141

v14: First cut using a single additional instruction
... v13: made bpf functions generic.


Suggested-by: Indan Zupancic <indan@nul.nu>
Signed-off-by: Will Drewry <wad@chromium.org>
---
 include/linux/filter.h |    1 +
 net/core/filter.c      |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/filter.h b/include/linux/filter.h
index 8eeb205..aaa2e80 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -228,6 +228,7 @@ enum {
 	BPF_S_ANC_HATYPE,
 	BPF_S_ANC_RXHASH,
 	BPF_S_ANC_CPU,
+	BPF_S_ANC_SECCOMP_LD_W,
 };
 
 #endif /* __KERNEL__ */
diff --git a/net/core/filter.c b/net/core/filter.c
index 5dea452..3000931 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -350,6 +350,11 @@ load_b:
 				A = 0;
 			continue;
 		}
+#ifdef CONFIG_SECCOMP_FILTER
+		case BPF_S_ANC_SECCOMP_LD_W:
+			A = seccomp_bpf_load(fentry->k);
+			continue;
+#endif
 		default:
 			WARN_RATELIMIT(1, "Unknown code:%u jt:%u tf:%u k:%u\n",
 				       fentry->code, fentry->jt,
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2012-03-20 13:56 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-12 21:28 [PATCH v14 01/13] sk_run_filter: add BPF_S_ANC_SECCOMP_LD_W Will Drewry
2012-03-12 21:28 ` [PATCH v14 02/13] net/compat.c,linux/filter.h: share compat_sock_fprog Will Drewry
2012-03-12 21:28 ` [PATCH v14 03/13] seccomp: kill the seccomp_t typedef Will Drewry
2012-03-12 21:28 ` [PATCH v14 04/13] arch/x86: add syscall_get_arch to syscall.h Will Drewry
2012-03-12 21:28 ` [PATCH v14 05/13] asm/syscall.h: add syscall_get_arch Will Drewry
2012-03-12 21:28 ` [PATCH v14 06/13] seccomp: add system call filtering using BPF Will Drewry
2012-03-13  3:33   ` Indan Zupancic
2012-03-13 15:57     ` [kernel-hardening] " Will Drewry
2012-03-12 21:28 ` [PATCH v14 07/13] signal, x86: add SIGSYS info and make it synchronous Will Drewry
2012-03-12 21:28 ` [PATCH v14 08/13] seccomp: add SECCOMP_RET_ERRNO Will Drewry
2012-03-12 21:28 ` [PATCH v14 09/13] seccomp: Add SECCOMP_RET_TRAP Will Drewry
2012-03-12 21:28 ` [PATCH v14 10/13] ptrace,seccomp: Add PTRACE_SECCOMP support Will Drewry
2012-03-14  7:31   ` Indan Zupancic
2012-03-14 15:03     ` [kernel-hardening] " Will Drewry
2012-03-14 15:52       ` Will Drewry
2012-03-15 20:31     ` [PATCH v16 11/13] " Will Drewry
2012-03-12 21:28 ` [PATCH v14 11/13] x86: Enable HAVE_ARCH_SECCOMP_FILTER Will Drewry
2012-03-12 21:28 ` [PATCH v14 12/13] Documentation: prctl/seccomp_filter Will Drewry
2012-03-12 21:28 ` [PATCH v14 13/13] seccomp: remove duplicated failure logging Will Drewry
2012-03-13  3:40 ` [PATCH v14 01/13] sk_run_filter: add BPF_S_ANC_SECCOMP_LD_W Indan Zupancic
2012-03-13 15:40   ` Will Drewry
2012-03-13 10:04 ` Indan Zupancic
2012-03-13 15:43   ` Will Drewry
2012-03-13 17:13   ` Eric Dumazet
2012-03-14  5:12     ` Indan Zupancic
2012-03-14  5:55       ` Eric Dumazet
2012-03-14  7:59         ` Indan Zupancic
2012-03-14  8:05           ` Eric Dumazet
2012-03-17 10:14             ` Indan Zupancic
2012-03-17 13:49               ` Eric Dumazet
2012-03-18  8:35                 ` Indan Zupancic
2012-03-18 12:40                   ` [PATCH] net: bpf_jit: fix BPF_S_LDX_B_MSH compilation Eric Dumazet
2012-03-19 21:42                     ` David Miller
2012-03-20  0:16                     ` [PATCH] net: bpf_jit: Document evilness of negative indirect loads Indan Zupancic
2012-03-18 12:52                   ` [PATCH v14 01/13] sk_run_filter: add BPF_S_ANC_SECCOMP_LD_W Eric Dumazet
2012-03-20  2:24                     ` [PATCH] net: bpf_jit: Simplify code by always using offset8 or offset32 Indan Zupancic
2012-03-20  2:59                       ` Eric Dumazet
2012-03-20 11:33                         ` Indan Zupancic
2012-03-20 11:41                           ` David Laight
2012-03-20 13:56                           ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).