aya: Set BPF_F_SLEEPABLE for sleepable programs

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/711/head
Dave Tucker 2 years ago
parent 677e7bda4a
commit 71737f5576

@ -562,14 +562,28 @@ impl<'a> BpfLoader<'a> {
data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level),
kind: ProbeKind::KRetProbe, kind: ProbeKind::KRetProbe,
}), }),
ProgramSection::UProbe { .. } => Program::UProbe(UProbe { ProgramSection::UProbe { sleepable, name: _ } => {
data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), let mut data =
kind: ProbeKind::UProbe, ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level);
}), if *sleepable {
ProgramSection::URetProbe { .. } => Program::UProbe(UProbe { data.flags = BPF_F_SLEEPABLE;
data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), }
kind: ProbeKind::URetProbe, Program::UProbe(UProbe {
}), data,
kind: ProbeKind::UProbe,
})
}
ProgramSection::URetProbe { sleepable, name: _ } => {
let mut data =
ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level);
if *sleepable {
data.flags = BPF_F_SLEEPABLE;
}
Program::UProbe(UProbe {
data,
kind: ProbeKind::URetProbe,
})
}
ProgramSection::TracePoint { .. } => Program::TracePoint(TracePoint { ProgramSection::TracePoint { .. } => Program::TracePoint(TracePoint {
data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level),
}), }),
@ -649,7 +663,7 @@ impl<'a> BpfLoader<'a> {
data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level),
}) })
} }
ProgramSection::Lsm { sleepable, .. } => { ProgramSection::Lsm { sleepable, name: _ } => {
let mut data = let mut data =
ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level); ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level);
if *sleepable { if *sleepable {
@ -662,12 +676,22 @@ impl<'a> BpfLoader<'a> {
data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level),
}) })
} }
ProgramSection::FEntry { .. } => Program::FEntry(FEntry { ProgramSection::FEntry { sleepable, name: _ } => {
data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), let mut data =
}), ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level);
ProgramSection::FExit { .. } => Program::FExit(FExit { if *sleepable {
data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), data.flags = BPF_F_SLEEPABLE;
}), }
Program::FEntry(FEntry { data })
}
ProgramSection::FExit { sleepable, name: _ } => {
let mut data =
ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level);
if *sleepable {
data.flags = BPF_F_SLEEPABLE;
}
Program::FExit(FExit { data })
}
ProgramSection::Extension { .. } => Program::Extension(Extension { ProgramSection::Extension { .. } => Program::Extension(Extension {
data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level),
}), }),

Loading…
Cancel
Save