[*] Binary protection state of ubiattach
Partial RELRO No Canary found NX disabled No PIE No RPATH No RUNPATH No Symbols
[*] Function sprintf tear down of ubiattach
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/56048-12514271.gzip_extract/gzip.uncompressed_extract/5243916-15068666.gzip_extract/gzip.uncompressed_extract/usr/sbin/ubiattach @ 0x117e8 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.000117e8 () | void fcn_000117e8 (int32_t arg1, int32_t arg2) {
| int32_t var_14h_2;
| int32_t var_14h;
| r0 = arg1;
| r1 = arg2;
0x000117e8 push {r4, r5, r6, r7, fp, lr} |
0x000117ec add fp, sp, 0x14 |
0x000117f0 mov r6, r1 | r6 = r1;
0x000117f4 mov r7, r2 | r7 = r2;
0x000117f8 mov r4, r3 | r4 = r3;
0x000117fc mov r5, r0 | r5 = r0;
0x00011800 bl 0x10b3c | strlen (r0);
0x00011804 mov r3, r7 | r3 = r7;
0x00011808 mov r2, r6 | r2 = r6;
0x0001180c mov r1, r5 | r1 = r5;
0x00011810 add r0, r0, 0x6b | r0 += 0x6b;
0x00011814 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00011818 sub sp, sp, r0 |
0x0001181c mov r0, sp | r0 = sp;
0x00011820 bl 0x10b18 | sprintf (r0, r1, r2)
0x00011824 mov r1, r4 | r1 = r4;
0x00011828 mov r0, sp | r0 = sp;
0x0001182c bl 0x1172c | fcn_0001172c (r0, r1);
0x00011830 sub sp, fp, 0x14 |
0x00011834 pop {r4, r5, r6, r7, fp, pc} |
| }
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/56048-12514271.gzip_extract/gzip.uncompressed_extract/5243916-15068666.gzip_extract/gzip.uncompressed_extract/usr/sbin/ubiattach @ 0x11c8c */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00011c8c () | void fcn_00011c8c (int32_t arg2, char * s) {
| int32_t var_14h_2;
| int32_t var_14h;
| r1 = arg2;
| r0 = s;
0x00011c8c push {r4, r5, r6, r7, fp, lr} |
0x00011c90 ldr r4, [r0] | r4 = *(r0);
0x00011c94 add fp, sp, 0x14 |
0x00011c98 mov r0, r4 | r0 = r4;
0x00011c9c mov r6, r3 | r6 = r3;
0x00011ca0 mov r7, r1 | r7 = r1;
0x00011ca4 mov r5, r2 | r5 = r2;
0x00011ca8 bl 0x10b3c | strlen (r0);
0x00011cac mov r2, r7 | r2 = r7;
0x00011cb0 mov r1, r4 | r1 = r4;
0x00011cb4 add r0, r0, 0x39 | r0 += 0x39;
0x00011cb8 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00011cbc sub sp, sp, r0 |
0x00011cc0 mov r0, sp | r0 = sp;
0x00011cc4 bl 0x10b18 | sprintf (r0, r1, r2)
0x00011cc8 mov r2, r6 | r2 = r6;
0x00011ccc mov r1, r5 | r1 = r5;
0x00011cd0 mov r0, sp | r0 = sp;
0x00011cd4 bl 0x11bb4 | fcn_00011bb4 (r0, r1);
0x00011cd8 sub sp, fp, 0x14 |
0x00011cdc pop {r4, r5, r6, r7, fp, pc} |
| }
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/56048-12514271.gzip_extract/gzip.uncompressed_extract/5243916-15068666.gzip_extract/gzip.uncompressed_extract/usr/sbin/ubiattach @ 0x12660 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00012660 () | void fcn_00012660 (int32_t arg2, char * s) {
| int32_t var_b4h;
| int32_t var_ach;
| int32_t var_a8h;
| int32_t var_a4h;
| int32_t var_a0h;
| int32_t var_9ch;
| int32_t var_8ch;
| int32_t var_7ch;
| int32_t var_6ch;
| int32_t var_0h;
| int32_t var_4h;
| int32_t var_sp_b4h;
| int32_t var_sp_6ch;
| int32_t var_20h_2;
| int32_t var_20h;
| r1 = arg2;
| r0 = s;
0x00012660 push {r4, r5, r6, r7, r8, sb, sl, fp, lr} |
0x00012664 add fp, sp, 0x20 |
0x00012668 sub sp, sp, 0x9c |
0x0001266c mov r6, r0 | r6 = r0;
0x00012670 ldr r0, [r0, 0x40] | r0 = *((r0 + 0x40));
0x00012674 mov r5, r1 | r5 = r1;
0x00012678 bl 0x10b3c | strlen (r0);
0x0001267c sub r1, fp, 0x8c | r1 -= var_8ch;
0x00012680 add r0, r0, 0x6b | r0 += 0x6b;
0x00012684 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012688 sub sp, sp, r0 |
0x0001268c mov r0, r5 | r0 = r5;
0x00012690 bl 0x109e0 | r0 = stat64 ();
0x00012694 cmp r0, 0 |
| if (r0 == 0) {
0x00012698 beq 0x126f0 | goto label_5;
| }
0x0001269c bl 0x10b24 | errno_location ();
0x000126a0 ldr r6, [pc, 0x1e8] | r6 = *(0x1288c);
0x000126a4 mov r3, r5 | r3 = r5;
0x000126a8 ldr r2, [pc, 0x1e4] | r2 = stderr;
0x000126ac ldr r1, [pc, 0x1e4] | r1 = "libubi";
0x000126b0 ldr r4, [r0] | r4 = *(r0);
0x000126b4 ldr r0, [r6] | r0 = *(0x1288c);
0x000126b8 bl 0x10a64 | fprintf (r0, "libubi", r2, r3, r4, r5, r6);
0x000126bc mov r0, r4 | r0 = r4;
0x000126c0 ldr r5, [r6] | r5 = *(0x1288c);
0x000126c4 bl 0x109d4 | strerror (r0);
0x000126c8 str r4, [sp] | *(sp) = r4;
0x000126cc ldr r3, [pc, 0x1c8] | r3 = "_s:_error_:_cannot_get_information_about___s_";
0x000126d0 mov r2, 8 | r2 = 8;
0x000126d4 ldr r1, [pc, 0x1c4] | r1 = *(0x1289c);
0x000126d8 str r0, [sp, 4] | var_4h = r0;
0x000126dc mov r0, r5 | r0 = r5;
0x000126e0 bl 0x10a64 | fprintf (r0, r1, r2, "_s:_error_:_cannot_get_information_about___s_", r4);
| do {
| label_0:
0x000126e4 mvn r0, 0 | r0 = ~0;
| label_4:
0x000126e8 sub sp, fp, 0x20 |
0x000126ec pop {r4, r5, r6, r7, r8, sb, sl, fp, pc} |
| label_5:
0x000126f0 ldr r3, [fp, -0x7c] | r3 = var_7ch;
0x000126f4 and r3, r3, 0xf000 | r3 &= 0xf000;
0x000126f8 cmp r3, 0x2000 |
| if (r3 == 0x2000) {
0x000126fc beq 0x12728 | goto label_6;
| }
0x00012700 ldr r0, [pc, 0x188] |
0x00012704 mov r3, r5 | r3 = r5;
0x00012708 ldr r2, [pc, 0x184] | r2 = stderr;
0x0001270c ldr r1, [pc, 0x190] | r1 = "_serror__d___s_";
0x00012710 ldr r0, [r0] | r0 = *(0x1288c);
0x00012714 bl 0x10a64 | r0 = fprintf (r0, "_serror__d___s_", r2, r3);
0x00012718 bl 0x10b24 | errno_location ();
0x0001271c mov r3, 0x16 | r3 = 0x16;
| label_1:
0x00012720 str r3, [r0] | *(r0) = r3;
0x00012724 b 0x126e4 |
| } while (1);
| label_6:
0x00012728 ldrd r2, r3, [fp, -0x6c] | __asm ("ldrd r2, r3, [var_6ch]");
0x0001272c mov r1, r3 | r1 = r3;
0x00012730 mov r0, r2 | r0 = r2;
0x00012734 strd r2, r3, [fp, -0xb4] | __asm ("strd r2, r3, [var_b4h]");
0x00012738 bl 0x10a04 | gnu_dev_major ();
0x0001273c ldrd r2, r3, [fp, -0xb4] | __asm ("ldrd r2, r3, [var_b4h]");
0x00012740 mov r1, r3 | r1 = r3;
0x00012744 mov sb, r0 | sb = r0;
0x00012748 mov r0, r2 | r0 = r2;
0x0001274c bl 0x10a40 | gnu_dev_minor ();
0x00012750 sub r1, fp, 0xa4 | r1 -= var_a4h;
0x00012754 mov r7, r0 | r7 = r0;
0x00012758 mov r0, r6 | r0 = r6;
0x0001275c bl 0x12330 | r0 = fcn_00012330 (r0, r1);
0x00012760 cmp r0, 0 |
| if (r0 != 0) {
0x00012764 addeq r8, sp, 8 | r8 += var_b4h;
| }
| if (r0 != 0) {
0x00012768 ldreq r4, [fp, -0xa0] | r4 = var_a0h;
| }
| if (r0 == 0) {
0x0001276c addeq sl, r6, 0x18 | sl = r6 + 0x18;
| goto label_7;
| }
| if (r0 != 0) {
| label_7:
0x00012770 bne 0x126e4 | goto label_0;
| }
| do {
0x00012774 ldr r3, [fp, -0x9c] | r3 = var_9ch;
0x00012778 cmp r4, r3 |
| if (r4 > r3) {
0x0001277c bgt 0x127f4 | goto label_8;
| }
0x00012780 sub r3, fp, 0xa8 | r3 -= var_a8h;
0x00012784 sub r2, fp, 0xac | r2 -= var_ach;
0x00012788 mov r1, r4 | r1 = r4;
0x0001278c mov r0, sl | r0 = sl;
0x00012790 bl 0x11c8c | r0 = fcn_00011c8c (r0, r1);
0x00012794 cmp r0, 0 |
| if (r0 == 0) {
0x00012798 beq 0x127e8 | goto label_9;
| }
0x0001279c bl 0x10b24 | r0 = errno_location ();
0x000127a0 ldr r3, [r0] | r3 = *(r0);
0x000127a4 cmp r3, 2 |
| if (r3 != 2) {
0x000127a8 bne 0x127b4 | goto label_10;
| }
| label_2:
0x000127ac add r4, r4, 1 | r4++;
0x000127b0 b 0x12774 |
| } while (1);
| label_10:
0x000127b4 cmp r3, 0 |
| if (r3 != 0) {
0x000127b8 bne 0x126e4 | goto label_0;
| }
| label_3:
0x000127bc ldr r0, [pc, 0xcc] |
0x000127c0 mov r3, r5 | r3 = r5;
0x000127c4 str r7, [sp, 4] | var_4h = r7;
0x000127c8 str sb, [sp] | *(sp) = sb;
0x000127cc ldr r2, [pc, 0xc0] | r2 = stderr;
0x000127d0 ldr r1, [pc, 0xd0] | r1 = "%s: error!: \"%s\" is not a character device\n";
0x000127d4 ldr r0, [r0] | r0 = *(0x1288c);
0x000127d8 bl 0x10a64 | r0 = fprintf (r0, "%s: error!: \"%s\" is not a character device\n", r2, r3);
0x000127dc bl 0x10b24 | errno_location ();
0x000127e0 mov r3, 0x13 | r3 = 0x13;
0x000127e4 b 0x12720 | goto label_1;
| label_9:
0x000127e8 ldr r3, [fp, -0xac] | r3 = var_ach;
0x000127ec cmp r3, sb |
| if (r3 != sb) {
0x000127f0 bne 0x127ac | goto label_2;
| }
| label_8:
0x000127f4 ldr r3, [fp, -0x9c] | r3 = var_9ch;
0x000127f8 cmp r4, r3 |
| if (r4 > r3) {
0x000127fc bgt 0x127bc | goto label_3;
| }
0x00012800 cmp r7, 0 |
| if (r7 == 0) {
0x00012804 moveq r0, 1 | r0 = 1;
| goto label_11;
| }
| if (r7 == 0) {
| label_11:
0x00012808 beq 0x126e8 | goto label_4;
| }
0x0001280c sub r3, r7, 1 | r3 = r7 - 1;
0x00012810 mov r2, r4 | r2 = r4;
0x00012814 ldr r1, [r6, 0x40] | r1 = *((r6 + 0x40));
0x00012818 mov r0, r8 | r0 = r8;
0x0001281c bl 0x10b18 | sprintf (r0, r1, r2)
0x00012820 mov r1, 0 | r1 = 0;
0x00012824 mov r0, r8 | r0 = r8;
0x00012828 bl 0x10af4 | r0 = open64 ();
0x0001282c cmn r0, 1 |
| if (r0 == 1) {
0x00012830 beq 0x127bc | goto label_3;
| }
0x00012834 bl 0x10b6c | r0 = close (r0);
0x00012838 cmp r0, 0 |
| if (r0 != 0) {
0x0001283c beq 0x12888 |
0x00012840 bl 0x10b24 | errno_location ();
0x00012844 ldr r5, [pc, 0x44] |
0x00012848 mov r3, r8 | r3 = r8;
0x0001284c ldr r2, [pc, 0x40] | r2 = stderr;
0x00012850 ldr r1, [pc, 0x54] | r1 = "%s: error!: \"%s\" has major:minor %d:%d, but this does not correspond to any existing UBI device or volume\n";
0x00012854 ldr r4, [r0] | r4 = *(r0);
0x00012858 ldr r0, [r5] | r0 = *(0x1288c);
0x0001285c bl 0x10a64 | fprintf (r0, "%s: error!: \"%s\" has major:minor %d:%d, but this does not correspond to any existing UBI device or volume\n", r2, r3, r4, r5);
0x00012860 mov r0, r4 | r0 = r4;
0x00012864 ldr r5, [r5] | r5 = *(0x1288c);
0x00012868 bl 0x109d4 | strerror (r0);
0x0001286c str r4, [sp] | *(sp) = r4;
0x00012870 ldr r3, [pc, 0x24] | r3 = "_s:_error_:_cannot_get_information_about___s_";
0x00012874 mov r2, 8 | r2 = 8;
0x00012878 ldr r1, [pc, 0x20] | r1 = *(0x1289c);
0x0001287c str r0, [sp, 4] | var_4h = r0;
0x00012880 mov r0, r5 | r0 = r5;
0x00012884 bl 0x10a64 | fprintf (r0, r1, r2, "_s:_error_:_cannot_get_information_about___s_", r4);
| }
0x00012888 mov r0, 2 | r0 = 2;
0x0001288c b 0x126e8 | goto label_4;
| }
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/56048-12514271.gzip_extract/gzip.uncompressed_extract/5243916-15068666.gzip_extract/gzip.uncompressed_extract/usr/sbin/ubiattach @ 0x12c68 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00012c68 () | void fcn_00012c68 (int32_t arg2, char * s) {
| int32_t var_74h;
| int32_t var_ch_2;
| int32_t var_ch;
| r1 = arg2;
| r0 = s;
0x00012c68 push {r4, r5, fp, lr} |
0x00012c6c add fp, sp, 0xc |
0x00012c70 sub sp, sp, 0x68 |
0x00012c74 ldr r4, [r0, 0x10] | r4 = *((r0 + 0x10));
0x00012c78 mov r5, r1 | r5 = r1;
0x00012c7c mov r0, r4 | r0 = r4;
0x00012c80 bl 0x10b3c | strlen (r0);
0x00012c84 mov r2, r5 | r2 = r5;
0x00012c88 mov r1, r4 | r1 = r4;
0x00012c8c add r0, r0, 0x39 | r0 += 0x39;
0x00012c90 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012c94 sub sp, sp, r0 |
0x00012c98 mov r0, sp | r0 = sp;
0x00012c9c bl 0x10b18 | sprintf (r0, r1, r2)
0x00012ca0 sub r1, fp, 0x74 | r1 -= var_74h;
0x00012ca4 mov r0, sp | r0 = sp;
0x00012ca8 bl 0x109e0 | r0 = stat64 ();
0x00012cac clz r0, r0 | r0 &= r0;
0x00012cb0 lsr r0, r0, 5 | r0 >>= 5;
0x00012cb4 sub sp, fp, 0xc |
0x00012cb8 pop {r4, r5, fp, pc} |
| }
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/56048-12514271.gzip_extract/gzip.uncompressed_extract/5243916-15068666.gzip_extract/gzip.uncompressed_extract/usr/sbin/ubiattach @ 0x12cbc */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00012cbc () | void fcn_00012cbc (int32_t arg1, int32_t arg2) {
| int32_t var_128h;
| int32_t var_124h;
| int32_t var_0h;
| int32_t var_4h;
| char * s;
| int32_t var_20h_2;
| int32_t var_20h;
| r0 = arg1;
| r1 = arg2;
0x00012cbc push {r4, r5, r6, r7, r8, sb, sl, fp, lr} |
0x00012cc0 add sl, r2, 4 | sl = r2 + 4;
0x00012cc4 add fp, sp, 0x20 |
0x00012cc8 sub sp, sp, 0x114 |
0x00012ccc mov r6, r1 | r6 = r1;
0x00012cd0 mov r5, r0 | r5 = r0;
0x00012cd4 mov r4, r2 | r4 = r2;
0x00012cd8 mov r1, 0 | r1 = 0;
0x00012cdc mov r2, 0x54 | r2 = 0x54;
0x00012ce0 mov r0, sl | r0 = sl;
0x00012ce4 bl 0x10adc | memset (r0, r1, r2);
0x00012ce8 str r6, [r4] | *(r4) = r6;
0x00012cec mov r1, r6 | r1 = r6;
0x00012cf0 mov r0, r5 | r0 = r5;
0x00012cf4 bl 0x12c68 | r0 = fcn_00012c68 (r0, r1);
0x00012cf8 cmp r0, 0 |
0x00012cfc bne 0x12d08 |
| while (r8 == r0) {
| label_0:
0x00012d00 mvn r0, 0 | r0 = ~0;
0x00012d04 b 0x12fcc | goto label_3;
0x00012d08 ldr r0, [r5, 0xc] | r0 = *((r5 + 0xc));
0x00012d0c bl 0x10b00 | r0 = opendir ();
0x00012d10 subs r8, r0, 0 | r8 = r0 - 0;
0x00012d14 beq 0x12d00 |
| }
0x00012d18 mvn r3, 0x80000000 | r3 = ~0x80000000;
0x00012d1c str r3, [r4, 0xc] | *((r4 + 0xc)) = r3;
0x00012d20 bl 0x10b24 | r0 = errno_location ();
0x00012d24 mov sb, r0 | sb = r0;
| do {
| label_1:
0x00012d28 mov r3, 0 | r3 = 0;
0x00012d2c str r3, [sb] | *(sb) = r3;
0x00012d30 mov r0, r8 | r0 = r8;
0x00012d34 bl 0x10aa0 | r0 = readdir64 ();
0x00012d38 cmp r0, 0 |
| if (r0 == 0) {
0x00012d3c beq 0x12dd8 | goto label_4;
| }
0x00012d40 add r7, r0, 0x13 | r7 = r0 + 0x13;
0x00012d44 mov r0, r7 | r0 = r7;
0x00012d48 bl 0x10b3c | r0 = strlen (r0);
0x00012d4c cmp r0, 0xfe |
| if (r0 >= 0xfe) {
0x00012d50 bls 0x12d7c |
0x00012d54 ldr r0, [pc, 0x278] |
0x00012d58 str r7, [sp] | *(sp) = r7;
0x00012d5c ldr r2, [pc, 0x274] | r2 = stderr;
0x00012d60 ldr r3, [r5, 0xc] | r3 = *((r5 + 0xc));
0x00012d64 ldr r1, [pc, 0x270] | r1 = "libubi";
0x00012d68 ldr r0, [r0] | r0 = *(0x12fd0);
0x00012d6c bl 0x10a64 | fprintf (r0, "libubi", r2, r3);
| label_2:
0x00012d70 mov r0, r8 | r0 = r8;
0x00012d74 bl 0x10b54 | closedir ();
0x00012d78 b 0x12d00 | goto label_0;
| }
0x00012d7c sub r3, fp, 0x124 | r3 -= var_124h;
0x00012d80 str r3, [sp] | *(sp) = r3;
0x00012d84 sub r2, fp, 0x128 | r2 -= var_128h;
0x00012d88 sub r3, fp, 0x12c | r3 -= s;
0x00012d8c ldr r1, [pc, 0x24c] | r1 = "_s:_error_:_invalid_entry_in__s:___s_";
0x00012d90 mov r0, r7 | r0 = r7;
0x00012d94 bl 0x10aac | r0 = sscanf (r0, "_s:_error_:_invalid_entry_in__s:___s_", r2);
0x00012d98 cmp r0, 2 |
0x00012d9c bne 0x12d28 |
| } while (r0 != 2);
0x00012da0 ldr r3, [fp, -0x128] | r3 = var_128h;
0x00012da4 cmp r3, r6 |
| if (r3 != r6) {
0x00012da8 bne 0x12d28 | goto label_1;
| }
0x00012dac ldr r3, [r4, 8] | r3 = *((r4 + 8));
0x00012db0 ldr r2, [r4, 0x10] | r2 = *((r4 + 0x10));
0x00012db4 add r3, r3, 1 | r3++;
0x00012db8 str r3, [r4, 8] | *((r4 + 8)) = r3;
0x00012dbc ldr r3, [fp, -0x12c] | r3 = s;
0x00012dc0 cmp r2, r3 |
0x00012dc4 ldr r2, [r4, 0xc] | r2 = *((r4 + 0xc));
| if (r2 >= r3) {
0x00012dc8 strlt r3, [r4, 0x10] | *((r4 + 0x10)) = r3;
| }
0x00012dcc cmp r3, r2 |
| if (r3 >= r2) {
0x00012dd0 strlt r3, [r4, 0xc] | *((r4 + 0xc)) = r3;
| }
0x00012dd4 b 0x12d28 | goto label_1;
| label_4:
0x00012dd8 ldr r7, [sb] | r7 = *(sb);
0x00012ddc cmp r7, 0 |
| if (r7 != 0) {
0x00012de0 beq 0x12e28 |
0x00012de4 ldr r4, [pc, 0x1e8] |
0x00012de8 ldr r3, [r5, 0xc] | r3 = *((r5 + 0xc));
0x00012dec ldr r2, [pc, 0x1e4] | r2 = stderr;
0x00012df0 ldr r1, [pc, 0x1ec] | r1 = "ubi_d__d_s";
0x00012df4 ldr r0, [r4] | r0 = *(0x12fd0);
0x00012df8 bl 0x10a64 | fprintf (r0, "ubi_d__d_s", r2, r3, r4);
0x00012dfc mov r0, r7 | r0 = r7;
0x00012e00 ldr r4, [r4] | r4 = *(0x12fd0);
0x00012e04 bl 0x109d4 | strerror (r0);
0x00012e08 str r7, [sp] | *(sp) = r7;
0x00012e0c ldr r3, [pc, 0x1d4] | r3 = "%s: error!: readdir failed on \"%s\"\n";
0x00012e10 mov r2, 8 | r2 = 8;
0x00012e14 ldr r1, [pc, 0x1d0] | r1 = *(0x12fe8);
0x00012e18 str r0, [sp, 4] | var_4h = r0;
0x00012e1c mov r0, r4 | r0 = r4;
0x00012e20 bl 0x10a64 | fprintf (r0, r1, r2, "%s: error!: readdir failed on \"%s\"\n");
0x00012e24 b 0x12d70 | goto label_2;
| }
0x00012e28 mov r0, r8 | r0 = r8;
0x00012e2c bl 0x10b54 | r0 = closedir ();
0x00012e30 cmp r0, 0 |
| if (r0 != 0) {
0x00012e34 beq 0x12e80 |
0x00012e38 ldr r6, [pc, 0x194] | r6 = *(0x12fd0);
0x00012e3c ldr r4, [sb] | r4 = *(sb);
0x00012e40 ldr r3, [r5, 0xc] | r3 = *((r5 + 0xc));
0x00012e44 ldr r2, [pc, 0x18c] | r2 = stderr;
0x00012e48 ldr r1, [pc, 0x1a0] | r1 = "_serror__d___s_";
0x00012e4c ldr r0, [r6] | r0 = *(0x12fd0);
0x00012e50 bl 0x10a64 | fprintf (r0, "_serror__d___s_", r2, r3, r4, r5, r6);
0x00012e54 mov r0, r4 | r0 = r4;
0x00012e58 ldr r5, [r6] | r5 = *(0x12fd0);
0x00012e5c bl 0x109d4 | strerror (r0);
0x00012e60 str r4, [sp] | *(sp) = r4;
0x00012e64 ldr r3, [pc, 0x17c] | r3 = "%s: error!: readdir failed on \"%s\"\n";
0x00012e68 mov r2, 8 | r2 = 8;
0x00012e6c ldr r1, [pc, 0x178] | r1 = *(0x12fe8);
0x00012e70 str r0, [sp, 4] | var_4h = r0;
0x00012e74 mov r0, r5 | r0 = r5;
0x00012e78 bl 0x10a64 | fprintf (r0, r1, r2, "%s: error!: readdir failed on \"%s\"\n", r4);
0x00012e7c b 0x12d00 | goto label_0;
| }
0x00012e80 ldr r3, [r4, 0xc] | r3 = *((r4 + 0xc));
0x00012e84 add r2, r4, 0x14 | r2 = r4 + 0x14;
0x00012e88 cmn r3, 0x80000001 |
| if (r3 != 0x80000001) {
0x00012e8c streq r0, [r4, 0xc] | *((r4 + 0xc)) = r0;
| }
0x00012e90 add r3, r4, 0x18 | r3 = r4 + 0x18;
0x00012e94 mov r1, r6 | r1 = r6;
0x00012e98 add r0, r5, 0x18 | r0 = r5 + 0x18;
0x00012e9c bl 0x11c8c | r0 = fcn_00011c8c (r0, r1);
0x00012ea0 cmp r0, 0 |
| if (r0 != 0) {
0x00012ea4 bne 0x12d00 | goto label_0;
| }
0x00012ea8 mov r2, sl | r2 = sl;
0x00012eac mov r1, r6 | r1 = r6;
0x00012eb0 ldr r0, [r5, 0x3c] | r0 = *((r5 + 0x3c));
0x00012eb4 bl 0x117a0 | r0 = fcn_000117a0 (r0, r1);
0x00012eb8 cmp r0, 0 |
| if (r0 != 0) {
0x00012ebc bne 0x12d00 | goto label_0;
| }
0x00012ec0 add r2, r4, 0x20 | r2 = r4 + 0x20;
0x00012ec4 mov r1, r6 | r1 = r6;
0x00012ec8 ldr r0, [r5, 0x1c] | r0 = *((r5 + 0x1c));
0x00012ecc bl 0x117a0 | r0 = fcn_000117a0 (r0, r1);
0x00012ed0 cmp r0, 0 |
| if (r0 != 0) {
0x00012ed4 bne 0x12d00 | goto label_0;
| }
0x00012ed8 add r2, r4, 0x1c | r2 = r4 + 0x1c;
0x00012edc mov r1, r6 | r1 = r6;
0x00012ee0 ldr r0, [r5, 0x20] | r0 = *((r5 + 0x20));
0x00012ee4 bl 0x117a0 | r0 = fcn_000117a0 (r0, r1);
0x00012ee8 cmp r0, 0 |
| if (r0 != 0) {
0x00012eec bne 0x12d00 | goto label_0;
| }
0x00012ef0 add r2, r4, 0x38 | r2 = r4 + 0x38;
0x00012ef4 mov r1, r6 | r1 = r6;
0x00012ef8 ldr r0, [r5, 0x24] | r0 = *((r5 + 0x24));
0x00012efc bl 0x117a0 | r0 = fcn_000117a0 (r0, r1);
0x00012f00 cmp r0, 0 |
| if (r0 != 0) {
0x00012f04 bne 0x12d00 | goto label_0;
| }
0x00012f08 add r2, r4, 0x3c | r2 = r4 + 0x3c;
0x00012f0c mov r1, r6 | r1 = r6;
0x00012f10 ldr r0, [r5, 0x28] | r0 = *((r5 + 0x28));
0x00012f14 bl 0x117a0 | r0 = fcn_000117a0 (r0, r1);
0x00012f18 cmp r0, 0 |
| if (r0 != 0) {
0x00012f1c bne 0x12d00 | goto label_0;
| }
0x00012f20 add r2, r4, 0x48 | r2 = r4 + 0x48;
0x00012f24 mov r1, r6 | r1 = r6;
0x00012f28 ldr r0, [r5, 0x30] | r0 = *((r5 + 0x30));
0x00012f2c bl 0x117a0 | r0 = fcn_000117a0 (r0, r1);
0x00012f30 cmp r0, 0 |
| if (r0 != 0) {
0x00012f34 bne 0x12d00 | goto label_0;
| }
0x00012f38 ldr r8, [r5, 0x2c] | r8 = *((r5 + 0x2c));
0x00012f3c mov sb, sp | sb = sp;
0x00012f40 mov r0, r8 | r0 = r8;
0x00012f44 bl 0x10b3c | strlen (r0);
0x00012f48 mov r2, r6 | r2 = r6;
0x00012f4c mov r1, r8 | r1 = r8;
0x00012f50 add r0, r0, 0x39 | r0 += 0x39;
0x00012f54 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012f58 sub sp, sp, r0 |
0x00012f5c add r7, sp, 8 | r7 += s;
0x00012f60 mov r0, r7 | r0 = r7;
0x00012f64 bl 0x10b18 | sprintf (r0, r1, r2)
0x00012f68 add r1, r4, 0x40 | r1 = r4 + 0x40;
0x00012f6c mov r0, r7 | r0 = r7;
0x00012f70 bl 0x1157c | fcn_0001157c (r0, r1);
0x00012f74 mov sp, sb |
0x00012f78 cmp r0, 0 |
| if (r0 != 0) {
0x00012f7c bne 0x12d00 | goto label_0;
| }
0x00012f80 add r2, r4, 0x4c | r2 = r4 + 0x4c;
0x00012f84 mov r1, r6 | r1 = r6;
0x00012f88 ldr r0, [r5, 0x34] | r0 = *((r5 + 0x34));
0x00012f8c bl 0x117a0 | r0 = fcn_000117a0 (r0, r1);
0x00012f90 cmp r0, 0 |
| if (r0 != 0) {
0x00012f94 bne 0x12d00 | goto label_0;
| }
0x00012f98 add r2, r4, 0x50 | r2 = r4 + 0x50;
0x00012f9c mov r1, r6 | r1 = r6;
0x00012fa0 ldr r0, [r5, 0x38] | r0 = *((r5 + 0x38));
0x00012fa4 bl 0x117a0 | r0 = fcn_000117a0 (r0, r1);
0x00012fa8 cmp r0, 0 |
| if (r0 != 0) {
0x00012fac bne 0x12d00 | goto label_0;
| }
0x00012fb0 ldr r3, [r4, 0x3c] | r3 = *((r4 + 0x3c));
0x00012fb4 ldr r2, [r4, 0x20] | r2 = *((r4 + 0x20));
0x00012fb8 smull r6, r7, r2, r3 | r6:r7 = r2 * r3;
0x00012fbc ldr r2, [r4, 0x1c] | r2 = *((r4 + 0x1c));
0x00012fc0 strd r6, r7, [r4, 0x30] | __asm ("strd r6, r7, [r4, 0x30]");
0x00012fc4 smull r6, r7, r2, r3 | r6:r7 = r2 * r3;
0x00012fc8 strd r6, r7, [r4, 0x28] | __asm ("strd r6, r7, [r4, 0x28]");
| label_3:
0x00012fcc sub sp, fp, 0x20 |
0x00012fd0 pop {r4, r5, r6, r7, r8, sb, sl, fp, pc} |
| }
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/56048-12514271.gzip_extract/gzip.uncompressed_extract/5243916-15068666.gzip_extract/gzip.uncompressed_extract/usr/sbin/ubiattach @ 0x131e4 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.000131e4 () | void fcn_000131e4 (int32_t arg1, int32_t arg2) {
| char * s1;
| int32_t var_0h;
| int32_t var_20h_2;
| int32_t var_20h;
| r0 = arg1;
| r1 = arg2;
0x000131e4 push {r4, r5, r6, r7, r8, sb, sl, fp, lr} |
0x000131e8 add sb, r3, 8 | sb = r3 + 8;
0x000131ec add fp, sp, 0x20 |
0x000131f0 sub sp, sp, 0x3c |
0x000131f4 mov r5, r1 | r5 = r1;
0x000131f8 mov r6, r2 | r6 = r2;
0x000131fc mov r1, 0 | r1 = 0;
0x00013200 mov r2, 0xb0 | r2 = 0xb0;
0x00013204 mov r7, r0 | r7 = r0;
0x00013208 mov r0, sb | r0 = sb;
0x0001320c mov r4, r3 | r4 = r3;
0x00013210 bl 0x10adc | memset (r0, r1, r2);
0x00013214 ldr sl, [r7, 0x48] | sl = *((r7 + 0x48));
0x00013218 stm r4, {r5, r6} | *(r4) = r5;
| *((r4 + 4)) = r6;
0x0001321c mov r0, sl | r0 = sl;
0x00013220 bl 0x10b3c | strlen (r0);
0x00013224 mov r8, sp | r8 = sp;
0x00013228 mov r3, r6 | r3 = r6;
0x0001322c mov r2, r5 | r2 = r5;
0x00013230 mov r1, sl | r1 = sl;
0x00013234 add r0, r0, 0x6b | r0 += 0x6b;
0x00013238 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x0001323c sub sp, sp, r0 |
0x00013240 mov r0, sp | r0 = sp;
0x00013244 bl 0x10b18 | sprintf (r0, r1, r2)
0x00013248 mov r0, sp | r0 = sp;
0x0001324c add r2, r4, 0xc | r2 = r4 + 0xc;
0x00013250 mov r1, sb | r1 = sb;
0x00013254 bl 0x11bb4 | fcn_00011bb4 (r0, r1);
0x00013258 mov sp, r8 |
0x0001325c cmp r0, 0 |
0x00013260 beq 0x13274 |
| while (r8 < r0) {
| label_0:
0x00013264 mvn r8, 0 | r8 = ~0;
| label_1:
0x00013268 mov r0, r8 | r0 = r8;
0x0001326c sub sp, fp, 0x20 |
0x00013270 pop {r4, r5, r6, r7, r8, sb, sl, fp, pc} |
0x00013274 ldr sb, [r7, 0x44] | sb = *((r7 + 0x44));
0x00013278 mov r0, sb | r0 = sb;
0x0001327c bl 0x10b3c | strlen (r0);
0x00013280 mov r3, r6 | r3 = r6;
0x00013284 mov r2, r5 | r2 = r5;
0x00013288 mov r1, sb | r1 = sb;
0x0001328c add r0, r0, 0x6b | r0 += 0x6b;
0x00013290 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00013294 sub sp, sp, r0 |
0x00013298 mov r0, sp | r0 = sp;
0x0001329c bl 0x10b18 | sprintf (r0, r1, r2)
0x000132a0 mov r0, sp | r0 = sp;
0x000132a4 mov r2, 0x32 | r2 = 0x32;
0x000132a8 sub r1, fp, 0x58 | r1 -= s1;
0x000132ac bl 0x11838 | fcn_00011838 (r0, r1);
0x000132b0 mov sp, r8 |
0x000132b4 subs r8, r0, 0 | r8 = r0 - 0;
0x000132b8 blt 0x13264 |
| }
0x000132bc mov r2, r8 | r2 = r8;
0x000132c0 ldr r1, [pc, 0x174] | r1 = *(0x13438);
0x000132c4 sub r0, fp, 0x58 | r0 -= s1;
0x000132c8 bl 0x10a88 | r0 = strncmp (r0, r1, r2);
0x000132cc cmp r0, 0 |
| if (r0 != 0) {
0x000132d0 moveq r3, 4 | r3 = 4;
| }
| if (r0 != 0) {
0x000132d4 beq 0x132f4 |
0x000132d8 mov r2, r8 | r2 = r8;
0x000132dc ldr r1, [pc, 0x15c] | r1 = "static";
0x000132e0 sub r0, fp, 0x58 | r0 -= s1;
0x000132e4 bl 0x10a88 | r0 = strncmp (r0, "static", r2);
0x000132e8 cmp r0, 0 |
| if (r0 != 0) {
0x000132ec bne 0x13414 | goto label_2;
| }
0x000132f0 mov r3, 3 | r3 = 3;
| }
0x000132f4 str r3, [r4, 0x10] | *((r4 + 0x10)) = r3;
0x000132f8 mov r2, r6 | r2 = r6;
0x000132fc add r3, r4, 0x14 | r3 = r4 + 0x14;
0x00013300 mov r1, r5 | r1 = r5;
0x00013304 ldr r0, [r7, 0x4c] | r0 = *((r7 + 0x4c));
0x00013308 bl 0x117e8 | r0 = fcn_000117e8 (r0, r1);
0x0001330c cmp r0, 0 |
| if (r0 != 0) {
0x00013310 bne 0x13264 | goto label_0;
| }
0x00013314 ldr r8, [r7, 0x50] | r8 = *((r7 + 0x50));
0x00013318 mov sb, sp | sb = sp;
0x0001331c mov r0, r8 | r0 = r8;
0x00013320 bl 0x10b3c | strlen (r0);
0x00013324 mov r3, r6 | r3 = r6;
0x00013328 mov r2, r5 | r2 = r5;
0x0001332c mov r1, r8 | r1 = r8;
0x00013330 add r0, r0, 0x6b | r0 += 0x6b;
0x00013334 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00013338 sub sp, sp, r0 |
0x0001333c mov r0, sp | r0 = sp;
0x00013340 bl 0x10b18 | sprintf (r0, r1, r2)
0x00013344 mov r0, sp | r0 = sp;
0x00013348 add r1, r4, 0x18 | r1 = r4 + 0x18;
0x0001334c bl 0x1157c | fcn_0001157c (r0, r1);
0x00013350 mov sp, sb |
0x00013354 cmp r0, 0 |
| if (r0 != 0) {
0x00013358 bne 0x13264 | goto label_0;
| }
0x0001335c add r3, r4, 0x28 | r3 = r4 + 0x28;
0x00013360 mov r2, r6 | r2 = r6;
0x00013364 mov r1, r5 | r1 = r5;
0x00013368 ldr r0, [r7, 0x54] | r0 = *((r7 + 0x54));
0x0001336c bl 0x117e8 | r0 = fcn_000117e8 (r0, r1);
0x00013370 cmp r0, 0 |
| if (r0 != 0) {
0x00013374 bne 0x13264 | goto label_0;
| }
0x00013378 add r3, r4, 0x2c | r3 = r4 + 0x2c;
0x0001337c mov r2, r6 | r2 = r6;
0x00013380 mov r1, r5 | r1 = r5;
0x00013384 ldr r0, [r7, 0x58] | r0 = *((r7 + 0x58));
0x00013388 bl 0x117e8 | r0 = fcn_000117e8 (r0, r1);
0x0001338c cmp r0, 0 |
| if (r0 != 0) {
0x00013390 bne 0x13264 | goto label_0;
| }
0x00013394 add r3, r4, 0x30 | r3 = r4 + 0x30;
0x00013398 mov r2, r6 | r2 = r6;
0x0001339c mov r1, r5 | r1 = r5;
0x000133a0 ldr r0, [r7, 0x5c] | r0 = *((r7 + 0x5c));
0x000133a4 bl 0x117e8 | r0 = fcn_000117e8 (r0, r1);
0x000133a8 subs r8, r0, 0 | r8 = r0 - 0;
| if (r8 != r0) {
0x000133ac bne 0x13264 | goto label_0;
| }
0x000133b0 ldr r1, [r4, 0x28] | r1 = *((r4 + 0x28));
0x000133b4 ldr r0, [r4, 0x2c] | r0 = *((r4 + 0x2c));
0x000133b8 ldr r7, [r7, 0x60] | r7 = *((r7 + 0x60));
0x000133bc smull r2, r3, r0, r1 | r2:r3 = r0 * r1;
0x000133c0 mov r0, r7 | r0 = r7;
0x000133c4 strd r2, r3, [r4, 0x20] | __asm ("strd r2, r3, [r4, 0x20]");
0x000133c8 bl 0x10b3c | strlen (r0);
0x000133cc mov r3, r6 | r3 = r6;
0x000133d0 mov r2, r5 | r2 = r5;
0x000133d4 mov r1, r7 | r1 = r7;
0x000133d8 add r0, r0, 0x6b | r0 += 0x6b;
0x000133dc bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x000133e0 sub sp, sp, r0 |
0x000133e4 mov r0, sp | r0 = sp;
0x000133e8 bl 0x10b18 | sprintf (r0, r1, r2)
0x000133ec mov r0, sp | r0 = sp;
0x000133f0 mov r2, 0x81 | r2 = 0x81;
0x000133f4 add r1, r4, 0x34 | r1 = r4 + 0x34;
0x000133f8 bl 0x11838 | fcn_00011838 (r0, r1);
0x000133fc mov sp, sb |
0x00013400 cmp r0, 0 |
| if (r0 < 0) {
0x00013404 blt 0x13264 | goto label_0;
| }
0x00013408 add r4, r4, r0 | r4 += r0;
0x0001340c strb r8, [r4, 0x33] | *((r4 + 0x33)) = r8;
0x00013410 b 0x13268 | goto label_1;
| label_2:
0x00013414 ldr r0, [pc, 0x28] |
0x00013418 sub r3, fp, 0x58 | r3 -= s1;
0x0001341c ldr r2, [pc, 0x24] | r2 = stderr;
0x00013420 ldr r1, [pc, 0x24] | r1 = "libubi";
0x00013424 ldr r0, [r0] | r0 = "dynamic";
0x00013428 bl 0x10a64 | r0 = fprintf ("dynamic", "libubi", r2, r3);
0x0001342c bl 0x10b24 | errno_location ();
0x00013430 mov r3, 0x16 | r3 = 0x16;
0x00013434 str r3, [r0] | *(r0) = r3;
0x00013438 b 0x13264 | goto label_0;
| }
[*] Function sprintf used 10 times ubiattach