eBPF-based security platform
kernel-obs: record socket families and activity
John Fastabendc46059c90e1f
diff --git a/upatches/kernel-obs/Beefile b/upatches/kernel-obs/Beefileindex e5ec48f6..2ab4a77c 100644--- a/upatches/kernel-obs/Beefile+++ b/upatches/kernel-obs/Beefile@@ -68,6 +68,10 @@ target = "decoders/exec.lua"source = "decoders/net.lua"target = "decoders/net.lua"+[[files]]+source = "decoders/socket.lua"+target = "decoders/socket.lua"+[[files]]source = "decoders/listen.lua"target = "decoders/listen.lua"diff --git a/upatches/kernel-obs/README.md b/upatches/kernel-obs/README.mdindex 7152b132..54ee4ab0 100644--- a/upatches/kernel-obs/README.md+++ b/upatches/kernel-obs/README.md@@ -50,6 +50,7 @@ sudo shirudo upatch list| --- | --- | --- || `exec` | executable, calling image, cgroup, euid | name, resolved path, uid, effective capabilities, pid, exec count; scripts yield one record for the script and a flagged one for the interpreter || `net` | executable, cgroup, protocol, role, peer address and port | connects or datagrams sent, packets and bytes in each direction, pid; accepted and listener-side peers aggregate by address, without the ephemeral port |+| `socket` | creator and current caller, family, type, protocol and operation | socket creation attempts for every family, plus bind/connect/listen/accept/send/receive/option/shutdown activity for IP, packet, XDP, UNIX, NETLINK and VSOCK sockets || `listen` | executable, cgroup, protocol, local address and port | TCP listens and UDP binds to a fixed port, with backlog || `watch` | executable, cgroup, protocol, destination | attempts and packets towards addresses in `watch.list` || `dns` | executable, cgroup, answered address | up to four names that resolved to the address, with counts |@@ -57,10 +58,11 @@ sudo shirudo upatch list| `file` | executable, cgroup, euid, open mode, path | opens matching `file-watch.list`, with the filesystem magic || `watch_stat` | per-CPU counters | metric: socket-level checks against the watch list and matches |-Every record carries the executable as `{dev, ino}` of the file, the-cgroup id, and `first_seen_unix_nano` and `last_seen_unix_nano`. A task-that started before the upatch loaded is attributed from its mapped-executable and flagged `caller_inferred` on its next exec.+Records include first- and last-seen timestamps and available task+identity. Executable identity is `{dev, ino}` with a cgroup id. Socket+records keep separate `owner` and `actor` identities with known and+inferred flags. Other tables flag a task that started before the upatch+loaded as `caller_inferred` when its mapped executable is first observed.The `mmap_exec` privilege records report mapping requests that include`PROT_EXEC`; `mprotect_exec` records transitions that newly grant it.@@ -69,6 +71,17 @@ mapping flags in `aux`, while `mprotect_exec` stores the VMA length.`name` is the backing file name or `anonymous`. These hooks observerequests, not whether the mapping succeeds or code runs.+Socket records describe attempts at the LSM hook; byte counts are+requested send or receive lengths, not confirmed transfers. Socket type+flags such as `SOCK_CLOEXEC` and `SOCK_NONBLOCK` are stripped before the+creation hook, so records retain the base type. Families without detailed+operation hooks still get creation, family, type and protocol records.+Sockets already open when the upatch loads are not enumerated; their owner+is marked inferred when an operation is first observed. Kernel-space+creations are not recorded. UNIX paths, message payloads and VSOCK peer+identifiers are not recorded. AF_PACKET and AF_XDP ring records cover setup+and wakeup calls, not individual frames.+Packet counts come from the cgroup hooks on the root cgroup and coverevery socket on the host, including sockets created before the load,which are attributed to their cgroup alone until their owner is known.diff --git a/upatches/kernel-obs/decoders/socket.lua b/upatches/kernel-obs/decoders/socket.luanew file mode 100644index 00000000..5b712679--- /dev/null+++ b/upatches/kernel-obs/decoders/socket.lua@@ -0,0 +1,103 @@+-- SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause+-- Copyright (c) 2026 Authors of shirudo++local RECORD = 128+local FAMILIES = {+ [1] = "unix", [2] = "inet", [10] = "inet6", [16] = "netlink",+ [17] = "packet", [40] = "vsock", [44] = "xdp",+}+local TYPES = {+ [1] = "stream", [2] = "dgram", [3] = "raw", [4] = "rdm",+ [5] = "seqpacket", [6] = "dccp", [10] = "packet",+}+local OPERATIONS = {+ [1] = "create", [2] = "bind", [3] = "connect", [4] = "listen",+ [5] = "accept", [6] = "sendmsg", [7] = "recvmsg",+ [8] = "setsockopt", [9] = "shutdown", [10] = "socketpair",+}++local function header(slot)+ return {+ boot_now_ns = slot:u64(32),+ since_ns = slot:u64(40),+ used = slot:u32(48),+ overflow = slot:u32(52),+ lost = slot:u32(56),+ peek = slot:u32(28) % 2 == 1,+ }+end++local function unix_nano(input, hdr, ts)+ if ts == "0" then+ return nil+ end+ return shirudo.u64_sub(input.timeUnixNano,+ shirudo.u64_sub(hdr.boot_now_ns, ts))+end++local function interval(input, hdr)+ return {+ since_unix_nano = unix_nano(input, hdr, hdr.since_ns),+ used = hdr.used,+ overflow = hdr.overflow,+ lost = hdr.lost,+ peek = hdr.peek,+ }+end++local function record(input, hdr, slot)+ local flags = slot:u32(84)+ local family, type = slot:u16(64), slot:u16(66)+ local operation = slot:u16(68)+ return {+ entry_index = slot:u32(0),+ owner = {+ executable = { dev = slot:u32(8), ino = slot:u64(16) },+ cgroup_id = slot:u64(24),+ pid = slot:u32(56),+ known = flags % 2 == 1,+ inferred = math.floor(flags / 2) % 2 == 1,+ },+ actor = {+ executable = { dev = slot:u32(32), ino = slot:u64(40) },+ cgroup_id = slot:u64(48),+ pid = slot:u32(60),+ known = math.floor(flags / 4) % 2 == 1,+ },+ family = family,+ family_name = FAMILIES[family] or family,+ type = type,+ type_name = TYPES[type] or type,+ operation = OPERATIONS[operation] or operation,+ protocol = slot:u32(72),+ level = slot:u32(76),+ option = slot:u32(80),+ count = slot:u64(96),+ bytes_requested = slot:u64(120),+ first_seen_unix_nano = unix_nano(input, hdr, slot:u64(104)),+ last_seen_unix_nano = unix_nano(input, hdr, slot:u64(112)),+ }+end++function decode(input)+ local records, summary = {}, nil+ for _, page in ipairs(input.data.pages) do+ local slots = shirudo.page_slots(page, RECORD)+ local hdr = slots[1] and header(slots[1])+ if hdr then+ summary = summary or interval(input, hdr)+ for i = 2, #slots do+ if slots[i]:u32(4) % 2 == 1 then+ records[#records + 1] = record(input, hdr, slots[i])+ end+ end+ end+ end+ return {+ schema = 2,+ upatch = input.upatch,+ map = input.map,+ interval = summary,+ records = records,+ }+enddiff --git a/upatches/kernel-obs/kernel-obs.bpf.c b/upatches/kernel-obs/kernel-obs.bpf.cindex d2096434..aad80dff 100644--- a/upatches/kernel-obs/kernel-obs.bpf.c+++ b/upatches/kernel-obs/kernel-obs.bpf.c@@ -33,6 +33,7 @@ char _license[] SEC("license") = "Dual BSD/GPL";OBS_VIEW(exec);OBS_VIEW(net);+OBS_VIEW(socket);OBS_VIEW(listen);OBS_VIEW(watch);OBS_VIEW(dns);@@ -57,6 +58,8 @@ OBS_DECODER(exec_decoder, "exec", "decoders/exec.lua",SHIRUDO_UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(net_decoder, "net", "decoders/net.lua",SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+OBS_DECODER(socket_decoder, "socket", "decoders/socket.lua",+ SHIRUDO_UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(listen_decoder, "listen", "decoders/listen.lua",SHIRUDO_UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(watch_decoder, "watch", "decoders/watch.lua",@@ -113,6 +116,8 @@ int shirudo_test__kernel_obs(void *ctx)rc = exec_init(now);if (!rc)rc = net_init(now);+ if (!rc)+ rc = socket_init(now);if (!rc)rc = listen_init(now);if (!rc)diff --git a/upatches/kernel-obs/obs_common.h b/upatches/kernel-obs/obs_common.hindex e4edc54d..e6ec73ba 100644--- a/upatches/kernel-obs/obs_common.h+++ b/upatches/kernel-obs/obs_common.h@@ -20,8 +20,13 @@#define EINVAL 22#define ENOSPC 28+#define AF_UNIX 1#define AF_INET 2#define AF_INET6 10+#define AF_NETLINK 16+#define AF_PACKET 17+#define AF_VSOCK 40+#define AF_XDP 44#define SOCK_TYPE_MASK 0xf#define ETH_P_IP 0x0800#define ETH_P_IPV6 0x86DD@@ -109,10 +114,15 @@ enum obs_role {OBS_ROLE_LISTENER = 3,};+#define OBS_SOCK_META_OWNER_INFERRED (1u << 0)+#define OBS_SOCK_META_OWNER_UNKNOWN (1u << 1)+struct obs_sock_meta {struct obs_exe exe;__u64 cgroup;+ __u32 owner_pid;__u32 role;+ __u32 flags;__u32 _pad;};diff --git a/upatches/kernel-obs/obs_net.bpf.c b/upatches/kernel-obs/obs_net.bpf.cindex 8471a7a9..449ac388 100644--- a/upatches/kernel-obs/obs_net.bpf.c+++ b/upatches/kernel-obs/obs_net.bpf.c@@ -17,6 +17,23 @@ enum obs_listen_kind {OBS_LISTEN_BIND = 2,};+enum obs_socket_operation {+ OBS_SOCKET_CREATE = 1,+ OBS_SOCKET_BIND,+ OBS_SOCKET_CONNECT,+ OBS_SOCKET_LISTEN,+ OBS_SOCKET_ACCEPT,+ OBS_SOCKET_SENDMSG,+ OBS_SOCKET_RECVMSG,+ OBS_SOCKET_SETSOCKOPT,+ OBS_SOCKET_SHUTDOWN,+ OBS_SOCKET_SOCKETPAIR,+};++#define OBS_SOCKET_F_OWNER_KNOWN (1u << 0)+#define OBS_SOCKET_F_OWNER_INFERRED (1u << 1)+#define OBS_SOCKET_F_ACTOR_KNOWN (1u << 2)+struct net_key {struct obs_ident ident;__u8 family;@@ -58,6 +75,30 @@ struct watch_val {__u32 _pad;};+struct socket_key {+ struct obs_ident owner;+ struct obs_ident actor;+ __u32 owner_pid;+ __u32 actor_pid;+ __u16 family;+ __u16 type;+ __u16 operation;+ __u16 _pad0;+ __u32 protocol;+ __u32 level;+ __u32 option;+ __u32 flags;+ __u32 _pad1;+ __u32 _pad2;+};++struct socket_val {+ __u64 count;+ __u64 first_ns;+ __u64 last_ns;+ __u64 bytes_requested;+};+struct obs_watch_node {__u16 child[256];__u16 terminal;@@ -181,6 +222,50 @@ static int watch_emit_record(struct shirudo_serial_chunk *chunk, __u32 off,return 0;}+#define OBS_T socket+#define OBS_T_MAP socket+#define OBS_T_KEY struct socket_key+#define OBS_T_VAL struct socket_val+#define OBS_T_CAPACITY 1024+#define OBS_T_BUCKETS 512+#define OBS_T_STEPS 8+#define OBS_T_MAGIC 0x4b434f53u /* "SOCK" little-endian */+#define OBS_T_RECORD 128+#define OBS_T_EMIT socket_emit_record+#include "obs_table.h"++static int socket_emit_record(struct shirudo_serial_chunk *chunk, __u32 off,+ const struct socket_entry __arena *e)+{+ const struct socket_key __arena *key = &e->key;++ *(__u32 *)&chunk->data[off + 8] = key->owner.exe.dev;+ *(__u32 *)&chunk->data[off + 12] = 0;+ *(__u64 *)&chunk->data[off + 16] = key->owner.exe.ino;+ *(__u64 *)&chunk->data[off + 24] = key->owner.cgroup;+ *(__u32 *)&chunk->data[off + 32] = key->actor.exe.dev;+ *(__u32 *)&chunk->data[off + 36] = 0;+ *(__u64 *)&chunk->data[off + 40] = key->actor.exe.ino;+ *(__u64 *)&chunk->data[off + 48] = key->actor.cgroup;+ *(__u32 *)&chunk->data[off + 56] = key->owner_pid;+ *(__u32 *)&chunk->data[off + 60] = key->actor_pid;+ *(__u16 *)&chunk->data[off + 64] = key->family;+ *(__u16 *)&chunk->data[off + 66] = key->type;+ *(__u16 *)&chunk->data[off + 68] = key->operation;+ *(__u16 *)&chunk->data[off + 70] = 0;+ *(__u32 *)&chunk->data[off + 72] = key->protocol;+ *(__u32 *)&chunk->data[off + 76] = key->level;+ *(__u32 *)&chunk->data[off + 80] = key->option;+ *(__u32 *)&chunk->data[off + 84] = key->flags;+ *(__u32 *)&chunk->data[off + 88] = 0;+ *(__u32 *)&chunk->data[off + 92] = 0;+ *(__u64 *)&chunk->data[off + 96] = e->val.count;+ *(__u64 *)&chunk->data[off + 104] = e->val.first_ns;+ *(__u64 *)&chunk->data[off + 112] = e->val.last_ns;+ *(__u64 *)&chunk->data[off + 120] = e->val.bytes_requested;+ return 0;+}+static __always_inline bool obs_watch_lookup_v4(__u32 addr4){__u32 address = bpf_ntohl(addr4), idx = 0, octet;@@ -332,20 +417,23 @@ obs_sock_meta_set(struct sock *sk, __u32 role, __u64 now){struct obs_sock_meta *meta;struct obs_ident ident;+ bool known;meta = bpf_sk_storage_get(&obs_i_sock, sk, 0,BPF_SK_STORAGE_GET_F_CREATE);if (!meta)return 0;- obs_ident_checked(&ident, now);+ known = obs_ident_checked(&ident, now);meta->exe = ident.exe;meta->cgroup = ident.cgroup;+ meta->owner_pid = obs_tgid();meta->role = role;+ meta->flags = known ? 0 : OBS_SOCK_META_OWNER_UNKNOWN;meta->_pad = 0;return meta;}-/* The socket's owner, or the current task for sockets created before load. */+/* A socket first seen after load has no observed creator. */static __always_inline struct obs_sock_meta *obs_sock_meta_get(struct sock *sk, __u64 now){@@ -354,7 +442,73 @@ obs_sock_meta_get(struct sock *sk, __u64 now)meta = bpf_sk_storage_get(&obs_i_sock, sk, 0, 0);if (meta)return meta;- return obs_sock_meta_set(sk, OBS_ROLE_NONE, now);+ meta = obs_sock_meta_set(sk, OBS_ROLE_NONE, now);+ if (meta)+ meta->flags |= OBS_SOCK_META_OWNER_INFERRED;+ return meta;+}++static __always_inline bool obs_socket_detail_family(__u16 family)+{+ return family == AF_UNIX || family == AF_INET ||+ family == AF_INET6 || family == AF_NETLINK ||+ family == AF_PACKET || family == AF_VSOCK ||+ family == AF_XDP;+}++static __always_inline void+obs_socket_record(struct socket *sock, __u16 family, __u16 type,+ __u32 protocol, __u16 operation, __s32 size,+ __s32 level, __s32 option, __u64 now)+{+ struct socket_entry __arena *entry;+ struct obs_sock_meta *meta;+ struct socket_key key = {};+ struct obs_ident actor = {};+ struct sock *sk;+ __u32 flags = 0;+ int status;++ if (!sock)+ return;+ sk = sock->sk;+ if (!sk)+ return;+ if (operation != OBS_SOCKET_CREATE &&+ !obs_socket_detail_family(family))+ return;+ meta = obs_sock_meta_get(sk, now);+ if (meta) {+ if (!(meta->flags & (OBS_SOCK_META_OWNER_INFERRED |+ OBS_SOCK_META_OWNER_UNKNOWN))) {+ key.owner.exe = meta->exe;+ key.owner.cgroup = meta->cgroup;+ key.owner_pid = meta->owner_pid;+ flags |= OBS_SOCKET_F_OWNER_KNOWN;+ } else if (meta->flags & OBS_SOCK_META_OWNER_INFERRED) {+ flags |= OBS_SOCKET_F_OWNER_INFERRED;+ }+ }+ if (obs_ident_checked(&actor, now))+ flags |= OBS_SOCKET_F_ACTOR_KNOWN;+ key.actor = actor;+ key.actor_pid = obs_tgid();+ key.family = family;+ key.type = type & SOCK_TYPE_MASK;+ key.operation = operation;+ key.protocol = protocol;+ key.level = level < 0 ? 0 : (__u32)level;+ key.option = option < 0 ? 0 : (__u32)option;+ key.flags = flags;+ entry = socket_touch(&key, &status);+ if (!entry)+ return;+ if (status == OBS_TOUCH_CREATED)+ entry->val.first_ns = now;+ __sync_fetch_and_add(&entry->val.count, 1);+ if (size > 0)+ __sync_fetch_and_add(&entry->val.bytes_requested, (__u32)size);+ entry->val.last_ns = now;}static __always_inline bool obs_peer_from_sockaddr(struct sockaddr *addr,@@ -450,16 +604,17 @@ SEC("lsm/socket_post_create")int BPF_PROG(obs_socket_create, struct socket *sock, int family, int type,int protocol, int kern){+ __u64 now = obs_now();struct sock *sk;- (void)type;- (void)protocol;- if (kern || !obs_inet_family((__u16)family) || !sock)+ if (kern || !sock)return 0;sk = sock->sk;if (!sk)return 0;- obs_sock_meta_set(sk, OBS_ROLE_NONE, obs_now());+ obs_sock_meta_set(sk, OBS_ROLE_NONE, now);+ obs_socket_record(sock, (__u16)family, (__u16)type, (__u32)protocol,+ OBS_SOCKET_CREATE, 0, 0, 0, now);return 0;}@@ -471,10 +626,11 @@ int BPF_PROG(obs_sock_graft, struct sock *sk, struct socket *parent)__u64 now = obs_now();(void)parent;- if (!sk || !obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)))+ if (!sk)return 0;meta = obs_sock_meta_set(sk, OBS_ROLE_ACCEPTOR, now);- if (!meta || !obs_peer_from_sock(sk, &key))+ if (!meta || !obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)) ||+ !obs_peer_from_sock(sk, &key))return 0;key.ident.exe = meta->exe;key.ident.cgroup = meta->cgroup;@@ -498,7 +654,12 @@ int BPF_PROG(obs_socket_connect, struct socket *sock, struct sockaddr *address,if (!sock)return 0;sk = sock->sk;- if (!sk || !obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)))+ if (!sk)+ return 0;+ obs_socket_record(sock, BPF_CORE_READ(sk, __sk_common.skc_family),+ sock->type, BPF_CORE_READ(sk, sk_protocol),+ OBS_SOCKET_CONNECT, 0, 0, 0, now);+ if (!obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)))return 0;type = sock->type & SOCK_TYPE_MASK;if (type != SOCK_STREAM && type != SOCK_SEQPACKET)@@ -530,10 +691,16 @@ int BPF_PROG(obs_socket_sendmsg, struct socket *sock, struct msghdr *msg,__u16 type;int addrlen;- if (size <= 0 || !sock || !msg)+ if (!sock || !msg)return 0;sk = sock->sk;- if (!sk || !obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)))+ if (!sk)+ return 0;+ obs_socket_record(sock, BPF_CORE_READ(sk, __sk_common.skc_family),+ sock->type, BPF_CORE_READ(sk, sk_protocol),+ OBS_SOCKET_SENDMSG, size, 0, 0, now);+ if (size <= 0 ||+ !obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)))return 0;type = sock->type & SOCK_TYPE_MASK;if (type != SOCK_DGRAM && type != SOCK_RAW)@@ -569,7 +736,12 @@ int BPF_PROG(obs_socket_listen, struct socket *sock, int backlog)if (!sock)return 0;sk = sock->sk;- if (!sk || !obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)))+ if (!sk)+ return 0;+ obs_socket_record(sock, BPF_CORE_READ(sk, __sk_common.skc_family),+ sock->type, BPF_CORE_READ(sk, sk_protocol),+ OBS_SOCKET_LISTEN, 0, 0, 0, now);+ if (!obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)))return 0;if (!obs_local_from_sock(sk, &key))return 0;@@ -598,7 +770,12 @@ int BPF_PROG(obs_socket_bind, struct socket *sock, struct sockaddr *address,if (!sock)return 0;sk = sock->sk;- if (!sk || !obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)))+ if (!sk)+ return 0;+ obs_socket_record(sock, BPF_CORE_READ(sk, __sk_common.skc_family),+ sock->type, BPF_CORE_READ(sk, sk_protocol),+ OBS_SOCKET_BIND, 0, 0, 0, now);+ if (!obs_inet_family(BPF_CORE_READ(sk, __sk_common.skc_family)))return 0;type = sock->type & SOCK_TYPE_MASK;if (type != SOCK_DGRAM)@@ -616,6 +793,99 @@ int BPF_PROG(obs_socket_bind, struct socket *sock, struct sockaddr *address,return 0;}+SEC("lsm/socket_accept")+int BPF_PROG(obs_socket_accept, struct socket *sock, struct socket *newsock)+{+ __u64 now = obs_now();+ struct sock *sk;++ (void)newsock;+ if (!sock)+ return 0;+ sk = sock->sk;+ if (!sk)+ return 0;+ obs_socket_record(sock, BPF_CORE_READ(sk, __sk_common.skc_family),+ sock->type, BPF_CORE_READ(sk, sk_protocol),+ OBS_SOCKET_ACCEPT, 0, 0, 0, now);+ return 0;+}++SEC("lsm/socket_recvmsg")+int BPF_PROG(obs_socket_recvmsg, struct socket *sock, struct msghdr *msg,+ int size, int flags)+{+ __u64 now = obs_now();+ struct sock *sk;++ (void)msg;+ (void)flags;+ if (!sock)+ return 0;+ sk = sock->sk;+ if (!sk)+ return 0;+ obs_socket_record(sock, BPF_CORE_READ(sk, __sk_common.skc_family),+ sock->type, BPF_CORE_READ(sk, sk_protocol),+ OBS_SOCKET_RECVMSG, size, 0, 0, now);+ return 0;+}++SEC("lsm/socket_setsockopt")+int BPF_PROG(obs_socket_setsockopt, struct socket *sock, int level,+ int optname)+{+ __u64 now = obs_now();+ struct sock *sk;++ if (!sock)+ return 0;+ sk = sock->sk;+ if (!sk)+ return 0;+ obs_socket_record(sock, BPF_CORE_READ(sk, __sk_common.skc_family),+ sock->type, BPF_CORE_READ(sk, sk_protocol),+ OBS_SOCKET_SETSOCKOPT, 0, level, optname, now);+ return 0;+}++SEC("lsm/socket_shutdown")+int BPF_PROG(obs_socket_shutdown, struct socket *sock, int how)+{+ __u64 now = obs_now();+ struct sock *sk;++ (void)how;+ if (!sock)+ return 0;+ sk = sock->sk;+ if (!sk)+ return 0;+ obs_socket_record(sock, BPF_CORE_READ(sk, __sk_common.skc_family),+ sock->type, BPF_CORE_READ(sk, sk_protocol),+ OBS_SOCKET_SHUTDOWN, 0, 0, 0, now);+ return 0;+}++SEC("lsm/socket_socketpair")+int BPF_PROG(obs_socket_socketpair, struct socket *socka,+ struct socket *sockb)+{+ __u64 now = obs_now();+ struct sock *sk;++ (void)sockb;+ if (!socka)+ return 0;+ sk = socka->sk;+ if (!sk)+ return 0;+ obs_socket_record(socka, BPF_CORE_READ(sk, __sk_common.skc_family),+ socka->type, BPF_CORE_READ(sk, sk_protocol),+ OBS_SOCKET_SOCKETPAIR, 0, 0, 0, now);+ return 0;+}+/* Parsed network and transport headers of one cgroup packet. */struct obs_pkt {__u8 family;diff --git a/vendor/libbpf/bpf/gen_loader.c b/vendor/libbpf/bpf/gen_loader.cindex f3c28226..c1bca9fd 100644--- a/vendor/libbpf/bpf/gen_loader.c+++ b/vendor/libbpf/bpf/gen_loader.c@@ -16,7 +16,7 @@#include "skel_internal.h"#define MAX_USED_MAPS 64-#define MAX_USED_PROGS 32+#define MAX_USED_PROGS 64#define MAX_KFUNC_DESCS 256#define MAX_FD_ARRAY_SZ (MAX_USED_MAPS + MAX_KFUNC_DESCS)