Re: [PATCH bpf-next v7 06/11] libbpf: Add support for global percpu data

From: Leon Hwang

Date: Wed Jun 24 2026 - 22:45:44 EST


On 25/6/26 00:45, Andrii Nakryiko wrote:
> On Tue, Jun 23, 2026 at 9:14 PM Leon Hwang <leon.hwang@xxxxxxxxx> wrote:
>>
>> This was suggested by you in v3:
>> https://lore.kernel.org/bpf/CAEf4BzY9KeVeo2+6Ht1v3rL6UdwNxABZCSK1OZ_sD8qhpYZaeQ@xxxxxxxxxxxxxx/
>>
>
> ah, the dangling pointer in skeleton that needs clearing, I forgot
> already :) ok, I don't mind mprotect(), it just was a new case that no
> other map followed, so I was curious if we can avoid deviations. But
> that brings back the KCONFIG map question, can you please check what's
> happening for it? Maybe we should do the same mprotect instead of
> dangling pointer (if we have dangling pointer, of course).
>

Looking at prog_tests/skeleton.c, skel->kconfig is NULL before loading,
then becomes a read-only mmaped pointer after loading.

So, skel->kconfig is not a dangling pointer after loading.

It looks good to mprotect() skel->percpu.

Thanks,
Leon

>>>> } else if (map->mmaped) {
>>>> munmap(map->mmaped, mmap_sz);
>>>> map->mmaped = NULL;
>>>> @@ -10806,16 +10847,19 @@ int bpf_map__fd(const struct bpf_map *map)
>>>>