[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5708a47d-5400-e75e-ccf6-96177366ea38@meta.com>
Date: Wed, 9 Nov 2022 08:45:07 -0800
From: Yonghong Song <yhs@...a.com>
To: Connor O'Brien <connoro@...gle.com>, bpf@...r.kernel.org
Cc: Martin KaFai Lau <martin.lau@...ux.dev>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next] bpf: btf: don't log ignored BTF mismatches
On 11/8/22 6:41 PM, Connor O'Brien wrote:
> Enabling CONFIG_MODULE_ALLOW_BTF_MISMATCH is an indication that BTF
> mismatches are expected and module loading should proceed
> anyway. Logging with pr_warn() on every one of these "benign"
> mismatches creates unnecessary noise when many such modules are
> loaded. Instead, limit logging to the case where a BTF mismatch
> actually prevents a module form loading.
>
> Signed-off-by: Connor O'Brien <connoro@...gle.com>
> ---
> kernel/bpf/btf.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 5579ff3a5b54..406370487413 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -7190,11 +7190,12 @@ static int btf_module_notify(struct notifier_block *nb, unsigned long op,
> }
> btf = btf_parse_module(mod->name, mod->btf_data, mod->btf_data_size);
> if (IS_ERR(btf)) {
> - pr_warn("failed to validate module [%s] BTF: %ld\n",
> - mod->name, PTR_ERR(btf));
I think such warning still useful even with
CONFIG_MODULE_ALLOW_BTF_MISMATCH.
Can we use pr_warn_ratelimited instead of pr_warn in the above to
avoid excessive warnings?
> kfree(btf_mod);
> - if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH))
> + if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) {
> + pr_warn("failed to validate module [%s] BTF: %ld\n",
> + mod->name, PTR_ERR(btf));
> err = PTR_ERR(btf);
> + }
> goto out;
> }
> err = btf_alloc_id(btf);
Powered by blists - more mailing lists