BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: btf: don't log ignored BTF mismatches
@ 2022-11-09  2:41 Connor O'Brien
  2022-11-09 16:45 ` Yonghong Song
  0 siblings, 1 reply; 7+ messages in thread
From: Connor O'Brien @ 2022-11-09  2:41 UTC (permalink / raw)
  To: bpf
  Cc: Martin KaFai Lau, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, linux-kernel,
	Connor O'Brien

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@google.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));
 			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);
-- 
2.38.1.431.g37b22c650d-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-09  1:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-09  2:41 [PATCH bpf-next] bpf: btf: don't log ignored BTF mismatches Connor O'Brien
2022-11-09 16:45 ` Yonghong Song
2022-12-08  2:19   ` Connor O'Brien
2022-12-08 18:01     ` Yonghong Song
2022-12-09  0:03       ` Andrii Nakryiko
2022-12-09  0:58         ` Connor O'Brien
2022-12-09  1:01           ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox