In a bpf_object, the datasec maps like .data, .bss, .rodata cannot be resized with bpf_map__set_value_size() like normal maps can. This patch series offers a way to allow the resizing of datasec maps. The thought behind this is to allow for use cases where a given datasec needs to scale to for example the number of CPU's present. A bpf program can have a global array in a custom data section with an initial length and before loading the bpf program, the array length could be extended to match the CPU count. The selftests included in this series perform this scaling to an arbitrary value to demonstrate how it can work. JP Kobryn (2): add capability for resizing datasec maps selftests for resizing datasec maps tools/lib/bpf/libbpf.c | 138 +++++++++++++ .../bpf/prog_tests/global_map_resize.c | 187 ++++++++++++++++++ .../bpf/progs/test_global_map_resize.c | 33 ++++ 3 files changed, 358 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/global_map_resize.c create mode 100644 tools/testing/selftests/bpf/progs/test_global_map_resize.c -- 2.40.0