[*] Binary protection state of ubirmvol
Partial RELRO No Canary found NX disabled No PIE No RPATH No RUNPATH No Symbols
[*] Function sprintf tear down of ubirmvol
; 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/ubirmvol @ 0x111f8 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.000111f8 () | void fcn_000111f8 (int32_t arg1, int32_t arg2) {
| int32_t var_14h_2;
| int32_t var_14h;
| r0 = arg1;
| r1 = arg2;
0x000111f8 push {r4, r5, r6, r7, fp, lr} |
0x000111fc add fp, sp, 0x14 |
0x00011200 mov r6, r1 | r6 = r1;
0x00011204 mov r7, r2 | r7 = r2;
0x00011208 mov r4, r3 | r4 = r3;
0x0001120c mov r5, r0 | r5 = r0;
0x00011210 bl 0x109a0 | strlen (r0);
0x00011214 mov r3, r7 | r3 = r7;
0x00011218 mov r2, r6 | r2 = r6;
0x0001121c mov r1, r5 | r1 = r5;
0x00011220 add r0, r0, 0x6b | r0 += 0x6b;
0x00011224 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00011228 sub sp, sp, r0 |
0x0001122c mov r0, sp | r0 = sp;
0x00011230 bl 0x1097c | sprintf (r0, r1, r2)
0x00011234 mov r1, r4 | r1 = r4;
0x00011238 mov r0, sp | r0 = sp;
0x0001123c bl 0x1113c | fcn_0001113c (r0, r1);
0x00011240 sub sp, fp, 0x14 |
0x00011244 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/ubirmvol @ 0x1169c */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.0001169c () | void fcn_0001169c (int32_t arg2, char * s) {
| int32_t var_14h_2;
| int32_t var_14h;
| r1 = arg2;
| r0 = s;
0x0001169c push {r4, r5, r6, r7, fp, lr} |
0x000116a0 ldr r4, [r0] | r4 = *(r0);
0x000116a4 add fp, sp, 0x14 |
0x000116a8 mov r0, r4 | r0 = r4;
0x000116ac mov r6, r3 | r6 = r3;
0x000116b0 mov r7, r1 | r7 = r1;
0x000116b4 mov r5, r2 | r5 = r2;
0x000116b8 bl 0x109a0 | strlen (r0);
0x000116bc mov r2, r7 | r2 = r7;
0x000116c0 mov r1, r4 | r1 = r4;
0x000116c4 add r0, r0, 0x39 | r0 += 0x39;
0x000116c8 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x000116cc sub sp, sp, r0 |
0x000116d0 mov r0, sp | r0 = sp;
0x000116d4 bl 0x1097c | sprintf (r0, r1, r2)
0x000116d8 mov r2, r6 | r2 = r6;
0x000116dc mov r1, r5 | r1 = r5;
0x000116e0 mov r0, sp | r0 = sp;
0x000116e4 bl 0x115c4 | fcn_000115c4 (r0, r1);
0x000116e8 sub sp, fp, 0x14 |
0x000116ec 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/ubirmvol @ 0x12070 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00012070 () | void fcn_00012070 (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;
0x00012070 push {r4, r5, r6, r7, r8, sb, sl, fp, lr} |
0x00012074 add fp, sp, 0x20 |
0x00012078 sub sp, sp, 0x9c |
0x0001207c mov r6, r0 | r6 = r0;
0x00012080 ldr r0, [r0, 0x40] | r0 = *((r0 + 0x40));
0x00012084 mov r5, r1 | r5 = r1;
0x00012088 bl 0x109a0 | strlen (r0);
0x0001208c sub r1, fp, 0x8c | r1 -= var_8ch;
0x00012090 add r0, r0, 0x6b | r0 += 0x6b;
0x00012094 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012098 sub sp, sp, r0 |
0x0001209c mov r0, r5 | r0 = r5;
0x000120a0 bl 0x10874 | r0 = stat64 ();
0x000120a4 cmp r0, 0 |
| if (r0 == 0) {
0x000120a8 beq 0x12100 | goto label_5;
| }
0x000120ac bl 0x10988 | errno_location ();
0x000120b0 ldr r6, [pc, 0x1e8] | r6 = *(0x1229c);
0x000120b4 mov r3, r5 | r3 = r5;
0x000120b8 ldr r2, [pc, 0x1e4] | r2 = stderr;
0x000120bc ldr r1, [pc, 0x1e4] | r1 = "libubi";
0x000120c0 ldr r4, [r0] | r4 = *(r0);
0x000120c4 ldr r0, [r6] | r0 = *(0x1229c);
0x000120c8 bl 0x108ec | fprintf (r0, "libubi", r2, r3, r4, r5, r6);
0x000120cc mov r0, r4 | r0 = r4;
0x000120d0 ldr r5, [r6] | r5 = *(0x1229c);
0x000120d4 bl 0x10868 | strerror (r0);
0x000120d8 str r4, [sp] | *(sp) = r4;
0x000120dc ldr r3, [pc, 0x1c8] | r3 = "_s:_error_:_cannot_get_information_about___s_";
0x000120e0 mov r2, 8 | r2 = 8;
0x000120e4 ldr r1, [pc, 0x1c4] | r1 = *(0x122ac);
0x000120e8 str r0, [sp, 4] | var_4h = r0;
0x000120ec mov r0, r5 | r0 = r5;
0x000120f0 bl 0x108ec | fprintf (r0, r1, r2, "_s:_error_:_cannot_get_information_about___s_", r4);
| do {
| label_0:
0x000120f4 mvn r0, 0 | r0 = ~0;
| label_4:
0x000120f8 sub sp, fp, 0x20 |
0x000120fc pop {r4, r5, r6, r7, r8, sb, sl, fp, pc} |
| label_5:
0x00012100 ldr r3, [fp, -0x7c] | r3 = var_7ch;
0x00012104 and r3, r3, 0xf000 | r3 &= 0xf000;
0x00012108 cmp r3, 0x2000 |
| if (r3 == 0x2000) {
0x0001210c beq 0x12138 | goto label_6;
| }
0x00012110 ldr r0, [pc, 0x188] |
0x00012114 mov r3, r5 | r3 = r5;
0x00012118 ldr r2, [pc, 0x184] | r2 = stderr;
0x0001211c ldr r1, [pc, 0x190] | r1 = "%*serror %d (%s)\n";
0x00012120 ldr r0, [r0] | r0 = *(0x1229c);
0x00012124 bl 0x108ec | r0 = fprintf (r0, "%*serror %d (%s)\n", r2, r3);
0x00012128 bl 0x10988 | errno_location ();
0x0001212c mov r3, 0x16 | r3 = 0x16;
| label_1:
0x00012130 str r3, [r0] | *(r0) = r3;
0x00012134 b 0x120f4 |
| } while (1);
| label_6:
0x00012138 ldrd r2, r3, [fp, -0x6c] | __asm ("ldrd r2, r3, [var_6ch]");
0x0001213c mov r1, r3 | r1 = r3;
0x00012140 mov r0, r2 | r0 = r2;
0x00012144 strd r2, r3, [fp, -0xb4] | __asm ("strd r2, r3, [var_b4h]");
0x00012148 bl 0x1088c | gnu_dev_major ();
0x0001214c ldrd r2, r3, [fp, -0xb4] | __asm ("ldrd r2, r3, [var_b4h]");
0x00012150 mov r1, r3 | r1 = r3;
0x00012154 mov sb, r0 | sb = r0;
0x00012158 mov r0, r2 | r0 = r2;
0x0001215c bl 0x108c8 | gnu_dev_minor ();
0x00012160 sub r1, fp, 0xa4 | r1 -= var_a4h;
0x00012164 mov r7, r0 | r7 = r0;
0x00012168 mov r0, r6 | r0 = r6;
0x0001216c bl 0x11d40 | r0 = fcn_00011d40 (r0, r1);
0x00012170 cmp r0, 0 |
| if (r0 != 0) {
0x00012174 addeq r8, sp, 8 | r8 += var_b4h;
| }
| if (r0 != 0) {
0x00012178 ldreq r4, [fp, -0xa0] | r4 = var_a0h;
| }
| if (r0 == 0) {
0x0001217c addeq sl, r6, 0x18 | sl = r6 + 0x18;
| goto label_7;
| }
| if (r0 != 0) {
| label_7:
0x00012180 bne 0x120f4 | goto label_0;
| }
| do {
0x00012184 ldr r3, [fp, -0x9c] | r3 = var_9ch;
0x00012188 cmp r4, r3 |
| if (r4 > r3) {
0x0001218c bgt 0x12204 | goto label_8;
| }
0x00012190 sub r3, fp, 0xa8 | r3 -= var_a8h;
0x00012194 sub r2, fp, 0xac | r2 -= var_ach;
0x00012198 mov r1, r4 | r1 = r4;
0x0001219c mov r0, sl | r0 = sl;
0x000121a0 bl 0x1169c | r0 = fcn_0001169c (r0, r1);
0x000121a4 cmp r0, 0 |
| if (r0 == 0) {
0x000121a8 beq 0x121f8 | goto label_9;
| }
0x000121ac bl 0x10988 | r0 = errno_location ();
0x000121b0 ldr r3, [r0] | r3 = *(r0);
0x000121b4 cmp r3, 2 |
| if (r3 != 2) {
0x000121b8 bne 0x121c4 | goto label_10;
| }
| label_2:
0x000121bc add r4, r4, 1 | r4++;
0x000121c0 b 0x12184 |
| } while (1);
| label_10:
0x000121c4 cmp r3, 0 |
| if (r3 != 0) {
0x000121c8 bne 0x120f4 | goto label_0;
| }
| label_3:
0x000121cc ldr r0, [pc, 0xcc] |
0x000121d0 mov r3, r5 | r3 = r5;
0x000121d4 str r7, [sp, 4] | var_4h = r7;
0x000121d8 str sb, [sp] | *(sp) = sb;
0x000121dc ldr r2, [pc, 0xc0] | r2 = stderr;
0x000121e0 ldr r1, [pc, 0xd0] | r1 = "_s:_error_:___s__is_not_a_character_device";
0x000121e4 ldr r0, [r0] | r0 = *(0x1229c);
0x000121e8 bl 0x108ec | r0 = fprintf (r0, "_s:_error_:___s__is_not_a_character_device", r2, r3);
0x000121ec bl 0x10988 | errno_location ();
0x000121f0 mov r3, 0x13 | r3 = 0x13;
0x000121f4 b 0x12130 | goto label_1;
| label_9:
0x000121f8 ldr r3, [fp, -0xac] | r3 = var_ach;
0x000121fc cmp r3, sb |
| if (r3 != sb) {
0x00012200 bne 0x121bc | goto label_2;
| }
| label_8:
0x00012204 ldr r3, [fp, -0x9c] | r3 = var_9ch;
0x00012208 cmp r4, r3 |
| if (r4 > r3) {
0x0001220c bgt 0x121cc | goto label_3;
| }
0x00012210 cmp r7, 0 |
| if (r7 == 0) {
0x00012214 moveq r0, 1 | r0 = 1;
| goto label_11;
| }
| if (r7 == 0) {
| label_11:
0x00012218 beq 0x120f8 | goto label_4;
| }
0x0001221c sub r3, r7, 1 | r3 = r7 - 1;
0x00012220 mov r2, r4 | r2 = r4;
0x00012224 ldr r1, [r6, 0x40] | r1 = *((r6 + 0x40));
0x00012228 mov r0, r8 | r0 = r8;
0x0001222c bl 0x1097c | sprintf (r0, r1, r2)
0x00012230 mov r1, 0 | r1 = 0;
0x00012234 mov r0, r8 | r0 = r8;
0x00012238 bl 0x10958 | r0 = open64 ();
0x0001223c cmn r0, 1 |
| if (r0 == 1) {
0x00012240 beq 0x121cc | goto label_3;
| }
0x00012244 bl 0x109d0 | r0 = close (r0);
0x00012248 cmp r0, 0 |
| if (r0 != 0) {
0x0001224c beq 0x12298 |
0x00012250 bl 0x10988 | errno_location ();
0x00012254 ldr r5, [pc, 0x44] |
0x00012258 mov r3, r8 | r3 = r8;
0x0001225c ldr r2, [pc, 0x40] | r2 = stderr;
0x00012260 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";
0x00012264 ldr r4, [r0] | r4 = *(r0);
0x00012268 ldr r0, [r5] | r0 = *(0x1229c);
0x0001226c bl 0x108ec | 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);
0x00012270 mov r0, r4 | r0 = r4;
0x00012274 ldr r5, [r5] | r5 = *(0x1229c);
0x00012278 bl 0x10868 | strerror (r0);
0x0001227c str r4, [sp] | *(sp) = r4;
0x00012280 ldr r3, [pc, 0x24] | r3 = "_s:_error_:_cannot_get_information_about___s_";
0x00012284 mov r2, 8 | r2 = 8;
0x00012288 ldr r1, [pc, 0x20] | r1 = *(0x122ac);
0x0001228c str r0, [sp, 4] | var_4h = r0;
0x00012290 mov r0, r5 | r0 = r5;
0x00012294 bl 0x108ec | fprintf (r0, r1, r2, "_s:_error_:_cannot_get_information_about___s_", r4);
| }
0x00012298 mov r0, 2 | r0 = 2;
0x0001229c b 0x120f8 | 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/ubirmvol @ 0x12678 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00012678 () | void fcn_00012678 (int32_t arg2, char * s) {
| int32_t var_74h;
| int32_t var_ch_2;
| int32_t var_ch;
| r1 = arg2;
| r0 = s;
0x00012678 push {r4, r5, fp, lr} |
0x0001267c add fp, sp, 0xc |
0x00012680 sub sp, sp, 0x68 |
0x00012684 ldr r4, [r0, 0x10] | r4 = *((r0 + 0x10));
0x00012688 mov r5, r1 | r5 = r1;
0x0001268c mov r0, r4 | r0 = r4;
0x00012690 bl 0x109a0 | strlen (r0);
0x00012694 mov r2, r5 | r2 = r5;
0x00012698 mov r1, r4 | r1 = r4;
0x0001269c add r0, r0, 0x39 | r0 += 0x39;
0x000126a0 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x000126a4 sub sp, sp, r0 |
0x000126a8 mov r0, sp | r0 = sp;
0x000126ac bl 0x1097c | sprintf (r0, r1, r2)
0x000126b0 sub r1, fp, 0x74 | r1 -= var_74h;
0x000126b4 mov r0, sp | r0 = sp;
0x000126b8 bl 0x10874 | r0 = stat64 ();
0x000126bc clz r0, r0 | r0 &= r0;
0x000126c0 lsr r0, r0, 5 | r0 >>= 5;
0x000126c4 sub sp, fp, 0xc |
0x000126c8 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/ubirmvol @ 0x126cc */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.000126cc () | void fcn_000126cc (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;
0x000126cc push {r4, r5, r6, r7, r8, sb, sl, fp, lr} |
0x000126d0 add sl, r2, 4 | sl = r2 + 4;
0x000126d4 add fp, sp, 0x20 |
0x000126d8 sub sp, sp, 0x114 |
0x000126dc mov r6, r1 | r6 = r1;
0x000126e0 mov r5, r0 | r5 = r0;
0x000126e4 mov r4, r2 | r4 = r2;
0x000126e8 mov r1, 0 | r1 = 0;
0x000126ec mov r2, 0x54 | r2 = 0x54;
0x000126f0 mov r0, sl | r0 = sl;
0x000126f4 bl 0x1094c | memset (r0, r1, r2);
0x000126f8 str r6, [r4] | *(r4) = r6;
0x000126fc mov r1, r6 | r1 = r6;
0x00012700 mov r0, r5 | r0 = r5;
0x00012704 bl 0x12678 | r0 = fcn_00012678 (r0, r1);
0x00012708 cmp r0, 0 |
0x0001270c bne 0x12718 |
| while (r8 == r0) {
| label_0:
0x00012710 mvn r0, 0 | r0 = ~0;
0x00012714 b 0x129dc | goto label_3;
0x00012718 ldr r0, [r5, 0xc] | r0 = *((r5 + 0xc));
0x0001271c bl 0x10964 | r0 = opendir ();
0x00012720 subs r8, r0, 0 | r8 = r0 - 0;
0x00012724 beq 0x12710 |
| }
0x00012728 mvn r3, 0x80000000 | r3 = ~0x80000000;
0x0001272c str r3, [r4, 0xc] | *((r4 + 0xc)) = r3;
0x00012730 bl 0x10988 | r0 = errno_location ();
0x00012734 mov sb, r0 | sb = r0;
| do {
| label_1:
0x00012738 mov r3, 0 | r3 = 0;
0x0001273c str r3, [sb] | *(sb) = r3;
0x00012740 mov r0, r8 | r0 = r8;
0x00012744 bl 0x10928 | r0 = readdir64 ();
0x00012748 cmp r0, 0 |
| if (r0 == 0) {
0x0001274c beq 0x127e8 | goto label_4;
| }
0x00012750 add r7, r0, 0x13 | r7 = r0 + 0x13;
0x00012754 mov r0, r7 | r0 = r7;
0x00012758 bl 0x109a0 | r0 = strlen (r0);
0x0001275c cmp r0, 0xfe |
| if (r0 >= 0xfe) {
0x00012760 bls 0x1278c |
0x00012764 ldr r0, [pc, 0x278] |
0x00012768 str r7, [sp] | *(sp) = r7;
0x0001276c ldr r2, [pc, 0x274] | r2 = stderr;
0x00012770 ldr r3, [r5, 0xc] | r3 = *((r5 + 0xc));
0x00012774 ldr r1, [pc, 0x270] | r1 = "libubi";
0x00012778 ldr r0, [r0] | r0 = *(0x129e0);
0x0001277c bl 0x108ec | fprintf (r0, "libubi", r2, r3);
| label_2:
0x00012780 mov r0, r8 | r0 = r8;
0x00012784 bl 0x109b8 | closedir ();
0x00012788 b 0x12710 | goto label_0;
| }
0x0001278c sub r3, fp, 0x124 | r3 -= var_124h;
0x00012790 str r3, [sp] | *(sp) = r3;
0x00012794 sub r2, fp, 0x128 | r2 -= var_128h;
0x00012798 sub r3, fp, 0x12c | r3 -= s;
0x0001279c ldr r1, [pc, 0x24c] | r1 = "_s:_error_:_invalid_entry_in__s:___s_";
0x000127a0 mov r0, r7 | r0 = r7;
0x000127a4 bl 0x10934 | r0 = sscanf (r0, "_s:_error_:_invalid_entry_in__s:___s_", r2);
0x000127a8 cmp r0, 2 |
0x000127ac bne 0x12738 |
| } while (r0 != 2);
0x000127b0 ldr r3, [fp, -0x128] | r3 = var_128h;
0x000127b4 cmp r3, r6 |
| if (r3 != r6) {
0x000127b8 bne 0x12738 | goto label_1;
| }
0x000127bc ldr r3, [r4, 8] | r3 = *((r4 + 8));
0x000127c0 ldr r2, [r4, 0x10] | r2 = *((r4 + 0x10));
0x000127c4 add r3, r3, 1 | r3++;
0x000127c8 str r3, [r4, 8] | *((r4 + 8)) = r3;
0x000127cc ldr r3, [fp, -0x12c] | r3 = s;
0x000127d0 cmp r2, r3 |
0x000127d4 ldr r2, [r4, 0xc] | r2 = *((r4 + 0xc));
| if (r2 >= r3) {
0x000127d8 strlt r3, [r4, 0x10] | *((r4 + 0x10)) = r3;
| }
0x000127dc cmp r3, r2 |
| if (r3 >= r2) {
0x000127e0 strlt r3, [r4, 0xc] | *((r4 + 0xc)) = r3;
| }
0x000127e4 b 0x12738 | goto label_1;
| label_4:
0x000127e8 ldr r7, [sb] | r7 = *(sb);
0x000127ec cmp r7, 0 |
| if (r7 != 0) {
0x000127f0 beq 0x12838 |
0x000127f4 ldr r4, [pc, 0x1e8] |
0x000127f8 ldr r3, [r5, 0xc] | r3 = *((r5 + 0xc));
0x000127fc ldr r2, [pc, 0x1e4] | r2 = stderr;
0x00012800 ldr r1, [pc, 0x1ec] | r1 = "ubi_d__d_s";
0x00012804 ldr r0, [r4] | r0 = *(0x129e0);
0x00012808 bl 0x108ec | fprintf (r0, "ubi_d__d_s", r2, r3, r4);
0x0001280c mov r0, r7 | r0 = r7;
0x00012810 ldr r4, [r4] | r4 = *(0x129e0);
0x00012814 bl 0x10868 | strerror (r0);
0x00012818 str r7, [sp] | *(sp) = r7;
0x0001281c ldr r3, [pc, 0x1d4] | r3 = "%s: error!: readdir failed on \"%s\"\n";
0x00012820 mov r2, 8 | r2 = 8;
0x00012824 ldr r1, [pc, 0x1d0] | r1 = *(0x129f8);
0x00012828 str r0, [sp, 4] | var_4h = r0;
0x0001282c mov r0, r4 | r0 = r4;
0x00012830 bl 0x108ec | fprintf (r0, r1, r2, "%s: error!: readdir failed on \"%s\"\n");
0x00012834 b 0x12780 | goto label_2;
| }
0x00012838 mov r0, r8 | r0 = r8;
0x0001283c bl 0x109b8 | r0 = closedir ();
0x00012840 cmp r0, 0 |
| if (r0 != 0) {
0x00012844 beq 0x12890 |
0x00012848 ldr r6, [pc, 0x194] | r6 = *(0x129e0);
0x0001284c ldr r4, [sb] | r4 = *(sb);
0x00012850 ldr r3, [r5, 0xc] | r3 = *((r5 + 0xc));
0x00012854 ldr r2, [pc, 0x18c] | r2 = stderr;
0x00012858 ldr r1, [pc, 0x1a0] | r1 = "%*serror %d (%s)\n";
0x0001285c ldr r0, [r6] | r0 = *(0x129e0);
0x00012860 bl 0x108ec | fprintf (r0, "%*serror %d (%s)\n", r2, r3, r4, r5, r6);
0x00012864 mov r0, r4 | r0 = r4;
0x00012868 ldr r5, [r6] | r5 = *(0x129e0);
0x0001286c bl 0x10868 | strerror (r0);
0x00012870 str r4, [sp] | *(sp) = r4;
0x00012874 ldr r3, [pc, 0x17c] | r3 = "%s: error!: readdir failed on \"%s\"\n";
0x00012878 mov r2, 8 | r2 = 8;
0x0001287c ldr r1, [pc, 0x178] | r1 = *(0x129f8);
0x00012880 str r0, [sp, 4] | var_4h = r0;
0x00012884 mov r0, r5 | r0 = r5;
0x00012888 bl 0x108ec | fprintf (r0, r1, r2, "%s: error!: readdir failed on \"%s\"\n", r4);
0x0001288c b 0x12710 | goto label_0;
| }
0x00012890 ldr r3, [r4, 0xc] | r3 = *((r4 + 0xc));
0x00012894 add r2, r4, 0x14 | r2 = r4 + 0x14;
0x00012898 cmn r3, 0x80000001 |
| if (r3 != 0x80000001) {
0x0001289c streq r0, [r4, 0xc] | *((r4 + 0xc)) = r0;
| }
0x000128a0 add r3, r4, 0x18 | r3 = r4 + 0x18;
0x000128a4 mov r1, r6 | r1 = r6;
0x000128a8 add r0, r5, 0x18 | r0 = r5 + 0x18;
0x000128ac bl 0x1169c | r0 = fcn_0001169c (r0, r1);
0x000128b0 cmp r0, 0 |
| if (r0 != 0) {
0x000128b4 bne 0x12710 | goto label_0;
| }
0x000128b8 mov r2, sl | r2 = sl;
0x000128bc mov r1, r6 | r1 = r6;
0x000128c0 ldr r0, [r5, 0x3c] | r0 = *((r5 + 0x3c));
0x000128c4 bl 0x111b0 | r0 = fcn_000111b0 (r0, r1);
0x000128c8 cmp r0, 0 |
| if (r0 != 0) {
0x000128cc bne 0x12710 | goto label_0;
| }
0x000128d0 add r2, r4, 0x20 | r2 = r4 + 0x20;
0x000128d4 mov r1, r6 | r1 = r6;
0x000128d8 ldr r0, [r5, 0x1c] | r0 = *((r5 + 0x1c));
0x000128dc bl 0x111b0 | r0 = fcn_000111b0 (r0, r1);
0x000128e0 cmp r0, 0 |
| if (r0 != 0) {
0x000128e4 bne 0x12710 | goto label_0;
| }
0x000128e8 add r2, r4, 0x1c | r2 = r4 + 0x1c;
0x000128ec mov r1, r6 | r1 = r6;
0x000128f0 ldr r0, [r5, 0x20] | r0 = *((r5 + 0x20));
0x000128f4 bl 0x111b0 | r0 = fcn_000111b0 (r0, r1);
0x000128f8 cmp r0, 0 |
| if (r0 != 0) {
0x000128fc bne 0x12710 | goto label_0;
| }
0x00012900 add r2, r4, 0x38 | r2 = r4 + 0x38;
0x00012904 mov r1, r6 | r1 = r6;
0x00012908 ldr r0, [r5, 0x24] | r0 = *((r5 + 0x24));
0x0001290c bl 0x111b0 | r0 = fcn_000111b0 (r0, r1);
0x00012910 cmp r0, 0 |
| if (r0 != 0) {
0x00012914 bne 0x12710 | goto label_0;
| }
0x00012918 add r2, r4, 0x3c | r2 = r4 + 0x3c;
0x0001291c mov r1, r6 | r1 = r6;
0x00012920 ldr r0, [r5, 0x28] | r0 = *((r5 + 0x28));
0x00012924 bl 0x111b0 | r0 = fcn_000111b0 (r0, r1);
0x00012928 cmp r0, 0 |
| if (r0 != 0) {
0x0001292c bne 0x12710 | goto label_0;
| }
0x00012930 add r2, r4, 0x48 | r2 = r4 + 0x48;
0x00012934 mov r1, r6 | r1 = r6;
0x00012938 ldr r0, [r5, 0x30] | r0 = *((r5 + 0x30));
0x0001293c bl 0x111b0 | r0 = fcn_000111b0 (r0, r1);
0x00012940 cmp r0, 0 |
| if (r0 != 0) {
0x00012944 bne 0x12710 | goto label_0;
| }
0x00012948 ldr r8, [r5, 0x2c] | r8 = *((r5 + 0x2c));
0x0001294c mov sb, sp | sb = sp;
0x00012950 mov r0, r8 | r0 = r8;
0x00012954 bl 0x109a0 | strlen (r0);
0x00012958 mov r2, r6 | r2 = r6;
0x0001295c mov r1, r8 | r1 = r8;
0x00012960 add r0, r0, 0x39 | r0 += 0x39;
0x00012964 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012968 sub sp, sp, r0 |
0x0001296c add r7, sp, 8 | r7 += s;
0x00012970 mov r0, r7 | r0 = r7;
0x00012974 bl 0x1097c | sprintf (r0, r1, r2)
0x00012978 add r1, r4, 0x40 | r1 = r4 + 0x40;
0x0001297c mov r0, r7 | r0 = r7;
0x00012980 bl 0x10f8c | fcn_00010f8c (r0, r1);
0x00012984 mov sp, sb |
0x00012988 cmp r0, 0 |
| if (r0 != 0) {
0x0001298c bne 0x12710 | goto label_0;
| }
0x00012990 add r2, r4, 0x4c | r2 = r4 + 0x4c;
0x00012994 mov r1, r6 | r1 = r6;
0x00012998 ldr r0, [r5, 0x34] | r0 = *((r5 + 0x34));
0x0001299c bl 0x111b0 | r0 = fcn_000111b0 (r0, r1);
0x000129a0 cmp r0, 0 |
| if (r0 != 0) {
0x000129a4 bne 0x12710 | goto label_0;
| }
0x000129a8 add r2, r4, 0x50 | r2 = r4 + 0x50;
0x000129ac mov r1, r6 | r1 = r6;
0x000129b0 ldr r0, [r5, 0x38] | r0 = *((r5 + 0x38));
0x000129b4 bl 0x111b0 | r0 = fcn_000111b0 (r0, r1);
0x000129b8 cmp r0, 0 |
| if (r0 != 0) {
0x000129bc bne 0x12710 | goto label_0;
| }
0x000129c0 ldr r3, [r4, 0x3c] | r3 = *((r4 + 0x3c));
0x000129c4 ldr r2, [r4, 0x20] | r2 = *((r4 + 0x20));
0x000129c8 smull r6, r7, r2, r3 | r6:r7 = r2 * r3;
0x000129cc ldr r2, [r4, 0x1c] | r2 = *((r4 + 0x1c));
0x000129d0 strd r6, r7, [r4, 0x30] | __asm ("strd r6, r7, [r4, 0x30]");
0x000129d4 smull r6, r7, r2, r3 | r6:r7 = r2 * r3;
0x000129d8 strd r6, r7, [r4, 0x28] | __asm ("strd r6, r7, [r4, 0x28]");
| label_3:
0x000129dc sub sp, fp, 0x20 |
0x000129e0 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/ubirmvol @ 0x12bf4 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00012bf4 () | void fcn_00012bf4 (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;
0x00012bf4 push {r4, r5, r6, r7, r8, sb, sl, fp, lr} |
0x00012bf8 add sb, r3, 8 | sb = r3 + 8;
0x00012bfc add fp, sp, 0x20 |
0x00012c00 sub sp, sp, 0x3c |
0x00012c04 mov r5, r1 | r5 = r1;
0x00012c08 mov r6, r2 | r6 = r2;
0x00012c0c mov r1, 0 | r1 = 0;
0x00012c10 mov r2, 0xb0 | r2 = 0xb0;
0x00012c14 mov r7, r0 | r7 = r0;
0x00012c18 mov r0, sb | r0 = sb;
0x00012c1c mov r4, r3 | r4 = r3;
0x00012c20 bl 0x1094c | memset (r0, r1, r2);
0x00012c24 ldr sl, [r7, 0x48] | sl = *((r7 + 0x48));
0x00012c28 stm r4, {r5, r6} | *(r4) = r5;
| *((r4 + 4)) = r6;
0x00012c2c mov r0, sl | r0 = sl;
0x00012c30 bl 0x109a0 | strlen (r0);
0x00012c34 mov r8, sp | r8 = sp;
0x00012c38 mov r3, r6 | r3 = r6;
0x00012c3c mov r2, r5 | r2 = r5;
0x00012c40 mov r1, sl | r1 = sl;
0x00012c44 add r0, r0, 0x6b | r0 += 0x6b;
0x00012c48 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012c4c sub sp, sp, r0 |
0x00012c50 mov r0, sp | r0 = sp;
0x00012c54 bl 0x1097c | sprintf (r0, r1, r2)
0x00012c58 mov r0, sp | r0 = sp;
0x00012c5c add r2, r4, 0xc | r2 = r4 + 0xc;
0x00012c60 mov r1, sb | r1 = sb;
0x00012c64 bl 0x115c4 | fcn_000115c4 (r0, r1);
0x00012c68 mov sp, r8 |
0x00012c6c cmp r0, 0 |
0x00012c70 beq 0x12c84 |
| while (r8 < r0) {
| label_0:
0x00012c74 mvn r8, 0 | r8 = ~0;
| label_1:
0x00012c78 mov r0, r8 | r0 = r8;
0x00012c7c sub sp, fp, 0x20 |
0x00012c80 pop {r4, r5, r6, r7, r8, sb, sl, fp, pc} |
0x00012c84 ldr sb, [r7, 0x44] | sb = *((r7 + 0x44));
0x00012c88 mov r0, sb | r0 = sb;
0x00012c8c bl 0x109a0 | strlen (r0);
0x00012c90 mov r3, r6 | r3 = r6;
0x00012c94 mov r2, r5 | r2 = r5;
0x00012c98 mov r1, sb | r1 = sb;
0x00012c9c add r0, r0, 0x6b | r0 += 0x6b;
0x00012ca0 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012ca4 sub sp, sp, r0 |
0x00012ca8 mov r0, sp | r0 = sp;
0x00012cac bl 0x1097c | sprintf (r0, r1, r2)
0x00012cb0 mov r0, sp | r0 = sp;
0x00012cb4 mov r2, 0x32 | r2 = 0x32;
0x00012cb8 sub r1, fp, 0x58 | r1 -= s1;
0x00012cbc bl 0x11248 | fcn_00011248 (r0, r1);
0x00012cc0 mov sp, r8 |
0x00012cc4 subs r8, r0, 0 | r8 = r0 - 0;
0x00012cc8 blt 0x12c74 |
| }
0x00012ccc mov r2, r8 | r2 = r8;
0x00012cd0 ldr r1, [pc, 0x174] | r1 = *(0x12e48);
0x00012cd4 sub r0, fp, 0x58 | r0 -= s1;
0x00012cd8 bl 0x10910 | r0 = strncmp (r0, r1, r2);
0x00012cdc cmp r0, 0 |
| if (r0 != 0) {
0x00012ce0 moveq r3, 4 | r3 = 4;
| }
| if (r0 != 0) {
0x00012ce4 beq 0x12d04 |
0x00012ce8 mov r2, r8 | r2 = r8;
0x00012cec ldr r1, [pc, 0x15c] | r1 = "static";
0x00012cf0 sub r0, fp, 0x58 | r0 -= s1;
0x00012cf4 bl 0x10910 | r0 = strncmp (r0, "static", r2);
0x00012cf8 cmp r0, 0 |
| if (r0 != 0) {
0x00012cfc bne 0x12e24 | goto label_2;
| }
0x00012d00 mov r3, 3 | r3 = 3;
| }
0x00012d04 str r3, [r4, 0x10] | *((r4 + 0x10)) = r3;
0x00012d08 mov r2, r6 | r2 = r6;
0x00012d0c add r3, r4, 0x14 | r3 = r4 + 0x14;
0x00012d10 mov r1, r5 | r1 = r5;
0x00012d14 ldr r0, [r7, 0x4c] | r0 = *((r7 + 0x4c));
0x00012d18 bl 0x111f8 | r0 = fcn_000111f8 (r0, r1);
0x00012d1c cmp r0, 0 |
| if (r0 != 0) {
0x00012d20 bne 0x12c74 | goto label_0;
| }
0x00012d24 ldr r8, [r7, 0x50] | r8 = *((r7 + 0x50));
0x00012d28 mov sb, sp | sb = sp;
0x00012d2c mov r0, r8 | r0 = r8;
0x00012d30 bl 0x109a0 | strlen (r0);
0x00012d34 mov r3, r6 | r3 = r6;
0x00012d38 mov r2, r5 | r2 = r5;
0x00012d3c mov r1, r8 | r1 = r8;
0x00012d40 add r0, r0, 0x6b | r0 += 0x6b;
0x00012d44 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012d48 sub sp, sp, r0 |
0x00012d4c mov r0, sp | r0 = sp;
0x00012d50 bl 0x1097c | sprintf (r0, r1, r2)
0x00012d54 mov r0, sp | r0 = sp;
0x00012d58 add r1, r4, 0x18 | r1 = r4 + 0x18;
0x00012d5c bl 0x10f8c | fcn_00010f8c (r0, r1);
0x00012d60 mov sp, sb |
0x00012d64 cmp r0, 0 |
| if (r0 != 0) {
0x00012d68 bne 0x12c74 | goto label_0;
| }
0x00012d6c add r3, r4, 0x28 | r3 = r4 + 0x28;
0x00012d70 mov r2, r6 | r2 = r6;
0x00012d74 mov r1, r5 | r1 = r5;
0x00012d78 ldr r0, [r7, 0x54] | r0 = *((r7 + 0x54));
0x00012d7c bl 0x111f8 | r0 = fcn_000111f8 (r0, r1);
0x00012d80 cmp r0, 0 |
| if (r0 != 0) {
0x00012d84 bne 0x12c74 | goto label_0;
| }
0x00012d88 add r3, r4, 0x2c | r3 = r4 + 0x2c;
0x00012d8c mov r2, r6 | r2 = r6;
0x00012d90 mov r1, r5 | r1 = r5;
0x00012d94 ldr r0, [r7, 0x58] | r0 = *((r7 + 0x58));
0x00012d98 bl 0x111f8 | r0 = fcn_000111f8 (r0, r1);
0x00012d9c cmp r0, 0 |
| if (r0 != 0) {
0x00012da0 bne 0x12c74 | goto label_0;
| }
0x00012da4 add r3, r4, 0x30 | r3 = r4 + 0x30;
0x00012da8 mov r2, r6 | r2 = r6;
0x00012dac mov r1, r5 | r1 = r5;
0x00012db0 ldr r0, [r7, 0x5c] | r0 = *((r7 + 0x5c));
0x00012db4 bl 0x111f8 | r0 = fcn_000111f8 (r0, r1);
0x00012db8 subs r8, r0, 0 | r8 = r0 - 0;
| if (r8 != r0) {
0x00012dbc bne 0x12c74 | goto label_0;
| }
0x00012dc0 ldr r1, [r4, 0x28] | r1 = *((r4 + 0x28));
0x00012dc4 ldr r0, [r4, 0x2c] | r0 = *((r4 + 0x2c));
0x00012dc8 ldr r7, [r7, 0x60] | r7 = *((r7 + 0x60));
0x00012dcc smull r2, r3, r0, r1 | r2:r3 = r0 * r1;
0x00012dd0 mov r0, r7 | r0 = r7;
0x00012dd4 strd r2, r3, [r4, 0x20] | __asm ("strd r2, r3, [r4, 0x20]");
0x00012dd8 bl 0x109a0 | strlen (r0);
0x00012ddc mov r3, r6 | r3 = r6;
0x00012de0 mov r2, r5 | r2 = r5;
0x00012de4 mov r1, r7 | r1 = r7;
0x00012de8 add r0, r0, 0x6b | r0 += 0x6b;
0x00012dec bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012df0 sub sp, sp, r0 |
0x00012df4 mov r0, sp | r0 = sp;
0x00012df8 bl 0x1097c | sprintf (r0, r1, r2)
0x00012dfc mov r0, sp | r0 = sp;
0x00012e00 mov r2, 0x81 | r2 = 0x81;
0x00012e04 add r1, r4, 0x34 | r1 = r4 + 0x34;
0x00012e08 bl 0x11248 | fcn_00011248 (r0, r1);
0x00012e0c mov sp, sb |
0x00012e10 cmp r0, 0 |
| if (r0 < 0) {
0x00012e14 blt 0x12c74 | goto label_0;
| }
0x00012e18 add r4, r4, r0 | r4 += r0;
0x00012e1c strb r8, [r4, 0x33] | *((r4 + 0x33)) = r8;
0x00012e20 b 0x12c78 | goto label_1;
| label_2:
0x00012e24 ldr r0, [pc, 0x28] |
0x00012e28 sub r3, fp, 0x58 | r3 -= s1;
0x00012e2c ldr r2, [pc, 0x24] | r2 = stderr;
0x00012e30 ldr r1, [pc, 0x24] | r1 = "libubi";
0x00012e34 ldr r0, [r0] | r0 = "dynamic";
0x00012e38 bl 0x108ec | r0 = fprintf ("dynamic", "libubi", r2, r3);
0x00012e3c bl 0x10988 | errno_location ();
0x00012e40 mov r3, 0x16 | r3 = 0x16;
0x00012e44 str r3, [r0] | *(r0) = r3;
0x00012e48 b 0x12c74 | goto label_0;
| }
[*] Function sprintf used 10 times ubirmvol