我想要的是:
向 execsnoop bcc 工具添加网络命名空间选项以仅跟踪具有指定网络命名空间的日志,就像我们在许多其他 bcc 工具中具有过滤 PID 选项一样。例如: execsnoop -N "ns_id"
我正在使用 linux 内核结构来检索命名空间 id net = task->nsproxy->net_ns;
,并且需要将检索到的 ns 分配给data.netns
u32 int。
我在做什么:
int syscall__execve(struct pt_regs *ctx,
const char __user *filename,
const char __user *const __user *__argv,
const char __user *const __user *__envp)
{
// create data here and pass to submit_arg to save stack space (#555)
//int ret = PT_REGS_RC(ctx);
struct data_t data = {};
struct task_struct *task;
struct nsproxy *nsproxy;
struct net *net;
//struct mnt_namespace *mnt_ns;
data.pid = bpf_get_current_pid_tgid() >> 32;
u32 net_ns_inum = 0;
//net = (struct net *)get_net_ns_by_pid(data.pid); //
//net_ns_inum = (uintptr_t)net;
task = (struct task_struct *)bpf_get_current_task();
// Some kernels, like Ubuntu 4.13.0-generic, return 0
// as the real_parent->tgid.
// We use the get_ppid function as a fallback in those cases. (#1883)
data.ppid = task->real_parent->tgid;
net = task->nsproxy->net_ns;
FILTER_NETNS
data.netns = (uintptr_t)net; //here have to perform casting
我已添加#include </usr/include/stdint.h>
,但文件中存在警告:include <bits/libc-header-start.h>
stdint.h
In file included from /virtual/main.c:8:
/usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found
#include <bits/libc-header-start.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
如果我解决了这个错误,它会继续生成其他丢失的头文件错误。