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:	Sun, 24 May 2015 08:28:04 +0000
From:	He Kuang <hekuang@...wei.com>
To:	<wangnan0@...wei.com>, <paulus@...ba.org>,
	<a.p.zijlstra@...llo.nl>, <mingo@...hat.com>, <acme@...nel.org>,
	<namhyung@...nel.org>, <jolsa@...nel.org>, <ast@...mgrid.com>,
	<masami.hiramatsu.pt@...achi.com>, <dsahern@...il.com>,
	<brendan.d.gregg@...il.com>, <daniel@...earbox.net>
CC:	<lizefan@...wei.com>, <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH v2 08/15] bpf tools: Fetch calling regs to bpf arglist

For generating bpf prologue which fetches function formal parameters
when debuginfo is not provided.

Signed-off-by: He Kuang <hekuang@...wei.com>
---
 tools/lib/bpf/gen_prologue.c | 19 +++++++++++++++++++
 tools/lib/bpf/libbpf.h       |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/tools/lib/bpf/gen_prologue.c b/tools/lib/bpf/gen_prologue.c
index ca8aa1c..d25693a 100644
--- a/tools/lib/bpf/gen_prologue.c
+++ b/tools/lib/bpf/gen_prologue.c
@@ -106,3 +106,22 @@ unsigned int bpf_prologue_end(char *new_prog, int nargs)
 
 	return (char *)new_insn - new_prog;
 }
+
+unsigned int bpf_prologue_formal_parameters(char *new_prog, int offset,
+					int index)
+{
+	struct bpf_insn *new_insn;
+
+	if (index >= BPF_PROLOGUE_NRARGS_MAX)
+		return 0;
+
+	new_insn = (struct bpf_insn *)new_prog;
+
+	/* load ctx to r3 */
+	if (new_prog)
+		*new_insn = BPF_LDX_MEM(BPF_DW, BPF_REG_ARG2 + index,
+				BPF_REG_ARG1, offset);
+	new_insn++;
+
+	return (char *)new_insn - new_prog;
+}
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index cf22a6a..9d6d4f7 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -72,5 +72,7 @@ unsigned int bpf_prologue_arg_deref(int offset,
 				int depth,
 				char *new_prog,
 				bool last);
+unsigned int bpf_prologue_formal_parameters(char *new_prog, int offset,
+					int index);
 
 #endif
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ