[*] Binary protection state of get_device
Full RELRO No Canary found NX disabled PIE enabled No RPATH No RUNPATH No Symbols
[*] Function fprintf tear down of get_device
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/4325012-58052244.squashfs_v4_le_extract/usr/bin/get_device @ 0x7d0 */
| #include <stdint.h>
|
; (fcn) main () | int32_t main () {
| /* [13] -r-x section size 864 named .text */
0x000007d0 lui gp, 2 |
0x000007d4 addiu gp, gp, -0x77c0 |
0x000007d8 addu gp, gp, t9 | gp += t9;
0x000007dc addiu sp, sp, -0x30 |
0x000007e0 addiu v0, zero, 3 | v0 = 3;
0x000007e4 sw gp, 0x18(sp) | *(var_18h) = gp;
0x000007e8 sw ra, 0x2c(sp) | *(var_2ch) = ra;
0x000007ec sw s1, 0x28(sp) | *(var_28h) = s1;
0x000007f0 sw s0, 0x24(sp) | *(var_24h) = s0;
0x000007f4 move s1, a1 | s1 = a1;
| if (a0 == v0) {
0x000007f8 beq a0, v0, 0x834 | goto label_1;
| }
0x000007fc lw v0, -0x7fac(gp) | v0 = *((gp - 8171));
0x00000800 lw a0, -0x7fdc(gp) | a0 = *((gp - 8183));
0x00000804 lw t9, -0x7f9c(gp) | t9 = sym.imp.fwrite;
0x00000808 lw a3, (v0) | a3 = *(v0);
0x0000080c addiu a2, zero, 0x21 | a2 = 0x21;
0x00000810 addiu a1, zero, 1 | a1 = 1;
0x00000814 addiu a0, a0, 0xbb8 | a0 += str.Usage:_get_device__bus___device__n;
0x00000818 jalr t9 | t9 ();
0x0000081c addiu v0, zero, 1 | v0 = 1;
| do {
| label_0:
0x00000820 lw ra, 0x2c(sp) | ra = *(var_2ch);
0x00000824 lw s1, 0x28(sp) | s1 = *(var_28h);
0x00000828 lw s0, 0x24(sp) | s0 = *(var_24h);
0x0000082c addiu sp, sp, 0x30 |
0x00000830 jr ra | return v0;
| label_1:
0x00000834 lw t9, -0x7f98(gp) | t9 = sym.imp.sysfs_open_device;
0x00000838 lw a1, 8(a1) | a1 = *((a1 + 2));
0x0000083c lw a0, 4(s1) | a0 = *((s1 + 1));
0x00000840 jalr t9 | t9 ();
0x00000844 move s0, v0 | s0 = v0;
0x00000848 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 == 0) {
0x0000084c beqz v0, 0x8d8 | goto label_2;
| }
0x00000850 lw s1, -0x7fac(gp) | s1 = *((gp - 8171));
0x00000854 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000858 lw t9, -0x7fb0(gp) | t9 = sym.imp.__fprintf_chk
0x0000085c lw a0, (s1) | a0 = *(s1);
0x00000860 addiu v0, v0, 0x1c4 | v0 += 0x1c4;
0x00000864 addiu a3, s0, 0x184 | a3 = s0 + segment.NOTE;
0x00000868 addiu a2, a2, 0xc00 | a2 += str.device_is_on_bus__s__using_driver__s_n;
0x0000086c addiu a1, zero, 1 | a1 = 1;
0x00000870 sw v0, 0x10(sp) | *(var_10h) = v0;
0x00000874 jalr t9 | t9 ();
0x00000878 lw gp, 0x18(sp) | gp = *(var_18h);
0x0000087c lw t9, -0x7fa8(gp) | t9 = sym.imp.sysfs_get_device_parent;
0x00000880 move a0, s0 | a0 = s0;
0x00000884 jalr t9 | t9 ();
0x00000888 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 == 0) {
0x0000088c beqz v0, 0x8b4 | goto label_3;
| }
0x00000890 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000894 lw t9, -0x7fb0(gp) | t9 = sym.imp.__fprintf_chk
0x00000898 lw a0, (s1) | a0 = *(s1);
0x0000089c move a3, v0 | a3 = v0;
0x000008a0 addiu a2, a2, 0xc28 | a2 += str.parent_is__s_n;
0x000008a4 addiu a1, zero, 1 | a1 = 1;
0x000008a8 jalr t9 | t9 ();
0x000008ac move v0, zero | v0 = 0;
0x000008b0 b 0x820 |
| } while (1);
| label_3:
0x000008b4 lw a0, -0x7fdc(gp) | a0 = *((gp - 8183));
0x000008b8 lw t9, -0x7f9c(gp) | t9 = sym.imp.fwrite;
0x000008bc lw a3, (s1) | a3 = *(s1);
0x000008c0 addiu a2, zero, 0xa | a2 = 0xa;
0x000008c4 addiu a1, zero, 1 | a1 = 1;
0x000008c8 addiu a0, a0, 0xc38 | a0 += str.no_parent_n;
0x000008cc jalr t9 | t9 ();
0x000008d0 move v0, zero | v0 = 0;
0x000008d4 b 0x820 | goto label_0;
| label_2:
0x000008d8 lw v1, -0x7fac(gp) | v1 = *((gp - 8171));
0x000008dc lw v0, 4(s1) | v0 = *((s1 + 1));
0x000008e0 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x000008e4 lw t9, -0x7fb0(gp) | t9 = sym.imp.__fprintf_chk
0x000008e8 lw a3, 8(s1) | a3 = *((s1 + 2));
0x000008ec lw a0, (v1) | a0 = *(v1);
0x000008f0 addiu a2, a2, 0xbdc | a2 += str.Device___s__not_found_on_bus___s__n;
0x000008f4 sw v0, 0x10(sp) | *(var_10h) = v0;
0x000008f8 addiu a1, zero, 1 | a1 = 1;
0x000008fc jalr t9 | t9 ();
0x00000900 addiu v0, zero, 1 | v0 = 1;
0x00000904 b 0x820 | goto label_0;
| }
[*] Function fprintf used 4 times get_device