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]
Message-ID: <1466940078-65581-26-git-send-email-hekuang@huawei.com>
Date:	Sun, 26 Jun 2016 11:21:17 +0000
From:	He Kuang <hekuang@...wei.com>
To:	<acme@...nel.org>, <peterz@...radead.org>, <mingo@...hat.com>,
	<jolsa@...hat.com>, <brendan.d.gregg@...il.com>, <ast@...nel.org>,
	<alexander.shishkin@...ux.intel.com>, <wangnan0@...wei.com>,
	<hekuang@...wei.com>
CC:	<linux-kernel@...r.kernel.org>
Subject: [RFC PATCH v2 25/26] perf bpf: Implement run_ubpf_program

Fill up the run_ubpf_program slot by fetching the ubpf entry and call
__bpf_prog_run().

Signed-off-by: He Kuang <hekuang@...wei.com>
Signed-off-by: Wang Nan <wangnan0@...wei.com>
---
 tools/perf/util/ubpf-hooks.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/ubpf-hooks.c b/tools/perf/util/ubpf-hooks.c
index 6ffe344..da19fab 100644
--- a/tools/perf/util/ubpf-hooks.c
+++ b/tools/perf/util/ubpf-hooks.c
@@ -8,12 +8,25 @@
 #include <asm/bug.h>
 #include <ubpf.h>
 #include "ubpf-hooks.h"
+#include "bpf-vm.h"
 #include "debug.h"
 
-static int run_ubpf_program(struct bpf_program *prog __maybe_unused,
-			    void *mem __maybe_unused, size_t len __maybe_unused)
+static int
+run_ubpf_program(struct bpf_program *prog, void *mem, size_t len)
 {
-	return 0;
+	struct ubpf_entry *entry;
+	int ret;
+
+	entry = bpf_program__vm(prog);
+	if (!entry) {
+		WARN_ONCE(!entry, "Unable to fetch entry from UBPF program\n");
+		return -EINVAL;
+	}
+
+	ret = __bpf_prog_run(mem, entry->insns, len);
+	pr_debug("program %s returns %d\n",
+		 bpf_program__title(prog, false), ret);
+	return ret;
 }
 
 static int
-- 
1.8.5.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ