[CRIU] [PATCH 1/2] compel hgen: fix for 32-bit ARM

Kir Kolyshkin kir at openvz.org
Wed Mar 29 13:15:57 PDT 2017


Since commit 93db22b ("compel: no -r for ARM ldflags") and
commit ce043d3 ("compel: make plugins .a archives") the generated
parasite/restorer blobs for 32-bit ARM are no longer relocatable,
and so their ELF header has e_type of ET_EXEC (rather than ET_REL).
As a result, we have "Unsupported header detected" message and
a failure from compel hgen.

This commit allows e_type == ET_EXEC in case NO_RELOCS is defined.
I am not sure if it's OK to still allow ET_REL -- maybe Dmitry
can chime in on that.

Cc: Dmitry Safonov <dsafonov at virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 compel/src/lib/handle-elf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compel/src/lib/handle-elf.c b/compel/src/lib/handle-elf.c
index 4b8b73d..41633e9 100644
--- a/compel/src/lib/handle-elf.c
+++ b/compel/src/lib/handle-elf.c
@@ -86,7 +86,11 @@ static bool is_header_supported(Elf_Ehdr *hdr)
 {
 	if (!arch_is_machine_supported(hdr->e_machine))
 		return false;
-	if (hdr->e_type != ET_REL || hdr->e_version != EV_CURRENT)
+	if ((hdr->e_type != ET_REL
+#ifdef NO_RELOCS
+		&& hdr->e_type != ET_EXEC
+#endif
+	    ) || hdr->e_version != EV_CURRENT)
 		return false;
 	return true;
 }
-- 
2.9.3



More information about the CRIU mailing list