diff options
| author | Martin KaFai Lau <martin.lau@kernel.org> | 2024-03-07 14:58:49 -0800 |
|---|---|---|
| committer | Martin KaFai Lau <martin.lau@kernel.org> | 2024-03-07 15:01:57 -0800 |
| commit | c7d4274e90a1e7aa43d11d2a16066cbbe610070e (patch) | |
| tree | afd0ca6870d3abf41b811e706c3f788057183e9b /kernel/bpf/core.c | |
| parent | e63985ecd22681c7f5975f2e8637187a326b6791 (diff) | |
| parent | fe5064158c561b807af5708c868f6c7cb5144e01 (diff) | |
Merge branch 'bpf: arena prerequisites'
Alexei Starovoitov says:
====================
These are bpf_arena prerequisite patches.
Useful on its own.
Alexei Starovoitov (5):
bpf: Allow kfuncs return 'void *'
bpf: Recognize '__map' suffix in kfunc arguments
bpf: Plumb get_unmapped_area() callback into bpf_map_ops
libbpf: Allow specifying 64-bit integers in map BTF.
bpf: Tell bpf programs kernel's PAGE_SIZE
====================
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'kernel/bpf/core.c')
| -rw-r--r-- | kernel/bpf/core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 9ee4536d0a09..134b7979f537 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -88,13 +88,18 @@ void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, int k, uns return NULL; } +/* tell bpf programs that include vmlinux.h kernel's PAGE_SIZE */ +enum page_size_enum { + __PAGE_SIZE = PAGE_SIZE +}; + struct bpf_prog *bpf_prog_alloc_no_stats(unsigned int size, gfp_t gfp_extra_flags) { gfp_t gfp_flags = bpf_memcg_flags(GFP_KERNEL | __GFP_ZERO | gfp_extra_flags); struct bpf_prog_aux *aux; struct bpf_prog *fp; - size = round_up(size, PAGE_SIZE); + size = round_up(size, __PAGE_SIZE); fp = __vmalloc(size, gfp_flags); if (fp == NULL) return NULL; |
