+1
−0
+8
−0
+32
−1
+3
−0
Loading
mainline inclusion from mainline-v6.12-rc1 commit 5d99e198be279045e6ecefe220f5c52f8ce9bfd5 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAYPJF CVE: CVE-2024-47703 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5d99e198be279045e6ecefe220f5c52f8ce9bfd5 -------------------------------- A bpf prog returning a positive number attached to file_alloc_security hook makes kernel panic. This happens because file system can not filter out the positive number returned by the LSM prog using IS_ERR, and misinterprets this positive number as a file pointer. Given that hook file_alloc_security never returned positive number before the introduction of BPF LSM, and other BPF LSM hooks may encounter similar issues, this patch adds LSM return value check in verifier, to ensure no unexpected value is returned. Fixes: 520b7aa0 ("bpf: lsm: Initialize the BPF LSM hooks") Reported-by:Xin Liu <liuxin350@huawei.com> Signed-off-by:
Xu Kuohai <xukuohai@huawei.com> Acked-by:
Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20240719110059.797546-3-xukuohai@huaweicloud.com Signed-off-by:
Alexei Starovoitov <ast@kernel.org> Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Conflicts: include/linux/bpf.h include/linux/bpf_verifier.h include/linux/bpf_lsm.h kernel/bpf/bpf_lsm.c kernel/bpf/btf.c kernel/bpf/verifier.c [This is because we did not backport 5f99f312bd3b, 61df7b828204, 8fa4ecd49b81, c871d0e00f0e and 69fd337a] Signed-off-by:
Tengda Wu <wutengda2@huawei.com>