[*] Binary protection state of get_driver
Full RELRO Canary found NX disabled PIE enabled No RPATH No RUNPATH No Symbols
[*] Function fprintf tear down of get_driver
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/4325012-58052244.squashfs_v4_le_extract/usr/bin/get_driver @ 0xa20 */
| #include <stdint.h>
|
; (fcn) main () | int32_t main () {
| /* [13] -r-x section size 1376 named .text */
0x00000a20 lui gp, 2 |
0x00000a24 addiu gp, gp, -0x6a10 |
0x00000a28 addu gp, gp, t9 | gp += t9;
0x00000a2c addiu sp, sp, -0x148 |
0x00000a30 addiu v0, zero, 3 | v0 = 3;
0x00000a34 sw s1, 0x130(sp) | *(var_130h) = s1;
0x00000a38 lw s1, -0x7f6c(gp) | s1 = *((gp - 8155));
0x00000a3c sw gp, 0x18(sp) | *(var_18h) = gp;
0x00000a40 sw ra, 0x144(sp) | *(var_144h) = ra;
0x00000a44 lw v1, (s1) | v1 = *(s1);
0x00000a48 sw s5, 0x140(sp) | *(var_140h) = s5;
0x00000a4c sw s4, 0x13c(sp) | *(var_13ch) = s4;
0x00000a50 sw s3, 0x138(sp) | *(var_138h) = s3;
0x00000a54 sw s2, 0x134(sp) | *(var_134h) = s2;
0x00000a58 sw s0, 0x12c(sp) | *(var_12ch) = s0;
0x00000a5c sw v1, 0x124(sp) | *(var_124h) = v1;
0x00000a60 lw t9, -0x7fa0(gp) | t9 = sym.imp.memset;
| if (a0 != v0) {
0x00000a64 beq a0, v0, 0xac4 |
0x00000a68 lw v0, -0x7fa4(gp) | v0 = *((gp - 8169));
0x00000a6c lw a0, -0x7fdc(gp) | a0 = *((gp - 8183));
0x00000a70 lw t9, -0x7f7c(gp) | t9 = sym.imp.fwrite;
0x00000a74 lw a3, (v0) | a3 = *(v0);
0x00000a78 addiu a2, zero, 0x21 | a2 = 0x21;
0x00000a7c addiu a1, zero, 1 | a1 = 1;
0x00000a80 addiu a0, a0, 0x10a8 | a0 += str.Usage:_get_driver__bus___driver__n;
0x00000a84 jalr t9 | t9 ();
0x00000a88 lw gp, 0x18(sp) | gp = *(var_18h);
0x00000a8c addiu s2, zero, 1 | s2 = 1;
| label_0:
0x00000a90 lw a0, 0x124(sp) | a0 = *(var_124h);
0x00000a94 lw v1, (s1) | v1 = *(s1);
0x00000a98 move v0, s2 | v0 = s2;
| if (a0 != v1) {
0x00000a9c bne a0, v1, 0xd54 | goto label_1;
| }
0x00000aa0 lw ra, 0x144(sp) | ra = *(var_144h);
0x00000aa4 lw s5, 0x140(sp) | s5 = *(var_140h);
0x00000aa8 lw s4, 0x13c(sp) | s4 = *(var_13ch);
0x00000aac lw s3, 0x138(sp) | s3 = *(var_138h);
0x00000ab0 lw s2, 0x134(sp) | s2 = *(var_134h);
0x00000ab4 lw s1, 0x130(sp) | s1 = *(var_130h);
0x00000ab8 lw s0, 0x12c(sp) | s0 = *(var_12ch);
0x00000abc addiu sp, sp, 0x148 |
0x00000ac0 jr ra | return v0;
| }
0x00000ac4 addiu s0, sp, 0x24 | s0 = sp + 0x24;
0x00000ac8 addiu a2, zero, 0x100 | a2 = 0x100;
0x00000acc move a0, s0 | a0 = s0;
0x00000ad0 move s5, a1 | s5 = a1;
0x00000ad4 move a1, zero | a1 = 0;
0x00000ad8 jalr t9 | t9 ();
0x00000adc lw gp, 0x18(sp) | gp = *(var_18h);
0x00000ae0 addiu a1, zero, 0x100 | a1 = 0x100;
0x00000ae4 lw t9, -0x7f9c(gp) | t9 = sym.imp.sysfs_get_mnt_path;
0x00000ae8 move a0, s0 | a0 = s0;
0x00000aec jalr t9 | t9 ();
0x00000af0 move s2, v0 | s2 = v0;
0x00000af4 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 != 0) {
0x00000af8 bnez v0, 0xcd8 | goto label_2;
| }
0x00000afc lw t9, -0x7f90(gp) | t9 = sym.imp.strlen;
0x00000b00 move a0, s0 | a0 = s0;
0x00000b04 jalr t9 | t9 ();
0x00000b08 lw gp, 0x18(sp) | gp = *(var_18h);
0x00000b0c addu v0, s0, v0 | v0 = s0 + v0;
0x00000b10 addiu s3, zero, 0x2f | s3 = 0x2f;
0x00000b14 lw v1, -0x7fdc(gp) | v1 = *((gp - 8183));
0x00000b18 sb s3, (v0) | *(v0) = s3;
0x00000b1c sb zero, 1(v0) | *((v0 + 1)) = 0;
0x00000b20 lw a2, 0x10e0(v1) | a2 = *((v1 + 1080));
0x00000b24 addiu a0, v0, 1 | a0 = v0 + 1;
0x00000b28 swl a2, 4(v0) | __asm ("swl a2, 4(v0)");
0x00000b2c addiu v1, v0, 4 | v1 = v0 + 4;
0x00000b30 lw a1, 4(s5) | a1 = *((s5 + 1));
0x00000b34 lw t9, -0x7f94(gp) | t9 = sym.imp.__stpcpy_chk;
0x00000b38 swr a2, (a0) | __asm ("swr a2, (a0)");
0x00000b3c addiu a2, zero, 0x100 | a2 = 0x100;
0x00000b40 addiu a0, a0, 4 | a0 += 4;
0x00000b44 sb s3, (v1) | *(v1) = s3;
0x00000b48 sb zero, 1(v1) | *((v1 + 1)) = 0;
0x00000b4c jalr t9 | t9 ();
0x00000b50 lw gp, 0x18(sp) | gp = *(var_18h);
0x00000b54 addiu v1, v0, 1 | v1 = v0 + 1;
0x00000b58 sb s3, (v0) | *(v0) = s3;
0x00000b5c lw a0, -0x7fdc(gp) | a0 = *((gp - 8183));
0x00000b60 lw t9, -0x7fa8(gp) | t9 = sym.imp.__strcpy_chk;
0x00000b64 lw a2, 0x10e4(a0) | a2 = *(a0);
0x00000b68 addiu a0, a0, 0x10e4 | a0 += str.drivers;
0x00000b6c swl a2, 3(v1) | __asm ("swl a2, 3(v1)");
0x00000b70 lw a1, 4(a0) | a1 = *((a0 + 1));
0x00000b74 swr a2, (v1) | __asm ("swr a2, (v1)");
0x00000b78 swl a1, 7(v1) | __asm ("swl a1, 7(v1)");
0x00000b7c swr a1, 4(v1) | __asm ("swr a1, 4(v1)");
0x00000b80 sb s3, 8(v0) | *((v0 + 8)) = s3;
0x00000b84 sb zero, 9(v0) | *((v0 + 9)) = 0;
0x00000b88 lw a1, 8(s5) | a1 = *((s5 + 2));
0x00000b8c addiu a2, zero, 0x100 | a2 = 0x100;
0x00000b90 addiu a0, v0, 9 | a0 = v0 + 9;
0x00000b94 jalr t9 | t9 ();
0x00000b98 lw gp, 0x18(sp) | gp = *(var_18h);
0x00000b9c lw t9, -0x7f70(gp) | t9 = sym.imp.sysfs_open_driver_path;
0x00000ba0 move a0, s0 | a0 = s0;
0x00000ba4 jalr t9 | t9 ();
0x00000ba8 move s4, v0 | s4 = v0;
0x00000bac lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 == 0) {
0x00000bb0 beqz v0, 0xd28 | goto label_3;
| }
0x00000bb4 lw t9, -0x7f80(gp) | t9 = sym.imp.sysfs_get_driver_devices;
0x00000bb8 move a0, v0 | a0 = v0;
0x00000bbc jalr t9 | t9 ();
0x00000bc0 lw gp, 0x18(sp) | gp = *(var_18h);
0x00000bc4 move s0, v0 | s0 = v0;
0x00000bc8 lw s3, -0x7fa4(gp) | s3 = *((gp - 8169));
| if (v0 == 0) {
0x00000bcc beqz v0, 0xd04 | goto label_4;
| }
0x00000bd0 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000bd4 lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000bd8 lw a3, 8(s5) | a3 = *((s5 + 2));
0x00000bdc lw a0, (s3) | a0 = *(s3);
0x00000be0 addiu a2, a2, 0x1104 | a2 += str._s_is_used_by:_n;
0x00000be4 addiu a1, zero, 1 | a1 = 1;
0x00000be8 jalr t9 | t9 ();
0x00000bec lw gp, 0x18(sp) | gp = *(var_18h);
0x00000bf0 lw t9, -0x7f88(gp) | t9 = sym.imp.dlist_start;
0x00000bf4 move a0, s0 | a0 = s0;
0x00000bf8 jalr t9 | t9 ();
0x00000bfc lw gp, 0x18(sp) | gp = *(var_18h);
0x00000c00 move a0, s0 | a0 = s0;
0x00000c04 lw t9, -0x7f74(gp) | t9 = sym.imp._dlist_mark_move;
0x00000c08 addiu a1, zero, 1 | a1 = 1;
0x00000c0c jalr t9 | t9 ();
0x00000c10 lw a0, 0x1c(s0) | a0 = *((s0 + 7));
0x00000c14 lw v1, (s0) | v1 = *(s0);
0x00000c18 lw gp, 0x18(sp) | gp = *(var_18h);
| if (a0 == v1) {
0x00000c1c beq a0, v1, 0xc64 | goto label_5;
| }
0x00000c20 lw s5, -0x7fdc(gp) | s5 = *((gp - 8183));
0x00000c24 addiu s5, s5, 0x1114 | s5 += str._t_t_s_n;
| do {
0x00000c28 lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000c2c lw a0, (s3) | a0 = *(s3);
0x00000c30 addiu a3, v0, 0x144 | a3 = v0 + 0x144;
0x00000c34 move a2, s5 | a2 = s5;
0x00000c38 addiu a1, zero, 1 | a1 = 1;
0x00000c3c jalr t9 | t9 ();
0x00000c40 lw gp, 0x18(sp) | gp = *(var_18h);
0x00000c44 move a0, s0 | a0 = s0;
0x00000c48 lw t9, -0x7f74(gp) | t9 = sym.imp._dlist_mark_move;
0x00000c4c addiu a1, zero, 1 | a1 = 1;
0x00000c50 jalr t9 | t9 ();
0x00000c54 lw a0, (s0) | a0 = *(s0);
0x00000c58 lw v1, 0x1c(s0) | v1 = *((s0 + 7));
0x00000c5c lw gp, 0x18(sp) | gp = *(var_18h);
0x00000c60 bne a0, v1, 0xc28 |
| } while (a0 != v1);
| do {
| label_5:
0x00000c64 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000c68 lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000c6c lw a0, (s3) | a0 = *(s3);
0x00000c70 addiu v0, s4, 0x144 | v0 = s4 + 0x144;
0x00000c74 move a3, s4 | a3 = s4;
0x00000c78 addiu a2, a2, 0x1144 | a2 += str.driver__s_is_on_bus__s_n;
0x00000c7c addiu a1, zero, 1 | a1 = 1;
0x00000c80 sw v0, 0x10(sp) | *(var_10h_2) = v0;
0x00000c84 jalr t9 | t9 ();
0x00000c88 lw gp, 0x18(sp) | gp = *(var_18h);
0x00000c8c lw t9, -0x7f8c(gp) | t9 = sym.imp.sysfs_get_driver_module;
0x00000c90 move a0, s4 | a0 = s4;
0x00000c94 jalr t9 | t9 ();
0x00000c98 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 != 0) {
0x00000c9c beqz v0, 0xcc4 |
0x00000ca0 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000ca4 lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000ca8 lw a0, (s3) | a0 = *(s3);
0x00000cac move a3, s4 | a3 = s4;
0x00000cb0 sw v0, 0x10(sp) | *(var_10h_2) = v0;
0x00000cb4 addiu a2, a2, 0x115c | a2 += str._s_is_using_the_module__s_n;
0x00000cb8 addiu a1, zero, 1 | a1 = 1;
0x00000cbc jalr t9 | t9 ();
0x00000cc0 lw gp, 0x18(sp) | gp = *(var_18h);
| }
0x00000cc4 lw t9, -0x7fb4(gp) | t9 = sym.imp.sysfs_close_driver;
0x00000cc8 move a0, s4 | a0 = s4;
0x00000ccc jalr t9 | t9 ();
0x00000cd0 lw gp, 0x18(sp) | gp = *(var_18h);
0x00000cd4 b 0xa90 | goto label_0;
| label_2:
0x00000cd8 lw v0, -0x7fa4(gp) | v0 = *((gp - 8169));
0x00000cdc lw a0, -0x7fdc(gp) | a0 = *((gp - 8183));
0x00000ce0 lw t9, -0x7f7c(gp) | t9 = sym.imp.fwrite;
0x00000ce4 lw a3, (v0) | a3 = *(v0);
0x00000ce8 addiu a2, zero, 0x13 | a2 = 0x13;
0x00000cec addiu a1, zero, 1 | a1 = 1;
0x00000cf0 addiu a0, a0, 0x10cc | a0 += str.Sysfs_not_mounted__n;
0x00000cf4 jalr t9 | t9 ();
0x00000cf8 addiu s2, zero, 1 | s2 = 1;
0x00000cfc lw gp, 0x18(sp) | gp = *(var_18h);
0x00000d00 b 0xa90 | goto label_0;
| label_4:
0x00000d04 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000d08 lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000d0c lw a3, 8(s5) | a3 = *((s5 + 2));
0x00000d10 lw a0, (s3) | a0 = *(s3);
0x00000d14 addiu a2, a2, 0x111c | a2 += str._s_is_presently_not_used_by_any_device_n;
0x00000d18 addiu a1, zero, 1 | a1 = 1;
0x00000d1c jalr t9 | t9 ();
0x00000d20 lw gp, 0x18(sp) | gp = *(var_18h);
0x00000d24 b 0xc64 |
| } while (1);
| label_3:
0x00000d28 lw v0, -0x7fa4(gp) | v0 = *((gp - 8169));
0x00000d2c lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000d30 lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000d34 lw a3, 4(s5) | a3 = *((s5 + 1));
0x00000d38 lw a0, (v0) | a0 = *(v0);
0x00000d3c addiu a2, a2, 0x10ec | a2 += str.Driver__s_not_found_n;
0x00000d40 addiu a1, zero, 1 | a1 = 1;
0x00000d44 jalr t9 | t9 ();
0x00000d48 addiu s2, zero, 1 | s2 = 1;
0x00000d4c lw gp, 0x18(sp) | gp = *(var_18h);
0x00000d50 b 0xa90 | goto label_0;
| label_1:
0x00000d54 lw t9, -0x7f78(gp) | t9 = sym.imp.__stack_chk_fail;
0x00000d58 jalr t9 | t9 ();
0x00000d5c nop |
| }
[*] Function fprintf used 7 times get_driver