[*] Binary protection state of netd
Full RELRO Canary found NX disabled PIE enabled No RPATH No RUNPATH No Symbols
[*] Function fprintf tear down of netd
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/4325012-58052244.squashfs_v4_le_extract/usr/sbin/netd @ 0x5305c */
| #include <stdint.h>
|
; (fcn) sym.netd_util_write_to_file_full () | void netd_util_write_to_file_full () {
0x0005305c lui gp, 4 |
0x00053060 addiu gp, gp, 0x4be4 |
0x00053064 addu gp, gp, t9 | gp += t9;
0x00053068 addiu sp, sp, -0x40 |
0x0005306c sw gp, 0x18(sp) | *(var_18h) = gp;
0x00053070 sw s4, 0x38(sp) | *(var_38h) = s4;
0x00053074 sw s3, 0x34(sp) | *(var_34h) = s3;
0x00053078 sw ra, 0x3c(sp) | *(var_3ch) = ra;
0x0005307c sw s2, 0x30(sp) | *(var_30h) = s2;
0x00053080 sw s1, 0x2c(sp) | *(var_2ch) = s1;
0x00053084 sw s0, 0x28(sp) | *(var_28h) = s0;
0x00053088 lw s3, 0x50(sp) | s3 = *(arg_50h);
0x0005308c lw v0, 0x54(sp) | v0 = *(arg_54h);
0x00053090 lw s4, 0x58(sp) | s4 = *(arg_58h);
| if (a0 == 0) {
0x00053094 beqz a0, 0x53210 | goto label_3;
| }
0x00053098 move s1, a1 | s1 = a1;
| if (a1 == 0) {
0x0005309c beqz a1, 0x53294 | goto label_4;
| }
0x000530a0 move s0, a0 | s0 = a0;
| if (v0 != 0) {
0x000530a4 bnez v0, 0x53238 | goto label_5;
| }
0x000530a8 lw t9, -0x7488(gp) | t9 = sym.imp.__errno_location;
0x000530ac jalr t9 | t9 ();
0x000530b0 nop |
0x000530b4 lw gp, 0x18(sp) | gp = *(var_18h);
0x000530b8 lui a1, 2 | a1 = 0x20000;
0x000530bc move a0, s0 | a0 = s0;
0x000530c0 lw t9, -0x74a4(gp) | t9 = sym.imp.open;
0x000530c4 sw zero, (v0) | *(v0) = 0;
0x000530c8 move a2, s3 | a2 = s3;
0x000530cc addiu a1, a1, 0x101 | a1 += 0x101;
0x000530d0 move s2, v0 | s2 = v0;
0x000530d4 jalr t9 | t9 ();
0x000530d8 move s0, v0 | s0 = v0;
0x000530dc addiu v0, zero, -1 | v0 = -1;
0x000530e0 lw gp, 0x18(sp) | gp = *(var_18h);
| if (s0 == v0) {
0x000530e4 beq s0, v0, 0x531bc | goto label_6;
| }
0x000530e8 lw a1, -0x7bf4(gp) | a1 = *((gp - 7933));
0x000530ec lw t9, -0x7530(gp) | t9 = sym.imp.fdopen;
0x000530f0 addiu a1, a1, -0x2120 | a1 += -0x2120;
0x000530f4 move a0, s0 | a0 = s0;
0x000530f8 jalr t9 | t9 ();
0x000530fc move s3, v0 | s3 = v0;
0x00053100 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 == 0) {
0x00053104 beqz v0, 0x531bc | goto label_6;
| }
0x00053108 lw a2, -0x7bf4(gp) | a2 = *((gp - 7933));
0x0005310c lw t9, -0x7524(gp) | t9 = sym.imp.__fprintf_chk
0x00053110 move a3, s1 | a3 = s1;
| /* esilref: '&s' */
0x00053114 addiu a2, a2, -0x211c | a2 += -0x211c;
0x00053118 addiu a1, zero, 1 | a1 = 1;
0x0005311c move a0, v0 | a0 = v0;
0x00053120 jalr t9 | t9 ();
0x00053124 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 < 0) {
0x00053128 bltz v0, 0x532c0 | goto label_7;
| }
0x0005312c lw t9, -0x76dc(gp) | t9 = sym.imp.fclose;
0x00053130 move a0, s3 | a0 = s3;
0x00053134 jalr t9 | t9 ();
0x00053138 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 == 0) {
0x0005313c beqz v0, 0x53320 | goto label_8;
| }
0x00053140 lw t9, -0x7638(gp) | t9 = sym.imp.g_unix_error_quark;
0x00053144 jalr t9 | t9 ();
0x00053148 nop |
0x0005314c lw gp, 0x18(sp) | gp = *(var_18h);
0x00053150 lw a0, (s2) | a0 = *(s2);
0x00053154 lw t9, -0x7880(gp) | t9 = sym.imp.g_strerror;
0x00053158 move s1, v0 | s1 = v0;
0x0005315c jalr t9 | t9 ();
0x00053160 lw gp, 0x18(sp) | gp = *(var_18h);
0x00053164 move a3, v0 | a3 = v0;
0x00053168 move a2, zero | a2 = 0;
0x0005316c lw t9, -0x784c(gp) | t9 = sym.imp.g_set_error_literal;
0x00053170 move a1, s1 | a1 = s1;
0x00053174 move a0, s4 | a0 = s4;
0x00053178 jalr t9 | t9 ();
0x0005317c lw gp, 0x18(sp) | gp = *(var_18h);
| label_1:
0x00053180 lw t9, -0x7780(gp) | t9 = sym.imp.close;
| label_0:
0x00053184 move a0, s0 | a0 = s0;
0x00053188 jalr t9 | t9 ();
0x0005318c addiu v1, zero, -1 | v1 = -1;
0x00053190 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 == v1) {
0x00053194 beq v0, v1, 0x53328 | goto label_9;
| }
| do {
0x00053198 move v0, zero | v0 = 0;
| label_2:
0x0005319c lw ra, 0x3c(sp) | ra = *(var_3ch);
0x000531a0 lw s4, 0x38(sp) | s4 = *(var_38h);
0x000531a4 lw s3, 0x34(sp) | s3 = *(var_34h);
0x000531a8 lw s2, 0x30(sp) | s2 = *(var_30h);
0x000531ac lw s1, 0x2c(sp) | s1 = *(var_2ch);
0x000531b0 lw s0, 0x28(sp) | s0 = *(var_28h);
0x000531b4 addiu sp, sp, 0x40 |
0x000531b8 jr ra | return v0;
| label_6:
0x000531bc lw t9, -0x7638(gp) | t9 = sym.imp.g_unix_error_quark;
0x000531c0 jalr t9 | t9 ();
0x000531c4 nop |
0x000531c8 lw gp, 0x18(sp) | gp = *(var_18h);
0x000531cc lw a0, (s2) | a0 = *(s2);
0x000531d0 lw t9, -0x7880(gp) | t9 = sym.imp.g_strerror;
0x000531d4 move s1, v0 | s1 = v0;
0x000531d8 jalr t9 | t9 ();
0x000531dc lw gp, 0x18(sp) | gp = *(var_18h);
0x000531e0 move a3, v0 | a3 = v0;
0x000531e4 move a2, zero | a2 = 0;
0x000531e8 lw t9, -0x784c(gp) | t9 = sym.imp.g_set_error_literal;
0x000531ec move a1, s1 | a1 = s1;
0x000531f0 move a0, s4 | a0 = s4;
0x000531f4 jalr t9 | t9 ();
0x000531f8 addiu v0, zero, -1 | v0 = -1;
0x000531fc lw gp, 0x18(sp) | gp = *(var_18h);
0x00053200 sw zero, (s2) | *(s2) = 0;
0x00053204 beq s0, v0, 0x53198 |
| } while (s0 == v0);
0x00053208 lw t9, -0x7780(gp) | t9 = sym.imp.close;
0x0005320c b 0x53184 | goto label_0;
| label_3:
0x00053210 lw v0, -0x7bf4(gp) | v0 = *((gp - 7933));
0x00053214 lw a3, -0x7bf4(gp) | a3 = *((gp - 7933));
0x00053218 lw a1, -0x7bf4(gp) | a1 = *((gp - 7933));
| /* str.file___NULL */
0x0005321c addiu v0, v0, -0x2140 | v0 += -0x2140;
0x00053220 lw t9, -0x764c(gp) | t9 = sym.imp.g_assertion_message_expr;
0x00053224 sw v0, 0x10(sp) | *(var_10h) = v0;
| /* str.netd_util_write_to_file_full */
0x00053228 addiu a3, a3, -0x1dec | a3 += -0x1dec;
0x0005322c addiu a2, zero, 0x198 | a2 = aav.0x00000198;
| /* str.src_netd_util.c */
0x00053230 addiu a1, a1, -0x221c | a1 += -0x221c;
0x00053234 jalr t9 | t9 ();
| label_5:
0x00053238 lw t9, -0x76f8(gp) | t9 = sym.imp.strlen;
0x0005323c sw a3, 0x24(sp) | *(var_24h) = a3;
0x00053240 sw a2, 0x20(sp) | *(var_20h) = a2;
0x00053244 move a0, a1 | a0 = a1;
0x00053248 jalr t9 | t9 ();
0x0005324c lw gp, 0x18(sp) | gp = *(var_18h);
0x00053250 lw a3, 0x24(sp) | a3 = *(var_24h);
0x00053254 lw a2, 0x20(sp) | a2 = *(var_20h);
0x00053258 sw s3, 0x54(sp) | *(arg_54h) = s3;
0x0005325c lw ra, 0x3c(sp) | ra = *(var_3ch);
0x00053260 lw s4, 0x38(sp) | s4 = *(var_38h);
0x00053264 lw s3, 0x34(sp) | s3 = *(var_34h);
0x00053268 lw s2, 0x30(sp) | s2 = *(var_30h);
0x0005326c move a1, s1 | a1 = s1;
0x00053270 move a0, s0 | a0 = s0;
0x00053274 lw s1, 0x2c(sp) | s1 = *(var_2ch);
0x00053278 lw s0, 0x28(sp) | s0 = *(var_28h);
0x0005327c lw t9, -0x76b0(gp) | t9 = sym.imp.confutils_set_file_contents_with_sync_full;
0x00053280 sw a3, 0x50(sp) | *(arg_50h) = a3;
0x00053284 move a3, a2 | a3 = a2;
0x00053288 move a2, v0 | a2 = v0;
0x0005328c addiu sp, sp, 0x40 |
0x00053290 jr t9 | t9 ();
| label_4:
0x00053294 lw v0, -0x7bf4(gp) | v0 = *((gp - 7933));
0x00053298 lw a3, -0x7bf4(gp) | a3 = *((gp - 7933));
0x0005329c lw a1, -0x7bf4(gp) | a1 = *((gp - 7933));
| /* str.value___NULL */
0x000532a0 addiu v0, v0, -0x2130 | v0 += -0x2130;
0x000532a4 lw t9, -0x764c(gp) | t9 = sym.imp.g_assertion_message_expr;
0x000532a8 sw v0, 0x10(sp) | *(var_10h) = v0;
| /* str.netd_util_write_to_file_full */
0x000532ac addiu a3, a3, -0x1dec | a3 += -0x1dec;
0x000532b0 addiu a2, zero, 0x199 | a2 = 0x199;
| /* str.src_netd_util.c */
0x000532b4 addiu a1, a1, -0x221c | a1 += -0x221c;
0x000532b8 move a0, zero | a0 = 0;
0x000532bc jalr t9 | t9 ();
| label_7:
0x000532c0 lw t9, -0x7638(gp) | t9 = sym.imp.g_unix_error_quark;
0x000532c4 jalr t9 | t9 ();
0x000532c8 nop |
0x000532cc lw gp, 0x18(sp) | gp = *(var_18h);
0x000532d0 lw a0, (s2) | a0 = *(s2);
0x000532d4 lw t9, -0x7880(gp) | t9 = sym.imp.g_strerror;
0x000532d8 move s1, v0 | s1 = v0;
0x000532dc jalr t9 | t9 ();
0x000532e0 lw gp, 0x18(sp) | gp = *(var_18h);
0x000532e4 move a3, v0 | a3 = v0;
0x000532e8 move a2, zero | a2 = 0;
0x000532ec lw t9, -0x784c(gp) | t9 = sym.imp.g_set_error_literal;
0x000532f0 move a1, s1 | a1 = s1;
0x000532f4 move a0, s4 | a0 = s4;
0x000532f8 jalr t9 | t9 ();
0x000532fc lw gp, 0x18(sp) | gp = *(var_18h);
0x00053300 sw zero, (s2) | *(s2) = 0;
0x00053304 lw t9, -0x76dc(gp) | t9 = sym.imp.fclose;
0x00053308 move a0, s3 | a0 = s3;
0x0005330c jalr t9 | t9 ();
0x00053310 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 != 0) {
0x00053314 bnez v0, 0x53180 | goto label_1;
| }
0x00053318 move v0, zero | v0 = 0;
0x0005331c b 0x5319c | goto label_2;
| label_8:
0x00053320 addiu v0, zero, 1 | v0 = 1;
0x00053324 b 0x5319c | goto label_2;
| label_9:
0x00053328 lw t9, -0x7880(gp) | t9 = sym.imp.g_strerror;
0x0005332c lw a0, (s2) | a0 = *(s2);
0x00053330 jalr t9 | t9 ();
0x00053334 lw gp, 0x18(sp) | gp = *(var_18h);
0x00053338 move a2, v0 | a2 = v0;
0x0005333c addiu a0, zero, 3 | a0 = 3;
0x00053340 lw a1, -0x7bf4(gp) | a1 = *((gp - 7933));
0x00053344 lw t9, -0x7fdc(gp) | t9 = sym.netd_log_esc;
| /* str.Failed_to_close_file:__s */
0x00053348 addiu a1, a1, -0x2118 | a1 += -0x2118;
0x0005334c bal 0x434d0 | sym_netd_log_esc ();
0x00053350 move v0, zero | v0 = 0;
0x00053354 b 0x5319c | goto label_2;
| }
[*] Function fprintf used 2 times netd