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-next>] [day] [month] [year] [list]
Date:   Thu, 12 Nov 2020 21:09:14 +0100
From:   Florent Revest <revest@...omium.org>
To:     bpf@...r.kernel.org
Cc:     ast@...nel.org, daniel@...earbox.net, kafai@...com, yhs@...com,
        andrii@...nel.org, kpsingh@...omium.org, jackmanb@...omium.org,
        linux-kernel@...r.kernel.org, Florent Revest <revest@...gle.com>
Subject: [PATCH] bpf: Expose bpf_sk_storage_* to iterator programs

From: Florent Revest <revest@...gle.com>

Iterators are currently used to expose kernel information to userspace
over fast procfs-like files but iterators could also be used to
initialize local storage. For example, the task_file iterator could be
used to store associations between processes and sockets.

This exposes the socket local storage helpers to all iterators. Martin
Kafai checked that this was safe to call these helpers from the
sk_storage_map iterators.

Signed-off-by: Florent Revest <revest@...gle.com>
---
 kernel/trace/bpf_trace.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index e4515b0f62a8..3530120fa280 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -17,6 +17,8 @@
 #include <linux/error-injection.h>
 #include <linux/btf_ids.h>
 
+#include <net/bpf_sk_storage.h>
+
 #include <uapi/linux/bpf.h>
 #include <uapi/linux/btf.h>
 
@@ -1750,6 +1752,14 @@ tracing_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
 		       NULL;
 	case BPF_FUNC_d_path:
 		return &bpf_d_path_proto;
+	case BPF_FUNC_sk_storage_get:
+		return prog->expected_attach_type == BPF_TRACE_ITER ?
+		       &bpf_sk_storage_get_proto :
+		       NULL;
+	case BPF_FUNC_sk_storage_delete:
+		return prog->expected_attach_type == BPF_TRACE_ITER ?
+		       &bpf_sk_storage_delete_proto :
+		       NULL;
 	default:
 		return raw_tp_prog_func_proto(func_id, prog);
 	}
-- 
2.29.2.222.g5d2a92d10f8-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ