提交 dec22753 编写于 作者: A Alexei Starovoitov 提交者: Zheng Zengkai

bpf: Adjust BTF log size limit.

stable inclusion
from stable-v5.10.94
commit 218d952160f71bfc85cbad4a4834e0de306e4b77
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=218d952160f71bfc85cbad4a4834e0de306e4b77

--------------------------------

[ Upstream commit c5a2d43e ]

Make BTF log size limit to be the same as the verifier log size limit.
Otherwise tools that progressively increase log size and use the same log
for BTF loading and program loading will be hitting hard to debug EINVAL.
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211201181040.23337-7-alexei.starovoitov@gmail.comSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 0492de98
...@@ -4135,7 +4135,7 @@ static struct btf *btf_parse(void __user *btf_data, u32 btf_data_size, ...@@ -4135,7 +4135,7 @@ static struct btf *btf_parse(void __user *btf_data, u32 btf_data_size,
log->len_total = log_size; log->len_total = log_size;
/* log attributes have to be sane */ /* log attributes have to be sane */
if (log->len_total < 128 || log->len_total > UINT_MAX >> 8 || if (log->len_total < 128 || log->len_total > UINT_MAX >> 2 ||
!log->level || !log->ubuf) { !log->level || !log->ubuf) {
err = -EINVAL; err = -EINVAL;
goto errout; goto errout;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册