All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH livepatch-build-tools] create-diff-object: Ignore .init sections
@ 2019-12-03  7:57 Pawel Wieczorkiewicz
  2019-12-04 14:48 ` Ross Lagerwall
  0 siblings, 1 reply; 2+ messages in thread
From: Pawel Wieczorkiewicz @ 2019-12-03  7:57 UTC (permalink / raw)
  To: xen-devel
  Cc: mpohlack, Pawel Wieczorkiewicz, Ross Lagerwall, Konrad Rzeszutek Wilk

The .init sections must not be considered for patching regardless of
whether they are CHANGED or NEW.
Explicitely detect and ignore all such sections, before marking
ignored sections as SAME.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
---
 common.c             |  7 +++++++
 common.h             |  1 +
 create-diff-object.c | 15 +++++++++++++++
 3 files changed, 23 insertions(+)

diff --git a/common.c b/common.c
index 8f553ea..68a71f7 100644
--- a/common.c
+++ b/common.c
@@ -256,6 +256,13 @@ int is_rodata_section(struct section *sec)
 	       !strncmp(sec->name, ".rodata", 7);
 }
 
+int is_init_section(struct section *sec)
+{
+	return sec->sh.sh_type == SHT_PROGBITS &&
+	       (sec->sh.sh_flags & SHF_ALLOC) &&
+	       !strncmp(sec->name, ".init", 5);
+}
+
 int is_debug_section(struct section *sec)
 {
 	char *name;
diff --git a/common.h b/common.h
index b6489db..02c9b7b 100644
--- a/common.h
+++ b/common.h
@@ -160,6 +160,7 @@ struct symbol *find_symbol_by_name(struct list_head *list, const char *name);
 
 int is_text_section(struct section *sec);
 int is_rodata_section(struct section *sec);
+int is_init_section(struct section *sec);
 int is_debug_section(struct section *sec);
 int is_rela_section(struct section *sec);
 int is_standard_section(struct section *sec);
diff --git a/create-diff-object.c b/create-diff-object.c
index abf3cc7..1ce5c09 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -881,6 +881,19 @@ static void kpatch_mark_ignored_functions_same(struct kpatch_elf *kelf)
 	}
 }
 
+static void livepatch_ignore_init_sections(struct kpatch_elf *kelf)
+{
+	struct section *sec;
+
+	list_for_each_entry(sec, &kelf->sections, list) {
+		if (is_init_section(sec)) {
+			log_normal("WARNING: Explicitly ignoring .init section: %s\n",
+				   sec->name);
+			sec->ignore = 1;
+		}
+	}
+}
+
 static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf)
 {
 	struct section *sec, *strsec, *ignoresec;
@@ -2332,6 +2345,8 @@ int main(int argc, char *argv[])
 	 * We access its sections via the twin pointers in the
 	 * section, symbol, and rela lists of kelf_patched.
 	 */
+	log_debug("Ignore .init sections\n");
+	livepatch_ignore_init_sections(kelf_patched);
 	log_debug("Mark ignored sections\n");
 	kpatch_mark_ignored_sections(kelf_patched);
 	log_debug("Compare correlated elements\n");
-- 
2.16.5




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH livepatch-build-tools] create-diff-object: Ignore .init sections
  2019-12-03  7:57 [Xen-devel] [PATCH livepatch-build-tools] create-diff-object: Ignore .init sections Pawel Wieczorkiewicz
@ 2019-12-04 14:48 ` Ross Lagerwall
  0 siblings, 0 replies; 2+ messages in thread
From: Ross Lagerwall @ 2019-12-04 14:48 UTC (permalink / raw)
  To: Pawel Wieczorkiewicz, xen-devel; +Cc: mpohlack, Konrad Rzeszutek Wilk

On 12/3/19 7:57 AM, Pawel Wieczorkiewicz wrote:
> The .init sections must not be considered for patching regardless of
> whether they are CHANGED or NEW.
> Explicitely detect and ignore all such sections, before marking
> ignored sections as SAME.
> 
> Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-12-04 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03  7:57 [Xen-devel] [PATCH livepatch-build-tools] create-diff-object: Ignore .init sections Pawel Wieczorkiewicz
2019-12-04 14:48 ` Ross Lagerwall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.