summaryrefslogtreecommitdiff
path: root/include/linux/filter.h
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2022-02-04 21:57:36 +0300
committerAlexei Starovoitov <ast@kernel.org>2022-02-08 05:13:01 +0300
commited2d9e1a26cca963ff5ed3b76326d70f7d8201a9 (patch)
tree573daed017dc2c0fdd4736cd52d93d0eb1b64d68 /include/linux/filter.h
parent3486bedd99196ecdfe99c0ab5b67ad3c47e8a8fa (diff)
downloadlinux-ed2d9e1a26cca963ff5ed3b76326d70f7d8201a9.tar.xz
bpf: Use size instead of pages in bpf_binary_header
This is necessary to charge sub page memory for the BPF program. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20220204185742.271030-4-song@kernel.org
Diffstat (limited to 'include/linux/filter.h')
-rw-r--r--include/linux/filter.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h
index d23e999dc032..5855eb474c62 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -548,7 +548,7 @@ struct sock_fprog_kern {
#define BPF_IMAGE_ALIGNMENT 8
struct bpf_binary_header {
- u32 pages;
+ u32 size;
u8 image[] __aligned(BPF_IMAGE_ALIGNMENT);
};
@@ -886,8 +886,8 @@ static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr)
{
set_vm_flush_reset_perms(hdr);
- set_memory_ro((unsigned long)hdr, hdr->pages);
- set_memory_x((unsigned long)hdr, hdr->pages);
+ set_memory_ro((unsigned long)hdr, hdr->size >> PAGE_SHIFT);
+ set_memory_x((unsigned long)hdr, hdr->size >> PAGE_SHIFT);
}
static inline struct bpf_binary_header *