Message ID | 20210618061404.818569-1-Tony.Ambardar@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 61e8aeda9398925f8c6fc290585bdd9727d154c4 |
Delegated to: | BPF |
Headers | show |
Series | [bpf,v2] bpf: fix libelf endian handling in resolv_btfids | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 7 maintainers not CCed: sdf@google.com jackmanb@google.com jetswayss@gmail.com kpsingh@kernel.org kafai@fb.com john.fastabend@gmail.com songliubraving@fb.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: From:/Signed-off-by: email address mismatch: 'From: Tony Ambardar <tony.ambardar@gmail.com>' != 'Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>' |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
Hello: This patch was applied to bpf/bpf.git (refs/heads/master): On Thu, 17 Jun 2021 23:14:04 -0700 you wrote: > The vmlinux ".BTF_ids" ELF section is declared in btf_ids.h to hold a list > of zero-filled BTF IDs, which is then patched at link-time with correct > values by resolv_btfids. The section is flagged as "allocable" to preclude > compression, but notably the section contents (BTF IDs) are untyped. > > When patching the BTF IDs, resolve_btfids writes in host-native endianness > and relies on libelf for any required translation on reading and updating > vmlinux. However, since the type of the .BTF_ids section content defaults > to ELF_T_BYTE (i.e. unsigned char), no translation occurs. This results in > incorrect patched values when cross-compiling to non-native endianness, > and can manifest as kernel Oops and test failures which are difficult to > troubleshoot [1]. > > [...] Here is the summary with links: - [bpf,v2] bpf: fix libelf endian handling in resolv_btfids https://git.kernel.org/bpf/bpf/c/61e8aeda9398 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c index d636643ddd35..f32c059fbfb4 100644 --- a/tools/bpf/resolve_btfids/main.c +++ b/tools/bpf/resolve_btfids/main.c @@ -649,6 +649,9 @@ static int symbols_patch(struct object *obj) if (sets_patch(obj)) return -1; + /* Set type to ensure endian translation occurs. */ + obj->efile.idlist->d_type = ELF_T_WORD; + elf_flagdata(obj->efile.idlist, ELF_C_SET, ELF_F_DIRTY); err = elf_update(obj->efile.elf, ELF_C_WRITE);