summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bpf_verifier.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index bc2af02547fe..ae0274a4bf35 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -1308,6 +1308,16 @@ static inline u32 type_flag(u32 type)
return type & ~BPF_BASE_TYPE_MASK;
}
+static inline bool bpf_may_fault_on_deref(enum bpf_reg_type type)
+{
+ /*
+ * The pointer types which must not be dereferenced without fault
+ * protection, that is, the ones bpf_convert_ctx_accesses() has to
+ * turn a BPF_LDX into a BPF_PROBE_MEM one for.
+ */
+ return type == PTR_TO_BTF_ID || (type_flag(type) & PTR_UNTRUSTED);
+}
+
static inline bool bpf_prog_has_arena_ctx_arg(const struct bpf_prog *prog)
{
int i;