Skip to content

s390x: add stack-protector-loc unit test#57

Merged
joe-lawrence merged 1 commit into
dynup:masterfrom
joe-lawrence:stack-protector-loc
Jun 12, 2026
Merged

s390x: add stack-protector-loc unit test#57
joe-lawrence merged 1 commit into
dynup:masterfrom
joe-lawrence:stack-protector-loc

Conversation

@joe-lawrence

Copy link
Copy Markdown
Contributor

Add object files for fs/proc/meminfo.o compiled with GCC's global stack protector recording options (-mstack-protector-guard=global -mstack-protector-guard-record). These generate a __stack_protector_loc section whose relocations must be regenerated when a patched function's layout changes. Without the fix, kpatch-build fails:

ERROR: changed section .rela__stack_protector_loc not selected for inclusion
ERROR: fs/proc/meminfo.o: 1 unsupported section change(s)

Unit test objects created gcc version 16.1.1 20260515 (Red Hat 16.1.1-2) (GCC), upstream kernel v7.0 with a Fedora 44-ish kernel config, and this kpatch:

diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index a458f1e11..c6fe0db41 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -41,6 +41,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
unsigned long sreclaimable, sunreclaim;
int lru;

  • pr_info("kpatch test"); +
    si_meminfo(&i); si_swapinfo(&i); committed = vm_memory_committed();

@sumanthkorikkar

Copy link
Copy Markdown

Looks fine. Thanks!

Add object files for fs/proc/meminfo.o compiled with GCC's global stack
protector recording options (-mstack-protector-guard=global
-mstack-protector-guard-record).  These generate a __stack_protector_loc
section whose relocations must be regenerated when a patched function's
layout changes.  Without the fix, kpatch-build fails:

  ERROR: changed section .rela__stack_protector_loc not selected for inclusion
  ERROR: fs/proc/meminfo.o: 1 unsupported section change(s)

Unit test objects created with gcc version 16.1.1 20260515 (Red Hat
16.1.1-2) (GCC), upstream kernel v7.0 with a Fedora 44-ish kernel
config, and this kpatch:

diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index a458f1e11..c6fe0db41 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -41,6 +41,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	unsigned long sreclaimable, sunreclaim;
 	int lru;

+	pr_info("kpatch test");
+
 	si_meminfo(&i);
 	si_swapinfo(&i);
 	committed = vm_memory_committed();

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
@joe-lawrence joe-lawrence force-pushed the stack-protector-loc branch from 24beeca to c06b36b Compare June 12, 2026 13:33
@joe-lawrence

Copy link
Copy Markdown
Contributor Author

v2:

  • drop the unnecessary .patch file
  • commit msg tweak

@joe-lawrence joe-lawrence merged commit d31eed7 into dynup:master Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants