[*] Binary protection state of ubidetach
Partial RELRO No Canary found NX disabled No PIE No RPATH No RUNPATH No Symbols
[*] Function sprintf tear down of ubidetach
; 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/ubidetach @ 0x11260 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00011260 () | void fcn_00011260 (int32_t arg1, int32_t arg2) {
| int32_t var_14h_2;
| int32_t var_14h;
| r0 = arg1;
| r1 = arg2;
0x00011260 push {r4, r5, r6, r7, fp, lr} |
0x00011264 add fp, sp, 0x14 |
0x00011268 mov r6, r1 | r6 = r1;
0x0001126c mov r7, r2 | r7 = r2;
0x00011270 mov r4, r3 | r4 = r3;
0x00011274 mov r5, r0 | r5 = r0;
0x00011278 bl 0x109a0 | strlen (r0);
0x0001127c mov r3, r7 | r3 = r7;
0x00011280 mov r2, r6 | r2 = r6;
0x00011284 mov r1, r5 | r1 = r5;
0x00011288 add r0, r0, 0x6b | r0 += 0x6b;
0x0001128c bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00011290 sub sp, sp, r0 |
0x00011294 mov r0, sp | r0 = sp;
0x00011298 bl 0x1097c | sprintf (r0, r1, r2)
0x0001129c mov r1, r4 | r1 = r4;
0x000112a0 mov r0, sp | r0 = sp;
0x000112a4 bl 0x111a4 | fcn_000111a4 (r0, r1);
0x000112a8 sub sp, fp, 0x14 |
0x000112ac 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/ubidetach @ 0x11704 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00011704 () | void fcn_00011704 (int32_t arg2, char * s) {
| int32_t var_14h_2;
| int32_t var_14h;
| r1 = arg2;
| r0 = s;
0x00011704 push {r4, r5, r6, r7, fp, lr} |
0x00011708 ldr r4, [r0] | r4 = *(r0);
0x0001170c add fp, sp, 0x14 |
0x00011710 mov r0, r4 | r0 = r4;
0x00011714 mov r6, r3 | r6 = r3;
0x00011718 mov r7, r1 | r7 = r1;
0x0001171c mov r5, r2 | r5 = r2;
0x00011720 bl 0x109a0 | strlen (r0);
0x00011724 mov r2, r7 | r2 = r7;
0x00011728 mov r1, r4 | r1 = r4;
0x0001172c add r0, r0, 0x39 | r0 += 0x39;
0x00011730 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00011734 sub sp, sp, r0 |
0x00011738 mov r0, sp | r0 = sp;
0x0001173c bl 0x1097c | sprintf (r0, r1, r2)
0x00011740 mov r2, r6 | r2 = r6;
0x00011744 mov r1, r5 | r1 = r5;
0x00011748 mov r0, sp | r0 = sp;
0x0001174c bl 0x1162c | fcn_0001162c (r0, r1);
0x00011750 sub sp, fp, 0x14 |
0x00011754 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/ubidetach @ 0x120d8 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.000120d8 () | void fcn_000120d8 (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;
0x000120d8 push {r4, r5, r6, r7, r8, sb, sl, fp, lr} |
0x000120dc add fp, sp, 0x20 |
0x000120e0 sub sp, sp, 0x9c |
0x000120e4 mov r6, r0 | r6 = r0;
0x000120e8 ldr r0, [r0, 0x40] | r0 = *((r0 + 0x40));
0x000120ec mov r5, r1 | r5 = r1;
0x000120f0 bl 0x109a0 | strlen (r0);
0x000120f4 sub r1, fp, 0x8c | r1 -= var_8ch;
0x000120f8 add r0, r0, 0x6b | r0 += 0x6b;
0x000120fc bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012100 sub sp, sp, r0 |
0x00012104 mov r0, r5 | r0 = r5;
0x00012108 bl 0x10874 | r0 = stat64 ();
0x0001210c cmp r0, 0 |
| if (r0 == 0) {
0x00012110 beq 0x12168 | goto label_5;
| }
0x00012114 bl 0x10988 | errno_location ();
0x00012118 ldr r6, [pc, 0x1e8] | r6 = *(0x12304);
0x0001211c mov r3, r5 | r3 = r5;
0x00012120 ldr r2, [pc, 0x1e4] | r2 = stderr;
0x00012124 ldr r1, [pc, 0x1e4] | r1 = "libubi";
0x00012128 ldr r4, [r0] | r4 = *(r0);
0x0001212c ldr r0, [r6] | r0 = *(0x12304);
0x00012130 bl 0x108ec | fprintf (r0, "libubi", r2, r3, r4, r5, r6);
0x00012134 mov r0, r4 | r0 = r4;
0x00012138 ldr r5, [r6] | r5 = *(0x12304);
0x0001213c bl 0x10868 | strerror (r0);
0x00012140 str r4, [sp] | *(sp) = r4;
0x00012144 ldr r3, [pc, 0x1c8] | r3 = "%s: error!: cannot get information about \"%s\"\n";
0x00012148 mov r2, 8 | r2 = 8;
0x0001214c ldr r1, [pc, 0x1c4] | r1 = *(0x12314);
0x00012150 str r0, [sp, 4] | var_4h = r0;
0x00012154 mov r0, r5 | r0 = r5;
0x00012158 bl 0x108ec | fprintf (r0, r1, r2, "%s: error!: cannot get information about \"%s\"\n", r4);
| do {
| label_0:
0x0001215c mvn r0, 0 | r0 = ~0;
| label_4:
0x00012160 sub sp, fp, 0x20 |
0x00012164 pop {r4, r5, r6, r7, r8, sb, sl, fp, pc} |
| label_5:
0x00012168 ldr r3, [fp, -0x7c] | r3 = var_7ch;
0x0001216c and r3, r3, 0xf000 | r3 &= 0xf000;
0x00012170 cmp r3, 0x2000 |
| if (r3 == 0x2000) {
0x00012174 beq 0x121a0 | goto label_6;
| }
0x00012178 ldr r0, [pc, 0x188] |
0x0001217c mov r3, r5 | r3 = r5;
0x00012180 ldr r2, [pc, 0x184] | r2 = stderr;
0x00012184 ldr r1, [pc, 0x190] | r1 = "_serror__d___s_";
0x00012188 ldr r0, [r0] | r0 = *(0x12304);
0x0001218c bl 0x108ec | r0 = fprintf (r0, "_serror__d___s_", r2, r3);
0x00012190 bl 0x10988 | errno_location ();
0x00012194 mov r3, 0x16 | r3 = 0x16;
| label_1:
0x00012198 str r3, [r0] | *(r0) = r3;
0x0001219c b 0x1215c |
| } while (1);
| label_6:
0x000121a0 ldrd r2, r3, [fp, -0x6c] | __asm ("ldrd r2, r3, [var_6ch]");
0x000121a4 mov r1, r3 | r1 = r3;
0x000121a8 mov r0, r2 | r0 = r2;
0x000121ac strd r2, r3, [fp, -0xb4] | __asm ("strd r2, r3, [var_b4h]");
0x000121b0 bl 0x1088c | gnu_dev_major ();
0x000121b4 ldrd r2, r3, [fp, -0xb4] | __asm ("ldrd r2, r3, [var_b4h]");
0x000121b8 mov r1, r3 | r1 = r3;
0x000121bc mov sb, r0 | sb = r0;
0x000121c0 mov r0, r2 | r0 = r2;
0x000121c4 bl 0x108c8 | gnu_dev_minor ();
0x000121c8 sub r1, fp, 0xa4 | r1 -= var_a4h;
0x000121cc mov r7, r0 | r7 = r0;
0x000121d0 mov r0, r6 | r0 = r6;
0x000121d4 bl 0x11da8 | r0 = fcn_00011da8 (r0, r1);
0x000121d8 cmp r0, 0 |
| if (r0 != 0) {
0x000121dc addeq r8, sp, 8 | r8 += var_b4h;
| }
| if (r0 != 0) {
0x000121e0 ldreq r4, [fp, -0xa0] | r4 = var_a0h;
| }
| if (r0 == 0) {
0x000121e4 addeq sl, r6, 0x18 | sl = r6 + 0x18;
| goto label_7;
| }
| if (r0 != 0) {
| label_7:
0x000121e8 bne 0x1215c | goto label_0;
| }
| do {
0x000121ec ldr r3, [fp, -0x9c] | r3 = var_9ch;
0x000121f0 cmp r4, r3 |
| if (r4 > r3) {
0x000121f4 bgt 0x1226c | goto label_8;
| }
0x000121f8 sub r3, fp, 0xa8 | r3 -= var_a8h;
0x000121fc sub r2, fp, 0xac | r2 -= var_ach;
0x00012200 mov r1, r4 | r1 = r4;
0x00012204 mov r0, sl | r0 = sl;
0x00012208 bl 0x11704 | r0 = fcn_00011704 (r0, r1);
0x0001220c cmp r0, 0 |
| if (r0 == 0) {
0x00012210 beq 0x12260 | goto label_9;
| }
0x00012214 bl 0x10988 | r0 = errno_location ();
0x00012218 ldr r3, [r0] | r3 = *(r0);
0x0001221c cmp r3, 2 |
| if (r3 != 2) {
0x00012220 bne 0x1222c | goto label_10;
| }
| label_2:
0x00012224 add r4, r4, 1 | r4++;
0x00012228 b 0x121ec |
| } while (1);
| label_10:
0x0001222c cmp r3, 0 |
| if (r3 != 0) {
0x00012230 bne 0x1215c | goto label_0;
| }
| label_3:
0x00012234 ldr r0, [pc, 0xcc] |
0x00012238 mov r3, r5 | r3 = r5;
0x0001223c str r7, [sp, 4] | var_4h = r7;
0x00012240 str sb, [sp] | *(sp) = sb;
0x00012244 ldr r2, [pc, 0xc0] | r2 = stderr;
0x00012248 ldr r1, [pc, 0xd0] | r1 = "_s:_error_:___s__is_not_a_character_device";
0x0001224c ldr r0, [r0] | r0 = *(0x12304);
0x00012250 bl 0x108ec | r0 = fprintf (r0, "_s:_error_:___s__is_not_a_character_device", r2, r3);
0x00012254 bl 0x10988 | errno_location ();
0x00012258 mov r3, 0x13 | r3 = 0x13;
0x0001225c b 0x12198 | goto label_1;
| label_9:
0x00012260 ldr r3, [fp, -0xac] | r3 = var_ach;
0x00012264 cmp r3, sb |
| if (r3 != sb) {
0x00012268 bne 0x12224 | goto label_2;
| }
| label_8:
0x0001226c ldr r3, [fp, -0x9c] | r3 = var_9ch;
0x00012270 cmp r4, r3 |
| if (r4 > r3) {
0x00012274 bgt 0x12234 | goto label_3;
| }
0x00012278 cmp r7, 0 |
| if (r7 == 0) {
0x0001227c moveq r0, 1 | r0 = 1;
| goto label_11;
| }
| if (r7 == 0) {
| label_11:
0x00012280 beq 0x12160 | goto label_4;
| }
0x00012284 sub r3, r7, 1 | r3 = r7 - 1;
0x00012288 mov r2, r4 | r2 = r4;
0x0001228c ldr r1, [r6, 0x40] | r1 = *((r6 + 0x40));
0x00012290 mov r0, r8 | r0 = r8;
0x00012294 bl 0x1097c | sprintf (r0, r1, r2)
0x00012298 mov r1, 0 | r1 = 0;
0x0001229c mov r0, r8 | r0 = r8;
0x000122a0 bl 0x10958 | r0 = open64 ();
0x000122a4 cmn r0, 1 |
| if (r0 == 1) {
0x000122a8 beq 0x12234 | goto label_3;
| }
0x000122ac bl 0x109d0 | r0 = close (r0);
0x000122b0 cmp r0, 0 |
| if (r0 != 0) {
0x000122b4 beq 0x12300 |
0x000122b8 bl 0x10988 | errno_location ();
0x000122bc ldr r5, [pc, 0x44] |
0x000122c0 mov r3, r8 | r3 = r8;
0x000122c4 ldr r2, [pc, 0x40] | r2 = stderr;
0x000122c8 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";
0x000122cc ldr r4, [r0] | r4 = *(r0);
0x000122d0 ldr r0, [r5] | r0 = *(0x12304);
0x000122d4 bl 0x108ec | fprintf (r0, "_s:_error_:___s__has_major:minor__d:_d__but_this_does_not_correspond_to_any_existing_UBI_device_or_volume", r2, r3, r4, r5);
0x000122d8 mov r0, r4 | r0 = r4;
0x000122dc ldr r5, [r5] | r5 = *(0x12304);
0x000122e0 bl 0x10868 | strerror (r0);
0x000122e4 str r4, [sp] | *(sp) = r4;
0x000122e8 ldr r3, [pc, 0x24] | r3 = "%s: error!: cannot get information about \"%s\"\n";
0x000122ec mov r2, 8 | r2 = 8;
0x000122f0 ldr r1, [pc, 0x20] | r1 = *(0x12314);
0x000122f4 str r0, [sp, 4] | var_4h = r0;
0x000122f8 mov r0, r5 | r0 = r5;
0x000122fc bl 0x108ec | fprintf (r0, r1, r2, "%s: error!: cannot get information about \"%s\"\n", r4);
| }
0x00012300 mov r0, 2 | r0 = 2;
0x00012304 b 0x12160 | 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/ubidetach @ 0x126e0 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.000126e0 () | void fcn_000126e0 (int32_t arg2, char * s) {
| int32_t var_74h;
| int32_t var_ch_2;
| int32_t var_ch;
| r1 = arg2;
| r0 = s;
0x000126e0 push {r4, r5, fp, lr} |
0x000126e4 add fp, sp, 0xc |
0x000126e8 sub sp, sp, 0x68 |
0x000126ec ldr r4, [r0, 0x10] | r4 = *((r0 + 0x10));
0x000126f0 mov r5, r1 | r5 = r1;
0x000126f4 mov r0, r4 | r0 = r4;
0x000126f8 bl 0x109a0 | strlen (r0);
0x000126fc mov r2, r5 | r2 = r5;
0x00012700 mov r1, r4 | r1 = r4;
0x00012704 add r0, r0, 0x39 | r0 += 0x39;
0x00012708 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x0001270c sub sp, sp, r0 |
0x00012710 mov r0, sp | r0 = sp;
0x00012714 bl 0x1097c | sprintf (r0, r1, r2)
0x00012718 sub r1, fp, 0x74 | r1 -= var_74h;
0x0001271c mov r0, sp | r0 = sp;
0x00012720 bl 0x10874 | r0 = stat64 ();
0x00012724 clz r0, r0 | r0 &= r0;
0x00012728 lsr r0, r0, 5 | r0 >>= 5;
0x0001272c sub sp, fp, 0xc |
0x00012730 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/ubidetach @ 0x12734 */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00012734 () | void fcn_00012734 (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;
0x00012734 push {r4, r5, r6, r7, r8, sb, sl, fp, lr} |
0x00012738 add sl, r2, 4 | sl = r2 + 4;
0x0001273c add fp, sp, 0x20 |
0x00012740 sub sp, sp, 0x114 |
0x00012744 mov r6, r1 | r6 = r1;
0x00012748 mov r5, r0 | r5 = r0;
0x0001274c mov r4, r2 | r4 = r2;
0x00012750 mov r1, 0 | r1 = 0;
0x00012754 mov r2, 0x54 | r2 = 0x54;
0x00012758 mov r0, sl | r0 = sl;
0x0001275c bl 0x1094c | memset (r0, r1, r2);
0x00012760 str r6, [r4] | *(r4) = r6;
0x00012764 mov r1, r6 | r1 = r6;
0x00012768 mov r0, r5 | r0 = r5;
0x0001276c bl 0x126e0 | r0 = fcn_000126e0 (r0, r1);
0x00012770 cmp r0, 0 |
0x00012774 bne 0x12780 |
| while (r8 == r0) {
| label_0:
0x00012778 mvn r0, 0 | r0 = ~0;
0x0001277c b 0x12a44 | goto label_3;
0x00012780 ldr r0, [r5, 0xc] | r0 = *((r5 + 0xc));
0x00012784 bl 0x10964 | r0 = opendir ();
0x00012788 subs r8, r0, 0 | r8 = r0 - 0;
0x0001278c beq 0x12778 |
| }
0x00012790 mvn r3, 0x80000000 | r3 = ~0x80000000;
0x00012794 str r3, [r4, 0xc] | *((r4 + 0xc)) = r3;
0x00012798 bl 0x10988 | r0 = errno_location ();
0x0001279c mov sb, r0 | sb = r0;
| do {
| label_1:
0x000127a0 mov r3, 0 | r3 = 0;
0x000127a4 str r3, [sb] | *(sb) = r3;
0x000127a8 mov r0, r8 | r0 = r8;
0x000127ac bl 0x10928 | r0 = readdir64 ();
0x000127b0 cmp r0, 0 |
| if (r0 == 0) {
0x000127b4 beq 0x12850 | goto label_4;
| }
0x000127b8 add r7, r0, 0x13 | r7 = r0 + 0x13;
0x000127bc mov r0, r7 | r0 = r7;
0x000127c0 bl 0x109a0 | r0 = strlen (r0);
0x000127c4 cmp r0, 0xfe |
| if (r0 >= 0xfe) {
0x000127c8 bls 0x127f4 |
0x000127cc ldr r0, [pc, 0x278] |
0x000127d0 str r7, [sp] | *(sp) = r7;
0x000127d4 ldr r2, [pc, 0x274] | r2 = stderr;
0x000127d8 ldr r3, [r5, 0xc] | r3 = *((r5 + 0xc));
0x000127dc ldr r1, [pc, 0x270] | r1 = "libubi";
0x000127e0 ldr r0, [r0] | r0 = *(0x12a48);
0x000127e4 bl 0x108ec | fprintf (r0, "libubi", r2, r3);
| label_2:
0x000127e8 mov r0, r8 | r0 = r8;
0x000127ec bl 0x109b8 | closedir ();
0x000127f0 b 0x12778 | goto label_0;
| }
0x000127f4 sub r3, fp, 0x124 | r3 -= var_124h;
0x000127f8 str r3, [sp] | *(sp) = r3;
0x000127fc sub r2, fp, 0x128 | r2 -= var_128h;
0x00012800 sub r3, fp, 0x12c | r3 -= s;
0x00012804 ldr r1, [pc, 0x24c] | r1 = "%s: error!: invalid entry in %s: \"%s\"\n";
0x00012808 mov r0, r7 | r0 = r7;
0x0001280c bl 0x10934 | r0 = sscanf (r0, "%s: error!: invalid entry in %s: \"%s\"\n", r2);
0x00012810 cmp r0, 2 |
0x00012814 bne 0x127a0 |
| } while (r0 != 2);
0x00012818 ldr r3, [fp, -0x128] | r3 = var_128h;
0x0001281c cmp r3, r6 |
| if (r3 != r6) {
0x00012820 bne 0x127a0 | goto label_1;
| }
0x00012824 ldr r3, [r4, 8] | r3 = *((r4 + 8));
0x00012828 ldr r2, [r4, 0x10] | r2 = *((r4 + 0x10));
0x0001282c add r3, r3, 1 | r3++;
0x00012830 str r3, [r4, 8] | *((r4 + 8)) = r3;
0x00012834 ldr r3, [fp, -0x12c] | r3 = s;
0x00012838 cmp r2, r3 |
0x0001283c ldr r2, [r4, 0xc] | r2 = *((r4 + 0xc));
| if (r2 >= r3) {
0x00012840 strlt r3, [r4, 0x10] | *((r4 + 0x10)) = r3;
| }
0x00012844 cmp r3, r2 |
| if (r3 >= r2) {
0x00012848 strlt r3, [r4, 0xc] | *((r4 + 0xc)) = r3;
| }
0x0001284c b 0x127a0 | goto label_1;
| label_4:
0x00012850 ldr r7, [sb] | r7 = *(sb);
0x00012854 cmp r7, 0 |
| if (r7 != 0) {
0x00012858 beq 0x128a0 |
0x0001285c ldr r4, [pc, 0x1e8] |
0x00012860 ldr r3, [r5, 0xc] | r3 = *((r5 + 0xc));
0x00012864 ldr r2, [pc, 0x1e4] | r2 = stderr;
0x00012868 ldr r1, [pc, 0x1ec] | r1 = "ubi%d_%d%s";
0x0001286c ldr r0, [r4] | r0 = *(0x12a48);
0x00012870 bl 0x108ec | fprintf (r0, "ubi%d_%d%s", r2, r3, r4);
0x00012874 mov r0, r7 | r0 = r7;
0x00012878 ldr r4, [r4] | r4 = *(0x12a48);
0x0001287c bl 0x10868 | strerror (r0);
0x00012880 str r7, [sp] | *(sp) = r7;
0x00012884 ldr r3, [pc, 0x1d4] | r3 = "_s:_error_:_readdir_failed_on___s_";
0x00012888 mov r2, 8 | r2 = 8;
0x0001288c ldr r1, [pc, 0x1d0] | r1 = *(0x12a60);
0x00012890 str r0, [sp, 4] | var_4h = r0;
0x00012894 mov r0, r4 | r0 = r4;
0x00012898 bl 0x108ec | fprintf (r0, r1, r2, "_s:_error_:_readdir_failed_on___s_");
0x0001289c b 0x127e8 | goto label_2;
| }
0x000128a0 mov r0, r8 | r0 = r8;
0x000128a4 bl 0x109b8 | r0 = closedir ();
0x000128a8 cmp r0, 0 |
| if (r0 != 0) {
0x000128ac beq 0x128f8 |
0x000128b0 ldr r6, [pc, 0x194] | r6 = *(0x12a48);
0x000128b4 ldr r4, [sb] | r4 = *(sb);
0x000128b8 ldr r3, [r5, 0xc] | r3 = *((r5 + 0xc));
0x000128bc ldr r2, [pc, 0x18c] | r2 = stderr;
0x000128c0 ldr r1, [pc, 0x1a0] | r1 = "_serror__d___s_";
0x000128c4 ldr r0, [r6] | r0 = *(0x12a48);
0x000128c8 bl 0x108ec | fprintf (r0, "_serror__d___s_", r2, r3, r4, r5, r6);
0x000128cc mov r0, r4 | r0 = r4;
0x000128d0 ldr r5, [r6] | r5 = *(0x12a48);
0x000128d4 bl 0x10868 | strerror (r0);
0x000128d8 str r4, [sp] | *(sp) = r4;
0x000128dc ldr r3, [pc, 0x17c] | r3 = "_s:_error_:_readdir_failed_on___s_";
0x000128e0 mov r2, 8 | r2 = 8;
0x000128e4 ldr r1, [pc, 0x178] | r1 = *(0x12a60);
0x000128e8 str r0, [sp, 4] | var_4h = r0;
0x000128ec mov r0, r5 | r0 = r5;
0x000128f0 bl 0x108ec | fprintf (r0, r1, r2, "_s:_error_:_readdir_failed_on___s_", r4);
0x000128f4 b 0x12778 | goto label_0;
| }
0x000128f8 ldr r3, [r4, 0xc] | r3 = *((r4 + 0xc));
0x000128fc add r2, r4, 0x14 | r2 = r4 + 0x14;
0x00012900 cmn r3, 0x80000001 |
| if (r3 != 0x80000001) {
0x00012904 streq r0, [r4, 0xc] | *((r4 + 0xc)) = r0;
| }
0x00012908 add r3, r4, 0x18 | r3 = r4 + 0x18;
0x0001290c mov r1, r6 | r1 = r6;
0x00012910 add r0, r5, 0x18 | r0 = r5 + 0x18;
0x00012914 bl 0x11704 | r0 = fcn_00011704 (r0, r1);
0x00012918 cmp r0, 0 |
| if (r0 != 0) {
0x0001291c bne 0x12778 | goto label_0;
| }
0x00012920 mov r2, sl | r2 = sl;
0x00012924 mov r1, r6 | r1 = r6;
0x00012928 ldr r0, [r5, 0x3c] | r0 = *((r5 + 0x3c));
0x0001292c bl 0x11218 | r0 = fcn_00011218 (r0, r1);
0x00012930 cmp r0, 0 |
| if (r0 != 0) {
0x00012934 bne 0x12778 | goto label_0;
| }
0x00012938 add r2, r4, 0x20 | r2 = r4 + 0x20;
0x0001293c mov r1, r6 | r1 = r6;
0x00012940 ldr r0, [r5, 0x1c] | r0 = *((r5 + 0x1c));
0x00012944 bl 0x11218 | r0 = fcn_00011218 (r0, r1);
0x00012948 cmp r0, 0 |
| if (r0 != 0) {
0x0001294c bne 0x12778 | goto label_0;
| }
0x00012950 add r2, r4, 0x1c | r2 = r4 + 0x1c;
0x00012954 mov r1, r6 | r1 = r6;
0x00012958 ldr r0, [r5, 0x20] | r0 = *((r5 + 0x20));
0x0001295c bl 0x11218 | r0 = fcn_00011218 (r0, r1);
0x00012960 cmp r0, 0 |
| if (r0 != 0) {
0x00012964 bne 0x12778 | goto label_0;
| }
0x00012968 add r2, r4, 0x38 | r2 = r4 + 0x38;
0x0001296c mov r1, r6 | r1 = r6;
0x00012970 ldr r0, [r5, 0x24] | r0 = *((r5 + 0x24));
0x00012974 bl 0x11218 | r0 = fcn_00011218 (r0, r1);
0x00012978 cmp r0, 0 |
| if (r0 != 0) {
0x0001297c bne 0x12778 | goto label_0;
| }
0x00012980 add r2, r4, 0x3c | r2 = r4 + 0x3c;
0x00012984 mov r1, r6 | r1 = r6;
0x00012988 ldr r0, [r5, 0x28] | r0 = *((r5 + 0x28));
0x0001298c bl 0x11218 | r0 = fcn_00011218 (r0, r1);
0x00012990 cmp r0, 0 |
| if (r0 != 0) {
0x00012994 bne 0x12778 | goto label_0;
| }
0x00012998 add r2, r4, 0x48 | r2 = r4 + 0x48;
0x0001299c mov r1, r6 | r1 = r6;
0x000129a0 ldr r0, [r5, 0x30] | r0 = *((r5 + 0x30));
0x000129a4 bl 0x11218 | r0 = fcn_00011218 (r0, r1);
0x000129a8 cmp r0, 0 |
| if (r0 != 0) {
0x000129ac bne 0x12778 | goto label_0;
| }
0x000129b0 ldr r8, [r5, 0x2c] | r8 = *((r5 + 0x2c));
0x000129b4 mov sb, sp | sb = sp;
0x000129b8 mov r0, r8 | r0 = r8;
0x000129bc bl 0x109a0 | strlen (r0);
0x000129c0 mov r2, r6 | r2 = r6;
0x000129c4 mov r1, r8 | r1 = r8;
0x000129c8 add r0, r0, 0x39 | r0 += 0x39;
0x000129cc bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x000129d0 sub sp, sp, r0 |
0x000129d4 add r7, sp, 8 | r7 += s;
0x000129d8 mov r0, r7 | r0 = r7;
0x000129dc bl 0x1097c | sprintf (r0, r1, r2)
0x000129e0 add r1, r4, 0x40 | r1 = r4 + 0x40;
0x000129e4 mov r0, r7 | r0 = r7;
0x000129e8 bl 0x10ff4 | fcn_00010ff4 (r0, r1);
0x000129ec mov sp, sb |
0x000129f0 cmp r0, 0 |
| if (r0 != 0) {
0x000129f4 bne 0x12778 | goto label_0;
| }
0x000129f8 add r2, r4, 0x4c | r2 = r4 + 0x4c;
0x000129fc mov r1, r6 | r1 = r6;
0x00012a00 ldr r0, [r5, 0x34] | r0 = *((r5 + 0x34));
0x00012a04 bl 0x11218 | r0 = fcn_00011218 (r0, r1);
0x00012a08 cmp r0, 0 |
| if (r0 != 0) {
0x00012a0c bne 0x12778 | goto label_0;
| }
0x00012a10 add r2, r4, 0x50 | r2 = r4 + 0x50;
0x00012a14 mov r1, r6 | r1 = r6;
0x00012a18 ldr r0, [r5, 0x38] | r0 = *((r5 + 0x38));
0x00012a1c bl 0x11218 | r0 = fcn_00011218 (r0, r1);
0x00012a20 cmp r0, 0 |
| if (r0 != 0) {
0x00012a24 bne 0x12778 | goto label_0;
| }
0x00012a28 ldr r3, [r4, 0x3c] | r3 = *((r4 + 0x3c));
0x00012a2c ldr r2, [r4, 0x20] | r2 = *((r4 + 0x20));
0x00012a30 smull r6, r7, r2, r3 | r6:r7 = r2 * r3;
0x00012a34 ldr r2, [r4, 0x1c] | r2 = *((r4 + 0x1c));
0x00012a38 strd r6, r7, [r4, 0x30] | __asm ("strd r6, r7, [r4, 0x30]");
0x00012a3c smull r6, r7, r2, r3 | r6:r7 = r2 * r3;
0x00012a40 strd r6, r7, [r4, 0x28] | __asm ("strd r6, r7, [r4, 0x28]");
| label_3:
0x00012a44 sub sp, fp, 0x20 |
0x00012a48 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/ubidetach @ 0x12c5c */
| #include <stdint.h>
|
| #define BIT_MASK(t,v) ((t)(-((v)!= 0)))&(((t)-1)>>((sizeof(t)*CHAR_BIT)-(v)))
|
; (fcn) fcn.00012c5c () | void fcn_00012c5c (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;
0x00012c5c push {r4, r5, r6, r7, r8, sb, sl, fp, lr} |
0x00012c60 add sb, r3, 8 | sb = r3 + 8;
0x00012c64 add fp, sp, 0x20 |
0x00012c68 sub sp, sp, 0x3c |
0x00012c6c mov r5, r1 | r5 = r1;
0x00012c70 mov r6, r2 | r6 = r2;
0x00012c74 mov r1, 0 | r1 = 0;
0x00012c78 mov r2, 0xb0 | r2 = 0xb0;
0x00012c7c mov r7, r0 | r7 = r0;
0x00012c80 mov r0, sb | r0 = sb;
0x00012c84 mov r4, r3 | r4 = r3;
0x00012c88 bl 0x1094c | memset (r0, r1, r2);
0x00012c8c ldr sl, [r7, 0x48] | sl = *((r7 + 0x48));
0x00012c90 stm r4, {r5, r6} | *(r4) = r5;
| *((r4 + 4)) = r6;
0x00012c94 mov r0, sl | r0 = sl;
0x00012c98 bl 0x109a0 | strlen (r0);
0x00012c9c mov r8, sp | r8 = sp;
0x00012ca0 mov r3, r6 | r3 = r6;
0x00012ca4 mov r2, r5 | r2 = r5;
0x00012ca8 mov r1, sl | r1 = sl;
0x00012cac add r0, r0, 0x6b | r0 += 0x6b;
0x00012cb0 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012cb4 sub sp, sp, r0 |
0x00012cb8 mov r0, sp | r0 = sp;
0x00012cbc bl 0x1097c | sprintf (r0, r1, r2)
0x00012cc0 mov r0, sp | r0 = sp;
0x00012cc4 add r2, r4, 0xc | r2 = r4 + 0xc;
0x00012cc8 mov r1, sb | r1 = sb;
0x00012ccc bl 0x1162c | fcn_0001162c (r0, r1);
0x00012cd0 mov sp, r8 |
0x00012cd4 cmp r0, 0 |
0x00012cd8 beq 0x12cec |
| while (r8 < r0) {
| label_0:
0x00012cdc mvn r8, 0 | r8 = ~0;
| label_1:
0x00012ce0 mov r0, r8 | r0 = r8;
0x00012ce4 sub sp, fp, 0x20 |
0x00012ce8 pop {r4, r5, r6, r7, r8, sb, sl, fp, pc} |
0x00012cec ldr sb, [r7, 0x44] | sb = *((r7 + 0x44));
0x00012cf0 mov r0, sb | r0 = sb;
0x00012cf4 bl 0x109a0 | strlen (r0);
0x00012cf8 mov r3, r6 | r3 = r6;
0x00012cfc mov r2, r5 | r2 = r5;
0x00012d00 mov r1, sb | r1 = sb;
0x00012d04 add r0, r0, 0x6b | r0 += 0x6b;
0x00012d08 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012d0c sub sp, sp, r0 |
0x00012d10 mov r0, sp | r0 = sp;
0x00012d14 bl 0x1097c | sprintf (r0, r1, r2)
0x00012d18 mov r0, sp | r0 = sp;
0x00012d1c mov r2, 0x32 | r2 = 0x32;
0x00012d20 sub r1, fp, 0x58 | r1 -= s1;
0x00012d24 bl 0x112b0 | fcn_000112b0 (r0, r1);
0x00012d28 mov sp, r8 |
0x00012d2c subs r8, r0, 0 | r8 = r0 - 0;
0x00012d30 blt 0x12cdc |
| }
0x00012d34 mov r2, r8 | r2 = r8;
0x00012d38 ldr r1, [pc, 0x174] | r1 = *(0x12eb0);
0x00012d3c sub r0, fp, 0x58 | r0 -= s1;
0x00012d40 bl 0x10910 | r0 = strncmp (r0, r1, r2);
0x00012d44 cmp r0, 0 |
| if (r0 != 0) {
0x00012d48 moveq r3, 4 | r3 = 4;
| }
| if (r0 != 0) {
0x00012d4c beq 0x12d6c |
0x00012d50 mov r2, r8 | r2 = r8;
0x00012d54 ldr r1, [pc, 0x15c] | r1 = "static\n";
0x00012d58 sub r0, fp, 0x58 | r0 -= s1;
0x00012d5c bl 0x10910 | r0 = strncmp (r0, "static\n", r2);
0x00012d60 cmp r0, 0 |
| if (r0 != 0) {
0x00012d64 bne 0x12e8c | goto label_2;
| }
0x00012d68 mov r3, 3 | r3 = 3;
| }
0x00012d6c str r3, [r4, 0x10] | *((r4 + 0x10)) = r3;
0x00012d70 mov r2, r6 | r2 = r6;
0x00012d74 add r3, r4, 0x14 | r3 = r4 + 0x14;
0x00012d78 mov r1, r5 | r1 = r5;
0x00012d7c ldr r0, [r7, 0x4c] | r0 = *((r7 + 0x4c));
0x00012d80 bl 0x11260 | r0 = fcn_00011260 (r0, r1);
0x00012d84 cmp r0, 0 |
| if (r0 != 0) {
0x00012d88 bne 0x12cdc | goto label_0;
| }
0x00012d8c ldr r8, [r7, 0x50] | r8 = *((r7 + 0x50));
0x00012d90 mov sb, sp | sb = sp;
0x00012d94 mov r0, r8 | r0 = r8;
0x00012d98 bl 0x109a0 | strlen (r0);
0x00012d9c mov r3, r6 | r3 = r6;
0x00012da0 mov r2, r5 | r2 = r5;
0x00012da4 mov r1, r8 | r1 = r8;
0x00012da8 add r0, r0, 0x6b | r0 += 0x6b;
0x00012dac bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012db0 sub sp, sp, r0 |
0x00012db4 mov r0, sp | r0 = sp;
0x00012db8 bl 0x1097c | sprintf (r0, r1, r2)
0x00012dbc mov r0, sp | r0 = sp;
0x00012dc0 add r1, r4, 0x18 | r1 = r4 + 0x18;
0x00012dc4 bl 0x10ff4 | fcn_00010ff4 (r0, r1);
0x00012dc8 mov sp, sb |
0x00012dcc cmp r0, 0 |
| if (r0 != 0) {
0x00012dd0 bne 0x12cdc | goto label_0;
| }
0x00012dd4 add r3, r4, 0x28 | r3 = r4 + 0x28;
0x00012dd8 mov r2, r6 | r2 = r6;
0x00012ddc mov r1, r5 | r1 = r5;
0x00012de0 ldr r0, [r7, 0x54] | r0 = *((r7 + 0x54));
0x00012de4 bl 0x11260 | r0 = fcn_00011260 (r0, r1);
0x00012de8 cmp r0, 0 |
| if (r0 != 0) {
0x00012dec bne 0x12cdc | goto label_0;
| }
0x00012df0 add r3, r4, 0x2c | r3 = r4 + 0x2c;
0x00012df4 mov r2, r6 | r2 = r6;
0x00012df8 mov r1, r5 | r1 = r5;
0x00012dfc ldr r0, [r7, 0x58] | r0 = *((r7 + 0x58));
0x00012e00 bl 0x11260 | r0 = fcn_00011260 (r0, r1);
0x00012e04 cmp r0, 0 |
| if (r0 != 0) {
0x00012e08 bne 0x12cdc | goto label_0;
| }
0x00012e0c add r3, r4, 0x30 | r3 = r4 + 0x30;
0x00012e10 mov r2, r6 | r2 = r6;
0x00012e14 mov r1, r5 | r1 = r5;
0x00012e18 ldr r0, [r7, 0x5c] | r0 = *((r7 + 0x5c));
0x00012e1c bl 0x11260 | r0 = fcn_00011260 (r0, r1);
0x00012e20 subs r8, r0, 0 | r8 = r0 - 0;
| if (r8 != r0) {
0x00012e24 bne 0x12cdc | goto label_0;
| }
0x00012e28 ldr r1, [r4, 0x28] | r1 = *((r4 + 0x28));
0x00012e2c ldr r0, [r4, 0x2c] | r0 = *((r4 + 0x2c));
0x00012e30 ldr r7, [r7, 0x60] | r7 = *((r7 + 0x60));
0x00012e34 smull r2, r3, r0, r1 | r2:r3 = r0 * r1;
0x00012e38 mov r0, r7 | r0 = r7;
0x00012e3c strd r2, r3, [r4, 0x20] | __asm ("strd r2, r3, [r4, 0x20]");
0x00012e40 bl 0x109a0 | strlen (r0);
0x00012e44 mov r3, r6 | r3 = r6;
0x00012e48 mov r2, r5 | r2 = r5;
0x00012e4c mov r1, r7 | r1 = r7;
0x00012e50 add r0, r0, 0x6b | r0 += 0x6b;
0x00012e54 bic r0, r0, 7 | r0 = BIT_MASK (r0, 7);
0x00012e58 sub sp, sp, r0 |
0x00012e5c mov r0, sp | r0 = sp;
0x00012e60 bl 0x1097c | sprintf (r0, r1, r2)
0x00012e64 mov r0, sp | r0 = sp;
0x00012e68 mov r2, 0x81 | r2 = 0x81;
0x00012e6c add r1, r4, 0x34 | r1 = r4 + 0x34;
0x00012e70 bl 0x112b0 | fcn_000112b0 (r0, r1);
0x00012e74 mov sp, sb |
0x00012e78 cmp r0, 0 |
| if (r0 < 0) {
0x00012e7c blt 0x12cdc | goto label_0;
| }
0x00012e80 add r4, r4, r0 | r4 += r0;
0x00012e84 strb r8, [r4, 0x33] | *((r4 + 0x33)) = r8;
0x00012e88 b 0x12ce0 | goto label_1;
| label_2:
0x00012e8c ldr r0, [pc, 0x28] |
0x00012e90 sub r3, fp, 0x58 | r3 -= s1;
0x00012e94 ldr r2, [pc, 0x24] | r2 = stderr;
0x00012e98 ldr r1, [pc, 0x24] | r1 = "libubi";
0x00012e9c ldr r0, [r0] | r0 = "dynamic\n";
0x00012ea0 bl 0x108ec | r0 = fprintf ("dynamic\n", "libubi", r2, r3);
0x00012ea4 bl 0x10988 | errno_location ();
0x00012ea8 mov r3, 0x16 | r3 = 0x16;
0x00012eac str r3, [r0] | *(r0) = r3;
0x00012eb0 b 0x12cdc | goto label_0;
| }
[*] Function sprintf used 10 times ubidetach