From 982c050adad7d8348730545492c1279bf388bf47 Mon Sep 17 00:00:00 2001 From: yangcheng01 Date: Mon, 15 Jul 2024 15:35:30 +0800 Subject: [PATCH] support multihreading ql.restore operation after ql.save --- qiling/os/linux/thread.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qiling/os/linux/thread.py b/qiling/os/linux/thread.py index a4162743d..18d4d895e 100644 --- a/qiling/os/linux/thread.py +++ b/qiling/os/linux/thread.py @@ -572,7 +572,13 @@ def _clear_queued_msg(self): pass def _prepare_lib_patch(self): - if self.ql.loader.elf_entry != self.ql.loader.entry_point: + # If current control flow comes from a second call of ql.run method, which means + # we have complished the preparation of library patch, then ql.entry_point would + # be the next instruction needed to execute, so we do not need do library patch twice now. + if self.ql.entry_point is not None: + self.ql.loader.elf_entry = self.ql.entry_point + return None + elif self.ql.loader.elf_entry != self.ql.loader.entry_point: entry_address = self.ql.loader.elf_entry if self.ql.arch.type == QL_ARCH.ARM: