Eva*_*oll 5 sqlserver proc strace ltrace reverse-engineering
我猜想Linux 上的 SQL Server 正在检查/proc/self/status,TracerPID如果不是,则停止运行0。我想测试一下。玩玩,这是 strace,
... lots of stuff
openat(AT_FDCWD, "/proc/self/status", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(5, "Name:\tsqlservr\nUmask:\t0022\nState"..., 1024) = 1024
close(5) = 0
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
getpid() = 28046
gettid() = 28046
tgkill(28046, 28046, SIGABRT) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=28046, si_uid=999} ---
gettid() = 28046
write(2, "Dump collecting thread [28046] h"..., 59Dump collecting thread [28046] hit exception [6]. Exiting.
) = 59
exit_group(-1) = ?
Run Code Online (Sandbox Code Playgroud)
ltrace更糟糕的是,幸运的是他们正在使用这strstr使得我的理论看起来很可能是正确的。
strstr("PPid:\t28515\n", "TracerPid:") = nil
__getdelim(0x7ffc0b7d2330, 0x7ffc0b7d2328, 10, 0x7f12f5811980) = 17
strstr("TracerPid:\t28515\n", "TracerPid:") = "TracerPid:\t28515\n"
strtol(0x7f12f581840b, 0x7ffc0b7d2320, 10, 0) = 0x6f63
free(0x7f12f5818400) = <void>
fclose(0x7f12f5811980) = 0
abort( <no return ...>
--- SIGABRT (Aborted) ---
syscall(186, 6, 0, 0) = 0x6f64
fprintf(0x7f12f6ec4640, "Dump collecting thread [%d] hit "..., 28516, 6Dump collecting thread [28516] hit exception [6]. Exiting.
) = 59
fflush(0x7f12f6ec4640) = 0
exit(-1 <unfinished ...>
Run Code Online (Sandbox Code Playgroud)
他们检查的文件的最后一行(用strstr)在它们之前abort()是用 的行TracerPid:,但是用 my/proc/self/status后面有很多行。
按照优先顺序,我想/proc/self/status报告
...stuff...
TracerPid: 0
...stuff...
Run Code Online (Sandbox Code Playgroud)
对于这个过程。如果无法实现这一点,我希望它报告0所有流程。
是否可以创建一个包装器来更改TracerPIDfor的值/proc/self/status,然后exec更改赋予它的参数,导致它无法访问TracerPID?
| 归档时间: |
|
| 查看次数: |
3021 次 |
| 最近记录: |