Pull bpf fixes from Eduard Zingerman: - Fix tcp_bpf_sendmsg() error path mistaking a concurrently-freed sk_psock->cork for the local temporary message and freeing it again (Chengfeng Ye) - Reject passing scalar NULL to nonnull arg of a global subprog. Previously the verifier did not account for the cases directly passing scalars to a global subprog, e.g.: 'global_func(0);' would pass even if 'global_func' argument was marked nonnull (Amery Hung) * tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf: bpf, sockmap: Fix cork use-after-free in tcp_bpf_sendmsg() selftests/bpf: Test passing scalar NULL to nonnull global subprog bpf: Reject passing scalar NULL to nonnull arg of a global subprog
Showing the changes to kernel (1 of 3 files). Show all
Unified · Split
| @@ -9189,7 +9189,8 @@ static int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog, · 9188 unmodified lines | ||
| 9189 | 9189 | return ret; |
| 9190 | 9190 | if (check_mem_reg(env, reg, argno, arg->mem_size)) |
| 9191 | 9191 | return -EINVAL; |
| 9192 | − if (!(arg->arg_type & PTR_MAYBE_NULL) && (reg->type & PTR_MAYBE_NULL)) { | |
| 9192 | + if (!(arg->arg_type & PTR_MAYBE_NULL) && | |
| 9193 | + (type_may_be_null(reg->type) || bpf_register_is_null(reg))) { | |
| 9193 | 9194 | bpf_log(log, "%s is expected to be non-NULL\n", |
| 9194 | 9195 | reg_arg_name(env, argno)); |
| 9195 | 9196 | return -EINVAL; |