some error message and can't be displayed in graph mode.
ResidualLaugh opened this issue · 5 comments
What happened to idawasm/processor.py
error message
Possible file format: WebAssembly v1 executable (/Applications/IDA Pro 7.0/ida64.app/Contents/MacOS/loaders/wasm_loader.py)
bytes pages size description
--------- ----- ---- --------------------------------------------
262144 32 8192 allocating memory for b-tree...
65536 8 8192 allocating memory for virtual array...
262144 32 8192 allocating memory for name pointers...
-----------------------------------------------------------------
589824 total memory allocated
Loading file '/Users/residuallaugh/Desktop/job/webassembly/quicksort/quicksort.wasm' into database...
Detected file format: WebAssembly v1 executable
Loading processor module /Applications/IDA Pro 7.0/ida64.app/Contents/MacOS/procs/wasm_proc.py for wasm...OK
Autoanalysis subsystem has been initialized.
0. Creating a new segment (0000000000000000-0000000000000008) ... ... OK
1. Creating a new segment (0000000000000008-0000000000000018) ... ... OK
2. Creating a new segment (0000000000000018-000000000000001D) ... ... OK
3. Creating a new segment (000000000000001D-0000000000000022) ... ... OK
4. Creating a new segment (0000000000000022-0000000000000041) ... ... OK
5. Creating a new segment (0000000000000041-00000000000000FA) ... ... OK
Flushing buffers, please wait...INFO:idawasm.processor:saving wasm processor state.
ok
File '/Users/residuallaugh/Desktop/job/webassembly/quicksort/quicksort.wasm' has been successfully loaded into the database.
INFO:idawasm.processor:new file: /Users/residuallaugh/Desktop/job/webassembly/quicksort/quicksort.wasm
INFO:idawasm.processor:parsing sections
INFO:idawasm.processor:parsing types
INFO:idawasm.processor:parsing globals
ERROR:idawasm.processor:exception in notify_newfile
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 58, in wrapper
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 533, in notify_newfile
self.load()
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 491, in load
self.globals = self._parse_globals()
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 309, in _parse_globals
global_section = self._get_section(wasm.wasmtypes.SEC_GLOBAL)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 155, in _get_section
raise KeyError(section_id)
KeyError: 6
IDA is analysing the input file...
You may start to explore the input file right now.
------------------------------------------------------------------------------------------------------------
Python 2.7.10 (default, Aug 17 2018, 17:41:52)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)]
IDAPython 64-bit v1.7.0 final (serial 0) (c) The IDAPython Team <idapython@googlegroups.com>
------------------------------------------------------------------------------------------------------------
The initial autoanalysis has been finished.
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 58, in wrapper
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 900, in notify_out_operand
f = self._get_function(ctx.insn.ea)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 861, in _get_function
raise KeyError(ea)
KeyError: 237L
ERROR:idawasm.processor:exception in notify_out_operand
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 58, in wrapper
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 900, in notify_out_operand
f = self._get_function(ctx.insn.ea)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 861, in _get_function
raise KeyError(ea)
KeyError: 242L
ERROR:idawasm.processor:exception in notify_out_operand
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 58, in wrapper
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 933, in notify_out_operand
f = self.functions[op.value]
KeyError: 1L
ERROR:idawasm.processor:exception in notify_out_operand
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 58, in wrapper
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 900, in notify_out_operand
f = self._get_function(ctx.insn.ea)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 861, in _get_function
raise KeyError(ea)
KeyError: 242L
ERROR:idawasm.processor:exception in notify_out_operand
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 58, in wrapper
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 933, in notify_out_operand
f = self.functions[op.value]
KeyError: 1L
ERROR:idawasm.processor:exception in notify_out_operand
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 58, in wrapper
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 900, in notify_out_operand
f = self._get_function(ctx.insn.ea)
File "/Library/Python/2.7/site-packages/idawasm/processor.py", line 861, in _get_function
raise KeyError(ea)
KeyError: 247L
Sorry, I've been (and will be for a few more days) AFK.
Looks like we need to tighten up the assumptions made about webassembly module, eg. don't assume that the globals section exists (exception #1) above.
The second sequence of exceptions is more difficult to triage. Are you able to share the .wasm file?
I'm getting the same key errors errors @williballenthin - also it seems I do not see any xrefs created so it's difficult to follow code flow. Is there supposed to be xrefs?
Attached is a WASM file I was looking at:
chintai.wasm.zip
Getting the same key errors and unknown opcode errors, @williballenthin.
xref is still not working for me, too.
Any plan to update idawasm? We are looking forward to it.
Unfortunately, I don't have much time to maintain this project these days, particularly because I don't deal with wasm often :-(
Its possible that I can find some spare time between now and the new year, but no promises. I hope that this is a matter of adding a couple opcodes and better handling of some conditional constructs. I'll update this thread if I have time.
In the meantime, I'm happy to work with any contributors that want to learn the code base and attempt a fix.
If any of those KeyErrors trace back to my wasm lib, feel free to just mention me here and I’ll take a look! Handling of incorrect / corrupted wasm files isn’t particularly great on my side either but should be a quick fix.