added memmove, memcmp to the list of function changed to BTF_FUNC_STATIC

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

@ -544,7 +544,12 @@ impl Btf {
let typedef_type =
BtfType::Typedef(Typedef::new(ty.name_offset, ty.btf_type));
types.types[i] = typedef_type;
} else if !features.btf_func_global || name == "memset" || name == "memcpy" {
} else if !features.btf_func_global
|| name == "memset"
|| name == "memcpy"
|| name == "memmove"
|| name == "memcmp"
{
// Sanitize BTF_FUNC_GLOBAL and memset, memcpy
let mut fixed_ty = ty.clone();
if ty.linkage() == FuncLinkage::Global {
@ -1359,7 +1364,7 @@ mod tests {
}
#[test]
fn test_sanitize_memset_memcpy() {
fn test_sanitize_mem_builtins() {
let mut btf = Btf::new();
let name_offset = btf.add_string("int".to_string());
let int_type_id = btf.add_type(BtfType::Int(Int::new(
@ -1382,7 +1387,9 @@ mod tests {
let func_proto_type_id =
btf.add_type(BtfType::FuncProto(FuncProto::new(params, int_type_id)));
["memset", "memcpy"].iter().for_each(|fname| {
["memset", "memcpy", "memcmp", "memmove"]
.iter()
.for_each(|fname| {
let func_name_offset = btf.add_string(fname.to_string());
let func_type_id = btf.add_type(BtfType::Func(Func::new(
func_name_offset,

Loading…
Cancel
Save