On 12/10/22 11:35 AM, Daan De Meyer wrote:
Preparation for adding unix support to cgroup sockaddr bpf programs.
In this commit, no programs are allowed to access user_path. We'll
open this up to the new unix program types in a later commit.
---
include/uapi/linux/bpf.h | 1 +
net/core/filter.c | 19 +++++++++++++++++++
tools/include/uapi/linux/bpf.h | 1 +
3 files changed, 21 insertions(+)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 7cafcfdbb9b2..9e3c33f83bba 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -6366,6 +6366,7 @@ struct bpf_sock_addr {
* Stored in network byte order.
*/
__bpf_md_ptr(struct bpf_sock *, sk);
+ char user_path[108]; /* Allows 1 byte read and write. */
__u32 user_addrlen; /* Allows 4 byte read and write. */
};
Ideally, for bisecting reason, it would be great to add user_path
first and then user_addrlen second. Otherwise, some tests utilizing
user_addrlen might not run correctly with Patch 2/9.
diff --git a/net/core/filter.c b/net/core/filter.c
index d0620927dbca..cc86b38fc764 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -26,6 +26,7 @@
#include <linux/socket.h>
#include <linux/sock_diag.h>
#include <linux/in.h>
+#include <linux/un.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/if_packet.h>
[...]