Skip to content

Commit

Permalink
tools/syz-declextract: add heuristic for sigsetsize
Browse files Browse the repository at this point in the history
  • Loading branch information
dvyukov committed Nov 14, 2024
1 parent 17fe63c commit bc187e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
22 changes: 11 additions & 11 deletions sys/linux/auto.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ dup3$auto(oldfd fd, newfd fd, flags int32) (automatic)
epoll_create$auto(size int32) (automatic)
epoll_create1$auto(flags int32) (automatic)
epoll_ctl$auto(epfd fd, op int32, fd fd, event ptr[inout, epoll_event$auto_record]) (automatic)
epoll_pwait$auto(epfd fd, events ptr[inout, epoll_event$auto_record], maxevents int32, timeout int32, sigmask ptr[in, sigset_t$auto_record], sigsetsize intptr) (automatic)
epoll_pwait2$auto(epfd fd, events ptr[inout, epoll_event$auto_record], maxevents int32, timeout ptr[in, __kernel_timespec$auto_record], sigmask ptr[in, sigset_t$auto_record], sigsetsize intptr) (automatic)
epoll_pwait$auto(epfd fd, events ptr[inout, epoll_event$auto_record], maxevents int32, timeout int32, sigmask ptr[in, sigset_t$auto_record], sigsetsize const[8]) (automatic)
epoll_pwait2$auto(epfd fd, events ptr[inout, epoll_event$auto_record], maxevents int32, timeout ptr[in, __kernel_timespec$auto_record], sigmask ptr[in, sigset_t$auto_record], sigsetsize const[8]) (automatic)
epoll_wait$auto(epfd fd, events ptr[inout, epoll_event$auto_record], maxevents int32, timeout int32) (automatic)
eventfd$auto(count int32) (automatic)
eventfd2$auto(count int32, flags int32) (automatic)
Expand Down Expand Up @@ -417,8 +417,8 @@ pkey_alloc$auto(flags intptr, init_val intptr) (automatic)
pkey_free$auto(pkey int32) (automatic)
pkey_mprotect$auto(start intptr, len intptr, prot intptr, pkey int32) (automatic)
poll$auto(ufds ptr[inout, pollfd$auto_record], nfds int32, timeout_msecs int32) (automatic)
ppoll$auto(ufds ptr[inout, pollfd$auto_record], nfds int32, tsp ptr[inout, __kernel_timespec$auto_record], sigmask ptr[in, sigset_t$auto_record], sigsetsize intptr) (automatic)
ppoll_time64$auto(ufds ptr[inout, pollfd$auto_record], nfds int32, tsp ptr[inout, __kernel_timespec$auto_record], sigmask ptr[in, sigset_t$auto_record], sigsetsize intptr) (automatic)
ppoll$auto(ufds ptr[inout, pollfd$auto_record], nfds int32, tsp ptr[inout, __kernel_timespec$auto_record], sigmask ptr[in, sigset_t$auto_record], sigsetsize const[8]) (automatic)
ppoll_time64$auto(ufds ptr[inout, pollfd$auto_record], nfds int32, tsp ptr[inout, __kernel_timespec$auto_record], sigmask ptr[in, sigset_t$auto_record], sigsetsize const[8]) (automatic)
prctl$auto(option int32, arg2 intptr, arg3 intptr, arg4 intptr, arg5 intptr) (automatic)
pread64$auto(fd fd, buf ptr[inout, string], count intptr, pos intptr) (automatic)
preadv$auto(fd intptr, vec ptr[in, iovec$auto_record], vlen intptr, pos_l intptr, pos_h intptr) (automatic)
Expand Down Expand Up @@ -455,13 +455,13 @@ renameat2$auto(olddfd fd_dir, oldname ptr[in, filename], newdfd fd_dir, newname
request_key$auto(_type ptr[in, string], _description ptr[in, string], _callout_info ptr[in, string], destringid int32) (automatic)
rmdir$auto(pathname ptr[in, filename]) (automatic)
rseq$auto(rseq ptr[inout, rseq$auto_record], rseq_len int32, flags int32, sig int32) (automatic)
rt_sigaction$auto(sig int32, act ptr[in, sigaction$auto_record], oact ptr[inout, sigaction$auto_record], sigsetsize intptr) (automatic)
rt_sigpending$auto(uset ptr[inout, sigset_t$auto_record], sigsetsize intptr) (automatic)
rt_sigprocmask$auto(how int32, nset ptr[inout, sigset_t$auto_record], oset ptr[inout, sigset_t$auto_record], sigsetsize intptr) (automatic)
rt_sigaction$auto(sig int32, act ptr[in, sigaction$auto_record], oact ptr[inout, sigaction$auto_record], sigsetsize const[8]) (automatic)
rt_sigpending$auto(uset ptr[inout, sigset_t$auto_record], sigsetsize const[8]) (automatic)
rt_sigprocmask$auto(how int32, nset ptr[inout, sigset_t$auto_record], oset ptr[inout, sigset_t$auto_record], sigsetsize const[8]) (automatic)
rt_sigqueueinfo$auto(pid pid, sig int32, uinfo ptr[inout, siginfo$auto_record]) (automatic)
rt_sigsuspend$auto(unewset ptr[inout, sigset_t$auto_record], sigsetsize intptr) (automatic)
rt_sigtimedwait$auto(uthese ptr[in, sigset_t$auto_record], uinfo ptr[inout, siginfo$auto_record], uts ptr[in, __kernel_timespec$auto_record], sigsetsize intptr) (automatic)
rt_sigtimedwait_time64$auto(uthese ptr[in, sigset_t$auto_record], uinfo ptr[inout, siginfo$auto_record], uts ptr[in, __kernel_timespec$auto_record], sigsetsize intptr) (automatic)
rt_sigsuspend$auto(unewset ptr[inout, sigset_t$auto_record], sigsetsize const[8]) (automatic)
rt_sigtimedwait$auto(uthese ptr[in, sigset_t$auto_record], uinfo ptr[inout, siginfo$auto_record], uts ptr[in, __kernel_timespec$auto_record], sigsetsize const[8]) (automatic)
rt_sigtimedwait_time64$auto(uthese ptr[in, sigset_t$auto_record], uinfo ptr[inout, siginfo$auto_record], uts ptr[in, __kernel_timespec$auto_record], sigsetsize const[8]) (automatic)
rt_tgsigqueueinfo$auto(tgid pid, pid pid, sig int32, uinfo ptr[inout, siginfo$auto_record]) (automatic)
sched_get_priority_max$auto(policy int32) (automatic)
sched_get_priority_min$auto(policy int32) (automatic)
Expand Down Expand Up @@ -1104,7 +1104,7 @@ writev$auto(fd intptr, vec ptr[in, iovec$auto_record], vlen intptr) (automatic)

__aio_sigset$auto_record {
sigmask ptr[in, sigset_t$auto_record]
sigsetsize intptr
sigsetsize const[8, intptr]
}

__kernel_fd_set$auto_record {
Expand Down
7 changes: 6 additions & 1 deletion tools/syz-declextract/syz-declextract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,12 @@ std::string int32Subtype(const std::string &name, const bool isSyscallParam) {

std::string int64Subtype(const std::string &name, const bool isSyscallParam) { return "int64"; }

std::string intptrSubtype(const std::string &name, const bool isSyscallParam) { return "intptr"; }
std::string intptrSubtype(const std::string &name, const bool isSyscallParam) {
if (name == "sigsetsize") {
return makeConst(isSyscallParam, "intptr", "8");
}
return "intptr";
}

std::string stringSubtype(const std::string &name, const char *defaultName = "string") {
if (contains(name, "ifname") || endsWith(name, "dev_name")) {
Expand Down

0 comments on commit bc187e2

Please sign in to comment.