9827 Commits

Author SHA1 Message Date
Álvaro Felipe Melchor
564803d5c2 express db breakpoints as dbm due to ASLR 2016-06-19 14:04:23 +02:00
Maijin
1117f5e19c Fix #3874 2016-06-19 12:30:30 +02:00
pancake
59f63e5f8d Handle Windows's noreturn call to ExitProcess 2016-06-19 12:26:58 +02:00
Jeffrey Crowell
769bcf98f6 add RBitmap to the rapi (#5176) 2016-06-19 11:10:59 +02:00
Jeffrey Crowell
387c2ce479 fix SIGFPE when queue is created with size <=0 2016-06-18 21:33:00 -04:00
Álvaro Felipe Melchor
93105250ab Handle bad PE files 2016-06-19 00:19:03 +02:00
pancake
43781f390a Code cleanup 2016-06-18 01:15:52 +02:00
ekse
60220bc525 Check that a required argument was passed for a couple of commands. (#5166) 2016-06-17 23:17:24 +02:00
pancake
e2ab783250 Fix for regression in thumb/arm detection 2016-06-17 23:05:13 +02:00
pancake
016f5ec8ed Fix arm on thumb bins issue 2016-06-17 19:38:37 +02:00
pancake
3b0b7db100 Fix another oobread caused by callconv 2016-06-17 18:42:50 +02:00
pancake
bfa8eb740a Optimize callconv and fix two bugs related to op_pos 2016-06-17 18:38:25 +02:00
pancake
a46689b1b4 Fix oobread in ELF with 70d23ff5faa2716094f1fd1f081f9281678455dd 2016-06-17 17:16:41 +02:00
pancake
fb3be2c58f Do not nullify RAnalOp after fini() 2016-06-17 15:52:57 +02:00
monosource
dc61e8c511 Change afbr description (#5163)
`afbr`'s description isn't worded properly. It doesn't actually print addresses of `ret` instructions, but of instructions which cause the flow of the program to leave the function body, like `call`, `jmp`, `hlt` etc.
2016-06-17 14:26:46 +02:00
pancake
1629dd2b64 Remove two unused fields in RAnalOp and some deadcode 2016-06-17 14:26:24 +02:00
pancake
281d79da58 Remove some DEAD code and a copypaste error in coredump 2016-06-17 12:53:21 +02:00
pancake
3bbb4d098b Refix CDIV deoptimization 2016-06-17 12:37:18 +02:00
pancake
f96f00d62d Fix #5158 - Merge r_db into r_util 2016-06-17 12:19:16 +02:00
Joshua J. Drake
0431a0efdf Properly handle forks on Linux 2.5.46+ (#5153)
Linux 2.5.46 made changes to the ptrace(2) API to inform a tracer when various
events occur. These are known as PTRACE_EVENTs. Start handling PTRACE_EVENTs
by:

 * Handling PTRACE_EVENT_FORK and PTRACE_EVENT_EXIT
 * For _FORK, stores the newly created pid in dbg->forked_pid
 * Add the "dpc" command to select the most recently forked child process.
 * Add the "dpc*" command to show the recently forked process' pid.

Additional minor changes to white space are included.

NOTE: This partially addresses #3549. It does handleLinux before 2.5.46.
2016-06-17 04:20:18 +02:00
Joshua J. Drake
9f570114c7 Add "clone" to the "dcf" command (#5161)
Previously, "dcf" didn't not consider that "clone" may be used to create child
processes. Look for that and also update the text shown to the user.
2016-06-17 04:19:31 +02:00
pancake
43472476c5 Fix w32 build 2016-06-17 03:35:11 +02:00
pancake
911fef209a Implement afbr and * sub-variants to list return addresses of current function 2016-06-17 02:50:01 +02:00
Joshua J. Drake
9c21df9272 Minor cleanups to process handling (#5152)
* Fixed 'dpk' handling (signal wasn't being groked)
* Mostly comments added
* Some eprintfs added
2016-06-17 01:59:10 +02:00
Joshua J. Drake
e76cd01564 Fix io_w32dbg build (#5159) 2016-06-17 01:43:16 +02:00
pancake
ac2a80a1ef Fix bugs in CDIV implementation 2016-06-16 23:48:01 +02:00
pancake
66e783965f Fix build and oobreads in =!pid 2016-06-16 23:42:11 +02:00
Joshua J. Drake
691dd0a5c5 Make "dbt" output aligned to columns based on dbg->bits (#5151)
* Make "dbt" output aligned to columns based on dbg->bits
* Add spaces between sizeof and paren
2016-06-16 22:57:44 +02:00
Joshua J. Drake
2b9edf8dc4 Fixes #5154: Stop including source-file whitespace (#5155) 2016-06-16 22:57:10 +02:00
Joshua J. Drake
e97e011426 Have r_debug_select change IO pids too (#5145) 2016-06-16 22:56:21 +02:00
pancake
5186afdbe4 Only attach io.pid when its different 2016-06-16 22:56:02 +02:00
pancake
4e67a31087 Fix some more =!pid cmd parsing issues 2016-06-16 22:53:16 +02:00
pancake
565c97f8f5 Fix =!pid for io.w32dbg 2016-06-16 22:53:10 +02:00
Joshua J. Drake
fb820f9c8e Fixes #4875: Refactor process listing (#5144)
* Fixes #4875: Refactor process listing
* Move procfs-based process listing into linux_debug.c, guarded by __linux__
* Provide a warning and eprintf a TODO on the remaining platforms.
* Break reusable parts into linux_get_proc_pid and call it as needed.
* Add/remove comments for clarity
* Address feedback and re-enable non-Linux
2016-06-16 22:39:11 +02:00
Lev Aronsky
db8414d186 Fixed order of arguments in ESIL representation of MUL. 2016-06-16 22:33:16 +02:00
UsusDei
5e7c93fc37 Add asm.hints and handle CDOV deoptimization
CDIV deoptimization
===================

This patch implements hints in the disassembler that
aim to assist the user in reading compiler-optimized divisions
by analysing the involved magic number.

Background
==========

Since integer divisions are usually very expensive on most architectures,
compilers try very hard to substitute them with cheaper operations.

One of the more advanced substitutions is described in the book __Hacker's Delight__,
chapter 10.
An actual implementation of the described algorithm in LLVM can be found in the
functions: `TargetLowering::BuildSDIV()` and `APInt::magic()`.

The optimization approximately transforms e.g.

```asm
xor edx, edx
idiv 39
```

into

```asm
mov eax, edi
mov edx, 0xd20d20d3
imul edx
lea eax, [rdx + rdi]
sar edi, 0x1f
sar eax, 5
sub eax, edi
```

Reading the optimized version and __seeing__ the constant 39 seems difficult.
Therefore I try to provide a small hint to the user.

Limitations
===========

* The current implementation only takes the magic number into account,
  therefore it may result in false positives.

* Due to the nature of the optimization, the given hint may be off by a power of two.
  Fixing this would require to analyse the following shift instructions.

* The hint is only shown in the line containing the magic number.
  The user still has to know which of the following instructions belong to the optimization.

TODO
====

* Implement the corresponding analysis for unsigned integers

* Implement the corresponding analysis for 64-bit integers.

* Improve the heuristic by also looking at the next few instructions.
  ( I don't really know how to iterate over the instructions in the disassember
  in a non-deprecated way. Maybe someone can drop me a hint? )

* Implement an exact analysis using the actual dataflow in radeco and use it
  to revert the optimization. ( I suppose this is outside the scope of radare )
2016-06-16 22:22:58 +02:00
pancake
48e5f8fc7e Fix ELF crash (null deref when missing shdr 2016-06-16 22:18:10 +02:00
Joshua J. Drake
176054c006 Fix ELF section size validation (#5148) 2016-06-16 16:43:04 +02:00
Joshua J. Drake
285cd3b32f Minor tweaks to breakpoint handling
* Fix "dbm" help string
* Save <module>+<offset> as the name when using dbm
* Fix allocation patterns for "module"
* Remove commented out code
* White space fixes
2016-06-16 12:36:17 +02:00
pancake
d3cae9d5a9 Show classname for static methods in DEX 2016-06-16 12:30:38 +02:00
pancake
b843aaf054 Fix imports and enhance parsing virtual methods in DEX 2016-06-16 05:04:00 +02:00
pancake
1111c00ea2 Better names for virtual Dalvik methods 2016-06-16 02:42:54 +02:00
pancake
b50a06f57c Load virtual methods from Dex files 2016-06-16 02:33:59 +02:00
pancake
5c14841299 Support op->family and some op->cycle for anal.arm64 2016-06-16 01:43:41 +02:00
Jeffrey Crowell
2f6d778aef cleanup usages of r_str_newf to meet style guide 2016-06-15 19:42:03 +00:00
Sven Steinbauer
d45101eebe Add offset support to add instruction (#5137)
support syntax for

add eax, [ecx]
add ecx, [eba +/- 3]
2016-06-15 15:33:14 +02:00
pancake
794c60bf18 Fix #5138 - huge load times for fuzzed versioninfo ELFs 2016-06-15 15:30:51 +02:00
pancake
0e9e80c578 Fix #5138 - crash in elf parser 2016-06-15 15:13:41 +02:00
pancake
84aa6782f1 Add trailing newline in afbj 2016-06-15 13:41:45 +02:00
Riccardo Schirone
04190287c1 core: fix uber confusing indentation in cmd_anal "afl" command 2016-06-15 11:15:42 +02:00