|
@@ -1,4 +1,16 @@
|
|
|
|
|
|
|
|
|
|
+struct trace_event_raw_sched_switch {
|
|
|
|
|
+ struct trace_entry ent; // Tracepoint 的通用头部
|
|
|
|
|
+ char prev_comm[TASK_COMM_LEN]; // 被切换出的进程名
|
|
|
|
|
+ pid_t prev_pid; // 被切换出的进程PID
|
|
|
|
|
+ int prev_prio; // 被切换出进程的优先级
|
|
|
|
|
+ long prev_state; // 被切换出进程的状态
|
|
|
|
|
+ char next_comm[TASK_COMM_LEN]; // 被切换入的进程名
|
|
|
|
|
+ pid_t next_pid; // 被切换入的进程PID
|
|
|
|
|
+ int next_prio; // 被切换入进程的优先级
|
|
|
|
|
+ // 可能还有其他字段,取决于内核版本
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/sched/sched_switch")
|
|
SEC("tracepoint/sched/sched_switch")
|
|
|
int handle_sched_switch(struct trace_event_raw_sched_switch *ctx)
|
|
int handle_sched_switch(struct trace_event_raw_sched_switch *ctx)
|
|
|
{
|
|
{
|
|
@@ -20,6 +32,18 @@ int handle_sched_switch(struct trace_event_raw_sched_switch *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct sys_exit_sendmsg_ctx {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_exit_sendmsg")
|
|
SEC("tracepoint/syscalls/sys_exit_sendmsg")
|
|
|
int handle_sys_exit_sendmsg(struct sys_exit_sendmsg_ctx *ctx)
|
|
int handle_sys_exit_sendmsg(struct sys_exit_sendmsg_ctx *ctx)
|
|
|
{
|
|
{
|
|
@@ -47,6 +71,18 @@ int handle_sys_exit_sendmsg(struct sys_exit_sendmsg_ctx *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// sys_exit_write tracepoint处理函数
|
|
// sys_exit_write tracepoint处理函数
|
|
|
SEC("tracepoint/syscalls/sys_exit_write")
|
|
SEC("tracepoint/syscalls/sys_exit_write")
|
|
|
int handle_sys_exit_write(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_write(struct trace_event_raw_sys_exit *ctx)
|
|
@@ -54,6 +90,18 @@ int handle_sys_exit_write(struct trace_event_raw_sys_exit *ctx)
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// sys_exit_writev tracepoint处理函数
|
|
// sys_exit_writev tracepoint处理函数
|
|
|
SEC("tracepoint/syscalls/sys_exit_writev")
|
|
SEC("tracepoint/syscalls/sys_exit_writev")
|
|
|
int handle_sys_exit_writev(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_writev(struct trace_event_raw_sys_exit *ctx)
|
|
@@ -104,6 +152,18 @@ int handle_sys_exit_writev(struct trace_event_raw_sys_exit *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// sys_exit_sendmmsg tracepoint处理函数
|
|
// sys_exit_sendmmsg tracepoint处理函数
|
|
|
SEC("tracepoint/syscalls/sys_exit_sendmmsg")
|
|
SEC("tracepoint/syscalls/sys_exit_sendmmsg")
|
|
|
int handle_sys_exit_sendmmsg(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_sendmmsg(struct trace_event_raw_sys_exit *ctx)
|
|
@@ -111,6 +171,18 @@ int handle_sys_exit_sendmmsg(struct trace_event_raw_sys_exit *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// sys_exit_sendto tracepoint处理函数
|
|
// sys_exit_sendto tracepoint处理函数
|
|
|
SEC("tracepoint/syscalls/sys_exit_sendto")
|
|
SEC("tracepoint/syscalls/sys_exit_sendto")
|
|
|
int handle_sys_exit_sendto(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_sendto(struct trace_event_raw_sys_exit *ctx)
|
|
@@ -118,6 +190,18 @@ int handle_sys_exit_sendto(struct trace_event_raw_sys_exit *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 捕获sys_enter_read以获取参数
|
|
// 捕获sys_enter_read以获取参数
|
|
|
SEC("tracepoint/syscalls/sys_enter_read")
|
|
SEC("tracepoint/syscalls/sys_enter_read")
|
|
|
int handle_sys_enter_read(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_read(struct trace_event_raw_sys_enter *ctx)
|
|
@@ -125,18 +209,54 @@ int handle_sys_enter_read(struct trace_event_raw_sys_enter *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_readv")
|
|
SEC("tracepoint/syscalls/sys_enter_readv")
|
|
|
int handle_sys_enter_readv(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_readv(struct trace_event_raw_sys_enter *ctx)
|
|
|
{
|
|
{
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_recvmsg")
|
|
SEC("tracepoint/syscalls/sys_enter_recvmsg")
|
|
|
int handle_sys_enter_recvmsg(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_recvmsg(struct trace_event_raw_sys_enter *ctx)
|
|
|
{
|
|
{
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_recvfrom")
|
|
SEC("tracepoint/syscalls/sys_enter_recvfrom")
|
|
|
int handle_sys_enter_recvfrom(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_recvfrom(struct trace_event_raw_sys_enter *ctx)
|
|
|
{
|
|
{
|
|
@@ -145,25 +265,73 @@ int handle_sys_enter_recvfrom(struct trace_event_raw_sys_enter *ctx)
|
|
|
|
|
|
|
|
//以上为网络部分监控函数原型
|
|
//以上为网络部分监控函数原型
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_epoll_wait")
|
|
SEC("tracepoint/syscalls/sys_enter_epoll_wait")
|
|
|
int handle_sys_enter_epoll_wait(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_epoll_wait(struct trace_event_raw_sys_enter *ctx)
|
|
|
{
|
|
{
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_epoll_pwait")
|
|
SEC("tracepoint/syscalls/sys_enter_epoll_pwait")
|
|
|
int handle_sys_enter_epoll_pwait(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_epoll_pwait(struct trace_event_raw_sys_enter *ctx)
|
|
|
{
|
|
{
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_epoll_pwait2")
|
|
SEC("tracepoint/syscalls/sys_enter_epoll_pwait2")
|
|
|
int handle_sys_enter_epoll_pwait2(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_epoll_pwait2(struct trace_event_raw_sys_enter *ctx)
|
|
|
{
|
|
{
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-//以上为epoll timewait部分监控函数原型
|
|
|
|
|
|
|
+//以上为epoll timewait部分监控函数原型
|
|
|
|
|
+
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
SEC("tracepoint/syscalls/sys_exit_futex")
|
|
SEC("tracepoint/syscalls/sys_exit_futex")
|
|
|
int handle_sys_exit_futex(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_futex(struct trace_event_raw_sys_exit *ctx)
|
|
@@ -173,7 +341,20 @@ int handle_sys_exit_futex(struct trace_event_raw_sys_exit *ctx)
|
|
|
|
|
|
|
|
//以上为futex time
|
|
//以上为futex time
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter__stub {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
#if defined(__TARGET_ARCH_x86)
|
|
#if defined(__TARGET_ARCH_x86)
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_open")
|
|
SEC("tracepoint/syscalls/sys_enter_open")
|
|
|
int sys_enter_open(struct trace_event_raw_sys_enter__stub* ctx)
|
|
int sys_enter_open(struct trace_event_raw_sys_enter__stub* ctx)
|
|
|
{
|
|
{
|
|
@@ -187,18 +368,54 @@ int sys_exit_open(struct trace_event_raw_sys_exit__stub* ctx)
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter__stub {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_openat")
|
|
SEC("tracepoint/syscalls/sys_enter_openat")
|
|
|
int sys_enter_openat(struct trace_event_raw_sys_enter__stub* ctx)
|
|
int sys_enter_openat(struct trace_event_raw_sys_enter__stub* ctx)
|
|
|
{
|
|
{
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit__stub {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_exit_openat")
|
|
SEC("tracepoint/syscalls/sys_exit_openat")
|
|
|
int sys_exit_openat(struct trace_event_raw_sys_exit__stub* ctx)
|
|
int sys_exit_openat(struct trace_event_raw_sys_exit__stub* ctx)
|
|
|
{
|
|
{
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_exit_read")
|
|
SEC("tracepoint/syscalls/sys_exit_read")
|
|
|
int handle_sys_exit_read(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_read(struct trace_event_raw_sys_exit *ctx)
|
|
|
{
|
|
{
|
|
@@ -213,6 +430,18 @@ int handle_sys_exit_read(struct trace_event_raw_sys_exit *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_exit_write")
|
|
SEC("tracepoint/syscalls/sys_exit_write")
|
|
|
int handle_sys_exit_write(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_write(struct trace_event_raw_sys_exit *ctx)
|
|
|
{
|
|
{
|
|
@@ -226,6 +455,18 @@ int handle_sys_exit_write(struct trace_event_raw_sys_exit *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_exit_close")
|
|
SEC("tracepoint/syscalls/sys_exit_close")
|
|
|
int handle_sys_exit_close(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_close(struct trace_event_raw_sys_exit *ctx)
|
|
|
{
|
|
{
|
|
@@ -238,6 +479,18 @@ int handle_sys_exit_close(struct trace_event_raw_sys_exit *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_exit_fsync")
|
|
SEC("tracepoint/syscalls/sys_exit_fsync")
|
|
|
int handle_sys_exit_fsync(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_fsync(struct trace_event_raw_sys_exit *ctx)
|
|
|
{
|
|
{
|
|
@@ -250,6 +503,18 @@ int handle_sys_exit_fsync(struct trace_event_raw_sys_exit *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_exit_fdatasync")
|
|
SEC("tracepoint/syscalls/sys_exit_fdatasync")
|
|
|
int handle_sys_exit_fdatasync(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_fdatasync(struct trace_event_raw_sys_exit *ctx)
|
|
|
{
|
|
{
|
|
@@ -262,6 +527,18 @@ int handle_sys_exit_fdatasync(struct trace_event_raw_sys_exit *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_exit_pread64")
|
|
SEC("tracepoint/syscalls/sys_exit_pread64")
|
|
|
int handle_sys_exit_pread64(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_pread64(struct trace_event_raw_sys_exit *ctx)
|
|
|
{
|
|
{
|
|
@@ -276,6 +553,18 @@ int handle_sys_exit_pread64(struct trace_event_raw_sys_exit *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_exit {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_exit_pwrite64")
|
|
SEC("tracepoint/syscalls/sys_exit_pwrite64")
|
|
|
int handle_sys_exit_pwrite64(struct trace_event_raw_sys_exit *ctx)
|
|
int handle_sys_exit_pwrite64(struct trace_event_raw_sys_exit *ctx)
|
|
|
{
|
|
{
|
|
@@ -326,6 +615,18 @@ KPROG(handle_mm_fault) (struct pt_regs *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_mmap")
|
|
SEC("tracepoint/syscalls/sys_enter_mmap")
|
|
|
int handle_sys_enter_mmap(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_mmap(struct trace_event_raw_sys_enter *ctx)
|
|
|
{
|
|
{
|
|
@@ -349,6 +650,18 @@ int handle_sys_enter_mmap(struct trace_event_raw_sys_enter *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_munmap")
|
|
SEC("tracepoint/syscalls/sys_enter_munmap")
|
|
|
int handle_sys_enter_munmap(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_munmap(struct trace_event_raw_sys_enter *ctx)
|
|
|
{
|
|
{
|
|
@@ -368,6 +681,18 @@ int handle_sys_enter_munmap(struct trace_event_raw_sys_enter *ctx)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 自定义的 sendmsg exit 上下文结构
|
|
|
|
|
+struct trace_event_raw_sys_enter {
|
|
|
|
|
+ struct trace_event_raw_sys_exit exit_ctx; // 基础exit结构
|
|
|
|
|
+ // 以下是sendmsg特有的扩展字段
|
|
|
|
|
+ int fd; // 套接字文件描述符
|
|
|
|
|
+ struct msghdr *msg; // 消息头指针
|
|
|
|
|
+ unsigned int flags; // 发送标志
|
|
|
|
|
+ u32 pid; // 进程PID
|
|
|
|
|
+ u32 tid; // 线程TID
|
|
|
|
|
+ char comm[TASK_COMM_LEN]; // 进程名
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
SEC("tracepoint/syscalls/sys_enter_brk")
|
|
SEC("tracepoint/syscalls/sys_enter_brk")
|
|
|
int handle_sys_enter_brk(struct trace_event_raw_sys_enter *ctx)
|
|
int handle_sys_enter_brk(struct trace_event_raw_sys_enter *ctx)
|
|
|
{
|
|
{
|