Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/seccomp-kvers.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,8 @@ enum scmp_kver {
SCMP_KV_6_15 = 78,
SCMP_KV_6_16 = 79,
SCMP_KV_6_17 = 80,
SCMP_KV_6_18 = 81,
SCMP_KV_6_19 = 82,
SCMP_KV_7_0 = 83,
__SCMP_KV_MAX,
};
18 changes: 18 additions & 0 deletions include/seccomp-syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@
#define __PNR_getpagesize -10249
#define __PNR_riscv_hwprobe -10250
#define __PNR_uretprobe -10251
#define __PNR_uprobe -10252
#define __PNR_rseq_slice_yield -10253
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the macros below it looks like __PNR_rseq_slice_yield isn't necessary as __NR_rseq_slice_yield is defined for all arches/ABIs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32-bit s390 isn't getting updates, so it needs __PNR_rseq_slice_yield

#define __PNR_listns -10254
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, it looks like __NR_listns is defined for all arches/ABIs? If not, we need to so the __SNR to __NR or __PNR macro dance down below.

Copy link
Copy Markdown
Member Author

@drakenclimber drakenclimber Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above. 32-bit s390 needs it.

This is one reason I was tempted to ditch s390 now.

The other reason is that syscalls table tool has generated some different syscall numbers from libseccomp's arch-syscall-validate for 32-bit s390. This made me nervous


/*
* libseccomp syscall definitions
Expand Down Expand Up @@ -648,6 +651,9 @@

#define __SNR_fgetxattr __NR_fgetxattr

#define __SNR_file_getattr __NR_file_getattr
#define __SNR_file_setattr __NR_file_setattr

#define __SNR_finit_module __NR_finit_module

#define __SNR_flistxattr __NR_flistxattr
Expand Down Expand Up @@ -1082,6 +1088,8 @@

#define __SNR_listmount __NR_listmount

#define __SNR_listns __NR_listns

#define __SNR_listxattr __NR_listxattr

#define __SNR_listxattrat __NR_listxattrat
Expand Down Expand Up @@ -1356,6 +1364,8 @@
#define __SNR_open_tree __PNR_open_tree
#endif

#define __SNR_open_tree_attr __NR_open_tree_attr

#define __SNR_openat __NR_openat

#define __SNR_openat2 __NR_openat2
Expand Down Expand Up @@ -1614,6 +1624,8 @@
#define __SNR_rseq __PNR_rseq
#endif

#define __SNR_rseq_slice_yield __NR_rseq_slice_yield

#define __SNR_rt_sigaction __NR_rt_sigaction

#define __SNR_rt_sigpending __NR_rt_sigpending
Expand Down Expand Up @@ -2304,6 +2316,12 @@

#define __SNR_unshare __NR_unshare

#ifdef __NR_uprobe
#define __SNR_uprobe __NR_uprobe
#else
#define __SNR_uprobe __PNR_uprobe
#endif

#ifdef __NR_uretprobe
#define __SNR_uretprobe __NR_uretprobe
#else
Expand Down
11 changes: 8 additions & 3 deletions src/arch-build-kver-tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#######################################################

from subprocess import TimeoutExpired
from pathlib import Path
import subprocess
import argparse
import os
Expand All @@ -43,7 +44,7 @@
'5.11', '5.12', '5.13', '5.14', '5.15', '5.16', '5.17',
'5.18', '5.19', '6.0', '6.1', '6.2', '6.3', '6.4', '6.5',
'6.6', '6.7', '6.8', '6.9', '6.10', '6.11', '6.12',
'6.13', '6.14', '6.15', '6.16', '6.17']
'6.13', '6.14', '6.15', '6.16', '6.17', '6.18', '6.19', '7.0']

def parse_args():
parser = argparse.ArgumentParser('Script to populate the syscalls.csv kernel versions',
Expand All @@ -66,6 +67,10 @@ def parse_args():
else:
args.versions = args.versions.split(',')

# Convert to absolute paths
args.datapath = Path(args.datapath).resolve()
args.kernelpath = Path(args.kernelpath).resolve()

return args

def run(command, verbose=False, shell=False, timeout=None):
Expand Down Expand Up @@ -135,10 +140,10 @@ def main(args):

src_path = os.path.join(args.datapath, 'data/tables')
dest_path = os.path.join(os.getcwd(), 'tables-{}'.format(kver))
cp_cmd = 'cp -r {} {}'.format(src_path, dest_path)
cp_cmd = 'cp -r {}/. {}'.format(src_path, dest_path)
ret, out, err = run(cp_cmd, shell=True)
if ret != 0:
raise RuntimeError('Table copy failed: {}'.format(ret))
raise RuntimeError('Table copy failed: {}'.format(err))

if __name__ == '__main__':
args = parse_args()
Expand Down
29 changes: 24 additions & 5 deletions src/arch-update-syscalls-csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# along with this library; if not, see <http://www.gnu.org/licenses>.
#

from pathlib import Path
import subprocess
import datetime
import argparse
Expand All @@ -36,7 +37,7 @@
ignore_syscall_list = [
'arc_gettls', 'arc_settls', 'arc_usr_cmpxchg', 'bfin_spinlock',
'cache_sync', 'clone2', 'cmpxchg_badaddr', 'dipc', 'dma_memcpy',
'exec_with_loader', 'execv', 'file_getattr', 'file_setattr',
'exec_with_loader', 'execv',
'flush_cache', 'fp_udfiex_crtl', 'getdomainname', 'getdtablesize',
'gethostname', 'getunwind', 'getxgid', 'getxpid', 'getxuid',
'kern_features', 'llseek', 'madvise1', 'memory_ordering', 'metag_get_tls',
Expand Down Expand Up @@ -79,6 +80,10 @@ def parse_args():
args = parser.parse_args()
args.versions = args.versions.split(',')

# Convert to absolute paths
args.datapath = Path(args.datapath).resolve()
args.kernelpath = Path(args.kernelpath).resolve()

return args

def run(command, verbose=False, shell=False, timeout=None):
Expand Down Expand Up @@ -182,18 +187,25 @@ def parse_syscalls_csv(args):

def insert_new_syscall(syscalls, syscall_name, column_cnt):
inserted = False
new_row = list()

for i in range(0, column_cnt):
if (i % 2) == 0:
new_row.append('PNR')
else:
new_row.append('SCMP_KV_UNDEF')

for syscall in syscalls:
if syscall_name < syscall:
idx = list(syscalls.keys()).index(syscall)
syscalls_list = list(syscalls.items())
syscalls_list.insert(idx, (syscall_name, ['PNR'] * column_cnt))
syscalls_list.insert(idx, (syscall_name, new_row))
syscalls = dict(syscalls_list)
inserted = True
break

if not inserted:
syscalls[syscall_name] = ['PNR'] * column_cnt
syscalls[syscall_name] = new_row

return syscalls

Expand Down Expand Up @@ -290,8 +302,15 @@ def update_syscalls_dict(args, columns, syscalls, kver):
format(syscall_name, column, kver))

syscalls[syscall_name][col_idx] = str(syscall_num)
maj = kver.split('.')[0]
mnr = kver.split('.')[1]

if kver.find('-rc') > 0:
# Remove trailing release candidate tags
tmp_kver = kver.split('-')[0]
else:
tmp_kver = kver

maj = tmp_kver.split('.')[0]
mnr = tmp_kver.split('.')[1]
syscalls[syscall_name][col_idx + 1] = \
'SCMP_KV_{}_{}'.format(maj, mnr)

Expand Down
Loading