| 184 | } |
| 185 | |
| 186 | static bool isExecutableAddr(uint32_t addr) { |
| 187 | FILE *fp; |
| 188 | char line[1024]; |
| 189 | uint32_t start; |
| 190 | uint32_t end; |
| 191 | |
| 192 | fp = fopen("/proc/self/maps", "r"); |
| 193 | if (fp == NULL) { |
| 194 | return false; |
| 195 | } |
| 196 | |
| 197 | while (fgets(line, sizeof(line), fp)) { |
| 198 | if (strstr(line, "r-xp") || strstr(line, "rwxp")) { |
| 199 | start = strtoul(strtok(line, "-"), NULL, 16); |
| 200 | end = strtoul(strtok(NULL, " "), NULL, 16); |
| 201 | if (addr >= start && addr <= end) { |
| 202 | fclose(fp); |
| 203 | return true; |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | fclose(fp); |
| 209 | |
| 210 | return false; |
| 211 | } |
| 212 | |
| 213 | static struct inlineHookItem *findInlineHookItem(uint32_t target_addr) { |
| 214 | int i; |
no outgoing calls
no test coverage detected