Skip to content

标题: 获取syscall名字与系统调用号之间的对应关系

创建: 2023-11-17 10:43 更新: 2024-09-26 14:23 链接: https://scz.617.cn/unix/202311171043.txt

原始办法

$ grep "__NR_open" /usr/include/asm/unistd_64.h

define __NR_open 2

define __NR_openat 257

define __NR_open_by_handle_at 304

define __NR_open_tree 428

define __NR_openat2 437

auditd包中有个ausyscall命令

aptitude install auditd

模糊匹配:

$ ausyscall open open 2 mq_open 240 openat 257 perf_event_open 298 open_by_handle_at 304 open_tree 428 fsopen 430 pidfd_open 434 openat2 437

精确匹配:

$ ausyscall --exact open 2

根据系统调用号反查名字:

$ ausyscall 437 openat2

转储所有系统调用号:

$ ausyscall --dump

$ ausyscall --dump | grep -P "\topen$" 2 open

seccomp包中有个scmp_sys_resolver命令

aptitude install seccomp

$ scmp_sys_resolver -a x86_64 write 1

$ scmp_sys_resolver -a x86_64 1 write