this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Properly report whether given process is 64-bit (#304)

+6 -22
+3 -22
src/kernel/emulation/linux/misc/proc_info.c
··· 17 17 #include "../elfcalls_wrapper.h" 18 18 #include <stdbool.h> 19 19 #include <sys/proc.h> 20 + #include <lkm/api.h> 20 21 #include "sysctl_proc.h" 21 22 22 23 #define LINUX_PR_SET_NAME 15 ··· 247 248 info->pbsi_gid = info->pbsi_rgid = info->pbsi_svgid = gid; 248 249 249 250 // 32/64 bit detection 250 - { 251 - int fd; 252 - 253 - __simple_sprintf(path, "/proc/%d/exe", pid); 254 - fd = sys_open(path, BSD_O_RDONLY, 0); 255 - 256 - if (fd != -1) 257 - { 258 - char magic[5]; 259 - if (sys_read(fd, magic, sizeof(magic)) == sizeof(magic)) 260 - { 261 - if (magic[0] == 0x7f && magic[1] == 'E' && magic[2] == 'L' && magic[3] == 'F') 262 - { 263 - if (magic[4] == 2) 264 - { 265 - info->pbsi_flags |= P_LP64; 266 - } 267 - } 268 - } 269 - sys_close(fd); 270 - } 271 - } 251 + if (lkm_call(NR_task_64bit, (void*)(long)pid) > 0) 252 + info->pbsi_flags |= P_LP64; 272 253 273 254 return 1; 274 255 reterr:
+3
src/kernel/emulation/linux/misc/sysctl_proc.c
··· 9 9 #include "../fcntl/open.h" 10 10 #include "../simple.h" 11 11 #include "sysctl_proc.h" 12 + #include <lkm/api.h> 12 13 13 14 #ifndef isdigit 14 15 # define isdigit(c) (c >= '0' && c <= '9') ··· 191 192 memset(kinfo, 0, sizeof(*kinfo)); 192 193 193 194 kinfo->kinfo.kp_proc.p_pid = __simple_atoi(name, NULL); 195 + if (lkm_call(NR_task_64bit, (void*)(long)kinfo->kinfo.kp_proc.p_pid) > 0) 196 + kinfo->kinfo.kp_proc.p_flag |= P_LP64; 194 197 195 198 if (!read_string(path, stat, sizeof(stat))) 196 199 goto retnull;