diff options
author | Jianlin Lv <[email protected]> | 2020-08-10 23:39:40 +0800 |
---|---|---|
committer | Daniel Borkmann <[email protected]> | 2020-08-11 15:36:45 +0200 |
commit | 0390c429dbed4068bd2cd8dded937d9a5ec24cd2 (patch) | |
tree | 467e1b67bae48778d9b916e6e42e0a7f4d3b62cc /scripts/gdb/linux/modules.py | |
parent | 63fe3fd393dc4e7ea3948e79947362ffbb0fd616 (diff) |
selftests/bpf: Fix segmentation fault in test_progs
test_progs reports the segmentation fault as below:
$ sudo ./test_progs -t mmap --verbose
test_mmap:PASS:skel_open_and_load 0 nsec
[...]
test_mmap:PASS:adv_mmap1 0 nsec
test_mmap:PASS:adv_mmap2 0 nsec
test_mmap:PASS:adv_mmap3 0 nsec
test_mmap:PASS:adv_mmap4 0 nsec
Segmentation fault
This issue was triggered because mmap() and munmap() used inconsistent
length parameters; mmap() creates a new mapping of 3 * page_size, but the
length parameter set in the subsequent re-map and munmap() functions is
4 * page_size; this leads to the destruction of the process space.
To fix this issue, first create 4 pages of anonymous mapping, then do all
the mmap() with MAP_FIXED.
Another issue is that when unmap the second page fails, the length
parameter to delete tmp1 mappings should be 4 * page_size.
Signed-off-by: Jianlin Lv <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'scripts/gdb/linux/modules.py')
0 files changed, 0 insertions, 0 deletions