Skip to content

Commit a9c6650

Browse files
authored
syscall_helpers.c / syscall.py: update syscall list (#5363)
Based on the Linux x86_64 source code (arch/x86/entry/syscalls/syscall_64.tbl).
1 parent 5640952 commit a9c6650

File tree

2 files changed

+164
-16
lines changed

2 files changed

+164
-16
lines changed

libbpf-tools/syscall_helpers.c

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,16 @@ void free_syscall_names(void)
124124
}
125125

126126
/*
127-
* Syscall table for Linux x86_64.
127+
* Syscall table for Linux x86_64. Automatically generated from
128+
* https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/x86/entry/syscalls/syscall_64.tbl?h=v6.15.6
129+
* using the following commands:
128130
*
129-
* Semi-automatically generated from strace/linux/x86_64/syscallent.h and
130-
* linux/syscallent-common.h using the following commands:
131+
* cat arch/x86/entry/syscalls/syscall_64.tbl \
132+
* | awk 'BEGIN { print "static const char *syscall_names_x86_64[] = {" }
133+
* /^[0-9]/ { print "\t["$1"] = \""$3"\"," }
134+
* END { print "};" }'
131135
*
132-
* awk -F\" '/SEN/{printf("%d %s\n", substr($0,2,3), $(NF-1));}' syscallent.h
133-
* awk '/SEN/ { printf("%d %s\n", $3, $9); }' syscallent-common.h
134-
*
135-
* (The idea is taken from src/python/bcc/syscall.py.)
136+
* (The idea is taken from src/python/bcc/syscall.py)
136137
*/
137138
#ifdef __x86_64__
138139
static const char *syscall_names_x86_64[] = {
@@ -471,6 +472,7 @@ static const char *syscall_names_x86_64[] = {
471472
[332] = "statx",
472473
[333] = "io_pgetevents",
473474
[334] = "rseq",
475+
[335] = "uretprobe",
474476
[424] = "pidfd_send_signal",
475477
[425] = "io_uring_setup",
476478
[426] = "io_uring_enter",
@@ -483,8 +485,74 @@ static const char *syscall_names_x86_64[] = {
483485
[433] = "fspick",
484486
[434] = "pidfd_open",
485487
[435] = "clone3",
488+
[436] = "close_range",
486489
[437] = "openat2",
487490
[438] = "pidfd_getfd",
491+
[439] = "faccessat2",
492+
[440] = "process_madvise",
493+
[441] = "epoll_pwait2",
494+
[442] = "mount_setattr",
495+
[443] = "quotactl_fd",
496+
[444] = "landlock_create_ruleset",
497+
[445] = "landlock_add_rule",
498+
[446] = "landlock_restrict_self",
499+
[447] = "memfd_secret",
500+
[448] = "process_mrelease",
501+
[449] = "futex_waitv",
502+
[450] = "set_mempolicy_home_node",
503+
[451] = "cachestat",
504+
[452] = "fchmodat2",
505+
[453] = "map_shadow_stack",
506+
[454] = "futex_wake",
507+
[455] = "futex_wait",
508+
[456] = "futex_requeue",
509+
[457] = "statmount",
510+
[458] = "listmount",
511+
[459] = "lsm_get_self_attr",
512+
[460] = "lsm_set_self_attr",
513+
[461] = "lsm_list_modules",
514+
[462] = "mseal",
515+
[463] = "setxattrat",
516+
[464] = "getxattrat",
517+
[465] = "listxattrat",
518+
[466] = "removexattrat",
519+
[467] = "open_tree_attr",
520+
[512] = "rt_sigaction",
521+
[513] = "rt_sigreturn",
522+
[514] = "ioctl",
523+
[515] = "readv",
524+
[516] = "writev",
525+
[517] = "recvfrom",
526+
[518] = "sendmsg",
527+
[519] = "recvmsg",
528+
[520] = "execve",
529+
[521] = "ptrace",
530+
[522] = "rt_sigpending",
531+
[523] = "rt_sigtimedwait",
532+
[524] = "rt_sigqueueinfo",
533+
[525] = "sigaltstack",
534+
[526] = "timer_create",
535+
[527] = "mq_notify",
536+
[528] = "kexec_load",
537+
[529] = "waitid",
538+
[530] = "set_robust_list",
539+
[531] = "get_robust_list",
540+
[532] = "vmsplice",
541+
[533] = "move_pages",
542+
[534] = "preadv",
543+
[535] = "pwritev",
544+
[536] = "rt_tgsigqueueinfo",
545+
[537] = "recvmmsg",
546+
[538] = "sendmmsg",
547+
[539] = "process_vm_readv",
548+
[540] = "process_vm_writev",
549+
[541] = "setsockopt",
550+
[542] = "getsockopt",
551+
[543] = "io_setup",
552+
[544] = "io_submit",
553+
[545] = "execveat",
554+
[546] = "preadv2",
555+
[547] = "pwritev2",
488556
};
489557
size_t syscall_names_x86_64_size = sizeof(syscall_names_x86_64)/sizeof(char*);
490558
#elif defined(__aarch64__) || defined(__riscv) || defined(__loongarch64)

src/python/bcc/syscall.py

Lines changed: 89 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@
1818
import subprocess
1919
import platform
2020

21+
# Syscall table for Linux x86_64, not very recent. Automatically generated from
22+
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/x86/entry/syscalls/syscall_64.tbl?h=v6.15.6
23+
# using the following command:
2124
#
22-
# Syscall table for Linux x86_64, not very recent.
23-
# Automatically generated from strace/linux/x86_64/syscallent.h using the
24-
# following command:
25-
#
26-
# cat syscallent.h | awk -F, '{ gsub(/[ \t"}]/, "", $4);
27-
# gsub(/[\[\] \t{]/, "", $1); split($1, a, "=");
28-
# print " "a[1]": b\""$4"\","; }
29-
# BEGIN { print "syscalls = {" }
30-
# END { print "}" '}
25+
# cat arch/x86/entry/syscalls/syscall_64.tbl \
26+
# | awk 'BEGIN { print "syscalls = {" }
27+
# /^[0-9]/ { print " "$1": b\""$3"\"," }
28+
# END { print "}" }'
29+
3130
syscalls = {
3231
0: b"read",
3332
1: b"write",
@@ -364,6 +363,87 @@
364363
332: b"statx",
365364
333: b"io_pgetevents",
366365
334: b"rseq",
366+
335: b"uretprobe",
367+
424: b"pidfd_send_signal",
368+
425: b"io_uring_setup",
369+
426: b"io_uring_enter",
370+
427: b"io_uring_register",
371+
428: b"open_tree",
372+
429: b"move_mount",
373+
430: b"fsopen",
374+
431: b"fsconfig",
375+
432: b"fsmount",
376+
433: b"fspick",
377+
434: b"pidfd_open",
378+
435: b"clone3",
379+
436: b"close_range",
380+
437: b"openat2",
381+
438: b"pidfd_getfd",
382+
439: b"faccessat2",
383+
440: b"process_madvise",
384+
441: b"epoll_pwait2",
385+
442: b"mount_setattr",
386+
443: b"quotactl_fd",
387+
444: b"landlock_create_ruleset",
388+
445: b"landlock_add_rule",
389+
446: b"landlock_restrict_self",
390+
447: b"memfd_secret",
391+
448: b"process_mrelease",
392+
449: b"futex_waitv",
393+
450: b"set_mempolicy_home_node",
394+
451: b"cachestat",
395+
452: b"fchmodat2",
396+
453: b"map_shadow_stack",
397+
454: b"futex_wake",
398+
455: b"futex_wait",
399+
456: b"futex_requeue",
400+
457: b"statmount",
401+
458: b"listmount",
402+
459: b"lsm_get_self_attr",
403+
460: b"lsm_set_self_attr",
404+
461: b"lsm_list_modules",
405+
462: b"mseal",
406+
463: b"setxattrat",
407+
464: b"getxattrat",
408+
465: b"listxattrat",
409+
466: b"removexattrat",
410+
467: b"open_tree_attr",
411+
512: b"rt_sigaction",
412+
513: b"rt_sigreturn",
413+
514: b"ioctl",
414+
515: b"readv",
415+
516: b"writev",
416+
517: b"recvfrom",
417+
518: b"sendmsg",
418+
519: b"recvmsg",
419+
520: b"execve",
420+
521: b"ptrace",
421+
522: b"rt_sigpending",
422+
523: b"rt_sigtimedwait",
423+
524: b"rt_sigqueueinfo",
424+
525: b"sigaltstack",
425+
526: b"timer_create",
426+
527: b"mq_notify",
427+
528: b"kexec_load",
428+
529: b"waitid",
429+
530: b"set_robust_list",
430+
531: b"get_robust_list",
431+
532: b"vmsplice",
432+
533: b"move_pages",
433+
534: b"preadv",
434+
535: b"pwritev",
435+
536: b"rt_tgsigqueueinfo",
436+
537: b"recvmmsg",
437+
538: b"sendmmsg",
438+
539: b"process_vm_readv",
439+
540: b"process_vm_writev",
440+
541: b"setsockopt",
441+
542: b"getsockopt",
442+
543: b"io_setup",
443+
544: b"io_submit",
444+
545: b"execveat",
445+
546: b"preadv2",
446+
547: b"pwritev2",
367447
}
368448

369449
# Try to use ausyscall if it is available, because it can give us an up-to-date

0 commit comments

Comments
 (0)