lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 23 Nov 2017 18:12:07 -0800
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     netdev@...r.kernel.org
Cc:     oss-drivers@...ronome.com, daniel@...earbox.net,
        Jakub Kicinski <jakub.kicinski@...ronome.com>
Subject: [PATCH iproute2/master 10/11] f_bpf: communicate ifindex for eBPF offload

Split parsing and loading of the eBPF program and if skip_sw is set
load the program for ifindex, to which the qdisc is attached.

Note that the ifindex will be ignored for programs which are already
loaded (e.g. when using pinned programs), but in that case we just
trust the user knows what he's doing.  Hopefully we will get extack
soon in the driver to help debugging this case.

Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@...ronome.com>
Acked-by: Daniel Borkmann <daniel@...earbox.net>
---
 tc/f_bpf.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tc/f_bpf.c b/tc/f_bpf.c
index f598784e8b08..5906f8bb969d 100644
--- a/tc/f_bpf.c
+++ b/tc/f_bpf.c
@@ -82,6 +82,7 @@ static int bpf_parse_opt(struct filter_util *qu, char *handle,
 	unsigned int bpf_flags = 0;
 	struct bpf_cfg_in cfg = {};
 	bool seen_run = false;
+	bool skip_sw = false;
 	struct rtattr *tail;
 	int ret = 0;
 
@@ -110,8 +111,11 @@ static int bpf_parse_opt(struct filter_util *qu, char *handle,
 			cfg.argc = argc;
 			cfg.argv = argv;
 
-			if (bpf_parse_and_load_common(&cfg, &bpf_cb_ops, n))
+			if (bpf_parse_common(&cfg, &bpf_cb_ops) < 0) {
+				fprintf(stderr,
+					"Unable to parse bpf command line\n");
 				return -1;
+			}
 
 			argc = cfg.argc;
 			argv = cfg.argv;
@@ -135,6 +139,7 @@ static int bpf_parse_opt(struct filter_util *qu, char *handle,
 			bpf_gen_flags |= TCA_CLS_FLAGS_SKIP_HW;
 		} else if (matches(*argv, "skip_sw") == 0) {
 			bpf_gen_flags |= TCA_CLS_FLAGS_SKIP_SW;
+			skip_sw = true;
 		} else if (matches(*argv, "action") == 0) {
 			NEXT_ARG();
 			if (parse_action(&argc, &argv, TCA_BPF_ACT, n)) {
@@ -164,6 +169,13 @@ static int bpf_parse_opt(struct filter_util *qu, char *handle,
 		NEXT_ARG_FWD();
 	}
 
+	if (skip_sw)
+		cfg.ifindex = t->tcm_ifindex;
+	if (bpf_load_common(&cfg, &bpf_cb_ops, n) < 0) {
+		fprintf(stderr, "Unable to load program\n");
+		return -1;
+	}
+
 	if (bpf_gen_flags)
 		addattr32(n, MAX_MSG, TCA_BPF_FLAGS_GEN, bpf_gen_flags);
 	if (bpf_flags)
-- 
2.14.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ