|
|
@ -161,7 +161,7 @@ pub struct Function {
|
|
|
|
/// - `uprobe.s+` or `uretprobe.s+`
|
|
|
|
/// - `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+` or `lsm.s+`
|
|
|
|
/// - `lsm_cgroup+`
|
|
|
|
/// - `lwt_in`, `lwt_out`, `lwt_seg6local`, `lwt_xmit`
|
|
|
|
/// - `lwt_in`, `lwt_out`, `lwt_seg6local`, `lwt_xmit`
|
|
|
|
/// - `raw_tp.w+`, `raw_tracepoint.w+`
|
|
|
|
/// - `raw_tp.w+`, `raw_tracepoint.w+`
|
|
|
|
/// - `action`
|
|
|
|
/// - `action`
|
|
|
@ -196,7 +196,7 @@ pub enum ProgramSection {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Xdp {
|
|
|
|
Xdp {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
|
frags_supported: bool,
|
|
|
|
frags: bool,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SkMsg {
|
|
|
|
SkMsg {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
@ -244,6 +244,7 @@ pub enum ProgramSection {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Lsm {
|
|
|
|
Lsm {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
|
|
|
|
|
sleepable: bool,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
BtfTracePoint {
|
|
|
|
BtfTracePoint {
|
|
|
|
name: String,
|
|
|
|
name: String,
|
|
|
@ -294,7 +295,7 @@ impl ProgramSection {
|
|
|
|
ProgramSection::LircMode2 { name } => name,
|
|
|
|
ProgramSection::LircMode2 { name } => name,
|
|
|
|
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,
|
|
|
@ -326,14 +327,8 @@ impl FromStr for ProgramSection {
|
|
|
|
"kretprobe" => KRetProbe { name },
|
|
|
|
"kretprobe" => KRetProbe { name },
|
|
|
|
"uprobe" => UProbe { name },
|
|
|
|
"uprobe" => UProbe { name },
|
|
|
|
"uretprobe" => URetProbe { name },
|
|
|
|
"uretprobe" => URetProbe { name },
|
|
|
|
"xdp" => Xdp {
|
|
|
|
"xdp" => Xdp { name, frags: false },
|
|
|
|
name,
|
|
|
|
"xdp.frags" => Xdp { name, frags: true },
|
|
|
|
frags_supported: false,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"xdp.frags" => Xdp {
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
frags_supported: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"tp_btf" => BtfTracePoint { name },
|
|
|
|
"tp_btf" => BtfTracePoint { name },
|
|
|
|
_ if kind.starts_with("tracepoint") || kind.starts_with("tp") => {
|
|
|
|
_ if kind.starts_with("tracepoint") || kind.starts_with("tp") => {
|
|
|
|
// tracepoint sections are named `tracepoint/category/event_name`,
|
|
|
|
// tracepoint sections are named `tracepoint/category/event_name`,
|
|
|
@ -485,7 +480,14 @@ impl FromStr for ProgramSection {
|
|
|
|
"lirc_mode2" => LircMode2 { name },
|
|
|
|
"lirc_mode2" => LircMode2 { name },
|
|
|
|
"perf_event" => PerfEvent { name },
|
|
|
|
"perf_event" => PerfEvent { name },
|
|
|
|
"raw_tp" | "raw_tracepoint" => RawTracePoint { name },
|
|
|
|
"raw_tp" | "raw_tracepoint" => RawTracePoint { name },
|
|
|
|
"lsm" => Lsm { name },
|
|
|
|
"lsm" => Lsm {
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: false,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"lsm.s" => Lsm {
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
"fentry" => FEntry { name },
|
|
|
|
"fentry" => FEntry { name },
|
|
|
|
"fexit" => FExit { name },
|
|
|
|
"fexit" => FExit { name },
|
|
|
|
"freplace" => Extension { name },
|
|
|
|
"freplace" => Extension { name },
|
|
|
@ -1876,7 +1878,7 @@ mod tests {
|
|
|
|
assert_matches!(
|
|
|
|
assert_matches!(
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
Some(Program {
|
|
|
|
Some(Program {
|
|
|
|
section: ProgramSection::Xdp { .. },
|
|
|
|
section: ProgramSection::Xdp { frags: false, .. },
|
|
|
|
..
|
|
|
|
..
|
|
|
|
})
|
|
|
|
})
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -1897,10 +1899,7 @@ mod tests {
|
|
|
|
assert_matches!(
|
|
|
|
assert_matches!(
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
Some(Program {
|
|
|
|
Some(Program {
|
|
|
|
section: ProgramSection::Xdp {
|
|
|
|
section: ProgramSection::Xdp { frags: true, .. },
|
|
|
|
frags_supported: true,
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
..
|
|
|
|
..
|
|
|
|
})
|
|
|
|
})
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -1958,7 +1957,34 @@ mod tests {
|
|
|
|
assert_matches!(
|
|
|
|
assert_matches!(
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
Some(Program {
|
|
|
|
Some(Program {
|
|
|
|
section: ProgramSection::Lsm { .. },
|
|
|
|
section: ProgramSection::Lsm {
|
|
|
|
|
|
|
|
sleepable: false,
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn test_parse_section_lsm_sleepable() {
|
|
|
|
|
|
|
|
let mut obj = fake_obj();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.parse_section(fake_section(
|
|
|
|
|
|
|
|
BpfSectionKind::Program,
|
|
|
|
|
|
|
|
"lsm.s/foo",
|
|
|
|
|
|
|
|
bytes_of(&fake_ins())
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_matches!(
|
|
|
|
|
|
|
|
obj.programs.get("foo"),
|
|
|
|
|
|
|
|
Some(Program {
|
|
|
|
|
|
|
|
section: ProgramSection::Lsm {
|
|
|
|
|
|
|
|
sleepable: true,
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
},
|
|
|
|
..
|
|
|
|
..
|
|
|
|
})
|
|
|
|
})
|
|
|
|
);
|
|
|
|
);
|
|
|
|