mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
Merge branch 'inline-btf-followups'
Alan Maguire says: ==================== Inline BTF followups This series addresses lingering issues after BTF inline series landed. Patch 1 fixes validation issue on loading BTF inline info. Patch 2 corrects the base address calculation for BTF inline data in LOCSEC to use the ELF section base rather than module base. Patch 3 enables BTF inline info for CI config. ==================== Acked-by: Jiri Olsa <jolsa@kernel.org> Link: https://patch.msgid.link/20261012140640.2932195-1-alan.maguire@oracle.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
commit
763187dbbf
|
|
@ -4827,12 +4827,12 @@ static s32 btf_loc_param_check_meta(struct btf_verifier_env *env,
|
|||
case BTF_LOC_PARAM_CONST | BTF_LOC_PARAM_SIGNED:
|
||||
case BTF_LOC_PARAM_CONST | BTF_LOC_PARAM_ADDR:
|
||||
case BTF_LOC_PARAM_CONST | BTF_LOC_PARAM_ADDR | BTF_LOC_PARAM_SIGNED:
|
||||
if (vlen > 2)
|
||||
if (vlen < 1 || vlen > 2)
|
||||
goto invalid_vlen;
|
||||
if (!size || size > sizeof(__u64))
|
||||
goto invalid_vlen;
|
||||
/* Ensure size/vlen are consistent */
|
||||
if (size > sizeof(__u32) && vlen != 2)
|
||||
goto invalid_vlen;
|
||||
if (size > sizeof(__u64))
|
||||
if (vlen != (size > sizeof(__u32) ? 2 : 1))
|
||||
goto invalid_vlen;
|
||||
break;
|
||||
case BTF_LOC_PARAM_REG:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ CONFIG_CRYPTO_ECB=y
|
|||
CONFIG_CRYPTO_AES=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
CONFIG_DEBUG_INFO_BTF=y
|
||||
CONFIG_DEBUG_INFO_BTF_INLINE=y
|
||||
CONFIG_DEBUG_INFO_DWARF4=y
|
||||
CONFIG_DMABUF_HEAPS=y
|
||||
CONFIG_DMABUF_HEAPS_SYSTEM=y
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ void test_btf_inline(void)
|
|||
return;
|
||||
}
|
||||
|
||||
base_addr = module_get_base_addr("bpf_testmod");
|
||||
/* LOCSEC offsets are relative to the ELF section base. */
|
||||
base_addr = module_get_base_addr_sec("bpf_testmod", ".text");
|
||||
if (!ASSERT_NEQ(base_addr, 0, "base_addr_nonzero"))
|
||||
return;
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ void test_btf_inline(void)
|
|||
return;
|
||||
if (!ASSERT_NEQ(caller_addr, 0, "caller_addr_nonzero"))
|
||||
return;
|
||||
if (!ASSERT_GT(caller_addr, base_addr, "caller_addr_gt_base_addr"))
|
||||
if (!ASSERT_GE(caller_addr, base_addr, "caller_addr_ge_base_addr"))
|
||||
return;
|
||||
caller_addr -= base_addr;
|
||||
|
||||
|
|
|
|||
|
|
@ -264,6 +264,25 @@ unsigned long long module_get_base_addr(const char *module)
|
|||
return base_addr;
|
||||
}
|
||||
|
||||
unsigned long long module_get_base_addr_sec(const char *module, const char *sec)
|
||||
{
|
||||
unsigned long long addr = 0;
|
||||
char *path;
|
||||
FILE *f;
|
||||
|
||||
if (asprintf(&path, "/sys/module/%s/sections/%s", module, sec) < 0)
|
||||
return 0;
|
||||
f = fopen(path, "r");
|
||||
free(path);
|
||||
if (!f)
|
||||
return 0;
|
||||
|
||||
if (fscanf(f, "%llx", &addr) != 1)
|
||||
addr = 0;
|
||||
fclose(f);
|
||||
return addr;
|
||||
}
|
||||
|
||||
#ifdef PROCMAP_QUERY
|
||||
int env_verbosity __weak = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ int load_kallsyms(void);
|
|||
struct ksym *ksym_search(long key);
|
||||
long ksym_get_addr(const char *name);
|
||||
unsigned long long module_get_base_addr(const char *module);
|
||||
unsigned long long module_get_base_addr_sec(const char *module, const char *sec);
|
||||
|
||||
struct ksyms *load_kallsyms_local(void);
|
||||
struct ksym *ksym_search_local(struct ksyms *ksyms, long key);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user