diff options
author | Alan Maguire <alan.maguire@oracle.com> | 2021-07-16 23:46:55 +0100 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-07-16 17:24:55 -0700 |
commit | 8d44c3578b48d5f605eddcfd6a644e3944455a6b (patch) | |
tree | ffbd29e58a926dec56fb62ca483932521f15f2dc /.cocciconfig | |
parent | 068dfc655b666b54e08fc3d7108b309d7f906d34 (diff) | |
download | linux-8d44c3578b48d5f605eddcfd6a644e3944455a6b.tar.gz |
libbpf: Clarify/fix unaligned data issues for btf typed dump
If data is packed, data structures can store it outside of usual
boundaries. For example a 4-byte int can be stored on a unaligned
boundary in a case like this:
struct s {
char f1;
int f2;
} __attribute((packed));
...the int is stored at an offset of one byte. Some platforms have
problems dereferencing data that is not aligned with its size, and
code exists to handle most cases of this for BTF typed data display.
However pointer display was missed, and a simple function to test if
"ptr_is_aligned(data, data_sz)" would help clarify this code.
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/1626475617-25984-2-git-send-email-alan.maguire@oracle.com
Diffstat (limited to '.cocciconfig')
0 files changed, 0 insertions, 0 deletions