|
|
@ -222,7 +222,6 @@ pub struct Function {
|
|
|
|
/// Currently, the following section names are not supported yet:
|
|
|
|
/// Currently, the following section names are not supported yet:
|
|
|
|
/// - `flow_dissector`: `BPF_PROG_TYPE_FLOW_DISSECTOR`
|
|
|
|
/// - `flow_dissector`: `BPF_PROG_TYPE_FLOW_DISSECTOR`
|
|
|
|
/// - `ksyscall+` or `kretsyscall+`
|
|
|
|
/// - `ksyscall+` or `kretsyscall+`
|
|
|
|
/// - `uprobe.s+` or `uretprobe.s+`
|
|
|
|
|
|
|
|
/// - `usdt+`
|
|
|
|
/// - `usdt+`
|
|
|
|
/// - `kprobe.multi+` or `kretprobe.multi+`: `BPF_TRACE_KPROBE_MULTI`
|
|
|
|
/// - `kprobe.multi+` or `kretprobe.multi+`: `BPF_TRACE_KPROBE_MULTI`
|
|
|
|
/// - `lsm_cgroup+`
|
|
|
|
/// - `lsm_cgroup+`
|
|
|
@ -233,7 +232,6 @@ pub struct Function {
|
|
|
|
/// - `syscall`
|
|
|
|
/// - `syscall`
|
|
|
|
/// - `struct_ops+`
|
|
|
|
/// - `struct_ops+`
|
|
|
|
/// - `fmod_ret+`, `fmod_ret.s+`
|
|
|
|
/// - `fmod_ret+`, `fmod_ret.s+`
|
|
|
|
/// - `fentry.s+`, `fexit.s+`
|
|
|
|
|
|
|
|
/// - `iter+`, `iter.s+`
|
|
|
|
/// - `iter+`, `iter.s+`
|
|
|
|
/// - `xdp.frags/cpumap`, `xdp/cpumap`
|
|
|
|
/// - `xdp.frags/cpumap`, `xdp/cpumap`
|
|
|
|
/// - `xdp.frags/devmap`, `xdp/devmap`
|
|
|
|
/// - `xdp.frags/devmap`, `xdp/devmap`
|
|
|
@ -248,9 +246,11 @@ pub enum ProgramSection {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
UProbe {
|
|
|
|
UProbe {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
|
|
|
|
|
sleepable: bool,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
URetProbe {
|
|
|
|
URetProbe {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
|
|
|
|
|
sleepable: bool,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
TracePoint {
|
|
|
|
TracePoint {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
@ -315,9 +315,11 @@ pub enum ProgramSection {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
FEntry {
|
|
|
|
FEntry {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
|
|
|
|
|
sleepable: bool,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
FExit {
|
|
|
|
FExit {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
|
|
|
|
|
sleepable: bool,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Extension {
|
|
|
|
Extension {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
@ -340,8 +342,8 @@ impl ProgramSection {
|
|
|
|
match self {
|
|
|
|
match self {
|
|
|
|
ProgramSection::KRetProbe { name } => name,
|
|
|
|
ProgramSection::KRetProbe { name } => name,
|
|
|
|
ProgramSection::KProbe { name } => name,
|
|
|
|
ProgramSection::KProbe { name } => name,
|
|
|
|
ProgramSection::UProbe { name } => name,
|
|
|
|
ProgramSection::UProbe { name, .. } => name,
|
|
|
|
ProgramSection::URetProbe { name } => name,
|
|
|
|
ProgramSection::URetProbe { name, .. } => name,
|
|
|
|
ProgramSection::TracePoint { name } => name,
|
|
|
|
ProgramSection::TracePoint { name } => name,
|
|
|
|
ProgramSection::SocketFilter { name } => name,
|
|
|
|
ProgramSection::SocketFilter { name } => name,
|
|
|
|
ProgramSection::Xdp { name, .. } => name,
|
|
|
|
ProgramSection::Xdp { name, .. } => name,
|
|
|
@ -360,9 +362,9 @@ impl ProgramSection {
|
|
|
|
ProgramSection::PerfEvent { name } => name,
|
|
|
|
ProgramSection::PerfEvent { name } => name,
|
|
|
|
ProgramSection::RawTracePoint { name } => name,
|
|
|
|
ProgramSection::RawTracePoint { name } => name,
|
|
|
|
ProgramSection::Lsm { name, .. } => name,
|
|
|
|
ProgramSection::Lsm { name, .. } => name,
|
|
|
|
ProgramSection::BtfTracePoint { name } => name,
|
|
|
|
ProgramSection::BtfTracePoint { name, .. } => name,
|
|
|
|
ProgramSection::FEntry { name } => name,
|
|
|
|
ProgramSection::FEntry { name, .. } => name,
|
|
|
|
ProgramSection::FExit { name } => name,
|
|
|
|
ProgramSection::FExit { name, .. } => name,
|
|
|
|
ProgramSection::Extension { name } => name,
|
|
|
|
ProgramSection::Extension { name } => name,
|
|
|
|
ProgramSection::SkLookup { name } => name,
|
|
|
|
ProgramSection::SkLookup { name } => name,
|
|
|
|
ProgramSection::CgroupSock { name, .. } => name,
|
|
|
|
ProgramSection::CgroupSock { name, .. } => name,
|
|
|
@ -388,8 +390,22 @@ impl FromStr for ProgramSection {
|
|
|
|
Ok(match kind {
|
|
|
|
Ok(match kind {
|
|
|
|
"kprobe" => KProbe { name },
|
|
|
|
"kprobe" => KProbe { name },
|
|
|
|
"kretprobe" => KRetProbe { name },
|
|
|
|
"kretprobe" => KRetProbe { name },
|
|
|
|
"uprobe" => UProbe { name },
|
|
|
|
"uprobe" => UProbe {
|
|
|
|
"uretprobe" => URetProbe { name },
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: false,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"uprobe.s" => UProbe {
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"uretprobe" => URetProbe {
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: false,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"uretprobe.s" => URetProbe {
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
"xdp" => Xdp { name, frags: false },
|
|
|
|
"xdp" => Xdp { name, frags: false },
|
|
|
|
"xdp.frags" => Xdp { name, frags: true },
|
|
|
|
"xdp.frags" => Xdp { name, frags: true },
|
|
|
|
"tp_btf" => BtfTracePoint { name },
|
|
|
|
"tp_btf" => BtfTracePoint { name },
|
|
|
@ -551,8 +567,22 @@ impl FromStr for ProgramSection {
|
|
|
|
name,
|
|
|
|
name,
|
|
|
|
sleepable: true,
|
|
|
|
sleepable: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"fentry" => FEntry { name },
|
|
|
|
"fentry" => FEntry {
|
|
|
|
"fexit" => FExit { name },
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: false,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"fentry.s" => FEntry {
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"fexit" => FExit {
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: false,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"fexit.s" => FExit {
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
"freplace" => Extension { name },
|
|
|
|
"freplace" => Extension { name },
|
|
|
|
"sk_lookup" => SkLookup { name },
|
|
|
|
"sk_lookup" => SkLookup { name },
|
|
|
|
_ => {
|
|
|
|
_ => {
|
|
|
@ -2018,6 +2048,81 @@ mod tests {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn test_parse_section_uprobe_sleepable() {
|
|
|
|
|
|
|
|
let mut obj = fake_obj();
|
|
|
|
|
|
|
|
fake_sym(&mut obj, 0, 0, "foo", FAKE_INS_LEN);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.parse_section(fake_section(
|
|
|
|
|
|
|
|
BpfSectionKind::Program,
|
|
|
|
|
|
|
|
"uprobe.s/foo",
|
|
|
|
|
|
|
|
bytes_of(&fake_ins()),
|
|
|
|
|
|
|
|
None
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
|
|
|
|
Some(Program {
|
|
|
|
|
|
|
|
section: ProgramSection::UProbe {
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn test_parse_section_uretprobe() {
|
|
|
|
|
|
|
|
let mut obj = fake_obj();
|
|
|
|
|
|
|
|
fake_sym(&mut obj, 0, 0, "foo", FAKE_INS_LEN);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.parse_section(fake_section(
|
|
|
|
|
|
|
|
BpfSectionKind::Program,
|
|
|
|
|
|
|
|
"uretprobe/foo",
|
|
|
|
|
|
|
|
bytes_of(&fake_ins()),
|
|
|
|
|
|
|
|
None
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
|
|
|
|
Some(Program {
|
|
|
|
|
|
|
|
section: ProgramSection::URetProbe { .. },
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn test_parse_section_uretprobe_sleepable() {
|
|
|
|
|
|
|
|
let mut obj = fake_obj();
|
|
|
|
|
|
|
|
fake_sym(&mut obj, 0, 0, "foo", FAKE_INS_LEN);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.parse_section(fake_section(
|
|
|
|
|
|
|
|
BpfSectionKind::Program,
|
|
|
|
|
|
|
|
"uretprobe.s/foo",
|
|
|
|
|
|
|
|
bytes_of(&fake_ins()),
|
|
|
|
|
|
|
|
None
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
|
|
|
|
Some(Program {
|
|
|
|
|
|
|
|
section: ProgramSection::URetProbe {
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_parse_section_trace_point() {
|
|
|
|
fn test_parse_section_trace_point() {
|
|
|
|
let mut obj = fake_obj();
|
|
|
|
let mut obj = fake_obj();
|
|
|
@ -2313,6 +2418,32 @@ mod tests {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn test_parse_section_fentry_sleepable() {
|
|
|
|
|
|
|
|
let mut obj = fake_obj();
|
|
|
|
|
|
|
|
fake_sym(&mut obj, 0, 0, "foo", FAKE_INS_LEN);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.parse_section(fake_section(
|
|
|
|
|
|
|
|
BpfSectionKind::Program,
|
|
|
|
|
|
|
|
"fentry.s/foo",
|
|
|
|
|
|
|
|
bytes_of(&fake_ins()),
|
|
|
|
|
|
|
|
None
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
|
|
|
|
Some(Program {
|
|
|
|
|
|
|
|
section: ProgramSection::FEntry {
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_parse_section_fexit() {
|
|
|
|
fn test_parse_section_fexit() {
|
|
|
|
let mut obj = fake_obj();
|
|
|
|
let mut obj = fake_obj();
|
|
|
@ -2336,6 +2467,32 @@ mod tests {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn test_parse_section_fexit_sleepable() {
|
|
|
|
|
|
|
|
let mut obj = fake_obj();
|
|
|
|
|
|
|
|
fake_sym(&mut obj, 0, 0, "foo", FAKE_INS_LEN);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.parse_section(fake_section(
|
|
|
|
|
|
|
|
BpfSectionKind::Program,
|
|
|
|
|
|
|
|
"fexit.s/foo",
|
|
|
|
|
|
|
|
bytes_of(&fake_ins()),
|
|
|
|
|
|
|
|
None
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
|
|
|
|
Some(Program {
|
|
|
|
|
|
|
|
section: ProgramSection::FExit {
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_parse_section_cgroup_skb_ingress_unnamed() {
|
|
|
|
fn test_parse_section_cgroup_skb_ingress_unnamed() {
|
|
|
|
let mut obj = fake_obj();
|
|
|
|
let mut obj = fake_obj();
|
|
|
|