Re: [RFC PATCH v6 03/12] livepatch: Add klp-convert tool

From
Joe Lawrence <joe.lawrence@redhat.com>
Date
2022-02-16 16:47:09
Also in
linux-kbuild, lkml
Reply to
Joe Lawrence, 2022-02-16
On Wed, Feb 16, 2022 at 11:39:31AM -0500, Joe Lawrence wrote:
quoted hunk ↗ jump to hunk

 [ ... snip ... ]

+/*
+ * Checks if rela conversion is supported in given section
+ */
+static bool supported_section(struct section *sec, char *object_name)
+{
+#if 0
+	/*
+	 * klp-relocations forbidden in sections that otherwise would
+	 * match in allowed_prefixes[]
+	 */
+	static const char * const not_allowed[] = {
+		".rela.data.rel.ro",
+		".rela.data.rel.ro.local",
+		".rela.data..ro_after_init",
+		NULL
+	};
+#endif
+
+	/* klp-relocations allowed in sections only for vmlinux */
+	static const char * const allowed_vmlinux[] = {
+		".rela__jump_table",
+		NULL
+	};
+
+	/* klp-relocations allowed in sections with prefixes */
+	static const char * const allowed_prefixes[] = {
+		".rela.data",
+		".rela.rodata",	// supported ???
+		".rela.sdata",
+		".rela.text",
+		".rela.toc",
+		NULL
+	};
+
+	const char * const *name;
+
+#if 0
+	for (name = not_allowed; *name; name++)
+		if (strcmp(sec->name, *name) == 0)
+			return false;
+#endif
I wasn't sure if relocations in .rela.<read-only> sections should be
supported or not, particularly in the late relocation use case.  For
most, I think they can be easily avoided by the livepatch author
changing the storage class for the C pointer that is relocated.  On the
other hand, this may be disruptive to automated tools like
kpatch-build... or maybe there is no issue at all for late relocating
.rela.<read-only>?

-- Joe
Thread (28 messages) 28 messages, 4 authors, last reply 2023-02-07
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help