From: Daniel Borkmann <dan...@iogearbox.net>

commit 47cc0ed574abcbbde0cf143ddb21a0baed1aa2df upstream.

Given bpf_probe_read{,str}() BPF helpers are now only available under
CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE, we need to add the drop-in
replacements of bpf_probe_read_{kernel,user}_str() to do_refine_retval_range()
as well to avoid hitting the same issue as in 849fa50662fbc ("bpf/verifier:
refine retval R0 state for bpf_get_stack helper").

Signed-off-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: John Fastabend <john.fastab...@gmail.com>
Acked-by: Yonghong Song <y...@fb.com>
Link: https://lore.kernel.org/bpf/20200515101118.6508-3-dan...@iogearbox.net
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

---
 kernel/bpf/verifier.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -4113,7 +4113,9 @@ static int do_refine_retval_range(struct
 
        if (ret_type != RET_INTEGER ||
            (func_id != BPF_FUNC_get_stack &&
-            func_id != BPF_FUNC_probe_read_str))
+            func_id != BPF_FUNC_probe_read_str &&
+            func_id != BPF_FUNC_probe_read_kernel_str &&
+            func_id != BPF_FUNC_probe_read_user_str))
                return 0;
 
        /* Error case where ret is in interval [S32MIN, -1]. */


Reply via email to