unicorn.unicorn.UcError when using timeout
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- reverse-engineering
Direzione di ricerca
Reproduce the sample with Qiling 1.4.6, then trace the timeout path through qiling/core.py, qiling/os/linux/linux.py, and Unicorn's emu_start call shown in the traceback. Compare runs with and without timeout and determine how the timeout result should be handled. Done means the timeout behavior is consistent with the documented expectation without an unexpected uncaught error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
I want to use Qiling to track the block nodes of the binary hited by the input file. I hope to use the timeout mechanism when calling qiling.run, so I set the timeout parameter to 10000 (10 seconds). As a result, I encountered the following error.
[x] 000000000000400000 - 000000000000403000 r-- re2 /home/test/re2
[x] 000000000000403000 - 000000000000425000 r-x re2 /home/test/re2
[x] 000000000000425000 - 000000000000438000 r-- re2 /home/test/re2
[x] 000000000000439000 - 00000000000043b000 rw- re2 /home/test/re2
[x] 00000000000043b000 - 00000000000043d000 rwx [hook_mem]
[x] 0000007ffff7dd5000 - 0000007ffff7dfc000 r-x ld-linux-x86-64.so.2 /home/rootfs/x8664_linux/lib64/ld-linux-x86-64.so.2
[x] 0000007ffff7ffc000 - 0000007ffff7fff000 rw- ld-linux-x86-64.so.2 /home/rootfs/x8664_linux/lib64/ld-linux-x86-64.so.2
[x] 0000007ffffffde000 - 00000080000000e000 rwx [stack]
[x] 00ffffffffff600000 - 00ffffffffff601000 rwx [vsyscall]
Traceback (most recent call last):
File "/home/source/cfg.py", line 220, in analyze_corpus
self.tracer.trace_corpus(file_path)
File "/home/source/cfg.py", line 117, in trace_corpus
ql.run(timeout=10000)
File "/home/angr/lib/python3.8/site-packages/qiling/core.py", line 595, in run
self.os.run()
File "/home/angr/lib/python3.8/site-packages/qiling/os/linux/linux.py", line 184, in run
self.ql.emu_start(self.ql.loader.elf_entry, self.exit_point, self.ql.timeout, self.ql.count)
File "/home/angr/lib/python3.8/site-packages/qiling/core.py", line 769, in emu_start
self.uc.emu_start(begin, end, timeout, count)
File "/home/angr/lib/python3.8/site-packages/unicorn/unicorn.py", line 547, in emu_start
raise UcError(status)
unicorn.unicorn.UcError: Invalid memory fetch (UC_ERR_FETCH_UNMAPPED)
When I remove the timeout parameter, the program runs normally.
Sample Code
ql = Qiling([target, os.path.abspath(corpus)], rootfs=rootfs, verbose=QL_VERBOSE.OFF)
ql.add_fs_mapper(os.path.abspath(corpus), os.path.abspath(corpus))
ql.os.stdout = open(os.devnull, 'wb')
ql.hook_block(hook_for_trace)
ql.run(timeout=10000)
Expected behavior
I want Qiling to forcibly terminate after running for more than 10 seconds, but I haven't found a method to stop it, so I used the timeout parameter.
I was originally expecting it to end after 10 seconds, and then I would check whether Qiling ended abnormally, but now it's throwing an error directly.
Additional context
Version: 1.4.6
May I ask why the timeout triggered this error? If the timeout cannot be used, how should I handle the timeout situation?
- Lingua principale
- Python
- Stelle
- 6.2k
- Fork
- 806
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di qilingframework/qiling
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
qilingframework/qiling#1690 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
qilingframework/qiling#1689 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
qilingframework/qiling#1688 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
qilingframework/qiling#1686 ·
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 82/100
qilingframework/qiling#1640 ·
Tutte le issue di qilingframework/qiling
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/datasets#9128 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OpenHands/extensions#975 ·
I maintainer di solito rispondono entro 1 giorno
-
Function/dict state handlers can't supply provider-state injected values (`generate.provider_state`)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pact-foundation/pact-python#1789 ·
I maintainer di solito rispondono entro 9 giorni
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
juandresrodca/AdminForge#66 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno