Commit Graph

451 Commits

Author SHA1 Message Date
Liumeo
fd2dfd63d7
Fix pseudo and esil of the TST instruction on ARM32 #18108 (#18110) 2020-12-26 23:55:10 +01:00
pancake
d3157e2ed3
Fix 32 critical COVs (UAF, UB and OOB) (#18077) 2020-12-21 01:10:22 +01:00
Aswin C
a44cedc6f9
Improve code quality in parse_att2intel.c ##refactor (#17891) 2020-12-11 23:03:08 +01:00
Aswin C
549187b9f1
Implement asm.pseudo for RISC-V (#17777) 2020-11-02 12:43:25 +08:00
Liumeo
38a13c94bb
Fix MSVC warning LNK4006 (#17885) 2020-11-02 12:27:02 +08:00
Riccardo Schirone
1e58692071
Fix incorrect uses of printf-like functions ##refactor (#17648) 2020-10-13 16:26:15 +02:00
Aswin C
45c0024300
Rename asm.var.sub to asm.sub.var ##cons (#17717)
* Rename `asm.var.sub` to `asm.sub.var`
* Rename tests for `asm.var.sub`
2020-09-28 17:51:38 +08:00
pancake
62c2128b6f
Better use of the R_SOCKET_PROTO_DEFAULT and add _NONE (#17644)
* Better use of the R_SOCKET_PROTO_DEFAULT and add _NONE ##http

* Fix regressions in: r2 -C and =+ ##r2pipe

Introduced in 04edfa82c1

* Implement sleep command ##shell

* Add tests for the webserver and remoting

* Implement daemon directive in rarun2, fix http test ##rarun2

* Fix socket timeout on Windows (patch by @GustavoLCR) ##socket

* Missing http.root is not a reason to not start the webserver ##http

* Fix r2 -C, =!=0, replace curl with r2 in the webserver test ##http

* Honor anal.in/from/to in aae, optimize db/formats/mach0/thumb ##anal

* Bug fixes and performance improvements

Co-authored-by: pancake <pancake@nopcode.org>
2020-09-25 19:51:23 +08:00
Riccardo Schirone
ea7da3366b
Add parse_v850_pseudo to meson build (#17710) 2020-09-25 16:51:03 +08:00
pancake
e28ce2990d
Implement the v850.pseudo RParser plugin ##disasm (#17687) 2020-09-24 17:56:16 +02:00
pancake
2cf9c91518
Implement tms320.pseudo to fix another arm64 test ##asm (#17613)
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2020-09-21 11:51:04 +08:00
Florian Märkl
178f69b643
Refactor Labels out of SDB ##anal (#17621) 2020-09-16 09:54:33 +02:00
Khairul Azhar Kasmiran
d9057505dc
Set RPATH/RUNPATH on r2 libs too if local (#17639) 2020-09-15 09:16:14 +02:00
pancake
45994dcc1f
ARM: Fix asm.pseudo for MOVN ##disasm (#17446)
Co-authored-by: pancake <pancake@nopcode.org>
2020-08-14 18:03:08 +08:00
GustavoLCR
bb3e80c040
Implement pde to disassemble following code execution ##disasm (#17410)
* Implement `pde` to disassemble following code execution
* Fix `asm.filter=1` with `scr.color=0`
* Fix cache not being used
* Share read and write file permissions on Windows
* Use CreateFileW in r_sandbox_open on Windows and fix file permissions
* Fix opening nul and O_RDWR
* File creation flags cannot be combined on Windows
* Share write in r_file_mmap_windows
2020-08-13 10:05:38 +08:00
Riccardo Schirone
154416c8fd
Add unit tests for binheap (#17367) 2020-07-31 18:09:50 +08:00
GustavoLCR
5b101b6521
Improve ARM and PPC analysis ##anal (#17356)
* Fix stepping with ESIL into thumb code
* Fix seek changed after `aaef`
* Run `aaef` instead of `aae` in `aaa`
* Fill IMM info for arm op
* Add op info for arm32 UXT opcodes
* Fill op src/dst info for cast ops on arm
* Fix false positives for reg args detection on arm/riscv
* Change `r_core_recover_vars()` to recurse on bbs
* Fix reg arena stack being corrupted on `aaef`
* Fix detection of var address references on `aaef`
* Fix arm pseudo syntax output
* Correctly substitute pc relative offsets
* Substitute address references to variables
* Fill op->cond for arm64
* Fix wrong jump table size for arm
* Fill bb->cond
* Implement r_anal_block_recurse_depth_first
* Use r_anal_block_recurse_depth_first on r_core_recover_vars
* Handle MRS/MSR on arm64
* Log if arm op not handled
* Complete arm op_fillval
* Convert 32bit arm64 reg names to 64bit
* Fix stackop analysis on PPC
* Fix tests
2020-07-29 10:41:26 +08:00
GustavoLCR
64f5ca4590
Detect stack vars accesses with misc regs with 'aaef' ##anal (#17255)
* Detect stack vars accesses with misc regs with `aaef` ##anal
* Follow bbs in r_core_anal_esil for functions
* Fix ARM PUSH/POP stackop analysis
* Fix arm varsub with `asm.ucase` and `asm.sub.varonly`
2020-07-17 08:01:03 +08:00
Riccardo Schirone
594b940b7c
Fixes some of the issues in Travis (#17267)
* Do not check with r_return_ if the convention is present

Let's just assume the NULL default in such a case, so that architectures
for which we don't have a defined calling convention can still be
processed somehow by the analysis code. It won't be precise, but it's
better than nothing.

Also add a warning message so users are aware when the calling
convention is not defined.

* Fix oob-read when # is at the end of the cmd string

* Do not set TMPDIR when the new value is the empty string

When TMPDIR is set to empty value, clang+ld behaves in weird ways and
you cannot compile files from within the r2 shell (e.g. when using #!c
or #!cpipe)

* Use meson and add -lasan to pkgconfig files when sanitizer are used
2020-07-16 20:47:30 +08:00
Aswin
5454239cae
Rename *sub* variables to asm.sub.* (#17176)
* Rename asm.sub.jmp, asm.sub.reg, asm.sub.rel, asm.sub.tail, asm.sub.varonly, asm.sub.section, asm.sub.varmin
2020-07-06 11:04:50 +02:00
pancake
160fc95e66
Use (void) instead of () in function signatures (#17026) ##refactoring
* Use (void) instead of () in function signatures
* Add test to avoid further contributions to commit the same mistake
2020-06-14 16:08:32 +02:00
Riccardo Schirone
70e3d3bc56
Fix compiler warnings (#17046) 2020-06-12 10:26:55 +02:00
Anton Kochkov
ffe743ef39
Fix #4056 - rename DEPS to R2DEPS ##build (#17020)
* Rename DEPS to R2DEPS
* Cleanup of sys/build.sh
2020-06-12 10:49:28 +08:00
zawwwu
9de7c2e8dd
x86 pseudo for LEA is wrong (#16980)
* Better solution + tests

* Adding pseudo for movabs
2020-06-04 13:02:45 +02:00
Khairul Azhar Kasmiran
1cb18df8b4
ahi 10 does signed decimal with 32-bit gp regs + ahi 10u for unsigned decimal (#16970)
* ahi 10 does signed decimal with x86 32-bit regs + ahi 10u for unsigned decimal
* Use arch-independent r_reg api instead
2020-05-30 01:31:22 +08:00
GustavoLCR
146c788fa0
Improve BP vars/args detection ##anal (#16935)
* Take into account initial BP position in stackframe
* Add reg name to RAnalVarAccess
* Add `anal.vars.stackname` config variable
* Fix riscv op/src imm info filling
* Fix getting BP vars if it is set with LEA
* Fix arg detection for functions that call __chkstk
* Fix tests

Signed-off-by: GustavoLCR <gugulcr@gmail.com>
2020-05-25 12:55:31 +08:00
Florian Märkl
4560120be2
Refactor Variable Accesses out of SDB (#16632)
Fix #15944
2020-04-19 17:56:27 +02:00
Florian Märkl
35290dd51d
Refactor Variables out of SDB ##anal (#16547) 2020-04-17 22:10:49 +02:00
Florian Märkl
18b1647267
Remove some useless members from RAnalVar (#16548) 2020-04-14 11:05:59 +02:00
pancake
79c5da3b1e Code cleanup in parse.x86_pseudo 2020-03-21 16:52:43 +01:00
radare
9ddfafcd65
Show flag realname when finding a function and realname is enabled ##disasm (#15827) 2020-01-16 21:15:42 +01:00
GustavoLCR
7d19556001 Improve SP based variable analysis ##anal
* Make SP based variable analysis aware of changes to SP
* Use delta inside stack to identify the variable used instead of offset to SP
* Keep track of offsets to SP used to access the variable
* Fix argument printing order for reg args
* Add test
2019-12-18 16:32:46 +01:00
Florian Märkl
aad2a2c79e Link sdb fully into r_util in meson (#15338) ##build 2019-10-23 15:52:19 +02:00
xarkes
e5f7fd947f Removed uppercase sub variables (#15209)
There's no particular reason to make the sub variables
uppercase when asm.ucase is enabled. Plus the color parser
does not recognize uppercase subvariables, so now everything
is properly colorized.
2019-10-06 21:22:53 +02:00
Florian Märkl
5a37bddbab
Fix double typedef of RParseCType (Fix #15085) (#15087) 2019-09-20 09:35:25 +02:00
pancake
fca09fab22 Fix #14716 - Honor local flags in RParse ##disasm 2019-09-02 00:37:20 +02:00
Khairul Azhar Kasmiran
cae071a050 Hide brackets for LEA even if operand is section flag ##disasm 2019-08-25 23:28:03 +02:00
Khairul Azhar Kasmiran
a7bf98bca7
Always bracket indirect addr operand (except LEA) (#14802)
* Always bracket indirect addr operand (except LEA)

* Don't use RAnalOp
2019-08-16 22:41:50 +08:00
radare
a0c6997cc5
Fix #14655 - Improve asm.pseudo for Dalvik ##disasm (#14694)
class, method and field names are now shorter and easier to read
2019-07-30 04:22:19 +02:00
Florian Märkl
d76bc232a2 Support struct/enum/union before name in ctypes parse 2019-07-26 01:33:11 +02:00
Florian Märkl
24d3a9cb5d Add r_parse_ctype ##parse (#14596)
* Add r_parse_ctype

* Add mpc to acr

* Readability

* Fix r_parse for acr
2019-07-20 12:50:27 +02:00
pancake
9778da3b7b Fix arm64 parse for BL instructions ##disasm 2019-06-20 20:14:27 +02:00
Anton Kochkov
20e19d6023 More spelling fixes in the code 2019-06-20 13:36:02 +08:00
Martin Brunner
af95ca437d fix, improve and add some sh pseudo ##disasm
* I recommend reading SH operands right-to-left
* tst is checking for zero (!)
2019-06-19 17:26:17 +02:00
radare
4dbe1453f5
Initial cleanup in RParse, delete mreplace plugin ##disasm
* Also voidify and boolify anal, parse, cons, bin, ..
2019-06-17 02:23:58 +02:00
radare
b282620b7a
Fix #14303 - oob crash in RParse api usage, needs API redesign (#14307) 2019-06-15 13:24:00 +02:00
radare
571a080ca7
s/CORELIB/R2_PLUGIN_INCORE/g (#14295) 2019-06-13 19:12:51 +02:00
radare
d7d104ac4b
Fix asm.varsub in a hacky way to fix the disasm output ##disasm 2019-06-06 17:01:57 -04:00
radare
1ab587c971
Improvements in dalvik analysis ##anal 2019-05-25 23:31:06 +02:00
pancake
0e87b15388 Add opcode mask field in ao and aoj ##anal 2019-05-21 17:05:58 +02:00