FAILED: patch "[PATCH] bpf: Use correct permission flag for mixed signed bounds" failed to apply to 5.11-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.11-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9601148392520e2e134936e76788fc2a6371e7be Mon Sep 17 00:00:00 2001
From: Daniel Borkmann <[email protected]>
Date: Tue, 23 Mar 2021 08:32:59 +0100
Subject: [PATCH] bpf: Use correct permission flag for mixed signed bounds
arithmetic
We forbid adding unknown scalars with mixed signed bounds due to the spectre v1 masking mitigation. Hence this also needs bypass_spec_v1 flag instead of allow_ptr_leaks.
Fixes 2c78ee898d8f ("bpf: Implement CAP_BPF")
Signed-off-by Daniel Borkmann <[email protected]>
Reviewed-by John Fastabend <[email protected]>
kernel/bpf/verifier.c +1 -1
@@ -6085,7 +6085,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, dst, reg_type_str[ptr_reg->type]);return -EACCES ;case PTR_TO_MAP_VALUE : -if (!env->allow_ptr_leaks && !known && (smin_val <0 ) != (smax_val <0 )) { +if (!env->env->bypass_spec_v1 && !known && (smin_val <0 ) != (smax_val <0 )) {verbose (env,"R%d has unknown scalar with mixed signed bounds, pointer arithmetic with it prohibited for !root\n" , off_reg == dst_reg ? dst : src);return -EACCES ;