mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [tip: objtool/core] objtool/klp: Add test for objects without .modinfo
       [not found] <20260916184351.2720310-26-song@kernel.org>
@ 2026-09-18 10:15 ` tip-bot2 for Puranjay Mohan
  2026-09-21  9:28 ` tip-bot2 for Puranjay Mohan
  1 sibling, 0 replies; 2+ messages in thread
From: tip-bot2 for Puranjay Mohan @ 2026-09-18 10:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Puranjay Mohan, Song Liu, Josh Poimboeuf, x86, linux-kernel

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     6e9105c21abde36acc9d48a5e037cc3ac1d78bf1
Gitweb:        https://git.kernel.org/tip/6e9105c21abde36acc9d48a5e037cc3ac1d78bf1
Author:        Puranjay Mohan <puranjay@kernel.org>
AuthorDate:    Wed, 16 Sep 2026 11:43:18 -07:00
Committer:     Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Wed, 16 Sep 2026 17:13:28 -07:00

objtool/klp: Add test for objects without .modinfo

The module name recorded in .modinfo ends up in the livepatch's klp_object,
and also decides whether a static branch key counts as belonging to vmlinux
or to a module.  An object without one cannot be diffed.

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Song Liu <song@kernel.org>
Link: https://patch.msgid.link/20260916184351.2720310-26-song@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 tools/objtool/tests/generic/fixtures/no_modinfo.c   | 11 ++++++++-
 tools/objtool/tests/generic/test-missing-modinfo.sh | 16 ++++++++++++-
 2 files changed, 27 insertions(+)
 create mode 100644 tools/objtool/tests/generic/fixtures/no_modinfo.c
 create mode 100755 tools/objtool/tests/generic/test-missing-modinfo.sh

diff --git a/tools/objtool/tests/generic/fixtures/no_modinfo.c b/tools/objtool/tests/generic/fixtures/no_modinfo.c
new file mode 100644
index 0000000..e463747
--- /dev/null
+++ b/tools/objtool/tests/generic/fixtures/no_modinfo.c
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Deliberately has no .modinfo section. */
+
+int target(int x)
+{
+#ifdef PATCHED
+	return x + 2;
+#else
+	return x + 1;
+#endif
+}
diff --git a/tools/objtool/tests/generic/test-missing-modinfo.sh b/tools/objtool/tests/generic/test-missing-modinfo.sh
new file mode 100755
index 0000000..6f242f7
--- /dev/null
+++ b/tools/objtool/tests/generic/test-missing-modinfo.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# The module name in .modinfo ends up in the livepatch's klp_object, so an
+# object without one cannot be diffed.
+
+. "$(dirname "$0")/../lib.sh"
+
+setup
+build_pair no_modinfo.c
+run_diff 255
+
+diff_log | grep -q 'modinfo' ||
+	fail "expected a complaint about .modinfo, got: $(diff_log | tail -1)"
+
+pass "object without .modinfo rejected"

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

* [tip: objtool/core] objtool/klp: Add test for objects without .modinfo
       [not found] <20260916184351.2720310-26-song@kernel.org>
  2026-09-18 10:15 ` [tip: objtool/core] objtool/klp: Add test for objects without .modinfo tip-bot2 for Puranjay Mohan
@ 2026-09-21  9:28 ` tip-bot2 for Puranjay Mohan
  1 sibling, 0 replies; 2+ messages in thread
From: tip-bot2 for Puranjay Mohan @ 2026-09-21  9:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Puranjay Mohan, Song Liu, Josh Poimboeuf, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     050a0c53a6c6009be329c7034d7a4d22ea146b12
Gitweb:        https://git.kernel.org/tip/050a0c53a6c6009be329c7034d7a4d22ea146b12
Author:        Puranjay Mohan <puranjay@kernel.org>
AuthorDate:    Wed, 16 Sep 2026 11:43:18 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Mon, 21 Sep 2026 11:05:34 +02:00

objtool/klp: Add test for objects without .modinfo

The module name recorded in .modinfo ends up in the livepatch's klp_object,
and also decides whether a static branch key counts as belonging to vmlinux
or to a module.  An object without one cannot be diffed.

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Assisted-by: Claude:claude-opus-5
Link: https://patch.msgid.link/20260916184351.2720310-26-song@kernel.org
---
 tools/objtool/tests/generic/fixtures/no_modinfo.c   | 11 ++++++++-
 tools/objtool/tests/generic/test-missing-modinfo.sh | 16 ++++++++++++-
 2 files changed, 27 insertions(+)
 create mode 100644 tools/objtool/tests/generic/fixtures/no_modinfo.c
 create mode 100755 tools/objtool/tests/generic/test-missing-modinfo.sh

diff --git a/tools/objtool/tests/generic/fixtures/no_modinfo.c b/tools/objtool/tests/generic/fixtures/no_modinfo.c
new file mode 100644
index 0000000..e463747
--- /dev/null
+++ b/tools/objtool/tests/generic/fixtures/no_modinfo.c
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Deliberately has no .modinfo section. */
+
+int target(int x)
+{
+#ifdef PATCHED
+	return x + 2;
+#else
+	return x + 1;
+#endif
+}
diff --git a/tools/objtool/tests/generic/test-missing-modinfo.sh b/tools/objtool/tests/generic/test-missing-modinfo.sh
new file mode 100755
index 0000000..6f242f7
--- /dev/null
+++ b/tools/objtool/tests/generic/test-missing-modinfo.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# The module name in .modinfo ends up in the livepatch's klp_object, so an
+# object without one cannot be diffed.
+
+. "$(dirname "$0")/../lib.sh"
+
+setup
+build_pair no_modinfo.c
+run_diff 255
+
+diff_log | grep -q 'modinfo' ||
+	fail "expected a complaint about .modinfo, got: $(diff_log | tail -1)"
+
+pass "object without .modinfo rejected"

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

end of thread, other threads:[~2026-09-21  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20260916184351.2720310-26-song@kernel.org>
2026-09-18 10:15 ` [tip: objtool/core] objtool/klp: Add test for objects without .modinfo tip-bot2 for Puranjay Mohan
2026-09-21  9:28 ` tip-bot2 for Puranjay Mohan

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

all inboxes | Powered by JetHome®