summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSong Liu <song@kernel.org>2022-02-04 10:57:39 -0800
committerAlexei Starovoitov <ast@kernel.org>2022-02-07 18:13:01 -0800
commitebc1415d9b4f043cef5a1fb002ec316e32167e7a (patch)
treebfa0fd9b389bc5a2718a5fafeae0ba390d74ea03 /kernel
parent0e06b40371682b6b70ed0302a7baec0698ada95c (diff)
bpf: Introduce bpf_arch_text_copy
This will be used to copy JITed text to RO protected module memory. On x86, bpf_arch_text_copy is implemented with text_poke_copy. bpf_arch_text_copy returns pointer to dst on success, and ERR_PTR(errno) on errors. Signed-off-by: Song Liu <song@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20220204185742.271030-7-song@kernel.org
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index e3fe53df0a71..a5ec480f9862 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -2440,6 +2440,11 @@ int __weak bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t,
return -ENOTSUPP;
}
+void * __weak bpf_arch_text_copy(void *dst, void *src, size_t len)
+{
+ return ERR_PTR(-ENOTSUPP);
+}
+
DEFINE_STATIC_KEY_FALSE(bpf_stats_enabled_key);
EXPORT_SYMBOL(bpf_stats_enabled_key);