- comment changed to be more precise

- adapted test to be more readable

Signed-off-by: Quentin JEROME <qjerome@users.noreply.github.com>
pull/583/head
Quentin JEROME 1 year ago
parent 72c1572178
commit 1464bdc1d4

@ -550,7 +550,11 @@ impl Btf {
|| name == "memmove"
|| name == "memcmp"
{
// Sanitize BTF_FUNC_GLOBAL and memset, memcpy
// Sanitize BTF_FUNC_GLOBAL when not supported and ensure that
// memory builtins are marked as static. Globals are type checked
// and verified separately from their callers, while instead we
// want tracking info (eg bound checks) to be propagated to the
// memory builtins.
let mut fixed_ty = ty.clone();
if ty.linkage() == FuncLinkage::Global {
if !features.btf_func_global {
@ -1387,9 +1391,8 @@ mod tests {
let func_proto_type_id =
btf.add_type(BtfType::FuncProto(FuncProto::new(params, int_type_id)));
["memset", "memcpy", "memcmp", "memmove"]
.iter()
.for_each(|fname| {
let builtins = ["memset", "memcpy", "memcmp", "memmove"];
for fname in builtins {
let func_name_offset = btf.add_string(fname.to_string());
let func_type_id = btf.add_type(BtfType::Func(Func::new(
func_name_offset,
@ -1415,7 +1418,7 @@ mod tests {
// Ensure we can convert to bytes and back again
let raw = btf.to_bytes();
Btf::parse(&raw, Endianness::default()).unwrap();
});
}
}
#[test]

Loading…
Cancel
Save