[livepatch-build-tools] create-diff-object: Include string sections later
diff mbox series

Message ID 20191203075722.107886-1-wipawel@amazon.de
State New
Headers show
Series
  • [livepatch-build-tools] create-diff-object: Include string sections later
Related show

Commit Message

Wieczorkiewicz, Pawel Dec. 3, 2019, 7:57 a.m. UTC
... when all symbols have their status and include flags processed.

Processing special sections may include additional symbols. String
sections (.rodata*) are included iff they are referenced by at least
one symbol. Thus, in order to decide if string section should be
included or not, all symbols must be evaluated first.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Reported-by: Sergey Dyasli <sergey.dyasli@citrix.com>
---
 create-diff-object.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sergey Dyasli Dec. 3, 2019, 9:42 a.m. UTC | #1
On 03/12/2019 07:57, Pawel Wieczorkiewicz wrote:
> ... when all symbols have their status and include flags processed.
> 
> Processing special sections may include additional symbols. String
> sections (.rodata*) are included iff they are referenced by at least
> one symbol. Thus, in order to decide if string section should be
> included or not, all symbols must be evaluated first.
> 
> Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
> Reported-by: Sergey Dyasli <sergey.dyasli@citrix.com>

Tested-by: Sergey Dyasli <sergey.dyasli@citrix.com>

This fixes creation/loading of my test LP.

--
Thanks,
Sergey
Ross Lagerwall Dec. 4, 2019, 2:48 p.m. UTC | #2
On 12/3/19 7:57 AM, Pawel Wieczorkiewicz wrote:
> ... when all symbols have their status and include flags processed.
> 
> Processing special sections may include additional symbols. String
> sections (.rodata*) are included iff they are referenced by at least
> one symbol. Thus, in order to decide if string section should be
> included or not, all symbols must be evaluated first.
> 
> Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
> Reported-by: Sergey Dyasli <sergey.dyasli@citrix.com>

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>

... and pushed. Thanks!

Patch
diff mbox series

diff --git a/create-diff-object.c b/create-diff-object.c
index 1ce5c09..a516670 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -2372,8 +2372,6 @@  int main(int argc, char *argv[])
 	log_debug("Include hook elements\n");
 	num_changed += kpatch_include_hook_elements(kelf_patched);
 	log_debug("num_changed = %d\n", num_changed);
-	log_debug("Include standard string elements\n");
-	kpatch_include_standard_string_elements(kelf_patched);
 	log_debug("Include new globals\n");
 	new_globals_exist = kpatch_include_new_globals(kelf_patched);
 	log_debug("new_globals_exist = %d\n", new_globals_exist);
@@ -2390,6 +2388,8 @@  int main(int argc, char *argv[])
 
 	log_debug("Process special sections\n");
 	kpatch_process_special_sections(kelf_patched);
+	log_debug("Include standard string elements\n");
+	kpatch_include_standard_string_elements(kelf_patched);
 	log_debug("Strip undefined elements of known size\n");
 	livepatch_strip_undefined_elements(kelf_patched);
 	log_debug("Verify patchability\n");