c - 函数waitpid c中的变量stat_loc
问题描述
我有一个代码,但我不明白变量stat_loc比较 127 (0x7f),然后比较 5。你能解释一下吗?非常感谢 !!
int __fastcall m_loop(__int64 Input)
{
int result;
int stat_loc;
void *v3;
__pid_t pid_child;
void *nanomites_addr;
stat_loc = 0;
nanomites_addr = mmap(0LL, 0x141, 7, 34, -1, 0);
pid_child = fork();
if ( !pid_child )`// This is the child process`
{
if ( ptrace(0, 0LL, 0LL, 0LL) == -1 )
{ puts("So you want to trace me?!");
exit(42);
}
v3 = nanomites_addr;
((void (__fastcall *)(__int64))nanomites_addr)(Input);
/* Call the first nanomite,
xor rax, rax
xor rcx, rcx
xor rbx, rbx
mov al, byte ptr[rdi]
int 3 */
exit(0);
}
while ( waitpid(pid_child, &stat_loc, 0) != -1 ) // This is in the parent
{
if ( (stat_loc == 127 )
{
if ( BYTE1(stat_loc) == 5 )
parent_read_regs(nanomites_addr, pid_child);
ptrace(PTRACE_CONT, pid_child, 0, 0);
}
}
if ( BYTE1(stat_loc) )
result = puts("You lost !");
else
result = puts("You win! ");
解决方案
推荐阅读
- javascript - 在类引用的多个 div 的内容中搜索数组的字符串,并根据条件执行操作
- go - 为什么构建约束会排除 '/Users/rpurusho/go/src/google.golang.org/api/compute/v1' 中的所有 Go 文件?
- python-3.x - NoSuchModuleError:teradata 无法加载插件 sqlalchemy
- python - 使用 python 访问远程数据库服务器
- ruby - 如何在没有 Ruby 的情况下获得 RUBY_PLATFORM 值?
- php - 如何使用本地存储的 JSON 文件填充下拉列表
- python - python子进程调用的sed中的转义错误
- azure - 在 Azure Cosmos 存储过程中递归获取文档
- swift - 删除行后无法禁用表格编辑
- python - Python正则表达式识别文本摘要中大写的单个单词行