1 #include <uapi/linux/ptrace.h>
2 #include <linux/sched.h>
4 #define DBUS_TYPE_OFFSET 1
7 G_DBUS_MESSAGE_TYPE_INVALID,
8 G_DBUS_MESSAGE_TYPE_METHOD_CALL,
9 G_DBUS_MESSAGE_TYPE_METHOD_RETURN,
10 G_DBUS_MESSAGE_TYPE_ERROR,
11 G_DBUS_MESSAGE_TYPE_SIGNAL
15 G_DBUS_MESSAGE_FLAGS_NONE = 0,
16 G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED = (1<<0),
17 G_DBUS_MESSAGE_FLAGS_NO_AUTO_START = (1<<1)
22 G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN = 'B',
23 G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN = 'l'
24 } GDBusMessageByteOrder;
26 struct GTypeInstance {
31 struct GTypeInstance g_type_instance;
33 volatile unsigned int ref_count;
56 const char *gconstpointer;
60 struct GVariant **children;
61 unsigned long n_children;
70 struct GObject parent_instance;
71 GDBusMessageType type;
72 GDBusMessageFlags flags;
74 GDBusMessageByteOrder byte_order;
75 unsigned char major_protocol_version;
77 struct GHashTable *headers;
78 struct GVariant *body;
84 unsigned int allocated;
85 unsigned int constant : 1;
86 unsigned int locked : 1;
87 unsigned int invalid : 1;
88 unsigned int align_offset : 3;
91 struct DBusHeaderFields {
96 struct DBusString data;
98 struct DBusHeaderFields fields[9];
102 unsigned char protocol_version;
107 struct DBusHeader header;
108 struct DBusString body;
110 unsigned int locked : 1;
113 long size_counter_delta;
116 u32 changed_stamp : 21;
124 unsigned n_unix_fds_allocated;
126 long unix_fd_counter_delta;
128 struct DBusString *signature;
129 struct DBusString *unique_sender;
130 size_t gvariant_body_last_offset;
131 size_t gvariant_body_last_pos;
136 char comm[TASK_COMM_LEN];
139 BPF_HASH(message, struct data_t, int);
140 BPF_HISTOGRAM(msg_type, int);
142 int g_get_message_type(struct pt_regs *ctx, void *conn, struct GDBusMessage *message) {
143 msg_type.increment(message->type);
147 int dbus_get_message_type(struct pt_regs *ctx, void *conn, struct DBusMessage *message) {
148 bpf_trace_printk("dbus: %d\n", PT_REGS_RC(ctx));
152 int message_type(struct pt_regs *ctx, void *conn, struct DBusMessage *message) {
154 bpf_probe_read(&addr, sizeof(addr), (char*)message + offsetof(struct DBusMessage, header.data.str));
156 bpf_probe_read(&type, sizeof(type), addr + 1);
157 msg_type.increment(type);