pax_global_header00006660000000000000000000000064144530522370014517gustar00rootroot0000000000000052 comment=e71872454d26baf37ae1d12e9b04a73d64179555 .deps/000077500000000000000000000000001445305223700120745ustar00rootroot00000000000000.deps/.gitignore000066400000000000000000000001071445305223700140620ustar00rootroot00000000000000# Ignore everything in this directory * # Except this file !.gitignore .gitignore000066400000000000000000000002551445305223700130550ustar00rootroot00000000000000core.* *.o *.d trinity logs/ trinity*.log trinity.socketcache tmp trinity-*.tar.xz victims tags config.h version.h .*.swp cscope.* ncscope.* cov-int trinity-coverity.tar.xz COPYING000066400000000000000000000435111445305223700121220ustar00rootroot00000000000000note that the only valid version of the GPL as far as trinity is concerned is _this_ particular version of the license (ie v2, not v2.2 or v3.x or whatever), unless explicitly otherwise stated. ---------------------------------------- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. Documentation/000077500000000000000000000000001445305223700136745ustar00rootroot00000000000000Documentation/HACKING.txt000066400000000000000000000056361445305223700155130ustar00rootroot00000000000000* Building on old distributions. Trinity is developed using the latest glibc/kernel, which means from time to time changes are introduced which may make it fail to compile on older distributions (especially enterprise ones). The preferred way to fix this is to add the missing declarations to compat.h If for some reason you can't detect presence of a definition in a header file (or need to test prescence of a header file), add it to configure.sh. This should be a last resort, in most cases an #ifndef addition to compat.h will be enough. This means of course that trinity will be trying to run new syscalls on older kernels that don't implement them, but it will only call them once. After the first -ENOSYS, it gets marked as "Don't run this again". It also allows us to run and test newer kernels on distributions with older userspace whose header files may not define those features. * Porting to new architectures - Add a syscalls-{archname}.h defining the syscall table in the same order as your arch - Add a arch-{archname}.h to define useful things like PAGE_OFFSET - If your arch starts its Linux syscalls at non-zero (like MIPS/IA64 do), define SYSCALL_OFFSET in arch-{archname}.h - Add syscalls/{syscallname}.c for your arch specific syscalls. - Change setup_syscall_tables in tables.c to pick the correct syscall table for your arch. That should be it. * Adding new sanitise routines syscalls: - First, decide if it's worth adding a sanitise routine at all, or if the generic sanitise routines are good enough, by setting each arguments .arg*type member to an appropriate ARG_* - In cases where the generic routines are either insufficient, or need to be overridden, the .sanitise member of the syscall struct can be pointed to a routine that will run after the generic sanitise routines. - The 'child' parameter of the sanitise function is to be used to index the various per-child arrays in the shm. - Likewise, after the syscall is run, you may need to free up resources allocated in the .sanitise. You can do this in the .post function. There's an unsigned long in the shm named 'scratch' that may be used to store ptrs to resources etc for retrieval later in .post - Beware of 'over sanitising' and limiting the possibility for boundary conditions to be violated. A syscall that always succeeds is not the goal, you want to be exercising as many error paths as possible. ioctls: TODO * Process model. On startup, the first process sets up the shm etc, and then enters the 'main' loop (see main.c), which is responsible for.. - initial opening of sockets/fd's. See sockets.c/fds.c/files.c - forking new children See fork_children() - handling those children. See handle_child() - makes sure the child processes are making progress, - Checks to see if the kernel has become tainted. - assorted other 'periodic' tasks. Documentation/Known-bugs.txt000066400000000000000000000024241445305223700164710ustar00rootroot00000000000000- render_arg occasionally scribbles past the end of the postbuffer. This becomes more obvious when trinity is run with MALLOC_PERTURB_ set. - getrandom syscall can block, and the watchdog can't kill it. Might need a ->sanitise routine to prevent blocking ops. - -c execve seems to always pass the same junk as args. - -r and -c don't seem to work together - when we randomly call personality, the child stops logging. - fuzzing certain syscalls causes segfaults - modify_ldt: This needs a proper sanitise routine - Various VM syscalls cause us to corrupt our own state. - munmap: Looks like we munmap something important. - move_pages: possibly a similar bug. - mprotect: Setting page_rand to readonly for eg will cause segv's. These need to work on their own allocated pages, or better yet a list of victim allocations. - fuzzing read() occasionally hangs a long time. Probably a socket ? The watchdog _should_ be killing processes that hang, but if they're stuck in D state, there's not much we can do. Maybe close that fd so we don't hang on it again? - occasionally a thread exits after 0 syscalls. Find out why. - occasionally trinity fails to startup because we've leaked so much ipc stuff. cleanup on startup. (scripts/clean-ipc.sh in the meantime) Documentation/TODO000066400000000000000000000506421445305223700143730ustar00rootroot00000000000000* Object logging. - Attach an operation history to each object to be dumped at post-mortem time. - Will need a comms channel from children->main. pipe? unix socket? * Various syscall improvements. - brk could be smarter about existing brk - Revisit fuzzing ptrace. - It's disabled currently because of situations like.. child a traces child b child a segfaults child b never proceeds, and doesn't get untraced. - semtimedop needs a timeout - execve close stderr/stdin/stdout and then dup weird fd's - demux do_futex - mremap post needs to get rid of global 'map'. Stash something in ->rec ? - Improve ioctl - VFS ioctls - ext ioctls - XFS ioctls - 3rd param to ioctl struct for the arg type - needs filename globbing for some ioctls - Maybe just make the ioctl's be NEED_ROOT child ops - audit which syscalls never succeed, and write sanitise routines for them - sanitise for shmget/shmat/shmctl - Make the write variants handle all common block/page sizes. The ARG_LEN code in particular could probably be made better. * Further syscall annotation improvements - Finish annotating syscall return types & error codes. - Add missing system calls. - Run scripts/hashcheck.sh to get info on new bits that need adding to Trinity. - Add additional userspace APIs to hashcheck * UDP logging - This is pretty rough right now, but kinda works. : Shortcomings: - if client crashes, or gets oom killed, server doesn't detect and sits on packets. flush-on-no-packet-in-a-while ? - ctrl-c on server should flush queues - getting a new handshake message should flush queues - if hasn't flushed in a while, will eventually oom. - accumulate packets, and kick threads to dispatch as needed ? - when we get a child spawn/signal/quit message, clear the queue of old pid first. - When this is solid enough, can we kill off post-mortem code ? - Likewise, can we revert all the log-to-disk stuff again, and just run a server on localhost ? - client perform extended tracking: - global fd logging. Store a linked-list of every op that happened to an fd, and the pid that did it. - log child exit reasons, so we can print reason when children just 'exit after n ops' - destroy context & restart when main exits. There's beginnings of multi-session support in how the fuzzsession struct was created, but there's no code to manage the possibility of multiple of them. I forward-planned a little too far here, thinking about a possible future where we have one server, and multiple clients running simultaneously. * Flesh out the child ops some more - Add more things that a real program would do. - add all the ops things like fsx do. - do file ops on a bunch of trinity test files - open->read->close - open->mmap->access mem->close - sysctl writes. (blacklist sysrq-trigger etc) - pick random elevator alg for all queues - fork-and-dirty mappings - send fd's over unix sockets to other children - open/read all /proc/$$/* files - tuned random syscalls. (open -> read -> close). tree of possibilities. - increment progress in childops - memcpy between map ptrs - child type where it picks one syscall and hammers on it with random args - maybe also hammer on an ->assoc - mlock patterns. Every other page etc. - madvise(DONTNEED/WILLNEED) in a loop on a mapping for a while. - "mmap-pagefault-munmap" loop - ioctls as child-op type - mprotect adjacent pages to random prot's, then all the same, to test splitting/merging - walk backwards - /dev/shm hugepage fuckery. - fork(), mess with maps, exit - fsx stuff - readdir() - inode spewer - create nested dir struct - create huge number of files in a subdir - nftw (stat/read/write) - nftw (stat/mmap/write) - nftw to delete subtree - variant: delete as we go - variant: create inotify/fsnotify watches "mount, make millions of inodes in cache, then unmount, and everything is sad" - http://bazaar.launchpad.net/~domas-mituzas/%2Bjunk/uncache/annotate/head%3A/uncache.c - blast data through a pipe / read from a pipe - producer/consumer over an ipv[46] socket - open/access/write/close one file concurrently - tsearch: http://serverfault.com/questions/183821/rm-on-a-directory-with-millions-of-files - read a file page at a time, MADV_DONTNEED'ing as we go - root child-ops - cgroup shit - mount something on a testdir - ionice - sched features - vm compaction - mkfs & mount a ramdisk, cd into it, add to pathname list. - loopback mount - cd back to original cwd, unmount a ramdisk - chroot to a destdir - create a pidns - mount a proc,sysfs,tmpfs in a destdir - unshare(CLONE_NEWPID) - fork then returns 1 in the child ? https://www.exploit-db.com/exploits/36746/ http://stealth.openwall.net/xSports/clown-newuser.c - echo 0,1,2 > /sys/kernel/mm/ksm/run - /proc/sys/vm/drop_cache * mm related improvements: - mmapping: - Sometimes generate overlapping addresses/lengths when we have ARG_ADDRESS/ARG_ADDRESS2 pairs - munge lengths when handing out maps. - mmap files (we do this already, but don't track it properly) - get_map_fragment() - keep track of holes when mprotect/munmap'd split maps in two ? (store original len, and current len) note: initial maps are MAP_SHARED. What to do? - mapping transaction log for dumping in post-mortem - huge pages - hugetlbfs mappings - crib from hugetlbfs tests examples for more ideas. - /dev/shm mappings - pass memfd's in mmap sanitise - sysv shm handling could be improved. - map cache a la last-fd cache - map struct needs a destructor. id = shmget(IPC_PRIVATE, 3 * PAGE_SIZE, 0); p = shmat(id, NULL, 0); shmctl(id, IPC_RMID, NULL); remap_file_pages(p, 3 * PAGE_SIZE, 0, 7, 0); In this case, the destructor is shmdt - Only allow max of 2-3 huge pages per child - Check we update map struct ptr when we mremap it * Networking improvements. - More focus on non-ipv4 protocols. - igmp - ipv6 / 6to4 - sctp - ipip - tun (vxlan / gre) - ppp - pppoe - tipc - rds - nfc - nft - iscsi - for syscalls that take a fd and a sockaddr, look up the triplet and match. - Flesh out sockaddr/socket gen for all remaining protocols. - setsockopt coverage is still lacking for some protocols. - improve netlink fuzzing. - Make sure we support all the different socket types. - pass down more realistic looking messages. - param to specify an ip of a victim machine - --proto-exclude - check EAFNOSUPPORT if -P - split ARG_SOCKET into per proto object caches ? - have write() check if the fd to be written to is a socket if so, lookup protocol, and use correct ->genpacket - in fds/sockets, as well as bind() try connect() random ip's borrow from https://github.com/borkmann/stuff/blob/master/daytime.c - accept() only on IPPROTO_IP sockets - linger off vs 0 linger - make -P INET:DCCP work - rewrite socket init to just do < 5 of each known proto type - Pass FD's over AF_UNIX between children - more ->socket entries for missing ones? - store the ports we're listening on in the shm, and use those when we send() --no-rfc1918, so we only use localhost - Is the socketcache still useful ? Probably not.. * Improve the ->post routine to walk a list of objects that we allocated during a syscalls ->sanitise in a ->post method. - On return from the syscall, we don't call the destructor immediately. We pick a small random number, and do N other syscalls before we do the destruction. This requires us to create a list of work to be done later, along with a pointer to any allocated data. - some ancillary data needs to be destroyed immediately after the syscall (it's pointless keeping around mangled pathnames for eg). For this, we just destroy it in ->post - Right now ->sanitise routines have to pick either a map, or malloc itself and do the right thing to free it in ->post. By tagging what the allocation type was in generic-sanitise, we can do multiple types. * munge_process() on child startup - replace fork() with random clone() - run children in different namespaces, personalities. - unshare - do some random fcntls to all fd's on child spawn - on child startup, setup some cgroup params for that child. * Some debugging enhancements. - Make -D use a separate debug log file - improve debugf re: http://c-faq.com/varargs/handoff.html - Activate the function tracer before each syscall. Flush before calling. * postmortem improvements - change child->syscall / ->previous to be a ringbuffer of syscallrecord structs. - Compare timestamp that taint was noticed at, ignore all later. - log 'unfinished' if state isn't complete. - function that takes a void * and outputs what it is (mapping, page_* etc) (searches various lists etc) * Extra command line args. --dry-run mode. need to work around segv's when we do things like mmap->post and register null maps. --disable-fault-injection --pause (reinstate the old code to pause for a second after a syscall) * fd handling improvements. - kill off NR_FILE_FDS - open some files in the child too after forking. - this requires a child-local fd mapping table. Maybe we can then reduce the size of the shared shm->file_fds - When requesting an fd, occasionally generate a new one. - parallelize nftw walks on startup using threads. - support for multiple victim file parameters - nftw of /lib/modules ? (for passing to init_module) (if run as root) - separate lists for dev sysfs etc When picking a random path, instead of treating the pool of paths as one thing, treat it as multiple (/dev, /sys, /proc). And then do a 1-in-3 chance of getting one of those. Right now, because there are 5-6 digits worth of /proc & /sys, they dominate over the /dev entries. - more fd 'types' (fanotify_init) - need a way to go from fd to string describing what it is. for post-mortem - deregister fd providers if init of one fails - separate fd lists for dirs vs files - make fd providers take array to fillin & num of fds as params. - child fd's - call some fd providers from children after init - periodically close/reopen existing fds - random selection of fd providers on startup - stuck_syscall_info should close the fd This needs a way to communicate from child -> main. - mmap more fd types Pathname rewrite: - convert pathnames to objects - separate pools for dev, sys, proc, testfile etc - get_random_pathname picks from a random pool - make get_filename return testfile[n] - make sure pathnames are read-only - make handle_arg_address return ptr to pathname - open() should add to local fd's. - finish globbing in ignore_files - add sd[a-z]* hd[a-z]* - if -EBADF remove the object - children should nftw and create their own local objects * Pretty-print improvements. - decode fd number -> filename in output - decode addresses when printing them out to print 'page_rand+4' instead of a hex address. - ->decode_argN functions to print decoded flags etc. - decode maps. - These things are all probably better done in the udp server at this point. * filename related issues. - filename cache. Similar to the socketcache. Create on startup, then on loading, invalidate entries that aren't present (/proc/pid etc). This should improve reproducability in some cases. Right now, when a syscall says "open the 5231st filename in the list", it differs across runs because we're rebuilding the list, and the system state means stuff moves around. - Add a way to add a filter to filelist. ie, something like --filter-files=*[0-9]* to ignore all files with numbers in them. Maybe also make this a config file parser. - Dump filelist to a logfile. (Perhaps this ties in with the idea above to cache the filelist?) - blacklist filenames for victim path & /proc/self/exe - make sure we don't call unlink() or rmdir() on them - also need to watch /proc/$$/exe, look up using shm->pids. - file list struct extensions - use count - create N testfiles for each -V * Perform some checks on return from syscall - check padding between struct members is zeroed. * allow for multiple -G's (after there is more than 'vm') - multigroups. mmap should be in VFS too - -G SCHED - -G IPC * if a read() blocks, blacklist (close?) that fd/filename. This needs a way to communicate from child -> main. * structured logging. - Basic premise is that we store records of each syscall in a manner that would allow easier replay of logs. - For eg, if a param is an fd, we store the type (socket/file/etc..) as well as a pathname/socket triplet/whatever to create it. - Take a logdump from the server, and rerun it on the client with --parselog=mylog.bin - Done correctly, this should allow automated bisecting of replays. - Different replay strategies: - replay log in reverse order - brute force replay using 1 call at a time from beginning of log + last syscall. (possibly unnecessary if the above strategies are good enough) - Once bisected, have a tool that can parse the binary log, and generate C. - Would need a separate binary logfile for each child. Because locking on a shared file would slow things down, and effectively single thread things, unless the children pass things to a separate logger thread, which has its own problems like potentially losing the last N syscalls if we crash) - To begin with, just allow replay/bisect using one child process. Synchronising threads across different runs may be complicated. * Misc improvements. - implement _lock->queue so waiters get the lock on a FIFO basis. (Do we have enough contention this matters?) - Add a NEEDS_ROOT flag for syscalls that are expected to fail. (and then if !root, deactivate them on startup) - avoid BORING syscalls. geteuid etc is kinda pointless. (maybe an override param to call them) - unix socket for comms between children/parent. also other apps so we can do stats gathering, debug, config changes etc - make check_children_progressing() look at se.exec_start field of /proc/1/task/1/sched (I can't remember the reasoning for this idea, it came from the watchdog days) - make -V do IS_CHR() etc tests and add to device list if chardev/blockdev - --no-sync to disable sync,syncfs,fsync,fdatasync - ioprio tweaking before doing io - split out sighandler -> sigalarmhandler - more --stats - count segv's. - Output errno distribution on exit - fastest/slowest syscall (that completed) - syscalls per second - segfaults per second * Misc cleanups - Move arch specific syscalls into syscalls/arch/ - Move addresses in get_interesting_value() to a function in per-arch headers. - audit all uses of rand64 for 32bit builds - possible helpers - zfree (free & null) - check_errno(EINVAL) (checks if -1, and checks errno, returns bool) [I forget why this was useful] - set_random_bits() - fix up -q. trinity -h needs to be more silent for non help related text - split up compat.h - merge fruncate/truncate - merge sync/fsync/syncfs - constructors for objects, like the fd providers * add a kernel rodata addr to trinity (sys_call_table for eg) * watch dmesg buffer for interesting kernel messages and halt if necessary. Lockdep for eg. * Blocked child improvements. - if we find a blocking fd, check if it's a socket, and shutdown() it. (tricky: we need to do the shutdown in the main process, and then tell other children) * things to check. - disappearing processes. 'oom killed maybe' when no oom. * pthreads. (Real long term, lots of work). - allocate separate childdata for each thread, and pass into pthread_create - allocate child->syscall.pre/post buffers too (maybe just use reinit_child?) - child_process takes ptr to childdata struct (just shm addr for processes) - set_seed needs to factor in pthread number. - locking needs to be pthread aware put mutex in lock_t ? - logging for threads? - send pthread_kill - split childdata into threaddata & childdata - logfiles got a lot trickier. nrgh. (postpone until after udp logging implemented) - audit getpids that should now be gettid's - more syscalls to be marked avoid ? - allocate threaddata/syscallrecord before/after syscall - tgkill instead of kill ? - child needs to 'tick' and also become mini-watchdog checking on threads. - each syscall: void *thr(void *p) { regset = (struct regset *) p; do_syscall(regset); } pthread_t th; pthread_create(&th, 0, thr, regset); //pthread_join(th, 0); pthread_detach(th) - parallelize nftw's on startup * bugs that need fixing -a64 is positional vs -c -g vm -c sendfile -a64 enables 1 32bit. use of socketinfo in syscall sanitizers will segv if --disable-fds=sockets - move to object cache - sysv objects - iovecs - store shmat return addresses. - keyctl foo * AVOID_SYSCALL_IF_ROOT might be useful ? * Improve ftrace setup - command line arg to enable function tracer or function-graph - use a list of functions to avoid. * make dropprivs default. - Move the drop privs code from main to just before we start a new child. * New ARG_ types - ARG_FPOS - 0 - page_size -1 - page_size - page_size * 2 - (page_size * 2) -1 - ARG_SHMID - More ARG_*FD types - ARG_FD -> ARG_FD_FILE - ARG_FD_DIR - ARG_FD_PIPE - ARG_FD_SIGNAL - ARG_FD_EVENT - ARG_FD_TIMER - ARG_FD_EPOLL - ARG_FD_MQ - ARG_FD_INOTIFY - ARG_FD_FANOTIFY - ARG_FD_TTY - ARG_FD_FUSE - ARG_FD_TTY - ARG_FD_DRM - ARG_FILENAME - kill off ARG_NON_NULL_ADDRESS & ARG_ADDRESS Long way to go here. Generally, use ARG_MMAP - ARG_DEVT - ARG_TIMESPEC makedev dev_t's for dev args unlink on /dev files should be disallowed scan /proc/filesystems for args for sys_mount Gather more from /proc/mounts ? Look at iknowthis for examples. Maintain a tree of errnos that a syscall has seen. (only tricky part is that it needs to be in the shm) on startup, enable /proc/sys/net/core/bpf_jit_enable if we're root ram disks for mkfs,mount etc audit malloc uses in syscalls and convert to ARG_MMAP use where possible zmalloc should indicate to children to munlockall, sleep, and then retry (some unix socket shared between children->main for comms?) load balancer: - monitor meminfo/loadavg and dynamically adjust number of children - fork extra children when more than half have been sent KILLs - set shm->notprogressing if stall count reaches == nr_running_child/2 - dont fork new processes if set - halve max_children - kill a few children at random New directions: - variable alarm time for syscalls that might take longer than usual. - recursion depth in child struct, so we can call fork/clone - use clone instead of fork() sometimes. - per child pids[] array ? - This gets messy with things like adding to object lists so might not be a good idea. - .assoc for things like socket/shutdown, open/close, mmap/munmap, truncate/lseek etc - create hash of call chain in kernel (mask out boring funcs) - use kcov for kernel traces - in syscall struct have a tree of mutations struct mutation { unsigned long tracehash; struct regset regs; } - if ->mutations is empty, generate args. otherwise, get mutation from list, and mutate one arg. if new run = new hash, store mutation in list. if new run = existing hash, refetch mutation & mutate again - if no other mutations, generate all new args - if child dies, generate all new args * Revisit kcov code, and make use of the stacktraces in some way. - we're not a mutational fuzzer (yet?) like syzkaller, so we might have to think of something different to do here. Some old, possibly no longer interesting ideas: If success, store parameters - each arg in syscall struct gets a valid inputs entry ARG_FD: bitmap of fd's that don't inval ARG_LEN: min/max - generate_args - looks at past successes and picks a mix of 90% the same as last inputs. - occasionally try something completely new Store success/fail per syscall hash stack trace for each arg { mutate arg <---+ if new stack trace | store arg | if tries < 10 ----+ } Documentation/pro-tips.txt000066400000000000000000000004761445305223700162210ustar00rootroot00000000000000Some things you might like to know to run trinity like a pro(tm). - The kernel is pretty noisy in some areas. You might find that it's worthwhile to remove a bunch of the noisier printk/WARN statements in your kernel tree while fuzzing. - Likewise, setting the sysctl net.core.warnings = 0 may be a good idea. Makefile000066400000000000000000000101061445305223700125210ustar00rootroot00000000000000VERSION="2023.01" INSTALL_PREFIX ?= $(DESTDIR) INSTALL_PREFIX ?= $(HOME) NR_CPUS := $(shell grep -c ^processor /proc/cpuinfo) ifeq ($(CC),"") CC := gcc endif CC := $(CROSS_COMPILE)$(CC) LD := $(CROSS_COMPILE)$(LD) CFLAGS ?= -g -O2 -D_FORTIFY_SOURCE=2 CFLAGS += -Wall -Wextra -I. -Iinclude/ -include config.h -Wimplicit -D_GNU_SOURCE -D__linux__ CCSTD := $(shell if $(CC) -std=gnu11 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-std=gnu11"; else echo "-std=gnu99"; fi) CFLAGS += $(CCSTD) ifneq ($(SYSROOT),) CFLAGS += --sysroot=$(SYSROOT) endif #CFLAGS += $(shell if $(CC) -m32 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-m32"; fi) CFLAGS += -Wformat=2 CFLAGS += -Winit-self CFLAGS += -Wnested-externs CFLAGS += -Wpacked CFLAGS += -Wshadow CFLAGS += -Wswitch-enum CFLAGS += -Wundef CFLAGS += -Wwrite-strings CFLAGS += -Wno-format-nonliteral CFLAGS += -Wstrict-prototypes -Wmissing-prototypes CFLAGS += -fsigned-char # BPF spew. CFLAGS += -Wno-missing-field-initializers # needed for show_backtrace() to work correctly. LDFLAGS += -rdynamic # glibc versions before 2.17 for clock_gettime LDLIBS += -lrt # gcc only. ifneq ($(shell $(CC) -v 2>&1 | grep -c "clang"), 1) CFLAGS += -Wlogical-op CFLAGS += -Wstrict-aliasing=3 endif # Sometimes useful for debugging. more useful with clang than gcc. #CFLAGS += -fsanitize=address V = @ Q = $(V:1=) QUIET_CC = $(Q:@=@echo ' CC '$@;) all: trinity test: @if [ ! -f config.h ]; then echo "Run configure.sh first." ; exit; fi MACHINE := $(shell $(CC) -dumpmachine) SYSCALLS_ARCH := $(shell case "$(MACHINE)" in \ (sh*) echo syscalls/sh/*.c ;; \ (ia64*) echo syscalls/ia64/*.c ;; \ (ppc*|powerpc*) echo syscalls/ppc/*.c ;; \ (sparc*) echo syscalls/sparc/*.c ;; \ (x86_64*) echo syscalls/x86/*.c \ syscalls/x86/i386/*.c \ syscalls/x86/x86_64/*.c;; \ (i?86*) echo syscalls/x86/*.c \ syscalls/x86/i386/*.c;; \ (s390x*) echo syscalls/s390x/*.c ;; \ esac) VERSION_H := include/version.h HEADERS := $(patsubst %.h,%.h,$(wildcard *.h)) $(patsubst %.h,%.h,$(wildcard syscalls/*.h)) $(patsubst %.h,%.h,$(wildcard ioctls/*.h)) SRCS := $(wildcard *.c) \ $(wildcard fds/*.c) \ $(wildcard ioctls/*.c) \ $(wildcard mm/*.c) \ $(wildcard net/*.c) \ $(wildcard rand/*.c) \ $(wildcard syscalls/*.c) \ $(SYSCALLS_ARCH) OBJS := $(sort $(patsubst %.c,%.o,$(wildcard *.c))) \ $(sort $(patsubst %.c,%.o,$(wildcard fds/*.c))) \ $(sort $(patsubst %.c,%.o,$(wildcard ioctls/*.c))) \ $(sort $(patsubst %.c,%.o,$(wildcard mm/*.c))) \ $(sort $(patsubst %.c,%.o,$(wildcard net/*.c))) \ $(sort $(patsubst %.c,%.o,$(wildcard rand/*.c))) \ $(sort $(patsubst %.c,%.o,$(wildcard syscalls/*.c))) \ $(sort $(patsubst %.c,%.o,$(SYSCALLS_ARCH))) DEPDIR= .deps -include $(SRCS:%.c=$(DEPDIR)/%.d) $(VERSION_H): scripts/gen-versionh.sh Makefile $(wildcard .git) @scripts/gen-versionh.sh trinity: test $(OBJS) $(HEADERS) $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o trinity $(OBJS) $(LDLIBS) @mkdir -p tmp df = $(DEPDIR)/$(*D)/$(*F) %.o : %.c | $(VERSION_H) $(QUIET_CC)$(CC) $(CFLAGS) -o $@ -c $< @mkdir -p $(DEPDIR)/$(*D) @$(CC) -MM $(CFLAGS) $*.c > $(df).d @mv -f $(df).d $(df).d.tmp @sed -e 's|.*:|$*.o:|' <$(df).d.tmp > $(df).d @sed -e 's/.*://' -e 's/\\$$//' < $(df).d.tmp | fmt -1 | \ sed -e 's/^ *//' -e 's/$$/:/' >> $(df).d @rm -f $(df).d.tmp clean: @rm -f $(OBJS) @rm -f core.* @rm -f trinity @rm -f tags @rm -rf $(DEPDIR)/* @rm -rf trinity-coverity.tar.xz cov-int @rm -f $(VERSION_H) tag: @git tag -a v$(VERSION) -m "$(VERSION) release." tarball: @git archive --format=tar --prefix=trinity-$(VERSION)/ HEAD > trinity-$(VERSION).tar @xz -9 trinity-$(VERSION).tar install: trinity install -d -m 755 $(INSTALL_PREFIX)/bin install trinity $(INSTALL_PREFIX)/bin tags: $(SRCS) @ctags -R --exclude=tmp scan: @scan-build --use-analyzer=/usr/bin/clang make -j $(NR_CPUS) coverity: @rm -rf cov-int trinity-coverity.tar.xz @cov-build --dir cov-int make -j $(NR_CPUS) @tar cJvf trinity-coverity.tar.xz cov-int cppcheck: @scripts/cppcheck.sh README000066400000000000000000000155741445305223700117570ustar00rootroot00000000000000Trinity: Linux system call fuzzer. "After the initial euphoria of witnessing the explosion had passed, test director Kenneth Bainbridge commented to Los Alamos director J. Robert Oppenheimer, "Now we are all sons of bitches." Oppenheimer later stated that while watching the test he was reminded of a line from the Hindu scripture the Bhagavad Gita: Now I am become Death, the destroyer of worlds." ####################################################################### WARNINGS: * This program may seriously corrupt your files, including any of those that may be writable on mounted network file shares. It may create network packets that may cause disruption on your local network. * Trinity may generate the right selection of syscalls to start sending random network packets to other hosts. While every effort is made to restrict this to IP addresses on local lans, multicast & broadcast, care should be taken to not allow the packets it generates to go out onto the internet. Run at your own risk. ####################################################################### System call fuzzers aren't a particularly new idea. As far back as 1991, people have written apps that bomb syscall inputs with garbage data, that have had a variety of success in crashing assorted operating systems. After fixing the obvious dumb bugs however, a majority of the time these calls will just by rejected by the kernel very near the beginning of their function entry point as basic parameter validation is performed. Trinity is a system call fuzzer which employs some techniques to pass semi-intelligent arguments to the syscalls being called. The intelligence features include: - If a system call expects a certain datatype as an argument (for example a file descriptor) it gets passed one. This is the reason for the slow initial startup, as it generates a list of fd's of files it can read from /sys, /proc and /dev and then supplements this with fd's for various network protocol sockets. (Information on which protocols succeed/fail is cached on the first run, greatly increasing the speed of subsequent runs). - If a system call only accepts certain values as an argument, (for example a 'flags' field), trinity has a list of all the valid flags that may be passed. Just to throw a spanner in the works, occasionally, it will bitflip one of the flags, just to make things more interesting. - If a system call only takes a range of values, the random value passed is biased to usually fit within that range. Trinity logs it's output to a files (1 for each child process), and fsync's the files before it actually makes the system call. This way, should you trigger something which panics the kernel, you should be able to find out exactly what happened by examining the log. There are several test harnesses provided (test-*.sh), which run trinity in various modes and takes care of things like cpu affinity, and makes sure it runs from the tmp directory. (Handy for cleaning up any garbage named files; just rm -rf tmp afterwards) ######### options ############################################### --quiet/-q: reduce verbosity. Specify once to not output register values, or twice to also suppress syscall count. --verbose: increase verbosity. -D: Debug mode. This is useful for catching core dumps if trinity is segfaulting, as by default the child processes ignore those signals. -sN: use N as random seed. (Omitting this uses time of day as a seed). Note: There are currently a few bugs that mean no two runs are necessary 100% identical with the same seed. See the TODO for details. --kernel_taint/-T: controls which kernel taint flags should be considered. The following flag names are supported: PROPRIETARY_MODULE, FORCED_MODULE, UNSAFE_SMP, FORCED_RMMOD, MACHINE_CHECK, BAD_PAGE, USER, DIE, OVERRIDDEN_ACPI_TABLE, WARN, CRAP, FIRMWARE_WORKAROUND, and OOT_MODULE. For instance, to set trinity to monitor only BAD, WARN and MACHINE_CHECK flags one should specify "-T BAD,WARN,MACHINE_CHECK" parameter. --list/-L: list known syscalls and their offsets --proto/-P: For network sockets, only use a specific packet family. --victims/-V: Victim file/dirs. By default, on startup trinity tree-walks /dev, /sys and /proc. Using this option you can specify a different path. (Currently limited to just one path) -p: Pause after making a syscall --children/-C: Number of child processes. -x: Exclude a syscall from being called. Useful when there's a known kernel bug you keep hitting that you want to avoid. Can be specified multiple times. -cN: do syscall N with random inputs. Good for concentrating on a certain syscall, if for eg, you just added one. Can be specified multiple times. --group/-g Used to specify enabling a group of syscalls. Current groups defined are 'vm' and 'vfs'. --logging/-l off: This disables logging to files. Useful if you have a serial console, though you will likely lose any information about what system call was being called, what maps got set up etc. Does make things go considerably faster however, as it no longer fsync()'s after every syscall : sends packets over udp to a trinity server running on another host. Note: Still in development. Enabling this feature disables log-to-file. : Specify a directory where trinity will dump its log files. --ioctls/-I will dump all available ioctls. --arch/-a Explicit selection of 32 or 64 bit variant of system calls. ####################################################################### Examples: ./trinity -c splice Stress test the splice syscall ./trinity -x splice Call every syscall except for splice. ./trinity -qq -l off -C16 Turn off logging, and suppress most output to run as fast as possible. Use 16 child processes ####################################################################### Development discussion of trinity occurs at trinity@vger.kernel.org As with all vger mailing lists, subscribe by sending 'subscribe trinity' in the body of a mail to majordomo@vger.kernel.org ######### Links to similar projects #################################### = tsys - 1991. http://groups.google.com/groups?q=syscall+crashme&hl=en&lr=&ie=UTF-8&selm=1991Sep20.232550.5013%40smsc.sony.com&rnum=1 = iknowthis http://iknowthis.googlecode.com Fuzzer by Tavis Ormandy with very similar goals to this project. = sysfuzz basic fuzzer by Ilja van Sprundel mentioned in http://events.ccc.de/congress/2005/fahrplan/attachments/683-slides_fuzzing.pdf http://leetupload.com/dbindex2/index.php?dir=Linux/&file=sysfuzz.tar.gz = xnufuzz https://github.com/fintler/xnufuzz/tree/ basic fuzzer for XNU. Looks to be based on Ilja's sysfuzz. = kg_crashme / ak_crashme / dj_crashme Kurt Garloff wrote a fuzzer similar to Ilja's sysfuzz in 2003. The ak / dj variants were improvements added by Andi Kleen, and Dave Jones. arg-decoder.c000066400000000000000000000112561445305223700134100ustar00rootroot00000000000000/* * Routines to take a syscallrecord and turn it into an ascii representation. */ #include #include "arch.h" //PAGE_MASK #include "arg-decoder.h" #include "params.h" // logging, quiet_level #include "pids.h" #include "shm.h" #include "syscall.h" #include "tables.h" #include "utils.h" static char * decode_argtype(char *sptr, unsigned long reg, enum argtype type) { switch (type) { case ARG_PATHNAME: sptr += sprintf(sptr, "\"%s\"", (char *) reg); break; case ARG_PID: case ARG_FD: case ARG_SOCKETINFO: sptr += sprintf(sptr, "%ld", (long) reg); break; case ARG_MODE_T: sptr += sprintf(sptr, "%o", (mode_t) reg); break; case ARG_ADDRESS: case ARG_NON_NULL_ADDRESS: case ARG_IOVEC: case ARG_SOCKADDR: sptr += sprintf(sptr, "0x%lx", reg); break; case ARG_MMAP: /* Although generic sanitise has set this to a map struct, * common_set_mmap_ptr_len() will subsequently set it to the ->ptr * in the per syscall ->sanitise routine. */ sptr += sprintf(sptr, "%p", (void *) reg); break; case ARG_OP: case ARG_LIST: sptr += sprintf(sptr, "0x%lx", reg); break; case ARG_UNDEFINED: case ARG_LEN: case ARG_RANGE: case ARG_CPU: case ARG_IOVECLEN: case ARG_SOCKADDRLEN: if (((long) reg < -16384) || ((long) reg > 16384)) { /* Print everything outside -16384 and 16384 as hex. */ sptr += sprintf(sptr, "0x%lx", reg); } else { /* Print everything else as signed decimal. */ sptr += sprintf(sptr, "%ld", (long) reg); } break; } return sptr; } static char * render_arg(struct syscallrecord *rec, char *sptr, unsigned int argnum, struct syscallentry *entry) { const char *name = NULL; unsigned long reg = 0; enum argtype type = 0; switch (argnum) { case 1: type = entry->arg1type; name = entry->arg1name; reg = rec->a1; break; case 2: type = entry->arg2type; name = entry->arg2name; reg = rec->a2; break; case 3: type = entry->arg3type; name = entry->arg3name; reg = rec->a3; break; case 4: type = entry->arg4type; name = entry->arg4name; reg = rec->a4; break; case 5: type = entry->arg5type; name = entry->arg5name; reg = rec->a5; break; case 6: type = entry->arg6type; name = entry->arg6name; reg = rec->a6; break; } if (argnum != 1) sptr += sprintf(sptr, ", "); sptr += sprintf(sptr, "%s=", name); sptr = decode_argtype(sptr, reg, type); if (entry->decode != NULL) { char *str; str = entry->decode(rec, argnum); if (str != NULL) { sptr += sprintf(sptr, "%s", str); free(str); } } return sptr; } /* * Used from output_syscall_prefix, and also from postmortem dumper */ static unsigned int render_syscall_prefix(struct syscallrecord *rec, char *bufferstart) { struct syscallentry *entry; struct childdata *child = this_child(); char *sptr = bufferstart; unsigned int i; unsigned int syscallnr; syscallnr = rec->nr; entry = get_syscall_entry(syscallnr, rec->do32bit); sptr += sprintf(sptr, "[child%u:%u] [%lu] %s", child->num, pids[child->num], child->op_nr, rec->do32bit == TRUE ? "[32BIT] " : ""); sptr += sprintf(sptr, "%s(", entry->name); for_each_arg(entry, i) { sptr = render_arg(rec, sptr, i, entry); } sptr += sprintf(sptr, ") "); return sptr - bufferstart; } static unsigned int render_syscall_postfix(struct syscallrecord *rec, char *bufferstart) { char *sptr = bufferstart; if (IS_ERR(rec->retval)) { sptr += sprintf(sptr, "= %ld (%s)", (long) rec->retval, strerror(rec->errno_post)); } else { sptr += sprintf(sptr, "= "); if ((unsigned long) rec->retval > 10000) sptr += sprintf(sptr, "0x%lx", rec->retval); else sptr += sprintf(sptr, "%ld", (long) rec->retval); } sptr += sprintf(sptr, "\n"); return sptr - bufferstart; } /* These next two functions are always called from child_random_syscalls() by a fuzzing child. * They render the buffer, and output it to stdout. * Other contexts (like post-mortem) directly use the buffers. */ void output_syscall_prefix(struct syscallrecord *rec) { static char *buffer = NULL; unsigned int len; if (buffer == NULL) buffer = zmalloc(PREBUFFER_LEN); len = render_syscall_prefix(rec, buffer); /* copy child-local buffer to shm, and zero out trailing bytes */ memcpy(rec->prebuffer, buffer, len); memset(rec->prebuffer + len, 0, PREBUFFER_LEN - len); output_rendered_buffer(rec->prebuffer); } void output_syscall_postfix(struct syscallrecord *rec) { static char *buffer = NULL; unsigned int len; if (buffer == NULL) buffer = zmalloc(POSTBUFFER_LEN); len = render_syscall_postfix(rec, buffer); /* copy child-local buffer to shm, and zero out trailing bytes */ memcpy(rec->postbuffer, buffer, len); memset(rec->postbuffer + len, 0, POSTBUFFER_LEN - len); output_rendered_buffer(rec->postbuffer); } blockdevs.c000066400000000000000000000030701445305223700132030ustar00rootroot00000000000000#include #include #include #include #include "bdevs.h" #include "list.h" #include "types.h" #include "utils.h" static unsigned int nr_blockdevs = 0; struct bdevlist { struct list_head list; const char *name; }; static struct bdevlist *bdevs = NULL; static void add_to_bdevlist(const char *name) { struct bdevlist *newnode; //TODO: Check if it's a valid /dev node (also check if passed without leading "/dev/") newnode = zmalloc(sizeof(struct bdevlist)); newnode->name = strdup(name); list_add_tail(&newnode->list, &bdevs->list); nr_blockdevs++; } static void stat_dev(char *name) { struct stat sb; int ret; ret = lstat(name, &sb); if (ret == -1) { printf("Couldn't open %s\n", name); exit(EXIT_FAILURE); } if (!(S_ISBLK(sb.st_mode))) { printf("Sorry, %s doesn't look like a block device.\n", name); exit(EXIT_FAILURE); } add_to_bdevlist(name); } void process_bdev_param(char *optarg) { unsigned int len, i; char *str = optarg; len = strlen(optarg); /* Check if there are any commas. If so, split them into multiple devs. */ for (i = 0; i < len; i++) { if (optarg[i] == ',') { optarg[i] = 0; stat_dev(str); str = optarg + i + 1; } } stat_dev(str); } void init_bdev_list(void) { bdevs = zmalloc(sizeof(struct bdevlist)); INIT_LIST_HEAD(&bdevs->list); } void dump_bdev_list(void) { struct list_head *node; printf("Found %u block devices.\n", nr_blockdevs); list_for_each(node, &bdevs->list) { struct bdevlist *nl; nl = (struct bdevlist *) node; printf("%s\n", nl->name); } } child.c000066400000000000000000000234151445305223700123170ustar00rootroot00000000000000/* * Each process that gets forked runs this code. */ #include #include #include #include #include #include #include #include #include #include #include "arch.h" #include "child.h" #include "list.h" #include "log.h" #include "maps.h" #include "params.h" #include "pids.h" #include "random.h" #include "shm.h" #include "signals.h" #include "syscall.h" #include "tables.h" #include "trinity.h" // ARRAY_SIZE #include "uid.h" #include "utils.h" // zmalloc /* * Provide temporary immunity from the reaper * This is useful if we're going to do something that might take * longer than the time the reaper is prepared to wait, especially if * we're doing something critical, like handling a lock, or dumping a log. */ void set_dontkillme(struct childdata *child, bool state) { if (child == NULL) /* possible, we might be the mainpid */ return; child->dontkillme = state; /* bump the progress indicator */ clock_gettime(CLOCK_MONOTONIC, &child->tp); } /* * For the child processes, we don't want core dumps (unless we're running with -D) * This is because it's not uncommon for us to get segfaults etc when we're doing * syscalls with garbage for arguments. */ static void disable_coredumps(void) { struct rlimit limit = { .rlim_cur = 0, .rlim_max = 0 }; if (shm->debug == TRUE) { (void)signal(SIGABRT, SIG_DFL); (void)signal(SIGSEGV, SIG_DFL); return; } if (setrlimit(RLIMIT_CORE, &limit) != 0) perror( "setrlimit(RLIMIT_CORE)" ); prctl(PR_SET_DUMPABLE, FALSE); } /* * We reenable core dumps when we're about to exit a child. * TODO: Maybe narrow the disable/enable pair to just around do_syscall ? */ static void enable_coredumps(void) { struct rlimit limit = { .rlim_cur = RLIM_INFINITY, .rlim_max = RLIM_INFINITY }; if (shm->debug == TRUE) return; prctl(PR_SET_DUMPABLE, TRUE); (void) setrlimit(RLIMIT_CORE, &limit); } /* * Enable the kernels fault-injection code for our child process. * (Assumes you've set everything else up by hand). */ static void set_make_it_fail(void) { int fd; const char *buf = "1"; /* If we failed last time, it's probably because we don't * have fault-injection enabled, so don't bother trying in future. */ if (shm->dont_make_it_fail == TRUE) return; fd = open("/proc/self/make-it-fail", O_WRONLY); if (fd == -1) { shm->dont_make_it_fail = TRUE; return; } if (write(fd, buf, 1) == -1) { if (errno != EPERM) outputerr("writing to /proc/self/make-it-fail failed! (%s)\n", strerror(errno)); shm->dont_make_it_fail = TRUE; } close(fd); } /* * We call this occasionally to set some FPU state, in the hopes that we * might tickle some weird FPU/scheduler related bugs */ static void use_fpu(void) { double x = 0; asm volatile("":"+m" (x)); x += 1; asm volatile("":"+m" (x)); } /* * Tweak the oom_score_adj setting for our child so that there's a higher * chance that the oom-killer kills our processes rather than something * more important. */ static void oom_score_adj(int adj) { FILE *fp; fp = fopen("/proc/self/oom_score_adj", "w"); if (!fp) return; fprintf(fp, "%d", adj); fclose(fp); } /* * Wipe out any state left from a previous child running in this slot. */ void clean_childdata(struct childdata *child) { memset(&child->syscall, 0, sizeof(struct syscallrecord)); child->logdirty = FALSE; child->seed = 0; child->kill_count = 0; child->dontkillme = FALSE; child->xcpu_count = 0; child->op_nr = 0; child->dropped_privs = FALSE; clock_gettime(CLOCK_MONOTONIC, &child->tp); } static void bind_child_to_cpu(struct childdata *child) { cpu_set_t set; unsigned int cpudest; pid_t pid = pids[child->num]; if (no_bind_to_cpu == TRUE) return; if (sched_getaffinity(pid, sizeof(set), &set) != 0) return; if (child->num > num_online_cpus) cpudest = child->num % num_online_cpus; else cpudest = child->num; CPU_ZERO(&set); CPU_SET(cpudest, &set); sched_setaffinity(pid, sizeof(set), &set); } /* * Called from the fork_children loop in the main process. */ static void init_child(struct childdata *child, int childno) { pid_t pid = getpid(); char childname[17]; unsigned int i; for_each_child(i) { if (child->num != i) mprotect(shm->children[i], sizeof(struct childdata), PROT_READ); } mprotect(pids, max_children * sizeof(int), PROT_READ); /* Wait for parent to set our childno */ while (pids[childno] != pid) { /* Make sure parent is actually alive to wait for us. */ if (pid_alive(mainpid) == FALSE) { panic(EXIT_SHM_CORRUPTION); outputerr("BUG!: parent (%d) went away!\n", mainpid); sleep(20000); } } set_seed(child); init_object_lists(OBJ_LOCAL); init_child_mappings(); dirty_random_mapping(); if (RAND_BOOL()) bind_child_to_cpu(child); memset(childname, 0, sizeof(childname)); sprintf(childname, "trinity-c%d", childno); prctl(PR_SET_NAME, (unsigned long) &childname); oom_score_adj(500); /* Wait for all the children to start up. */ while (shm->ready == FALSE) sleep(1); set_make_it_fail(); if (RAND_BOOL()) use_fpu(); mask_signals_child(); disable_coredumps(); if (RAND_BOOL()) { unshare(CLONE_NEWNS); unshare(CLONE_NEWIPC); unshare(CLONE_IO); unshare(CLONE_NEWNET); } /* if (shm->unshare_perm_err == FALSE) { if (RAND_BOOL()) { int ret = unshare(CLONE_NEWUSER); if (ret != 0) output(0, "couldn't unshare: %s\n", strerror(errno)); if (ret == -EPERM) shm->unshare_perm_err = TRUE; } } */ if (orig_uid == 0) child->dropped_privs = FALSE; } /* * Sanity check to make sure that the main process is still around * to wait for us. */ static void check_parent_pid(void) { pid_t pid, ppid; ppid = getppid(); if (ppid == mainpid) return; pid = getpid(); /* TODO: it'd be neat to do stuff inside pidns's, but right now * we shit ourselves when we exit and get reparented to pid 1 */ if (pid == ppid) { debugf("pid became ppid! exiting child.\n"); _exit(EXIT_FAILURE); } if (ppid < 2) { debugf("ppid == %d. pidns? exiting child.\n", ppid); _exit(EXIT_FAILURE);; } lock(&shm->buglock); if (shm->exit_reason == EXIT_REPARENT_PROBLEM) goto out; output(0, "BUG!: CHILD (pid:%d) GOT REPARENTED! " "main pid:%d. ppid=%d\n", pid, mainpid, ppid); if (pid_alive(mainpid) == FALSE) output(0, "main pid %d is dead.\n", mainpid); panic(EXIT_REPARENT_PROBLEM); out: unlock(&shm->buglock); _exit(EXIT_FAILURE); } /* * Here we call various functions that perform checks/changes that * we don't want to happen on every iteration of the child loop. */ static void periodic_work(void) { static unsigned int periodic_counter = 0; periodic_counter++; if (periodic_counter < 10) return; /* Every ten iterations. */ if (!(periodic_counter % 10)) check_parent_pid(); /* Every 100 iterations. */ // if (!(periodic_counter % 100)) // dirty_random_mapping(); if (periodic_counter == 1000) periodic_counter = 0; } /* * We jump here on return from a signal. We do all the stuff here that we * otherwise couldn't do in a signal handler. * * FIXME: when we have different child ops, we're going to need to redo the progress detector. */ static bool handle_sigreturn(int sigwas) { struct childdata *child = this_child(); struct syscallrecord *rec; static unsigned int count = 0; static unsigned int last = 0; rec = &child->syscall; /* If we held a lock before the signal happened, drop it. */ bust_lock(&rec->lock); /* Check if we're blocked because we were stuck on an fd. */ lock(&rec->lock); if (check_if_fd(child, rec) == TRUE) { /* avoid doing it again from other threads. */ shm->fd_lifetime = 0; /* TODO: Somehow mark the fd in the parent not to be used again too. */ } unlock(&rec->lock); /* Check if we're making any progress at all. */ if (child->op_nr == last) { count++; //output(1, "no progress for %d tries.\n", count); } else { count = 0; last = child->op_nr; } if (count == 10) { output(1, "no progress for 10 tries, exiting child.\n"); return FALSE; } if (child->kill_count > 0) { output(1, "[%d] Missed a kill signal, exiting\n", getpid()); return FALSE; } if (sigwas == SIGHUP) return FALSE; if (sigwas != SIGALRM) output(1, "[%d] Back from signal handler! (sig was %s)\n", getpid(), strsignal(sigwas)); else { child->op_nr++; } return TRUE; } /* * This is the child main loop, entered after init_child has completed * from the fork_children() loop. * We also re-enter it from the signal handler code if something happened. */ #define NEW_OP_COUNT 100000 void child_process(struct childdata *child, int childno) { int ret; init_child(child, childno); ret = sigsetjmp(ret_jump, 1); if (ret != 0) { if (child->xcpu_count == 100) { debugf("Child %d [%d] got 100 XCPUs. Exiting child.\n", child->num, pids[child->num]); goto out; } if (handle_sigreturn(ret) == FALSE) goto out; // Exit the child, things are getting too weird. } while (shm->exit_reason == STILL_RUNNING) { /* If the parent reseeded, we should reflect the latest seed too. */ if (shm->seed != child->seed) { //output(0, "child %d reseeded to %x\n", child->num, child->seed); set_seed(child); } periodic_work(); /* timestamp, and do the syscall */ clock_gettime(CLOCK_MONOTONIC, &child->tp); ret = random_syscall(child); child->op_nr++; if (ret == FAIL) goto out; if (syscalls_todo) { if (shm->stats.op_count >= syscalls_todo) { shm->exit_reason = EXIT_REACHED_COUNT; goto out; } } } enable_coredumps(); /* If we're exiting because we tainted, wait here for it to be done. */ while (shm->postmortem_in_progress == TRUE) { /* Make sure the main process is still around. */ if (pid_alive(mainpid) == FALSE) goto out; usleep(1); } out: shutdown_child_logging(child); debugf("child %d %d exiting.\n", childno, getpid()); } configure000077500000000000000000000204201445305223700127700ustar00rootroot00000000000000#!/bin/bash CONFIGH="config.h" if [ -t 1 ]; then RED="" GREEN="" COL_RESET="" fi MISSING_DEFS=0 [ -z "$CC" ] && CC=gcc # expand tilde CC="$(eval echo ${CROSS_COMPILE}${CC})" CFLAGS="${CFLAGS}" if [ "${SYSROOT}xx" != "xx" ]; then CFLAGS="${CFLAGS} $(eval echo --sysroot=${SYSROOT} )" fi echo "#pragma once" > $CONFIGH echo "/* This file is auto-generated by configure.sh */" >> $CONFIGH TMP=$(mktemp) check_header() { echo -n "[*] Checking header $1 ... " rm -f "$TMP" || exit 1 echo "#include <$1>" >"$TMP.c" ${CC} ${CFLAGS} "$TMP.c" -E &>"$TMP.log" if [ $? -eq 0 ]; then echo $GREEN "[YES]" $COL_RESET echo "#define $2 1" >> $CONFIGH else echo $RED "[NO]" $COL_RESET MISSING_DEFS=1 fi } ############################################################################################# echo "[*] Checking system headers." ############################################################################################# # Are ipv6 headers usable ? [ -z "$IPV6" ] && IPV6=yes if [[ "$IPV6" == "yes" ]]; then echo -n "[*] Checking ipv6 headers ... " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include #include #include #include int main() { struct in6_addr test; } EOF ${CC} ${CFLAGS} -D_GNU_SOURCE "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[BROKEN]" $COL_RESET "See https://patchwork.ozlabs.org/patch/425881/" else echo $GREEN "[OK]" $COL_RESET echo "#define USE_IPV6 1" >> $CONFIGH fi fi ############################################################################################# # is /usr/include/linux/if_pppox.h new enough to feature pppol2tpin6/pppol2tpv3in6 # echo -n "[*] Checking if pppox can use pppol2tpin6.. " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include #include #include #include void main() { struct sockaddr_pppol2tpin6 *pppox; printf("%d\n", pppox->sa_family); } EOF ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[NO]" $COL_RESET MISSING_DEFS=1 else echo $GREEN "[YES]" $COL_RESET echo "#define USE_PPPOL2TPIN6 1" >> $CONFIGH fi ############################################################################################# # is /usr/include/linux/if_pppox.h new enough to feature pppol2tpv3 # echo -n "[*] Checking if pppox can use pppol2tv3.. " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include #include #include #include void main() { struct sockaddr_pppol2tpv3 *pppox; printf("%d\n", pppox->sa_family); } EOF ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[NO]" $COL_RESET MISSING_DEFS=1 else echo $GREEN "[YES]" $COL_RESET echo "#define USE_PPPOL2TPV3 1" >> $CONFIGH fi ############################################################################################# # is /usr/include/linux/if_pppox.h new enough to feature pptp # echo -n "[*] Checking if pppox can use pptp.. " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include #include #include #include void main() { struct sockaddr_pppox *pppox; printf("%d\n", pppox->sa_addr.pptp.call_id); } EOF ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[NO]" $COL_RESET MISSING_DEFS=1 else echo $GREEN "[YES]" $COL_RESET echo "#define USE_PPPOX_PPTP 1" >> $CONFIGH fi ############################################################################################# # is /usr/include/linux/llc.h new enough to feature LLC_OPT_PKTINFO # echo -n "[*] Checking if llc can use LLC_OPT_PKTINFO.. " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include #include #include void main() { printf("%d\n", LLC_OPT_PKTINFO); } EOF ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[NO]" $COL_RESET MISSING_DEFS=1 else echo $GREEN "[YES]" $COL_RESET echo "#define USE_LLC_OPT_PKTINFO 1" >> $CONFIGH fi ############################################################################################# # Do glibc headers provides struct termios2 echo -n "[*] Checking if glibc headers provide termios2.. " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include #include #include int main() { struct termios2 test; } EOF ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[NO]" $COL_RESET MISSING_DEFS=1 else echo $GREEN "[YES]" $COL_RESET echo "#define HAVE_TERMIOS2 1" >> $CONFIGH fi ############################################################################################# # Do glibc headers provides nvme ioctls echo -n "[*] Checking if glibc headers provide nvme ioctls.. " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include #include int main(int argc, char* argv[]) { unsigned int foo = NVME_IOCTL_IO_CMD; } EOF ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[NO]" $COL_RESET MISSING_DEFS=1 else echo $GREEN "[YES]" $COL_RESET echo "#define USE_NVME 1" >> $CONFIGH fi ############################################################################################# # is /usr/include/linux/bpf.h new enough to feature bpf # echo -n "[*] Checking if bpf_attr can use map_flags.. " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include #include void main() { union bpf_attr attr = { .map_flags = 0, }; enum bpf_prog_type type = BPF_PROG_TYPE_PERF_EVENT; } EOF ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[NO]" $COL_RESET MISSING_DEFS=1 else echo $GREEN "[YES]" $COL_RESET echo "#define USE_BPF 1" >> $CONFIGH fi ############################################################################################# # is /usr/include/linux/btrfs.h new enough to feature btrfs # echo -n "[*] Checking if btrfs can use btrfs_ioctl_defrag_range_args.. " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include #include void main() { struct btrfs_ioctl_defrag_range_args args; } EOF ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[NO]" $COL_RESET MISSING_DEFS=1 else echo $GREEN "[YES]" $COL_RESET echo "#define USE_BTRFS 1" >> $CONFIGH fi ############################################################################################# # Does glibc provide memfd_create() syscall wrapper # echo -n "[*] Checking if glibc provides memfd_create.. " rm -f "$TMP" || exit 1 cat >"$TMP.c" << EOF #include void main() { memfd_create(); } EOF ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" if [ ! -x "$TMP" ]; then echo $RED "[NO]" $COL_RESET else echo $GREEN "[YES]" $COL_RESET echo "#define USE_MEMFD_CREATE 1" >> $CONFIGH fi ############################################################################################# check_header linux/caif/caif_socket.h USE_CAIF check_header linux/fsmap.h USE_FSMAP check_header linux/if_alg.h USE_IF_ALG check_header linux/irda.h USE_IRDA check_header linux/rds.h USE_RDS check_header linux/vfio.h USE_VFIO check_header drm/drm.h USE_DRM check_header drm/i810_drm.h USE_DRM_I810 check_header drm/mga_drm.h USE_DRM_MGA check_header drm/r128_drm.h USE_DRM_R128 check_header drm/savage_drm.h USE_DRM_SAVAGE check_header drm/exynos_drm.h USE_DRM_EXYNOS check_header sound/compress_offload.h USE_SNDDRV_COMPRESS_OFFLOAD check_header linux/kvm.h USE_KVM check_header linux/seccomp.h USE_SECCOMP check_header linux/vhost.h USE_VHOST check_header execinfo.h USE_BACKTRACE check_header netatalk/at.h USE_APPLETALK check_header netrom/netrom.h USE_NETROM check_header netrose/rose.h USE_ROSE check_header neteconet/ec.h USE_NETECONET check_header netax25/ax25.h USE_NETAX25 check_header netipx/ipx.h USE_IPX rm -f "$TMP" "$TMP.log" "$TMP.c" ############################################################################################# if [ "$MISSING_DEFS" == "1" ]; then echo "[-] Some header definitions were missing. This is not fatal." echo " It usually means you're building on an older distribution which doesn't" echo " have header files describing newer kernel features." echo " Trinity will still compile and run, it just won't use those new features." echo " Go ahead, and run 'make'" fi exit 0 debug.c000066400000000000000000000071651445305223700123260ustar00rootroot00000000000000/* * Various routines useful for debugging. */ #ifdef USE_BACKTRACE #include #endif #include #include #include #include #include "child.h" #include "debug.h" #include "log.h" #include "params.h" #include "pids.h" #include "shm.h" #include "syscall.h" #include "version.h" #define BACKTRACE_SIZE 100 static void __show_backtrace(void) { #ifdef USE_BACKTRACE unsigned int j, nptrs; void *buffer[BACKTRACE_SIZE]; char **strings; nptrs = backtrace(buffer, BACKTRACE_SIZE); strings = backtrace_symbols(buffer, nptrs); if (strings == NULL) { perror("backtrace_symbols"); return; } for (j = 0; j < nptrs; j++) output(0, "%s\n", strings[j]); free(strings); #endif } static void show_child_backtrace(void) { struct childdata *child = this_child(); set_dontkillme(child, FALSE); __show_backtrace(); set_dontkillme(child, TRUE); } void show_backtrace(void) { pid_t pid = getpid(); if (pid == mainpid) { __show_backtrace(); return; } show_child_backtrace(); } void __BUG(const char *bugtxt, const char *filename, const char *funcname, unsigned int lineno) { struct childdata *child = this_child(); printf("BUG!: %s\n", bugtxt); printf("BUG!: %s\n", VERSION); printf("BUG!: [%d] %s:%s:%u\n", getpid(), filename, funcname, lineno); show_backtrace(); /* Now spin indefinitely (but allow ctrl-c) */ set_dontkillme(child, TRUE); while (1) { if (shm->exit_reason == EXIT_SIGINT) { set_dontkillme(child, FALSE); exit(EXIT_FAILURE); } sleep(1); } } void dump_syscallrec(struct syscallrecord *rec) { output(0, " nr:%d a1:%lx a2:%lx a3:%lx a4:%lx a5:%lx a6:%lx retval:%ld errno_post:%d\n", rec->nr, rec->a1, rec->a2, rec->a3, rec->a4, rec->a5, rec->a6, rec->retval, rec->errno_post); output(0, " do32bit:%d\n", rec->do32bit); output(0, " lock:%d {owner:%d)\n", rec->lock.lock, rec->lock.owner); output(0, " state:%d\n", rec->state); output(0, " prebuffer : %p (len:%d)\n", rec->prebuffer, strlen(rec->prebuffer)); output(0, " -> %s\n", rec->prebuffer); output(0, " postbuffer : %p (len:%ld)\n", rec->postbuffer, strlen(rec->postbuffer)); output(0, " -> %s\n", rec->postbuffer); } void dump_childdata(struct childdata *child) { output(0, "child struct @%p\n", child); output(0, " op_nr:%lx\n", child->op_nr); output(0, "syscall: %p\n", &child->syscall); dump_syscallrec(&child->syscall); if (logging == LOGGING_FILES) output(0, "logfile: %p (dirty:%d)\n", child->logfile, child->logdirty); output(0, "objects: %p\n", child->objects); //TODO: dump each objhead output(0, " tp.tv_sec=%ld tp.tv_nsec=%ld\n", child->tp.tv_sec, child->tp.tv_nsec); output(0, "seed: %u\n", child->seed); output(0, "childnum: %d\n", child->num); output(0, "killcount: %d\n", child->kill_count); output(0, "dontkillme: %d\n", child->dontkillme); output(0, "\n"); }; /* * debugging output. * This is just a convenience helper to avoid littering the code * with dozens of 'if debug == TRUE' comparisons causing unnecessary nesting. */ #define BUFSIZE 1024 void debugf(const char *fmt, ...) { char debugbuf[BUFSIZE]; va_list args; if (shm->debug == FALSE) return; va_start(args, fmt); vsprintf(debugbuf, fmt, args); va_end(args); output(0, debugbuf); } /* This is a bit crappy, wrapping a varargs fn with another, * but this saves us having to do the openlog/closelog for every * case where we want to write a message. */ void syslogf(const char *fmt, ...) { char debugbuf[BUFSIZE]; va_list args; va_start(args, fmt); vsprintf(debugbuf, fmt, args); va_end(args); openlog("trinity", LOG_CONS|LOG_PERROR, LOG_USER); syslog(LOG_CRIT, "%s", debugbuf); closelog(); } devices.c000066400000000000000000000054031445305223700126530ustar00rootroot00000000000000/* * Routines for parsing /proc/devices for use by the ioctl fuzzer. */ #include #include #include #include #include #include #include "files.h" #include "trinity.h" static struct { int major; int minor; const char *name; } *block_devs, *char_devs, *misc_devs; static size_t bldevs, chrdevs, miscdevs; static void parse_proc_devices(void) { FILE *fp; char *p, *name, *line = NULL; size_t n = 0; int block, major; void *new; fp = fopen("/proc/devices", "r"); if (!fp) return; block = 0; while (getline(&line, &n, fp) >= 0) { if (strcmp("Block devices:\n", line) == 0) block = 1; else if (strcmp("Character devices:\n", line) == 0) block = 0; else if (sscanf(line, "%d %*s", &major) == 1) { if ((p = strchr(line, '\n')) != NULL) *p = 0; if ((p = strrchr(line, ' ')) == NULL) continue; p++; name = strdup(p); if (block) { new = realloc(block_devs, (bldevs+1)*sizeof(*block_devs)); if (!new) { // FIXME: We should propagate failure up here. free(name); break; } block_devs = new; block_devs[bldevs].major = major; block_devs[bldevs].minor = 0; block_devs[bldevs].name = name; bldevs++; } else { new = realloc(char_devs, (chrdevs+1)*sizeof(*char_devs)); if (!new) { free(name); break; } char_devs = new; char_devs[chrdevs].major = major; char_devs[chrdevs].minor = 0; char_devs[chrdevs].name = name; chrdevs++; } } } fclose(fp); free(line); } static void parse_proc_misc(void) { FILE *fp; char *name; int minor; void *new; fp = fopen("/proc/misc", "r"); if (!fp) return; while (fscanf(fp, "%d %ms", &minor, &name) == 2) { new = realloc(misc_devs, (miscdevs+1)*sizeof(*misc_devs)); if (!new) { free(name); break; } misc_devs = new; misc_devs[miscdevs].major = 0; misc_devs[miscdevs].minor = minor; misc_devs[miscdevs].name = name; miscdevs++; } fclose(fp); } void parse_devices(void) { parse_proc_devices(); parse_proc_misc(); output(2, "Parsed %zu char devices, %zu block devices, %zu misc devices.\n", chrdevs, bldevs, miscdevs); } const char *map_dev(dev_t st_rdev, mode_t st_mode) { int major, minor; size_t i; major = MAJOR(st_rdev); minor = MINOR(st_rdev); if (S_ISCHR(st_mode)) { for (i = 0; i < chrdevs; ++i) { if (char_devs[i].major == major) { if (strcmp(char_devs[i].name, "misc") == 0) { size_t j; for (j = 0; j < miscdevs; ++j) if (misc_devs[j].minor == minor) return misc_devs[j].name; } else return char_devs[i].name; } } } else if (S_ISBLK(st_mode)) { for (i = 0; i < bldevs; ++i) { if (block_devs[i].major == major) return block_devs[i].name; } } return NULL; } fds/000077500000000000000000000000001445305223700116375ustar00rootroot00000000000000fds/bpf.c000066400000000000000000000070171445305223700125570ustar00rootroot00000000000000/* bpf FDs */ #ifdef USE_BPF #include #include #include #include #include #include #include #include #include #include #include "bpf.h" #include "fd.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "compat.h" #include "trinity.h" static int bpf(int cmd, union bpf_attr *attr, unsigned int size) { return syscall(__NR_bpf, cmd, attr, size); } static int bpf_create_map(enum bpf_map_type map_type, unsigned int key_size, unsigned int value_size, unsigned int max_entries, int map_flags) { union bpf_attr attr = { .map_type = map_type, .key_size = key_size, .value_size = value_size, .max_entries = max_entries, .map_flags = map_flags, }; return bpf(BPF_MAP_CREATE, &attr, sizeof(attr)); } static void bpf_destructor(struct object *obj) { close(obj->bpfobj.map_fd); } struct bpf_fd_types { u32 map_type; u32 key_size; u32 value_size; u32 max_entries; u32 flags; char name[32]; }; // TODO: Move to syscalls/bpf.c static struct bpf_fd_types bpf_fds[] = { { BPF_MAP_TYPE_HASH, sizeof(long long), sizeof(long long), 1024, 0, "hash" }, { BPF_MAP_TYPE_ARRAY, sizeof(int), sizeof(long long), 256, 0, "array" }, { BPF_MAP_TYPE_PROG_ARRAY, sizeof(int), sizeof(int), 4, 0, "prog_array" }, { BPF_MAP_TYPE_PERF_EVENT_ARRAY, sizeof(int), sizeof(u32), 32, 0, "perf event array" }, { BPF_MAP_TYPE_PERCPU_HASH, sizeof(u32), sizeof(u64) * PERF_MAX_STACK_DEPTH, 10000, 0, "percpu hash" }, { BPF_MAP_TYPE_PERCPU_ARRAY, sizeof(u32), sizeof(u64), 100, 0, "percpu array" }, { BPF_MAP_TYPE_STACK_TRACE, sizeof(u32), sizeof(u64), 100, 0, "stack trace" }, { BPF_MAP_TYPE_CGROUP_ARRAY, sizeof(u32), sizeof(u32), 1, 0, "cgroup array" }, { BPF_MAP_TYPE_LRU_HASH, sizeof(u32), sizeof(long), 10000, 0, "LRU hash" }, { BPF_MAP_TYPE_LRU_HASH, sizeof(u32), sizeof(long), 10000, BPF_F_NO_COMMON_LRU, "LRU hash (no common LRU)" }, { BPF_MAP_TYPE_LRU_PERCPU_HASH, sizeof(u32), sizeof(long), 1000, 0, "LRU percpu hash" }, { BPF_MAP_TYPE_LPM_TRIE, 8, sizeof(long), 10000, 0, "LPM TRIE" }, }; static void bpf_map_dump(struct object *obj, bool global) { u32 type = obj->bpfobj.map_type; output(2, "bpf map fd:%d type:%s global:%d\n", obj->bpfobj.map_fd, (char *)&bpf_fds[type].name, global); } static int open_bpf_fds(void) { struct objhead *head; struct rlimit r = {1 << 20, 1 << 20}; unsigned int i; setrlimit(RLIMIT_MEMLOCK, &r); head = get_objhead(OBJ_GLOBAL, OBJ_FD_BPF_MAP); head->destroy = &bpf_destructor; head->dump = &bpf_map_dump; for (i = 0; i < ARRAY_SIZE(bpf_fds); i++) { struct object *obj; int fd; fd = bpf_create_map(bpf_fds[i].map_type, bpf_fds[i].key_size, bpf_fds[i].value_size, bpf_fds[i].max_entries, bpf_fds[i].flags); if (fd < 0) continue; obj = alloc_object(); obj->bpfobj.map_fd = fd; obj->bpfobj.map_type = bpf_fds[i].map_type; add_object(obj, OBJ_GLOBAL, OBJ_FD_BPF_MAP); } //FIXME: right now, returning FALSE means "abort everything", not // "skip this provider", so on -ENOSYS, we have to still register. return TRUE; } int get_rand_bpf_fd(void) { struct object *obj; /* check if bpf unavailable/disabled. */ if (objects_empty(OBJ_FD_BPF_MAP) == TRUE) return -1; obj = get_random_object(OBJ_FD_BPF_MAP, OBJ_GLOBAL); return obj->bpfobj.map_fd; } static const struct fd_provider bpf_fd_provider = { .name = "bpf", .enabled = TRUE, .open = &open_bpf_fds, .get = &get_rand_bpf_fd, }; REG_FD_PROV(bpf_fd_provider); #endif fds/drm.c000066400000000000000000000054631445305223700125750ustar00rootroot00000000000000/* DRM FDs */ #include "fd.h" #include "memfd.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "compat.h" #include "trinity.h" #ifdef USE_DRM #include #include #include #include #include #include #include #include #include #include #include static void drmfd_destructor(struct object *obj) { close(obj->drmfd); } static void drmfd_dump(struct object *obj, bool global) { output(2, "drmfd:%d global:%d\n", obj->drmfd, global); } static int create_dumb(__unused__ int fd) { #if defined(DRM_IOCTL_MODE_CREATE_DUMB) && defined(DRM_IOCTL_PRIME_HANDLE_TO_FD) struct drm_mode_create_dumb create; struct drm_prime_handle handle_to_fd; memset(&create, 0, sizeof(create)); create.height = 1 << RAND_RANGE(0, 10); create.width = 1 << RAND_RANGE(0, 10); create.bpp = 32; if (ioctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &create) < 0) { return -1; } memset(&handle_to_fd, 0, sizeof(handle_to_fd)); handle_to_fd.handle = create.handle; if (RAND_BOOL()) handle_to_fd.flags = DRM_CLOEXEC; if (ioctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &handle_to_fd) < 0) { return -1; } return handle_to_fd.fd; #else return -1; #endif } static void add_drm_obj(int fd) { struct object *obj; obj = alloc_object(); obj->drmfd = fd; add_object(obj, OBJ_GLOBAL, OBJ_FD_DRM); output(2, "fd[%d] = drm\n", fd); } static struct fd_provider drm_fd_provider; static int open_drm_fds(void) { struct objhead *head; int fd, dfd; DIR *dir; struct dirent *entry; char buf[256 + 10]; head = get_objhead(OBJ_GLOBAL, OBJ_FD_DRM); head->destroy = &drmfd_destructor; head->dump = &drmfd_dump; dir = opendir("/dev/dri/"); if (!dir) goto done; // Open all /dev/dri/*, and try to make FDs from each of them. while (1) { entry = readdir(dir); if (!entry) break; if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) continue; snprintf(buf, sizeof(buf), "/dev/dri/%s", entry->d_name); buf[sizeof(buf)-1] = '\0'; fd = open(buf, O_RDWR); if (fd < 0) continue; add_drm_obj(fd); dfd = create_dumb(fd); if (dfd < 0) continue; add_drm_obj(dfd); } if (dir) closedir(dir); done: if (objects_empty(OBJ_FD_DRM) == TRUE) drm_fd_provider.enabled = FALSE; return TRUE; } #else static int open_drm_fds(void) { return TRUE; } #endif /* USE_DRM */ static int get_rand_drm_fd(void) { struct object *obj; /* check if drm unavailable/disabled. */ if (objects_empty(OBJ_FD_DRM) == TRUE) return -1; obj = get_random_object(OBJ_FD_DRM, OBJ_GLOBAL); return obj->drmfd; } static struct fd_provider drm_fd_provider = { .name = "drm", .enabled = TRUE, .open = &open_drm_fds, .get = &get_rand_drm_fd, }; REG_FD_PROV(drm_fd_provider); fds/epoll.c000066400000000000000000000033471445305223700131250ustar00rootroot00000000000000/* epoll related fds */ #include #include #include #include #include #include #include "fd.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #define MAX_EPOLL_FDS 10 static void epoll_destructor(struct object *obj) { close(obj->epollobj.fd); } static void epoll_dump(struct object *obj, bool global) { struct epollobj *eo = &obj->epollobj; output(2, "epoll fd:%d used create1?:%d flags:%x global:%d\n", eo->fd, eo->create1, eo->flags, global); } static int open_epoll_fds(void) { struct object *obj = NULL; struct objhead *head; unsigned int i = 0; int fd = -1; head = get_objhead(OBJ_GLOBAL, OBJ_FD_EPOLL); head->destroy = &epoll_destructor; head->dump = &epoll_dump; while (i < MAX_EPOLL_FDS) { if (obj == NULL) obj = alloc_object(); if (RAND_BOOL()) { obj->epollobj.create1 = FALSE; obj->epollobj.flags = 0; fd = epoll_create(1); } else{ obj->epollobj.create1 = TRUE; obj->epollobj.flags = EPOLL_CLOEXEC; fd = epoll_create1(EPOLL_CLOEXEC); } if (fd != -1) { obj->epollobj.fd = fd; add_object(obj, OBJ_GLOBAL, OBJ_FD_EPOLL); i++; obj = NULL; // alloc a new obj. } else { /* not sure what happened. */ output(0, "open_epoll_fds fail: %s\n", strerror(errno)); free(obj); return FALSE; } } return TRUE; } static int get_rand_epoll_fd(void) { struct object *obj; if (objects_empty(OBJ_FD_EPOLL) == TRUE) return -1; obj = get_random_object(OBJ_FD_EPOLL, OBJ_GLOBAL); return obj->epollobj.fd; } static const struct fd_provider epoll_fd_provider = { .name = "epoll", .enabled = TRUE, .open = &open_epoll_fds, .get = &get_rand_epoll_fd, }; REG_FD_PROV(epoll_fd_provider); fds/eventfd.c000066400000000000000000000033671445305223700134470ustar00rootroot00000000000000/* eventfd FDs */ #include #include #include #include #include #include #include "fd.h" #include "files.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "compat.h" static void eventfd_destructor(struct object *obj) { close(obj->eventfdobj.fd); } static void eventfd_dump(struct object *obj, bool global) { struct eventfdobj *eo = &obj->eventfdobj; output(2, "eventfd fd:%d count:%d flags:%x global:%d\n", eo->fd, eo->count, eo->flags, global); } static int open_eventfd_fds(void) { struct objhead *head; unsigned int i; const unsigned int flags[] = { 0, EFD_NONBLOCK, EFD_NONBLOCK | EFD_SEMAPHORE, EFD_CLOEXEC, EFD_CLOEXEC | EFD_NONBLOCK, EFD_CLOEXEC | EFD_SEMAPHORE, EFD_CLOEXEC | EFD_NONBLOCK | EFD_SEMAPHORE, EFD_SEMAPHORE, }; head = get_objhead(OBJ_GLOBAL, OBJ_FD_EVENTFD); head->destroy = &eventfd_destructor; head->dump = &eventfd_dump; for (i = 0; i < ARRAY_SIZE(flags); i++) { struct object *obj; int fd; int count = rand32(); fd = eventfd(count, flags[i]); if (fd < 0) continue; obj = alloc_object(); obj->eventfdobj.fd = fd; obj->eventfdobj.count = count; obj->eventfdobj.flags = flags[i]; add_object(obj, OBJ_GLOBAL, OBJ_FD_EVENTFD); } return TRUE; } static int get_rand_eventfd_fd(void) { struct object *obj; /* check if eventfd unavailable/disabled. */ if (objects_empty(OBJ_FD_EVENTFD) == TRUE) return -1; obj = get_random_object(OBJ_FD_EVENTFD, OBJ_GLOBAL); return obj->eventfdobj.fd; } static const struct fd_provider eventfd_fd_provider = { .name = "eventfd", .enabled = TRUE, .open = &open_eventfd_fds, .get = &get_rand_eventfd_fd, }; REG_FD_PROV(eventfd_fd_provider); fds/fanotify_init.c000066400000000000000000000040631445305223700146500ustar00rootroot00000000000000/* fanotify FDs */ #include #include #include #include #include #include #include "fd.h" #include "fanotify.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "compat.h" #include "trinity.h" #include "utils.h" #define NR_FANOTIFYFDS 10 static int fanotify_init(__unused__ unsigned int flags, __unused__ unsigned int eflags) { #ifdef SYS_fanotify_init return syscall(SYS_fanotify_init, flags, eflags); #else return -ENOSYS; #endif } static void fanotifyfd_destructor(struct object *obj) { close(obj->fanotifyobj.fd); } static void fanotifyfd_dump(struct object *obj, bool global) { struct fanotifyobj *fo = &obj->fanotifyobj; output(2, "fanotify fd:%d flags:%x eventflags:%x global:%d\n", fo->fd, fo->flags, fo->eventflags, global); } static int open_fanotify_fds(void) { struct objhead *head; unsigned int i; head = get_objhead(OBJ_GLOBAL, OBJ_FD_FANOTIFY); head->destroy = &fanotifyfd_destructor; head->dump = &fanotifyfd_dump; for (i = 0; i < NR_FANOTIFYFDS; i++) { struct object *obj; unsigned long flags, eventflags; int fd; eventflags = get_fanotify_init_event_flags(); flags = get_fanotify_init_flags(); fd = fanotify_init(flags, eventflags); if (fd < 0) continue; obj = alloc_object(); obj->fanotifyobj.fd = fd; obj->fanotifyobj.flags = flags; obj->fanotifyobj.eventflags = eventflags; add_object(obj, OBJ_GLOBAL, OBJ_FD_FANOTIFY); } //FIXME: right now, returning FALSE means "abort everything", not // "skip this provider", so on -ENOSYS, we have to still register. return TRUE; } static int get_rand_fanotifyfd(void) { struct object *obj; /* check if eventfd unavailable/disabled. */ if (objects_empty(OBJ_FD_FANOTIFY) == TRUE) return -1; obj = get_random_object(OBJ_FD_FANOTIFY, OBJ_GLOBAL); return obj->fanotifyobj.fd; } static const struct fd_provider fanotify_fd_provider = { .name = "fanotify", .enabled = TRUE, .open = &open_fanotify_fds, .get = &get_rand_fanotifyfd, }; REG_FD_PROV(fanotify_fd_provider); fds/fds.c000066400000000000000000000121611445305223700125600ustar00rootroot00000000000000#include #include #include #include #include #include "fd.h" #include "list.h" #include "net.h" #include "params.h" #include "pids.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "trinity.h" #include "utils.h" static unsigned int num_fd_providers; // num in list. static unsigned int num_fd_providers_to_enable = 0; // num of --fd-enable= params static unsigned int num_fd_providers_enabled = 0; // final num we enabled. static unsigned int num_fd_providers_initialized = 0; // num we called ->init on static bool enable_fd_initialized = FALSE; // initialized (disabled all) fd providers static struct fd_provider *fd_providers = NULL; /* * This is called by the REG_FD_PROV constructors on startup. * Because of this, this function shouldn't rely on anything * already existing/being initialized. */ void register_fd_provider(const struct fd_provider *prov) { struct fd_provider *newnode; if (fd_providers == NULL) { fd_providers = zmalloc(sizeof(struct fd_provider)); INIT_LIST_HEAD(&fd_providers->list); } newnode = zmalloc(sizeof(struct fd_provider)); newnode->name = strdup(prov->name); newnode->enabled = prov->enabled; newnode->open = prov->open; newnode->get = prov->get; num_fd_providers++; list_add_tail(&newnode->list, &fd_providers->list); } static void __open_fds(bool do_rand) { struct list_head *node; list_for_each(node, &fd_providers->list) { struct fd_provider *provider; provider = (struct fd_provider *) node; /* disabled on cmdline */ if (provider->enabled == FALSE) continue; /* already done */ if (provider->initialized == TRUE) continue; if (do_rand == TRUE) { /* to mix up init order */ if (RAND_BOOL()) continue; } provider->enabled = provider->open(); if (provider->enabled == TRUE) { provider->initialized = TRUE; num_fd_providers_initialized++; num_fd_providers_enabled++; } else { outputstd("Error during initialization of %s\n", provider->name); num_fd_providers_to_enable--; } } } unsigned int open_fds(void) { /* Open half the providers randomly */ while (num_fd_providers_initialized < (num_fd_providers_to_enable / 2)) __open_fds(TRUE); /* Now open any leftovers */ __open_fds(FALSE); output(0, "Enabled %d/%d fd providers. initialized:%d.\n", num_fd_providers_enabled, num_fd_providers, num_fd_providers_initialized); return TRUE; } int get_new_random_fd(void) { struct list_head *node; int fd = -1; /* short-cut if we've disabled everything. */ if (num_fd_providers_enabled == 0) return -1; /* if nothing has initialized yet, bail */ if (num_fd_providers_initialized == 0) return -1; while (fd < 0) { unsigned int i, j; retry: i = rnd() % num_fd_providers; // FIXME: after below fixme, this should be num_fd_providers_initialized j = 0; list_for_each(node, &fd_providers->list) { struct fd_provider *provider; if (i == j) { provider = (struct fd_provider *) node; if (provider->enabled == FALSE) // FIXME: Better would be to just remove disabled providers from the list. goto retry; // Hasn't been run yet. if (provider->initialized == FALSE) goto retry; fd = provider->get(); break; } j++; } } return fd; } int get_random_fd(void) { /* return the same fd as last time if we haven't over-used it yet. */ regen: if (shm->fd_lifetime == 0) { shm->current_fd = get_new_random_fd(); if (max_children > 5) shm->fd_lifetime = RAND_RANGE(5, max_children); else shm->fd_lifetime = RAND_RANGE(max_children, 5); } else shm->fd_lifetime--; if (shm->current_fd == 0) { shm->fd_lifetime = 0; goto regen; } return shm->current_fd; } static void toggle_fds_param(char *str, bool enable) { struct list_head *node; list_for_each(node, &fd_providers->list) { struct fd_provider *provider; provider = (struct fd_provider *) node; if (strcmp(provider->name, str) == 0) { if (enable == TRUE) { provider->enabled = TRUE; outputstd("Enabled fd provider %s\n", str); num_fd_providers_to_enable++; } else { provider->enabled = FALSE; outputstd("Disabled fd provider %s\n", str); } return; } } outputstd("Unknown parameter \"%s\"\n", str); enable_disable_fd_usage(); exit(EXIT_FAILURE); } //TODO: prevent --enable and --disable being passed at the same time. void process_fds_param(char *param, bool enable) { unsigned int len, i; char *str_orig = strdup(param); char *str = str_orig; len = strlen(param); if (enable_fd_initialized == FALSE && enable == TRUE) { struct list_head *node; /* First, pass through and mark everything disabled. */ list_for_each(node, &fd_providers->list) { struct fd_provider *provider; provider = (struct fd_provider *) node; provider->enabled = FALSE; } enable_fd_initialized = TRUE; } /* Check if there are any commas. If so, split them into multiple params, * validating them as we go. */ for (i = 0; i < len; i++) { if (str_orig[i] == ',') { str_orig[i] = 0; toggle_fds_param(str, enable); str = str_orig + i + 1; } } if (str < str_orig + len) toggle_fds_param(str, enable); free(str_orig); } fds/files.c000066400000000000000000000072731445305223700131160ustar00rootroot00000000000000#include #include #include #include #include #include #include #include #include "exit.h" #include "fd.h" #include "files.h" #include "objects.h" #include "pathnames.h" #include "random.h" #include "syscalls/syscalls.h" int open_with_fopen(const char *filename, int flags) { FILE *file; int fd = -1; char mode[3]=" "; switch (flags) { case O_RDONLY: mode[0] = 'r'; mode[1] = 0; break; case O_WRONLY: mode[0] = 'w'; mode[1] = 0; break; case O_RDWR: mode[0] = 'w'; mode[1] = '+'; mode[2] = 0; break; } file = fopen(filename, mode); if (file) fd = fileno(file); return fd; } static int open_file(struct object *obj, const char *filename, int flags) { int fd; int tries = 0; int fcntl_flags = 0; int randflags = 0; obj->fileobj.filename = filename; /* OR in some random flags. */ retry_flags: if (RAND_BOOL()) { randflags = get_o_flags(); obj->fileobj.flags = flags | randflags; fd = open(filename, flags | randflags | O_NONBLOCK, 0666); obj->fileobj.fopened = FALSE; obj->fileobj.fcntl_flags = 0; } else { fd = open_with_fopen(filename, flags); obj->fileobj.fopened = TRUE; obj->fileobj.flags = flags; fcntl_flags = random_fcntl_setfl_flags(); fcntl(fd, F_SETFL, fcntl_flags); obj->fileobj.fcntl_flags = fcntl_flags; } if (fd < 0) { /* * if we failed to open the file, retry with different flags. * we should eventually succeed, but set an arbitary upper limit of * 50 tries before just giving up. */ tries++; if (tries == 50) { output(2, "Couldn't open %s : %s\n", filename, strerror(errno)); return fd; } goto retry_flags; } return fd; } static void filefd_destructor(struct object *obj) { close(obj->fileobj.fd); } static void filefd_dump(struct object *obj, bool global) { struct fileobj *fo = &obj->fileobj; output(2, "file fd:%d filename:%s flags:%x fopened:%d fcntl_flags:%x global:%d\n", fo->fd, fo->filename, fo->flags, fo->fopened, fo->fcntl_flags, global); } static int open_files(void) { struct objhead *head; unsigned int i, nr_to_open; head = get_objhead(OBJ_GLOBAL, OBJ_FD_FILE); head->destroy = &filefd_destructor; head->dump = &filefd_dump; generate_filelist(); if (files_in_index == 0) { /* Something bad happened. Crappy -V maybe? */ panic(EXIT_NO_FILES); return FALSE; } nr_to_open = min(files_in_index, NR_FILE_FDS); if (fileindex == NULL) /* this can happen if we ctrl-c'd */ return FALSE; for (i = 0; i < nr_to_open; i++) { struct stat sb; const char *filename; struct object *obj = alloc_object(); int fd = -1; int flags; do { int ret; filename = get_filename(); ret = lstat(filename, &sb); if (ret == -1) continue; flags = check_stat_file(&sb); if (flags == -1) continue; fd = open_file(obj, filename, flags); } while (fd == -1); obj->fileobj.fd = fd; add_object(obj, OBJ_GLOBAL, OBJ_FD_FILE); /* convert O_ open flags to mmap prot flags */ switch (flags) { case O_RDONLY: flags = PROT_READ; break; case O_WRONLY: flags = PROT_WRITE; break; case O_RDWR: flags = PROT_READ|PROT_WRITE; break; default: break; } mmap_fd(fd, filename, sb.st_size, flags, OBJ_GLOBAL, OBJ_MMAP_FILE); } return TRUE; } static int get_rand_file_fd(void) { struct object *obj; if (objects_empty(OBJ_FD_FILE) == TRUE) return -1; obj = get_random_object(OBJ_FD_FILE, OBJ_GLOBAL); return obj->fileobj.fd; } static const struct fd_provider file_fd_provider = { .name = "pseudo", // FIXME: Use separate providers for dev/sysfs/procfs .enabled = TRUE, .open = &open_files, .get = &get_rand_file_fd, }; REG_FD_PROV(file_fd_provider); fds/inotify.c000066400000000000000000000033021445305223700134620ustar00rootroot00000000000000/* inotify related fds */ #include #include #include #include #include #include #include "fd.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #define MAX_INOTIFY_FDS 5 static void inotify_destructor(struct object *obj) { close(obj->inotifyobj.fd); } static void inotify_dump(struct object *obj, bool global) { struct inotifyobj *io = &obj->inotifyobj; output(2, "inotify fd:%d flags:%x global:%d\n", io->fd, io->flags, global); } static int open_inotify_fds(void) { struct objhead *head; struct object *obj; unsigned int i; int fd; int flags[] = { 0, IN_NONBLOCK, IN_CLOEXEC, IN_NONBLOCK | IN_CLOEXEC, }; head = get_objhead(OBJ_GLOBAL, OBJ_FD_INOTIFY); head->destroy = &inotify_destructor; head->dump = &inotify_dump; fd = inotify_init(); if (fd < 0) return FALSE; obj = alloc_object(); obj->inotifyobj.fd = fd; obj->inotifyobj.flags = 0; add_object(obj, OBJ_GLOBAL, OBJ_FD_INOTIFY); for (i = 0; i < ARRAY_SIZE(flags); i++) { fd = inotify_init1(flags[i]); if (fd < 0) return FALSE; obj = alloc_object(); obj->inotifyobj.fd = fd; obj->inotifyobj.flags = flags[i]; add_object(obj, OBJ_GLOBAL, OBJ_FD_INOTIFY); } return TRUE; } static int get_rand_inotify_fd(void) { struct object *obj; /* check if inotifyfd unavailable/disabled. */ if (objects_empty(OBJ_FD_INOTIFY) == TRUE) return -1; obj = get_random_object(OBJ_FD_INOTIFY, OBJ_GLOBAL); return obj->inotifyobj.fd; } static const struct fd_provider inotify_fd_provider = { .name = "inotify", .enabled = TRUE, .open = &open_inotify_fds, .get = &get_rand_inotify_fd, }; REG_FD_PROV(inotify_fd_provider); fds/memfd.c000066400000000000000000000041021445305223700130700ustar00rootroot00000000000000/* memfd FDs */ #include #include #include #include #include #include #include "fd.h" #include "memfd.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "compat.h" #include "trinity.h" #ifndef USE_MEMFD_CREATE #ifndef memfd_create static int memfd_create(__unused__ const char *uname, __unused__ unsigned int flag) { #ifdef SYS_memfd_create return syscall(SYS_memfd_create, uname, flag); #else return -ENOSYS; #endif } #endif #endif static void memfd_destructor(struct object *obj) { free(obj->memfdobj.name); close(obj->memfdobj.fd); } static void memfd_dump(struct object *obj, bool global) { struct memfdobj *mo = &obj->memfdobj; output(2, "memfd fd:%d name:%s flags:%x global:%d\n", mo->fd, mo->name, mo->flags, global); } static int open_memfd_fds(void) { struct objhead *head; unsigned int i; unsigned int flags[] = { 0, MFD_CLOEXEC, MFD_CLOEXEC | MFD_ALLOW_SEALING, MFD_ALLOW_SEALING, MFD_HUGETLB, }; head = get_objhead(OBJ_GLOBAL, OBJ_FD_MEMFD); head->destroy = &memfd_destructor; head->dump = &memfd_dump; for (i = 0; i < ARRAY_SIZE(flags); i++) { struct object *obj; char namestr[] = "memfdN"; int fd; sprintf(namestr, "memfd%u", i + 1); fd = memfd_create(namestr, flags[i]); if (fd < 0) continue; obj = alloc_object(); obj->memfdobj.fd = fd; obj->memfdobj.name = strdup(namestr); obj->memfdobj.flags = flags[i]; add_object(obj, OBJ_GLOBAL, OBJ_FD_MEMFD); } //FIXME: right now, returning FALSE means "abort everything", not // "skip this provider", so on -ENOSYS, we have to still register. return TRUE; } static int get_rand_memfd_fd(void) { struct object *obj; /* check if eventfd unavailable/disabled. */ if (objects_empty(OBJ_FD_MEMFD) == TRUE) return -1; obj = get_random_object(OBJ_FD_MEMFD, OBJ_GLOBAL); return obj->memfdobj.fd; } static const struct fd_provider memfd_fd_provider = { .name = "memfd", .enabled = TRUE, .open = &open_memfd_fds, .get = &get_rand_memfd_fd, }; REG_FD_PROV(memfd_fd_provider); fds/perf.c000066400000000000000000000060141445305223700127400ustar00rootroot00000000000000#include #include #include #include #include #include #include #include #include "fd.h" #include "objects.h" #include "perf.h" #include "shm.h" #include "sanitise.h" #include "utils.h" #define MAX_PERF_FDS 10 static void perffd_destructor(struct object *obj) { free(obj->perfobj.eventattr); close(obj->perfobj.fd); } static void perffd_dump(struct object *obj, bool global) { struct perfobj *po = &obj->perfobj; // unsigned int i; output(2, "perf fd: %d pid:%d cpu:%d group_fd:%d flags:%lx global:%d\n", po->fd, po->pid, po->cpu, po->group_fd, po->flags, global); /* output(2, " perf_event_attr:"); for (i = 0; i < perfsize ; i++) { output(CONT, "%02x ", (unsigned char) p[i]); } output(CONT, "\n"); */ } static int open_perf_fds(void) { struct objhead *head; unsigned int i = 0; unsigned int perm_count = 0; unsigned int inval_count = 0; head = get_objhead(OBJ_GLOBAL, OBJ_FD_PERF); head->destroy = &perffd_destructor; head->dump = &perffd_dump; while (i < MAX_PERF_FDS) { struct syscallrecord *rec; int fd; rec = &shm->children[0]->syscall; sanitise_perf_event_open(rec); fd = syscall(__NR_perf_event_open, rec->a1, rec->a2, rec->a3, rec->a4, rec->a5); if (fd != -1) { struct object *obj; obj = alloc_object(); obj->perfobj.fd = fd; obj->perfobj.eventattr = zmalloc(sizeof(struct perf_event_attr)); memcpy(obj->perfobj.eventattr, (void *) rec->a1, sizeof(struct perf_event_attr)); obj->perfobj.pid = rec->a2; obj->perfobj.cpu = rec->a3; obj->perfobj.group_fd = rec->a4; obj->perfobj.flags = rec->a5; add_object(obj, OBJ_GLOBAL, OBJ_FD_PERF); i++; /* any time we succeed, reset the failure counts. * They're only there for the cases where we hit them repeatedly. */ inval_count = 0; perm_count = 0; } else { switch (errno) { case ENOSYS: /* If ENOSYS, bail early rather than do MAX_PERF_FDS retries */ return FALSE; case EINVAL: /* If we get here we probably generated something invalid and * perf_event_open threw it out. Go around the loop again. * OR its LXCore throwing us in an endless loop. */ inval_count++; break; case EACCES: perm_count++; break; } } if (perm_count > 1000) { output(2, "Couldn't open enough perf events, got EPERM too much. Giving up.\n"); return FALSE; } if (inval_count > 10000) { output(2, "couldn't open enough perf events, got EINVAL too much. Giving up.\n"); return FALSE; } if (shm->exit_reason != STILL_RUNNING) return FALSE; } return TRUE; } int get_rand_perf_fd(void) { struct object *obj; /* check if perf unavailable/disabled. */ if (objects_empty(OBJ_FD_PERF) == TRUE) return -1; obj = get_random_object(OBJ_FD_PERF, OBJ_GLOBAL); return obj->perfobj.fd; } static const struct fd_provider perf_fd_provider = { .name = "perf", .enabled = TRUE, .open = &open_perf_fds, .get = &get_rand_perf_fd, }; REG_FD_PROV(perf_fd_provider); fds/pipes.c000066400000000000000000000032641445305223700131300ustar00rootroot00000000000000/* Pipe FD related functions. */ #include #include #include #include #include #include #include "fd.h" #include "files.h" #include "objects.h" #include "pipes.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "trinity.h" static void pipefd_destructor(struct object *obj) { close(obj->pipeobj.fd); } static void pipefd_dump(struct object *obj, bool global) { struct pipeobj *po = &obj->pipeobj; output(2, "pipe fd:%d flags:%x [%s] global:%d\n", po->fd, po->flags, po->reader ? "reader" : "writer", global); } static void open_pipe_pair(unsigned int flags) { struct object *obj; int pipes[2]; if (pipe2(pipes, flags) < 0) { perror("pipe fail.\n"); return; } obj = alloc_object(); obj->pipeobj.fd = pipes[0]; obj->pipeobj.flags = flags; obj->pipeobj.reader = TRUE; add_object(obj, OBJ_GLOBAL, OBJ_FD_PIPE); obj = alloc_object(); obj->pipeobj.fd = pipes[1]; obj->pipeobj.flags = flags; obj->pipeobj.reader = FALSE; add_object(obj, OBJ_GLOBAL, OBJ_FD_PIPE); } static int open_pipes(void) { struct objhead *head; head = get_objhead(OBJ_GLOBAL, OBJ_FD_PIPE); head->destroy = &pipefd_destructor; head->dump = &pipefd_dump; open_pipe_pair(0); open_pipe_pair(O_NONBLOCK); open_pipe_pair(O_CLOEXEC); open_pipe_pair(O_NONBLOCK | O_CLOEXEC); return TRUE; } int get_rand_pipe_fd(void) { struct object *obj; obj = get_random_object(OBJ_FD_PIPE, OBJ_GLOBAL); if (obj == NULL) return 0; return obj->pipeobj.fd; } static const struct fd_provider pipes_fd_provider = { .name = "pipes", .enabled = TRUE, .open = &open_pipes, .get = &get_rand_pipe_fd, }; REG_FD_PROV(pipes_fd_provider); fds/sockets.c000066400000000000000000000265041445305223700134650ustar00rootroot00000000000000#include #include #include #include #include #include #include #include #include #include "debug.h" #include "domains.h" #include "net.h" #include "objects.h" #include "params.h" // verbose, do_specific_domain #include "random.h" #include "sanitise.h" #include "shm.h" #include "trinity.h" #include "uid.h" #include "utils.h" unsigned int nr_sockets = 0; static const char *cachefilename="trinity.socketcache"; static int cachefile; static void sso_socket(struct socket_triplet *triplet, struct sockopt *so, int fd) { int ret; unsigned int tries = 0; /* skip over bluetooth due to weird linger bug */ if (triplet->family == PF_BLUETOOTH) return; so->optval = 0; retry: if (so->optval != 0) { free((void *) so->optval); so->optval = 0; } do_setsockopt(so, triplet); ret = setsockopt(fd, so->level, so->optname, (void *)so->optval, so->optlen); if (ret == 0) { output(2, "setsockopt(%u 0x%lx 0x%lx 0x%lx) on fd %u [%u:%u:%u]\n", so->level, so->optname, so->optval, so->optlen, fd, triplet->family, triplet->type, triplet->protocol); } else { tries++; if (tries != 100) goto retry; } if (so->optval != 0) free((void *) so->optval); } static struct object * add_socket(int fd, unsigned int domain, unsigned int type, unsigned int protocol) { struct object *obj; obj = alloc_object(); obj->sockinfo.fd = fd; obj->sockinfo.triplet.family = domain; obj->sockinfo.triplet.type = type; obj->sockinfo.triplet.protocol = protocol; add_object(obj, OBJ_GLOBAL, OBJ_FD_SOCKET); return obj; } static int open_socket(unsigned int domain, unsigned int type, unsigned int protocol) { struct object *obj; struct sockaddr *sa = NULL; const struct netproto *proto; socklen_t salen; struct sockopt so = { 0, 0, 0, 0 }; int fd; fd = socket(domain, type, protocol); if (fd == -1) return fd; obj = add_socket(fd, domain, type, protocol); proto = net_protocols[domain].proto; if (proto != NULL) if (proto->socket_setup != NULL) proto->socket_setup(fd); // FIXME: // All of this needs to be broken out into child ops instead of // special casing it all at creation time. /* Set some random socket options. */ sso_socket(&obj->sockinfo.triplet, &so, fd); nr_sockets++; /* Sometimes, listen on created sockets. */ if (RAND_BOOL()) { int ret, one = 1; /* fake a sockaddr. */ generate_sockaddr((struct sockaddr **) &sa, (socklen_t *) &salen, domain); ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); if (ret != -1) goto skip_bind; ret = bind(fd, sa, salen); if (ret != -1) (void) listen(fd, RAND_RANGE(1, 128)); // ret = accept4(fd, sa, &salen, SOCK_NONBLOCK); // if (ret != -1) { // obj = add_socket(ret, domain, type, protocol); // nr_sockets++; // } } skip_bind: if (sa != NULL) free(sa); return fd; } static void lock_cachefile(int type) { struct flock fl = { .l_len = 0, .l_start = 0, .l_whence = SEEK_SET, }; fl.l_pid = getpid(); fl.l_type = type; if (verbose) output(2, "waiting on lock for cachefile\n"); if (fcntl(cachefile, F_SETLKW, &fl) == -1) { perror("fcntl F_SETLKW"); return; } if (verbose) output(2, "took lock for cachefile\n"); } static void unlock_cachefile(void) { struct flock fl = { .l_len = 0, .l_start = 0, .l_whence = SEEK_SET, }; fl.l_pid = getpid(); fl.l_type = F_UNLCK; if (fcntl(cachefile, F_SETLK, &fl) == -1) { perror("fcntl F_UNLCK F_SETLK "); return; } if (verbose) output(2, "dropped lock for cachefile\n"); } static unsigned int valid_proto(unsigned int family) { const char *famstr; famstr = get_domain_name(family); /* Not used for creating sockets. */ if (strncmp(famstr, "UNSPEC", 9) == 0) return FALSE; if (strncmp(famstr, "BRIDGE", 9) == 0) return FALSE; if (strncmp(famstr, "SECURITY", 11) == 0) return FALSE; /* Not actually implemented (or now removed). */ if (strncmp(famstr, "NETBEUI", 10) == 0) return FALSE; if (strncmp(famstr, "ASH", 6) == 0) return FALSE; if (strncmp(famstr, "ECONET", 9) == 0) return FALSE; if (strncmp(famstr, "SNA", 6) == 0) return FALSE; if (strncmp(famstr, "WANPIPE", 10) == 0) return FALSE; /* Needs root. */ if (orig_uid != 0) { if (strncmp(famstr, "KEY", 6) == 0) return FALSE; if (strncmp(famstr, "PACKET", 9) == 0) return FALSE; if (strncmp(famstr, "LLC", 6) == 0) return FALSE; } return TRUE; } static bool write_socket_to_cache(struct socket_triplet *st) { unsigned int buffer[3]; int n; if (cachefile == -1) return FALSE; buffer[0] = st->family; buffer[1] = st->type; buffer[2] = st->protocol; n = write(cachefile, &buffer, sizeof(int) * 3); if (n == -1) { outputerr("something went wrong writing the cachefile! : %s\n", strerror(errno)); return FALSE; } return TRUE; } static bool generate_socket(unsigned int family, unsigned int protocol, unsigned int type) { struct socket_triplet st; int fd; st.family = family; st.type = type; st.protocol = protocol; fd = open_socket(st.family, st.type, st.protocol); if (fd > -1) { write_socket_to_cache(&st); return TRUE; } output(2, "Couldn't open socket %u:%u:%u. %s\n", family, type, protocol, strerror(errno)); return FALSE; } static bool generate_specific_socket(int family) { struct socket_triplet st; int fd; st.family = family; BUG_ON(st.family >= ARRAY_SIZE(no_domains)); if (no_domains[st.family]) return FALSE; if (get_domain_name(st.family) == NULL) return FALSE; if (valid_proto(st.family) == FALSE) { outputerr("Can't do protocol %s\n", get_domain_name(st.family)); return FALSE; } st.protocol = rnd() % 256; if (sanitise_socket_triplet(&st) == -1) rand_proto_type(&st); fd = open_socket(st.family, st.type, st.protocol); if (fd == -1) { output(0, "Couldn't open socket (%u:%u:%u). %s\n", st.family, st.type, st.protocol, strerror(errno)); return FALSE; } return write_socket_to_cache(&st); } #define NR_SOCKET_FDS 50 static bool generate_sockets(void) { int i, r, ret = FALSE; bool domains_disabled = FALSE; cachefile = creat(cachefilename, S_IWUSR|S_IRUSR); if (cachefile == -1) { outputerr("Couldn't open cachefile for writing! (%s)\n", strerror(errno)); return FALSE; } lock_cachefile(F_WRLCK); if (do_specific_domain == TRUE) { while (nr_sockets < NR_SOCKET_FDS) { ret = generate_specific_socket(specific_domain); if (ret == FALSE) return FALSE; } goto out_unlock; } /* * check if all domains are disabled. */ for (i = 0; i < (int)ARRAY_SIZE(no_domains); i++) { if (no_domains[i] == FALSE) { domains_disabled = FALSE; break; } else { domains_disabled = TRUE; } } if (domains_disabled == TRUE) { output(0, "All domains disabled!\n"); goto out_unlock; } for (i = 0; i < TRINITY_PF_MAX; i++) { const struct netproto *proto = net_protocols[i].proto; struct socket_triplet *triplets; unsigned int j; if (no_domains[i] == TRUE) continue; /* check for ctrl-c again. */ if (shm->exit_reason != STILL_RUNNING) goto out_unlock; if (proto == NULL) continue; if (proto->nr_triplets == 0) continue; triplets = proto->valid_triplets; for (j = 0; j < proto->nr_triplets; j++) ret |= generate_socket(triplets[j].family, triplets[j].protocol, triplets[j].type); if (proto->nr_privileged_triplets == 0) continue; if (orig_uid != 0) continue; triplets = proto->valid_privileged_triplets; for (j = 0; j < proto->nr_privileged_triplets; j++) ret |= generate_socket(triplets[j].family, triplets[j].protocol, triplets[j].type); } /* This is here temporarily until we have sufficient ->valid_proto's */ while (nr_sockets < NR_SOCKET_FDS) { r = rnd() % TRINITY_PF_MAX; for (i = 0; i < 10; i++) if (generate_specific_socket(r) == FALSE) break; } out_unlock: if (cachefile != -1) { unlock_cachefile(); close(cachefile); } return ret; } static void socket_destructor(struct object *obj) { struct socketinfo *si = &obj->sockinfo; struct linger ling = { .l_onoff = FALSE, .l_linger = 0 }; int fd; //FIXME: This is a workaround for a weird bug where we hang forevre // waiting for bluetooth sockets when we setsockopt. // Hopefully at some point we can remove this when someone figures out what's going on. if (si->triplet.family == PF_BLUETOOTH) return; /* Grab an fd, and nuke it before someone else uses it. */ fd = si->fd; si->fd = 0; /* disable linger */ (void) setsockopt(fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)); (void) shutdown(fd, SHUT_RDWR); if (close(fd) != 0) output(1, "failed to close socket [%u:%u:%u].(%s)\n", si->triplet.family, si->triplet.type, si->triplet.protocol, strerror(errno)); } static void socket_dump(struct object *obj, bool global) { struct socketinfo *si = &obj->sockinfo; output(2, "socket fd:%u domain:%u (%s) type:0x%u protocol:%u global:%d\n", si->fd, si->triplet.family, get_domain_name(si->triplet.family), si->triplet.type, si->triplet.protocol, global); } static int open_sockets(void) { struct objhead *head; int bytesread = -1; int ret; head = get_objhead(OBJ_GLOBAL, OBJ_FD_SOCKET); head->destroy = &socket_destructor; head->dump = &socket_dump; cachefile = open(cachefilename, O_RDONLY); if (cachefile < 0) { output(1, "Couldn't find socket cachefile. Regenerating.\n"); ret = generate_sockets(); output(1, "created %u sockets\n", nr_sockets); return ret; } lock_cachefile(F_RDLCK); while (bytesread != 0) { unsigned int domain, type, protocol; unsigned int buffer[3]; int fd; bytesread = read(cachefile, buffer, sizeof(int) * 3); if (bytesread == 0) { if (nr_sockets == 0) goto regenerate; break; } domain = buffer[0]; type = buffer[1]; protocol = buffer[2]; if (domain >= TRINITY_PF_MAX) { output(1, "cachefile contained invalid domain %u\n", domain); goto regenerate; } if ((do_specific_domain == TRUE && domain != specific_domain) || (no_domains[domain] == TRUE)) { output(1, "ignoring socket cachefile due to specific " "protocol request (or protocol disabled), " "and stale data in cachefile.\n"); regenerate: unlock_cachefile(); /* drop the reader lock. */ close(cachefile); unlink(cachefilename); ret = generate_sockets(); return ret; } fd = open_socket(domain, type, protocol); if (fd < 0) { output(1, "Cachefile is stale. Need to regenerate.\n"); goto regenerate; } /* check for ctrl-c */ if (shm->exit_reason != STILL_RUNNING) { close(cachefile); return FALSE; } } output(1, "%u sockets created based on info from socket cachefile.\n", nr_sockets); unlock_cachefile(); close(cachefile); return TRUE; } struct socketinfo * get_rand_socketinfo(void) { struct object *obj; /* When using victim files, sockets can be 0. */ if (objects_empty(OBJ_FD_SOCKET) == TRUE) return NULL; obj = get_random_object(OBJ_FD_SOCKET, OBJ_GLOBAL); return &obj->sockinfo; } static int get_rand_socket_fd(void) { struct socketinfo *sockinfo; sockinfo = get_rand_socketinfo(); if (sockinfo == NULL) return -1; return sockinfo->fd; } int fd_from_socketinfo(struct socketinfo *si) { if (si != NULL) { if (!(ONE_IN(1000))) return si->fd; } return get_random_fd(); } static const struct fd_provider socket_fd_provider = { .name = "sockets", .enabled = TRUE, .open = &open_sockets, .get = &get_rand_socket_fd, }; REG_FD_PROV(socket_fd_provider); fds/testfiles.c000066400000000000000000000057431445305223700140160ustar00rootroot00000000000000#include #include #include #include #include #include #include #include #include #include "fd.h" #include "files.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "syscalls/syscalls.h" #include "testfile.h" #include "utils.h" #define MAX_TESTFILES 4 #define MAX_TESTFILE_FDS 20 static void testfile_destructor(struct object *obj) { close(obj->testfileobj.fd); } static void testfile_dump(struct object *obj, bool global) { struct fileobj *fo = &obj->testfileobj; output(2, "testfile fd:%d filename:%s flags:%x fopened:%d fcntl_flags:%x global:%d\n", fo->fd, fo->filename, fo->flags, fo->fopened, fo->fcntl_flags, global); } static int open_testfile(struct object *obj, char *filename) { int fd; obj->testfileobj.filename = filename; /* file might be around from an earlier run, nuke it. */ (void) unlink(filename); if (RAND_BOOL()) { const unsigned long open_flags[] = { O_DIRECT, O_DSYNC, O_SYNC, }; int flags = 0; flags = set_rand_bitmask(ARRAY_SIZE(open_flags), open_flags);; obj->testfileobj.flags = O_CREAT | flags; fd = open(filename, O_CREAT | flags, 0666); obj->testfileobj.fopened = FALSE; obj->testfileobj.fcntl_flags = 0; } else { obj->testfileobj.fopened = TRUE; obj->testfileobj.flags = O_RDWR; fd = open_with_fopen(filename, O_RDWR); if (fd != -1) { int fcntl_flags; fcntl_flags = random_fcntl_setfl_flags(); (void) fcntl(fd, F_SETFL, fcntl_flags); obj->testfileobj.fcntl_flags = fcntl_flags; } } return fd; } static int open_testfile_fds(void) { struct objhead *head; struct object *obj = NULL; char *filename; unsigned int i = 1, nr = 0; unsigned int fails = 0; head = get_objhead(OBJ_GLOBAL, OBJ_FD_TESTFILE); head->destroy = &testfile_destructor; head->dump = &testfile_dump; filename = zmalloc(64); while (nr < MAX_TESTFILE_FDS) { int fd; sprintf(filename, "trinity-testfile%u", i); if (obj == NULL) obj = alloc_object(); fd = open_testfile(obj, filename); if (fd != -1) { obj->testfileobj.fd = fd; add_object(obj, OBJ_GLOBAL, OBJ_FD_TESTFILE); i++; if (i > MAX_TESTFILES) i = 1; nr++; fails = 0; obj = NULL; // Make it alloc a new one. mmap_fd(fd, filename, page_size, PROT_READ|PROT_WRITE, OBJ_GLOBAL, OBJ_MMAP_TESTFILE); } else { fails++; if (fails == 100) { output(2, "testfile creation is failing a lot. last error:%s\n", strerror(errno)); } } } free(filename); return TRUE; } int get_rand_testfile_fd(void) { struct object *obj; /* check if testfilefd's unavailable/disabled. */ if (objects_empty(OBJ_FD_TESTFILE) == TRUE) return -1; obj = get_random_object(OBJ_FD_TESTFILE, OBJ_GLOBAL); return obj->testfileobj.fd; } static const struct fd_provider testfile_fd_provider = { .name = "testfile", .enabled = TRUE, .open = &open_testfile_fds, .get = &get_rand_testfile_fd, }; REG_FD_PROV(testfile_fd_provider); fds/timerfd.c000066400000000000000000000034701445305223700134410ustar00rootroot00000000000000/* timerfd FDs */ #include #include #include #include #include #include #include "fd.h" #include "files.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "compat.h" static void timerfd_destructor(struct object *obj) { close(obj->timerfdobj.fd); } static void timerfd_dump(struct object *obj, bool global) { struct timerfdobj *to = &obj->timerfdobj; output(2, "timerfd fd:%d clockid:%d flags:%x global:%d\n", to->fd, to->clockid, to->flags, global); } static int __open_timerfd_fds(int clockid) { struct objhead *head; unsigned int i; unsigned int flags[] = { 0, TFD_NONBLOCK, TFD_CLOEXEC, TFD_NONBLOCK | TFD_CLOEXEC, }; head = get_objhead(OBJ_GLOBAL, OBJ_FD_TIMERFD); head->destroy = &timerfd_destructor; head->dump = &timerfd_dump; for (i = 0; i < ARRAY_SIZE(flags); i++) { struct object *obj; int fd; fd = timerfd_create(clockid, flags[i]); if (fd == -1) if (errno == ENOSYS) return FALSE; obj = alloc_object(); obj->timerfdobj.fd = fd; obj->timerfdobj.clockid = clockid; obj->timerfdobj.flags = flags[i]; add_object(obj, OBJ_GLOBAL, OBJ_FD_TIMERFD); } return TRUE; } static int open_timerfd_fds(void) { int ret; ret = __open_timerfd_fds(CLOCK_REALTIME); if (ret != FALSE) ret = __open_timerfd_fds(CLOCK_MONOTONIC); return ret; } static int get_rand_timerfd_fd(void) { struct object *obj; /* check if timerfd unavailable/disabled. */ if (objects_empty(OBJ_FD_TIMERFD) == TRUE) return -1; obj = get_random_object(OBJ_FD_TIMERFD, OBJ_GLOBAL); return obj->timerfdobj.fd; } static const struct fd_provider timerfd_fd_provider = { .name = "timerfd", .enabled = TRUE, .open = &open_timerfd_fds, .get = &get_rand_timerfd_fd, }; REG_FD_PROV(timerfd_fd_provider); fds/userfaultfd.c000066400000000000000000000036241445305223700143340ustar00rootroot00000000000000/* userfaultfd FDs */ #include #include #include #include #include #include #include "fd.h" #include "userfaultfd.h" #include "objects.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "compat.h" #include "trinity.h" static int userfaultfd_create(__unused__ unsigned int flag) { #ifdef SYS_userfaultfd return syscall(SYS_userfaultfd, flag); #else return -ENOSYS; #endif } static void userfaultfd_destructor(struct object *obj) { close(obj->userfaultobj.fd); } static void userfaultfd_dump(struct object *obj, bool global) { struct userfaultobj *uo = &obj->userfaultobj; output(2, "userfault fd:%d flags:%x global:%d\n", uo->fd, uo->flags, global); } static int open_userfaultfds(void) { struct objhead *head; unsigned int i; unsigned int flags[] = { 0, O_CLOEXEC, O_NONBLOCK, O_CLOEXEC | O_NONBLOCK, }; head = get_objhead(OBJ_GLOBAL, OBJ_FD_USERFAULTFD); head->destroy = &userfaultfd_destructor; head->dump = &userfaultfd_dump; for (i = 0; i < ARRAY_SIZE(flags); i++) { struct object *obj; int fd; fd = userfaultfd_create(flags[i]); if (fd < 0) continue; obj = alloc_object(); obj->userfaultobj.fd = fd; obj->userfaultobj.flags = flags[i]; add_object(obj, OBJ_GLOBAL, OBJ_FD_USERFAULTFD); } //FIXME: right now, returning FALSE means "abort everything", not // "skip this provider", so on -ENOSYS, we have to still register. return TRUE; } static int get_rand_userfaultfd(void) { struct object *obj; /* check if eventfd unavailable/disabled. */ if (objects_empty(OBJ_FD_USERFAULTFD) == TRUE) return -1; obj = get_random_object(OBJ_FD_USERFAULTFD, OBJ_GLOBAL); return obj->userfaultobj.fd; } static const struct fd_provider userfaultfd_provider = { .name = "userfaultfd", .enabled = TRUE, .open = &open_userfaultfds, .get = &get_rand_userfaultfd, }; REG_FD_PROV(userfaultfd_provider); ftrace.c000066400000000000000000000037771445305223700125110ustar00rootroot00000000000000#include #include #include #include #include #include "ftrace.h" #include "trinity.h" static int trace_fd = -1; // TODO: if passed a dir, generate filename with datestamp static const char defaultdumpfilename[] = "/boot/trace.txt"; const char *ftracedumpname = defaultdumpfilename; static void dump_trace(void) { int tracein, traceout; ssize_t in = -1, out = -1; char buffer[4096]; const char tracefile[] = "/sys/kernel/debug/tracing/trace"; tracein = open(tracefile, O_RDONLY); if (tracein == -1) { if (errno != -EEXIST) output(0, "Error opening %s : %s\n", tracefile, strerror(errno)); goto fail_tracein; } traceout = open(ftracedumpname, O_CREAT | O_WRONLY, 0600); if (traceout == -1) { output(0, "Error opening %s : %s\n", ftracedumpname, strerror(errno)); goto fail_traceout; } while (in != 0) { in = read(tracein, buffer, 4096); if (in > 0) { out = write(traceout, buffer, in); if (out == -1) { output(0, "Error writing trace to %s. %s\n", ftracedumpname, strerror(errno)); goto fail; } } if (in == -1) { output(0, "something went wrong reading from trace. %s\n", strerror(errno)); goto fail; } } output(0, "Dumped trace to %s\n", ftracedumpname); fail: fsync(traceout); close(traceout); fail_traceout: close(tracein); fail_tracein: if (ftracedumpname != defaultdumpfilename) { free((void *)ftracedumpname); ftracedumpname = NULL; } } void setup_ftrace(void) { //todo: check for root trace_fd = open("/sys/kernel/debug/tracing/tracing_on", O_WRONLY); if (trace_fd == -1) { if (errno != -EEXIST) { output(0, "Error opening tracing_on : %s\n", strerror(errno)); return; } } output(0, "Opened ftrace tracing_on as fd %d\n", trace_fd); output(0, "Ftrace log will be dumped to %s\n", ftracedumpname); } void stop_ftrace(void) { if (trace_fd != -1) { if (write(trace_fd, "0", 1) == -1) { output(0, "Stopping ftrace failed! %s\n", strerror(errno)); return; } dump_trace(); return; } } generate-args.c000066400000000000000000000225361445305223700137630ustar00rootroot00000000000000#include #include #include #include #include #include "arch.h" #include "debug.h" #include "files.h" #include "maps.h" #include "net.h" #include "pathnames.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "syscall.h" #include "tables.h" #include "trinity.h" // num_online_cpus static int get_cpu(void) { int i; i = rnd() % 100; switch (i) { case 0: return -1; case 1: return rnd() % 4096; case 2: return INT_MAX; case 3 ... 98: return rnd() % num_online_cpus; } return 0; } static unsigned long handle_arg_address(struct syscallrecord *rec, unsigned int argnum) { unsigned long addr = 0; if (argnum == 1) return (unsigned long) get_address(); if (RAND_BOOL()) return (unsigned long) get_address(); /* Half the time, we look to see if earlier args were also ARG_ADDRESS, * and munge that instead of returning a new one from get_address() */ addr = find_previous_arg_address(rec, argnum); switch (rnd() % 4) { case 0: break; /* return unmodified */ case 1: addr++; break; case 2: addr+= sizeof(int); break; case 3: addr+= sizeof(long); break; } return addr; } static unsigned long handle_arg_range(struct syscallentry *entry, unsigned int argnum) { unsigned long i; unsigned long low = 0, high = 0; switch (argnum) { case 1: low = entry->low1range; high = entry->hi1range; break; case 2: low = entry->low2range; high = entry->hi2range; break; case 3: low = entry->low3range; high = entry->hi3range; break; case 4: low = entry->low4range; high = entry->hi4range; break; case 5: low = entry->low5range; high = entry->hi5range; break; case 6: low = entry->low6range; high = entry->hi6range; break; } if (high == 0) { outputerr("%s forgets to set hirange!\n", entry->name); BUG("Fix syscall definition!\n"); } i = (unsigned long) rand64() % high; if (i < low) { i += low; i &= high; } return i; } static void get_num_and_values(struct syscallentry *entry, unsigned int argnum, unsigned int *num, const unsigned long **values) { switch (argnum) { case 1: *num = entry->arg1list.num; *values = entry->arg1list.values; break; case 2: *num = entry->arg2list.num; *values = entry->arg2list.values; break; case 3: *num = entry->arg3list.num; *values = entry->arg3list.values; break; case 4: *num = entry->arg4list.num; *values = entry->arg4list.values; break; case 5: *num = entry->arg5list.num; *values = entry->arg5list.values; break; case 6: *num = entry->arg6list.num; *values = entry->arg6list.values; break; default: unreachable(); } if (*num == 0) BUG("ARG_OP/LIST with 0 args. What?\n"); if (*values == NULL) BUG("ARG_OP/LIST with no values.\n"); } /* * Get a single entry from the list of values. */ static unsigned long handle_arg_op(struct syscallentry *entry, unsigned int argnum) { const unsigned long *values = NULL; unsigned int num = 0; unsigned long op = 0; get_num_and_values(entry, argnum, &num, &values); op = values[rnd() % num]; return op; } /* * OR a random number of bits from the list of values into a bitmask, and return it. */ static unsigned long handle_arg_list(struct syscallentry *entry, unsigned int argnum) { unsigned long mask = 0; unsigned int num = 0; const unsigned long *values = NULL; get_num_and_values(entry, argnum, &num, &values); if (RAND_BOOL()) num = min(num, 3U); mask = set_rand_bitmask(num, values); return mask; } static unsigned long handle_arg_iovec(struct syscallentry *entry, struct syscallrecord *rec, unsigned int argnum) { unsigned long num_entries; if (RAND_BOOL()) num_entries = 1; else num_entries = RAND_RANGE(1, 256); switch (argnum) { case 1: if (entry->arg2type == ARG_IOVECLEN) rec->a2 = num_entries; break; case 2: if (entry->arg3type == ARG_IOVECLEN) rec->a3 = num_entries; break; case 3: if (entry->arg4type == ARG_IOVECLEN) rec->a4 = num_entries; break; case 4: if (entry->arg5type == ARG_IOVECLEN) rec->a5 = num_entries; break; case 5: if (entry->arg6type == ARG_IOVECLEN) rec->a6 = num_entries; break; } return (unsigned long) alloc_iovec(num_entries); } static unsigned long handle_arg_sockaddr(struct syscallentry *entry, struct syscallrecord *rec, unsigned int argnum) { struct sockaddr *sockaddr = NULL; socklen_t sockaddrlen = 0; generate_sockaddr((struct sockaddr **)&sockaddr, &sockaddrlen, PF_NOHINT); switch (argnum) { case 1: if (entry->arg2type == ARG_SOCKADDRLEN) rec->a2 = sockaddrlen; break; case 2: if (entry->arg3type == ARG_SOCKADDRLEN) rec->a3 = sockaddrlen; break; case 3: if (entry->arg4type == ARG_SOCKADDRLEN) rec->a4 = sockaddrlen; break; case 4: if (entry->arg5type == ARG_SOCKADDRLEN) rec->a5 = sockaddrlen; break; case 5: if (entry->arg6type == ARG_SOCKADDRLEN) rec->a6 = sockaddrlen; break; case 6: break; } return (unsigned long) sockaddr; } static unsigned long handle_arg_mode_t(void) { unsigned int i, count; mode_t mode = 0, op = 0; count = rnd() % 9; for (i = 0; i < count; i++) { unsigned int j; j = rnd() % 16; switch (j) { case 0: op = S_IRWXU; break; case 1: op = S_IRUSR; break; case 2: op = S_IWUSR; break; case 3: op = S_IXUSR; break; case 4: op = S_IRWXG; break; case 5: op = S_IRGRP; break; case 6: op = S_IWGRP; break; case 7: op = S_IXGRP; break; case 8: op = S_IRWXO; break; case 9: op = S_IROTH; break; case 10: op = S_IWOTH; break; case 11: op = S_IXOTH; break; case 12: op = S_ISUID; break; case 13: op = S_ISGID; break; case 14: op = S_ISVTX; break; } if (RAND_BOOL()) mode |= op; else mode &= ~op; } return mode; } enum argtype get_argtype(struct syscallentry *entry, unsigned int argnum) { enum argtype argtype = 0; switch (argnum) { case 1: argtype = entry->arg1type; break; case 2: argtype = entry->arg2type; break; case 3: argtype = entry->arg3type; break; case 4: argtype = entry->arg4type; break; case 5: argtype = entry->arg5type; break; case 6: argtype = entry->arg6type; break; } return argtype; } static unsigned long fill_arg(struct syscallrecord *rec, unsigned int argnum) { struct syscallentry *entry; unsigned int call; enum argtype argtype; call = rec->nr; entry = syscalls[call].entry; if (argnum > entry->num_args) return 0; argtype = get_argtype(entry, argnum); switch (argtype) { case ARG_UNDEFINED: if (RAND_BOOL()) return (unsigned long) rand64(); return (unsigned long) get_writable_address(page_size); case ARG_FD: if (RAND_BOOL()) { unsigned int i; /* If this is the 2nd or more ARG_FD, make it unique */ for (i = 0; i < argnum; i++) { enum argtype arg; arg = get_argtype(entry, i); if (arg == ARG_FD) return get_new_random_fd(); } } return get_random_fd(); case ARG_LEN: return (unsigned long) get_len(); case ARG_ADDRESS: return handle_arg_address(rec, argnum); case ARG_NON_NULL_ADDRESS: return (unsigned long) get_non_null_address(); case ARG_MMAP: return (unsigned long) get_map(); case ARG_PID: return (unsigned long) get_pid(); case ARG_RANGE: return handle_arg_range(entry, argnum); case ARG_OP: /* Like ARG_LIST, but just a single value. */ return handle_arg_op(entry, argnum); case ARG_LIST: return handle_arg_list(entry, argnum); case ARG_CPU: return (unsigned long) get_cpu(); case ARG_PATHNAME: return (unsigned long) generate_pathname(); case ARG_IOVEC: return handle_arg_iovec(entry, rec, argnum); case ARG_IOVECLEN: case ARG_SOCKADDRLEN: /* We already set the len in the ARG_IOVEC/ARG_SOCKADDR case * So here we just return what we had set there. */ return get_argval(rec, argnum); case ARG_SOCKADDR: return handle_arg_sockaddr(entry, rec, argnum); case ARG_MODE_T: return handle_arg_mode_t(); case ARG_SOCKETINFO: return (unsigned long) get_rand_socketinfo(); } BUG("unreachable!\n"); } void generic_sanitise(struct syscallrecord *rec) { struct syscallentry *entry; unsigned int call; call = rec->nr; entry = syscalls[call].entry; if (entry->arg1type != 0) rec->a1 = fill_arg(rec, 1); if (entry->arg2type != 0) rec->a2 = fill_arg(rec, 2); if (entry->arg3type != 0) rec->a3 = fill_arg(rec, 3); if (entry->arg4type != 0) rec->a4 = fill_arg(rec, 4); if (entry->arg5type != 0) rec->a5 = fill_arg(rec, 5); if (entry->arg6type != 0) rec->a6 = fill_arg(rec, 6); } void generic_free_arg(struct syscallrecord *rec) { struct syscallentry *entry; unsigned int i, call; call = rec->nr; entry = syscalls[call].entry; for_each_arg(entry, i) { enum argtype argtype; argtype = get_argtype(entry, i); if (argtype == ARG_IOVEC) free((void *) get_argval(rec, i)); } } void generate_syscall_args(struct syscallrecord *rec) { struct syscallentry *entry; lock(&rec->lock); //TODO: instead of rand64() do a rand arg type entry = syscalls[rec->nr].entry; rec->state = PREP; if (entry->arg1type == ARG_UNDEFINED) rec->a1 = (unsigned long) rand64(); if (entry->arg2type == ARG_UNDEFINED) rec->a2 = (unsigned long) rand64(); if (entry->arg3type == ARG_UNDEFINED) rec->a3 = (unsigned long) rand64(); if (entry->arg4type == ARG_UNDEFINED) rec->a4 = (unsigned long) rand64(); if (entry->arg5type == ARG_UNDEFINED) rec->a5 = (unsigned long) rand64(); if (entry->arg6type == ARG_UNDEFINED) rec->a6 = (unsigned long) rand64(); generic_sanitise(rec); if (entry->sanitise) entry->sanitise(rec); unlock(&rec->lock); } include/000077500000000000000000000000001445305223700125065ustar00rootroot00000000000000include/arch-aarch64.h000066400000000000000000000006531445305223700150260ustar00rootroot00000000000000#pragma once #define PAGE_OFFSET 0xffffffc000000000UL #define TASK_SIZE (1UL << 39) #define MODULE_ADDR (PAGE_OFFSET - 0x04000000) #define KERNEL_ADDR (PAGE_OFFSET + 0x80000) /* PAGE_SHIFT is 16 ifdef CONFIG_ARM64_64K_PAGES */ #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 60 #define PTRACE_GETREGS 0 #define PTRACE_GETFPREGS 0 #define PTRACE_SETREGS 0 #define PTRACE_SETFPREGS 0 #define SYSCALLS syscalls_aarch64 include/arch-alpha.h000066400000000000000000000012441445305223700146600ustar00rootroot00000000000000#pragma once #define KERNEL_ADDR 0xfffffc0000310000 /* KERNEL_ADDR is 0xfffffc0001010000 ifndef CONFIG_ALPHA_LEGACY_START_ADDRESS */ #define PAGE_SHIFT 13 #define PGDIR_SHIFT (PAGE_SHIFT + 2*(PAGE_SHIFT-3)) #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define MODULE_ADDR (-2*PGDIR_SIZE) /* MODULE_ADDR is 0xfffffe0000000000 ifdef CONFIG_ALPHA_LARGE_VMALLOC */ #define PAGE_OFFSET 0xfffffc0000000000UL /* PAGE_OFFSET is 0xffff800000000000UL ifdef USE_48_BIT_KSEG */ #define TASK_SIZE 0x40000000000UL #define PTE_FILE_MAX_BITS 32 #define PTRACE_GETREGS 0 #define PTRACE_GETFPREGS 0 #define PTRACE_SETREGS 0 #define PTRACE_SETFPREGS 0 #define SYSCALLS syscalls_alpha include/arch-arm.h000066400000000000000000000006161445305223700143540ustar00rootroot00000000000000#pragma once #define PAGE_OFFSET 0xC0000000 /* * Alternative possibilities for PAGE_OFFSET: * default 0x40000000 if VMSPLIT_1G * default 0x80000000 if VMSPLIT_2G */ #define TASK_SIZE (PAGE_OFFSET - 0x01000000) #define MODULE_ADDR (PAGE_OFFSET - 0x00800000) #define KERNEL_ADDR (PAGE_OFFSET + 0x00008000) #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 29 #define SYSCALLS syscalls_arm include/arch-i386.h000066400000000000000000000006571445305223700142730ustar00rootroot00000000000000#pragma once #define X86 1 #define KERNEL_ADDR 0xc0100220 #define MODULE_ADDR 0xa0000000 // FIXME: Placeholder #define PAGE_OFFSET 0xC0000000 #define TASK_SIZE (PAGE_OFFSET) /* * Alternative possibilities for PAGE_OFFSET: * default 0xB0000000 if VMSPLIT_3G_OPT * default 0x78000000 if VMSPLIT_2G * default 0x40000000 if VMSPLIT_1G */ #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 31 #define SYSCALLS syscalls_i386 include/arch-ia64.h000066400000000000000000000006601445305223700143370ustar00rootroot00000000000000#pragma once #define KERNEL_ADDR 0xa000000100000000 #define MODULE_ADDR 0xffffffffa0000000L // FIXME: Placeholder #define PAGE_OFFSET 0xe000000000000000 #define TASK_SIZE 0xa000000000000000 #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 61 #define SYSCALL_OFFSET 1024 // for __IA64_UL_CONST we need to include: #include #define PTRACE_GETFPREGS 0 #define PTRACE_SETFPREGS 0 #define SYSCALLS syscalls_ia64 include/arch-mips.h000066400000000000000000000006361445305223700145470ustar00rootroot00000000000000#pragma once #define KERNEL_ADDR 0xc0100220 #define MODULE_ADDR 0xa0000000 // FIXME: Placeholder #define PAGE_OFFSET 0x80000000 #define TASK_SIZE (PAGE_OFFSET) #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 31 #if _MIPS_SIM == _ABIO32 #define SYSCALL_OFFSET 4000 #elif _MIPS_SIM == _ABIN32 #define SYSCALL_OFFSET 6000 #elif _MIPS_SIM == _ABI64 #define SYSCALL_OFFSET 5000 #endif #define SYSCALLS syscalls_mips include/arch-parisc.h000066400000000000000000000010331445305223700150500ustar00rootroot00000000000000#pragma once // FIXME: depends on kernel bit size, userspace is always 32 bit #define PAGE_OFFSET 0x10000000 #if 0 // for 64 bit #define PAGE_OFFSET 0x40000000 #endif #define KERNEL_ADDR 0xa0000000 // FIXME: Placeholder #define MODULE_ADDR 0xa0000000L // FIXME: Placeholder #define TASK_SIZE 0xa0000000 // FIXME: Placeholder #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS (32 - 11) #define PTRACE_GETREGS 18 #define PTRACE_GETFPREGS 14 #define PTRACE_SETREGS 19 #define PTRACE_SETFPREGS 15 #define SYSCALLS syscalls_parisc include/arch-ppc.h000066400000000000000000000012731445305223700143570ustar00rootroot00000000000000#pragma once #ifdef __powerpc64__ #define KERNEL_ADDR 0xc000000000000000UL #define MODULE_ADDR 0xd000000000000000UL #define PAGE_OFFSET 0xc000000000000000UL #define TASK_SIZE (PAGE_OFFSET) #define PAGE_SHIFT 12 #define BITS_PER_LONG 64 #define PTE_RPN_SHIFT (PAGE_SHIFT) #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT) #else /* __powerpc64__ */ #define KERNEL_ADDR 0xc0000000 #define MODULE_ADDR 0xd0000000 #define PAGE_OFFSET 0xc0000000 #define TASK_SIZE (PAGE_OFFSET) #define PAGE_SHIFT 12 #define BITS_PER_LONG 32 #define PTE_RPN_SHIFT (PAGE_SHIFT) #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT) #endif /* __powerpc64__ */ #define SYSCALLS syscalls_ppc include/arch-riscv64.h000066400000000000000000000005671445305223700151020ustar00rootroot00000000000000#pragma once #define PAGE_OFFSET 0xffffffc000000000UL #define TASK_SIZE (1UL << 39) #define MODULE_ADDR (PAGE_OFFSET - 0x04000000) #define KERNEL_ADDR (PAGE_OFFSET + 0x80000) #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 60 #define PTRACE_GETREGS 0 #define PTRACE_GETFPREGS 0 #define PTRACE_SETREGS 0 #define PTRACE_SETFPREGS 0 #define SYSCALLS syscalls_riscv64 include/arch-s390.h000066400000000000000000000010161445305223700142660ustar00rootroot00000000000000#pragma once #ifdef __s390x__ #define KERNEL_ADDR 0UL #define MODULE_ADDR 0x1fffff80000000UL #define TASK_SIZE ~0UL #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 59 #define SYSCALLS syscalls_s390x #else /* __s390x__ */ #define KERNEL_ADDR 0UL #define TASK_SIZE 0x80000000UL #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 26 #define SYSCALLS syscalls_s390 #endif /* __s390x__ */ #define PAGE_OFFSET 0x0UL #define PTRACE_GETREGS 0 #define PTRACE_GETFPREGS 0 #define PTRACE_SETREGS 0 #define PTRACE_SETFPREGS 0 include/arch-sh.h000066400000000000000000000007341445305223700142100ustar00rootroot00000000000000#pragma once #include #if WORD_BIT == 64 #define KERNEL_ADDR 0xfffff80000000000 #define MODULE_ADDR 0xffffffffa0000000L // FIXME: Placeholder #define TASK_SIZE ~0UL #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 29 #else #define KERNEL_ADDR 0xf0000000 #define TASK_SIZE 0xF0000000UL #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 31 #endif #define SYSCALLS syscalls_sh include/arch-sparc.h000066400000000000000000000006131445305223700147020ustar00rootroot00000000000000#pragma once #ifdef __arch64__ #define KERNEL_ADDR 0xfffff80000000000 #define MODULE_ADDR 0xffffffffa0000000L // FIXME: Placeholder #define TASK_SIZE ~0UL #define PAGE_SHIFT 13 #define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) #else #define KERNEL_ADDR 0xf0000000 #define TASK_SIZE 0xF0000000UL #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 24 #endif #define SYSCALLS syscalls_sparc include/arch-syscalls.h000066400000000000000000000016161445305223700154330ustar00rootroot00000000000000#pragma once #ifdef __x86_64__ #include "syscalls-x86_64.h" #include "syscalls-i386.h" #endif #ifdef __i386__ #include "syscalls-i386.h" #endif #ifdef __powerpc__ #include "syscalls-ppc.h" #endif #ifdef __ia64__ #include "syscalls-ia64.h" #endif #ifdef __sparc__ #include "syscalls-sparc.h" #endif #ifdef __s390x__ #include "syscalls-s390x.h" #endif #ifdef __s390__ #include "syscalls-s390.h" #endif #ifdef __arm__ #include "syscalls-arm.h" #endif #ifdef __mips__ #include "syscalls-mips.h" #endif #ifdef __sh__ #include "syscalls-sh.h" #endif #ifdef __alpha__ #include "syscalls-alpha.h" #endif #ifdef __aarch64__ #include "syscalls-aarch64.h" #endif #ifdef __hppa__ #include "syscalls-parisc.h" #endif #ifdef __tile__ #include "syscalls-tile.h" #endif #if defined(__riscv) || defined(__riscv__) #if __riscv_xlen == 64 #include "syscalls-riscv64.h" #else #error "riscv32 is not supported yet." #endif #endif include/arch-tile.h000066400000000000000000000013671445305223700145360ustar00rootroot00000000000000#pragma once #ifdef __tilegx__ #define MAX_VA_WIDTH 42 #define MAX_PA_WIDTH 40 #define PAGE_OFFSET (-(1 << (MAX_VA_WIDTH - 1))) #define KERNEL_HIGH_VADDR 0xfffffff800000000 /* high 32GB */ #define MEM_SV_START (KERNEL_HIGH_VADDR - 0x100000000) /* 256 MB */ #define MEM_MODULE_START (MEM_SV_START + (256*1024*1024)) /* 256 MB */ #define MEM_MODULE_END (MEM_MODULE_START + (256*1024*1024)) #define KERNEL_ADDR MEM_SV_START #define MODULE_ADDR MEM_MODULE_START #define TASK_SIZE_MAX (1 << (MAX_VA_WIDTH - 1)) #define TASK_SIZE TASK_SIZE_MAX #define PAGE_SHIFT 16 #define PTE_FILE_MAX_BITS 32 #define BITS_PER_LONG 64 #endif #define SYSCALLS syscalls_tile include/arch-x86-64.h000066400000000000000000000015551445305223700144540ustar00rootroot00000000000000#pragma once #define X86 1 #define PAGE_OFFSET 0xffff880000000000UL #define KERNEL_ADDR 0xffffffff81000000UL #define MODULE_ADDR 0xffffffffa0000000UL #define VDSO_ADDR 0xffffffffff600000UL #define TASK_SIZE (0x800000000000UL - 4096) #define PAGE_SHIFT 12 #define PTE_FILE_MAX_BITS 32 #define ARCH_IS_BIARCH 1 #define SYSCALLS32 syscalls_i386 #define SYSCALLS64 syscalls_x86_64 #define DO_32_SYSCALL \ __asm__ volatile ( \ "pushq %%rbp\n\t" \ "pushq %%r8\n\t" \ "pushq %%r9\n\t" \ "pushq %%r10\n\t" \ "pushq %%r11\n\t" \ "movq %7, %%rbp\n\t" \ "int $0x80\n\t" \ "popq %%r11\n\t" \ "popq %%r10\n\t" \ "popq %%r9\n\t" \ "popq %%r8\n\t" \ "popq %%rbp\n\t" \ : "=a" (__res) \ : "0" (call),"b" ((long)(a1)),"c" ((long)(a2)),"d" ((long)(a3)), "S" ((long)(a4)),"D" ((long)(a5)), "g" ((long)(a6)) \ : "%rbp" /* mark EBP reg as dirty */ \ ); include/arch.h000066400000000000000000000016721445305223700136020ustar00rootroot00000000000000#pragma once #include "types.h" #ifdef __x86_64__ #include "arch-x86-64.h" #endif #ifdef __i386__ #include "arch-i386.h" #endif #ifdef __powerpc__ #include "arch-ppc.h" #endif #ifdef __ia64__ #include "arch-ia64.h" #endif #ifdef __sparc__ #include "arch-sparc.h" #endif #ifdef __s390__ #include "arch-s390.h" #endif #ifdef __arm__ #include "arch-arm.h" #endif #ifdef __mips__ #include "arch-mips.h" #endif #ifdef __sh__ #include "arch-sh.h" #endif #ifdef __alpha__ #include "arch-alpha.h" #endif #ifdef __aarch64__ #include "arch-aarch64.h" #endif #ifdef __hppa__ #include "arch-parisc.h" #endif #ifdef __tile__ #include "arch-tile.h" #endif #if defined(__riscv) || defined(__riscv__) #if __riscv_xlen == 64 #include "arch-riscv64.h" #else #error "riscv32 is not supported yet." #endif #endif #ifndef SYSCALL_OFFSET #define SYSCALL_OFFSET 0 #endif #define PAGE_MASK (~(page_size - 1)) extern unsigned int page_size; extern bool biarch; include/arg-decoder.h000066400000000000000000000002761445305223700150400ustar00rootroot00000000000000#pragma once #include "syscall.h" void output_rendered_buffer(char *buffer); void output_syscall_prefix(struct syscallrecord *rec); void output_syscall_postfix(struct syscallrecord *rec); include/bdevs.h000066400000000000000000000002261445305223700137620ustar00rootroot00000000000000#ifndef _DEVS_H #define _DEVS_H 1 void process_bdev_param(char *optarg); void init_bdev_list(void); void dump_bdev_list(void); #endif /* _DEVS_H */ include/bpf.h000066400000000000000000000004051445305223700134250ustar00rootroot00000000000000#pragma once int get_rand_bpf_fd(void); #ifndef BPF_MAP_TYPE_LRU_HASH #define BPF_MAP_TYPE_LRU_HASH 9 #define BPF_MAP_TYPE_LRU_PERCPU_HASH 10 #define BPF_MAP_TYPE_LPM_TRIE 11 #endif #ifndef BPF_F_NO_COMMON_LRU #define BPF_F_NO_COMMON_LRU (1U << 1) #endif include/child.h000066400000000000000000000023031445305223700137400ustar00rootroot00000000000000#pragma once #include #include #include #include "objects.h" #include "syscall.h" struct childdata { /* The actual syscall records each child uses. */ struct syscallrecord syscall; /* log file related stuff */ FILE *logfile; bool logdirty; /* ONLY to be read by main. */ FILE *pidstatfile; struct objhead objects[MAX_OBJECT_TYPES]; /* last time the child made progress. */ struct timespec tp; unsigned long op_nr; unsigned int seed; unsigned int num; unsigned char xcpu_count; unsigned char kill_count; bool dontkillme; /* provide temporary protection from the reaper. */ bool dropped_privs; }; extern unsigned int max_children; struct childdata * this_child(void); void clean_childdata(struct childdata *child); void init_child_mappings(void); void child_process(struct childdata *child, int childno); void set_dontkillme(struct childdata *child, bool state); void reap_child(struct childdata *child); /* Childops */ bool random_syscall(struct childdata *child); bool read_all_files(struct childdata *child); bool thrash_pidfiles(struct childdata *child); bool drop_privs(struct childdata *child); bool truncate_testfile(struct childdata *child); include/compat.h000066400000000000000000000662601445305223700141540ustar00rootroot00000000000000#pragma once #include /* bits/eventfd.h */ #ifndef EFD_SEMAPHORE #define EFD_SEMAPHORE 1 #endif #ifndef EFD_CLOEXEC #define EFD_CLOEXEC 02000000 #endif #ifndef EFD_NONBLOCK #define EFD_NONBLOCK 04000 #endif /* fcntl.h */ #ifndef AT_EMPTY_PATH #define AT_EMPTY_PATH 0x1000 #endif #ifndef AT_SYMLINK_NOFOLLOW #define AT_SYMLINK_NOFOLLOW 0x100 #endif #ifndef O_PATH #define O_PATH 010000000 /* Resolve pathname but do not open file. */ #endif #ifndef O_CLOEXEC #define O_CLOEXEC 02000000 #endif #ifndef O_LARGEFILE #define O_LARGEFILE 00100000 #endif #ifndef O_TMPFILE #define O_TMPFILE 020000000 #endif #ifndef AT_NO_AUTOMOUNT #define AT_NO_AUTOMOUNT 0x800 #endif #ifndef F_LINUX_SPECIFIC_BASE #define F_LINUX_SPECIFIC_BASE 1024 #endif #ifndef F_SETPIPE_SZ #define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7) #endif #ifndef F_GETPIPE_SZ #define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) #endif #ifndef F_DUPFD_CLOEXEC #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) #endif #ifndef F_SETOWN_EX #define F_SETOWN_EX 15 #endif #ifndef F_GETOWN_EX #define F_GETOWN_EX 16 #endif #ifndef F_GETOWNER_UIDS #define F_GETOWNER_UIDS 17 #endif #ifndef F_OFD_GETLK #define F_OFD_GETLK 36 #define F_OFD_SETLK 37 #define F_OFD_SETLKW 38 #endif /* Flags for SPLICE and VMSPLICE. */ #ifndef SPLICE_F_MOVE # define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ # define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing */ # define SPLICE_F_MORE 4 /* Expect more data. */ #endif #ifndef SPLICE_F_GIFT # define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ #endif /* linux/hw_breakpoint.h */ enum { HW_BREAKPOINT_LEN_1 = 1, HW_BREAKPOINT_LEN_2 = 2, HW_BREAKPOINT_LEN_4 = 4, HW_BREAKPOINT_LEN_8 = 8, }; enum { HW_BREAKPOINT_EMPTY = 0, HW_BREAKPOINT_R = 1, HW_BREAKPOINT_W = 2, HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W, HW_BREAKPOINT_X = 4, HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X, }; /* asm-generic/mman-common.h */ #ifndef MAP_UNINITIALIZED #define MAP_UNINITIALIZED 0x4000000 #endif #ifndef PROT_SEM #define PROT_SEM 0x8 #endif #ifndef MAP_HUGETLB #define MAP_HUGETLB 0x40000 #endif #ifndef MAP_STACK #define MAP_STACK 0x20000 #endif #ifndef MADV_FREE #define MADV_FREE 8 #endif #ifndef MADV_MERGEABLE #define MADV_MERGEABLE 12 #endif #ifndef MADV_UNMERGEABLE #define MADV_UNMERGEABLE 13 #endif #ifndef MADV_HUGEPAGE #define MADV_HUGEPAGE 14 #endif #ifndef MADV_NOHUGEPAGE #define MADV_NOHUGEPAGE 15 #endif #ifndef MADV_DONTDUMP #define MADV_DONTDUMP 16 #endif #ifndef MADV_DODUMP #define MADV_DODUMP 17 #endif #ifndef MADV_WIPEONFORK #define MADV_WIPEONFORK 18 #endif #ifndef MADV_KEEPONFORK #define MADV_KEEPONFORK 19 #endif #ifndef MADV_COLD #define MADV_COLD 20 /* deactivate these pages */ #endif #ifndef MADV_PAGEOUT #define MADV_PAGEOUT 21 /* reclaim these pages */ #endif /* bits/socket.h */ #ifndef SOCK_CLOEXEC #define SOCK_CLOEXEC 02000000 #endif #ifndef SOCK_NONBLOCK #define SOCK_NONBLOCK 04000 #endif #ifndef PF_RDS #define PF_RDS 21 #endif #ifndef AF_RDS #define AF_RDS PF_RDS #endif #ifndef PF_LLC #define PF_LLC 26 #endif #ifndef AF_LLC #define AF_LLC PF_LLC #endif #ifndef AF_IB #define AF_IB 27 #endif #ifndef PF_IB #define PF_IB AF_IB #endif #ifndef PF_MPLS #define PF_MPLS 28 #endif #ifndef PF_CAN #define PF_CAN 29 #endif #ifndef AF_CAN #define AF_CAN PF_CAN #endif #ifndef PF_TIPC #define PF_TIPC 30 #endif #ifndef AF_TIPC #define AF_TIPC PF_TIPC #endif #ifndef PF_PHONET #define PF_PHONET 35 #endif #ifndef AF_PHONET #define AF_PHONET PF_PHONET #endif #ifndef PF_CAIF #define PF_CAIF 37 #endif #ifndef AF_CAIF #define AF_CAIF PF_CAIF #endif #ifndef PF_ALG #define PF_ALG 38 #endif #ifndef AF_ALG #define AF_ALG PF_ALG #endif #ifndef PF_NFC #define PF_NFC 39 #endif #ifndef AF_NFC #define AF_NFC PF_NFC #endif #ifndef PF_VSOCK #define PF_VSOCK 40 #endif #ifndef AF_VSOCK #define AF_VSOCK PF_VSOCK #endif #ifndef PF_KCM #define PF_KCM 41 #endif #ifndef PF_QIPCRTR #define PF_QIPCRTR 42 #endif #ifndef PF_SMC #define PF_SMC 43 #endif #ifndef PF_XDP #define PF_XDP 44 #endif #ifndef NFC_SOCKPROTO_RAW #define NFC_SOCKPROTO_RAW 0 #endif #ifndef NFC_SOCKPROTO_LLCP #define NFC_SOCKPROTO_LLCP 1 #endif #ifndef MSG_WAITFORONE #define MSG_WAITFORONE 0x10000 #endif #ifndef MSG_BATCH #define MSG_BATCH 0x40000 #endif #ifndef MSG_ZEROCOPY #define MSG_ZEROCOPY 0x4000000 #endif #ifndef MSG_CMSG_CLOEXEC #define MSG_CMSG_CLOEXEC 0x40000000 #endif /* linux/socket.h */ #ifndef MSG_PROBE #define MSG_PROBE 0x10 #endif #ifndef MSG_FASTOPEN #define MSG_FASTOPEN 0x20000000 #endif #ifndef MSG_CMSG_COMPAT #define MSG_CMSG_COMPAT 0x80000000 #endif /* linux/net.h */ #ifndef SYS_RECVMMSG #define SYS_RECVMMSG 19 #endif #ifndef SYS_SENDMMSG #define SYS_SENDMMSG 20 #endif /* linux/netlink.h */ #ifndef NETLINK_CRYPTO #define NETLINK_CRYPTO 21 #endif #ifndef NETLINK_SMC #define NETLINK_SMC 22 #endif #ifndef NETLINK_RX_RING #define NETLINK_RX_RING 6 #define NETLINK_TX_RING 7 #endif #ifndef NETLINK_LISTEN_ALL_NSID #define NETLINK_LISTEN_ALL_NSID 8 #endif #ifndef NETLINK_LIST_MEMBERSHIPS #define NETLINK_LIST_MEMBERSHIPS 9 #endif #ifndef NETLINK_CAP_ACK #define NETLINK_CAP_ACK 10 #endif #ifndef NETLINK_SOCK_DIAG #define NETLINK_SOCK_DIAG 4 #endif #ifndef RTNLGRP_DCB #define RTNLGRP_DCB 23 #endif #ifndef RTNLGRP_IPV4_NETCONF #define RTNLGRP_IPV4_NETCONF 24 #endif #ifndef RTNLGRP_IPV6_NETCONF #define RTNLGRP_IPV6_NETCONF 25 #endif #ifndef RTNLGRP_MDB #define RTNLGRP_MDB 26 #endif #ifndef RTNLGRP_MPLS_ROUTE #define RTNLGRP_MPLS_ROUTE 27 #endif #ifndef RTNLGRP_NSID #define RTNLGRP_NSID 28 #endif #ifndef RTNLGRP_MPLS_NETCONF #define RTNLGRP_MPLS_NETCONF 29 #endif /* linux/prctl.h */ #ifndef PR_MCE_KILL_GET #define PR_MCE_KILL_GET 34 #endif #ifndef PR_SET_MM #define PR_SET_MM 35 #endif #ifndef PR_SET_CHILD_SUBREAPER #define PR_SET_CHILD_SUBREAPER 36 #define PR_GET_CHILD_SUBREAPER 37 #endif #ifndef PR_SET_NO_NEW_PRIVS #define PR_SET_NO_NEW_PRIVS 38 #define PR_GET_NO_NEW_PRIVS 39 #endif #ifndef PR_GET_TID_ADDRESS #define PR_GET_TID_ADDRESS 40 #endif #ifndef PR_SET_THP_DISABLE #define PR_SET_THP_DISABLE 41 #define PR_GET_THP_DISABLE 42 #endif #ifndef PR_MPX_ENABLE_MANAGEMENT #define PR_MPX_ENABLE_MANAGEMENT 43 #define PR_MPX_DISABLE_MANAGEMENT 44 #endif #ifdef __mips__ #ifndef PR_SET_FP_MODE #define PR_SET_FP_MODE 45 #define PR_GET_FP_MODE 46 #endif #endif #ifndef PR_CAP_AMBIENT #define PR_CAP_AMBIENT 47 #endif //TODO wtf were 48,49 ? // arm64 only #ifndef PR_SVE_SET_VL #define PR_SVE_SET_VL 50 #define PR_SVE_GET_VL 51 #endif #ifndef PR_GET_SPECULATION_CTRL #define PR_GET_SPECULATION_CTRL 52 #define PR_SET_SPECULATION_CTRL 53 #endif // arm64 only #ifndef PR_PAC_RESET_KEYS #define PR_PAC_RESET_KEYS 54 #endif /* linux/rds.h */ #ifndef RDS_CANCEL_SENT_TO #define RDS_CANCEL_SENT_TO 1 #define RDS_GET_MR 2 #define RDS_FREE_MR 3 /* deprecated: RDS_BARRIER 4 */ #define RDS_RECVERR 5 #define RDS_CONG_MONITOR 6 #define RDS_GET_MR_FOR_DEST 7 #endif /* asm/ptrace-abi.h */ #ifndef PTRACE_SYSEMU #define PTRACE_SYSEMU 31 #endif #ifndef PTRACE_SYSEMU_SINGLESTEP #define PTRACE_SYSEMU_SINGLESTEP 32 #endif #ifndef PTRACE_GETSIGMASK #define PTRACE_GETSIGMASK 0x420a #define PTRACE_SETSIGMASK 0x420b #endif /* sys/timerfd.h */ #ifndef TFD_CLOEXEC #define TFD_CLOEXEC 02000000 #endif #ifndef TFD_NONBLOCK #define TFD_NONBLOCK 04000 #endif /* linux/keyctl.h */ #ifndef KEYCTL_GET_KEYRING_ID #define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ #define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ #define KEYCTL_UPDATE 2 /* update a key */ #define KEYCTL_REVOKE 3 /* revoke a key */ #define KEYCTL_CHOWN 4 /* set ownership of a key */ #define KEYCTL_SETPERM 5 /* set perms on a key */ #define KEYCTL_DESCRIBE 6 /* describe a key */ #define KEYCTL_CLEAR 7 /* clear contents of a keyring */ #define KEYCTL_LINK 8 /* link a key into a keyring */ #define KEYCTL_UNLINK 9 /* unlink a key from a keyring */ #define KEYCTL_SEARCH 10 /* search for a key in a keyring */ #define KEYCTL_READ 11 /* read a key or keyring's contents */ #define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ #define KEYCTL_NEGATE 13 /* negate a partially constructed key */ #define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ #define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ #define KEYCTL_GET_SECURITY 17 /* get key security label */ #define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ #endif #ifndef KEYCTL_REJECT #define KEYCTL_REJECT 19 /* reject a partially constructed key */ #endif #ifndef KEYCTL_INSTANTIATE_IOV #define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ #endif #ifndef KCMP_TYPES enum kcmp_type { KCMP_FILE, KCMP_VM, KCMP_FILES, KCMP_FS, KCMP_SIGHAND, KCMP_IO, KCMP_SYSVSEM, KCMP_TYPES, }; #endif /* asm/socket.h */ #ifndef SO_BSDCOMPAT #define SO_BSDCOMPAT 14 #endif #ifndef SO_REUSEPORT #define SO_REUSEPORT 15 #endif #ifndef SO_RXQ_OVFL #define SO_RXQ_OVFL 40 #endif #ifndef SO_WIFI_STATUS #define SO_WIFI_STATUS 41 #endif #ifndef SO_PEEK_OFF #define SO_PEEK_OFF 42 #endif #ifndef SO_NOFCS #define SO_NOFCS 43 #endif #ifndef SO_LOCK_FILTER #define SO_LOCK_FILTER 44 #endif #ifndef SO_SELECT_ERR_QUEUE #define SO_SELECT_ERR_QUEUE 45 #endif #ifndef SO_BUSY_POLL #define SO_BUSY_POLL 46 #endif #ifndef SO_MAX_PACING_RATE #define SO_MAX_PACING_RATE 47 #endif #ifndef SO_BPF_EXTENSIONS #define SO_BPF_EXTENSIONS 48 #endif #ifndef SO_INCOMING_CPU #define SO_INCOMING_CPU 49 #endif #ifndef SO_ATTACH_BPF #define SO_ATTACH_BPF 50 #endif #ifndef SO_ATTACH_REUSEPORT_CBPF #define SO_ATTACH_REUSEPORT_CBPF 51 #define SO_ATTACH_REUSEPORT_EBPF 52 #endif #ifndef SO_CNX_ADVICE #define SO_CNX_ADVICE 53 #endif #ifndef SCM_TIMESTAMPING_OPT_STATS #define SCM_TIMESTAMPING_OPT_STATS 54 #endif #ifndef SO_MEMINFO #define SO_MEMINFO 55 #endif #ifndef SO_INCOMING_NAPI_ID #define SO_INCOMING_NAPI_ID 56 #endif #ifndef SO_COOKIE #define SO_COOKIE 57 #endif #ifndef SCM_TIMESTAMPING_PKTINFO #define SCM_TIMESTAMPING_PKTINFO 58 #endif #ifndef SO_PEERGROUPS #define SO_PEERGROUPS 59 #endif #ifndef SO_ZEROCOPY #define SO_ZEROCOPY 60 #endif #ifndef SO_TXTIME #define SO_TXTIME 61 #endif #ifndef SO_BINDTOIFINDEX #define SO_BINDTOIFINDEX 62 #endif #ifndef SO_TIMESTAMP_NEW #define SO_TIMESTAMP_NEW 63 #endif #ifndef SO_TIMESTAMPNS_NEW #define SO_TIMESTAMPNS_NEW 64 #endif #ifndef SO_TIMESTAMPING_NEW #define SO_TIMESTAMPING_NEW 65 #endif #ifndef SO_RCVTIMEO_NEW #define SO_RCVTIMEO_NEW 66 #endif #ifndef SO_SNDTIMEO_NEW #define SO_SNDTIMEO_NEW 67 #endif #ifndef SO_DETACH_REUSEPORT_BPF #define SO_DETACH_REUSEPORT_BPF 68 #endif #ifndef SO_PREFER_BUSY_POLL #define SO_PREFER_BUSY_POLL 69 #endif #ifndef SO_BUSY_POLL_BUDGET #define SO_BUSY_POLL_BUDGET 70 #endif #ifndef SO_NETNS_COOKIE #define SO_NETNS_COOKIE 71 #endif #ifndef SO_BUF_LOCK #define SO_BUF_LOCK 72 #endif /* linux/tcp.h */ #ifndef TCP_COOKIE_TRANSACTIONS #define TCP_COOKIE_TRANSACTIONS 15 #endif #ifndef TCP_THIN_LINEAR_TIMEOUTS #define TCP_THIN_LINEAR_TIMEOUTS 16 #endif #ifndef TCP_THIN_DUPACK #define TCP_THIN_DUPACK 17 #endif #ifndef TCP_USER_TIMEOUT #define TCP_USER_TIMEOUT 18 #endif #ifndef TCP_REPAIR #define TCP_REPAIR 19 #endif #ifndef TCP_REPAIR_QUEUE #define TCP_REPAIR_QUEUE 20 #endif #ifndef TCP_QUEUE_SEQ #define TCP_QUEUE_SEQ 21 #endif #ifndef TCP_REPAIR_OPTIONS #define TCP_REPAIR_OPTIONS 22 #endif #ifndef TCP_FASTOPEN #define TCP_FASTOPEN 23 #endif #ifndef TCP_TIMESTAMP #define TCP_TIMESTAMP 24 #endif #ifndef TCP_NOTSENT_LOWAT #define TCP_NOTSENT_LOWAT 25 #endif #ifndef TCP_CC_INFO #define TCP_CC_INFO 26 #endif #ifndef TCP_SAVE_SYN #define TCP_SAVE_SYN 27 #define TCP_SAVED_SYN 28 #endif #ifndef TCP_REPAIR_WINDOW #define TCP_REPAIR_WINDOW 29 #endif #ifndef TCP_FASTOPEN_CONNECT #define TCP_FASTOPEN_CONNECT 30 #endif #ifndef TCP_ULP #define TCP_ULP 31 #endif #ifndef TCP_MD5SIG_EXT #define TCP_MD5SIG_EXT 32 #endif #ifndef TCP_FASTOPEN_KEY #define TCP_FASTOPEN_KEY 33 /* Set the key for Fast Open (cookie) */ #endif #ifndef TCP_FASTOPEN_NO_COOKIE #define TCP_FASTOPEN_NO_COOKIE 34 /* Enable TFO without a TFO cookie */ #endif #ifndef TCP_ZEROCOPY_RECEIVE #define TCP_ZEROCOPY_RECEIVE 35 #endif #ifndef TCP_INQ #define TCP_INQ 36 /* Notify bytes available to read as a cmsg on read */ #endif #ifndef TCP_TX_DELAY #define TCP_TX_DELAY 37 #endif /* linux/if_packet.h */ #ifndef PACKET_VNET_HDR #define PACKET_VNET_HDR 15 #endif #ifndef PACKET_TX_TIMESTAMP #define PACKET_TX_TIMESTAMP 16 #endif #ifndef PACKET_TIMESTAMP #define PACKET_TIMESTAMP 17 #endif #ifndef PACKET_FANOUT #define PACKET_FANOUT 18 #endif /* linux/dccp.h */ #ifndef DCCP_SOCKOPT_QPOLICY_ID #define DCCP_SOCKOPT_QPOLICY_ID 16 #endif #ifndef DCCP_SOCKOPT_QPOLICY_TXQLEN #define DCCP_SOCKOPT_QPOLICY_TXQLEN 17 #endif /* net/udplite.h */ #ifndef UDPLITE_SEND_CSCOV #define UDPLITE_SEND_CSCOV 10 /* sender partial coverage (as sent) */ #endif #ifndef UDPLITE_RECV_CSCOV #define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */ #endif /* linux/in.h */ #ifndef IP_MTU #define IP_MTU 14 #endif #ifndef IP_FREEBIND #define IP_FREEBIND 15 #endif #ifndef IP_IPSEC_POLICY #define IP_IPSEC_POLICY 16 #endif #ifndef IP_XFRM_POLICY #define IP_XFRM_POLICY 17 #endif #ifndef IP_PASSSEC #define IP_PASSSEC 18 #endif #ifndef IP_TRANSPARENT #define IP_TRANSPARENT 19 #endif #ifndef IP_MINTTL #define IP_MINTTL 21 #endif #ifndef IP_ORIGDSTADDR #define IP_ORIGDSTADDR 20 #endif #ifndef IP_RECVORIGDSTADDR #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR #endif #ifndef IP_NODEFRAG #define IP_NODEFRAG 22 #endif #ifndef IP_CHECKSUM #define IP_CHECKSUM 23 #endif #ifndef IP_BIND_ADDRESS_NO_PORT #define IP_BIND_ADDRESS_NO_PORT 24 #endif #ifndef IP_RECVFRAGSIZE #define IP_RECVFRAGSIZE 25 #endif #ifndef IP_MULTICAST_ALL #define IP_MULTICAST_ALL 49 #endif #ifndef IP_UNICAST_IF #define IP_UNICAST_IF 50 #endif #ifndef IPPROTO_BEETPH #define IPPROTO_BEETPH 94 #endif #ifndef IPPROTO_MPLS #define IPPROTO_MPLS 137 #endif /* linux/in6.h */ #ifndef IPV6_FLOWINFO #define IPV6_FLOWINFO 11 #endif #ifndef IPV6_FLOWLABEL_MGR #define IPV6_FLOWLABEL_MGR 32 #define IPV6_FLOWINFO_SEND 33 #endif #ifndef IPV6_RECVPATHMTU #define IPV6_RECVPATHMTU 60 #define IPV6_PATHMTU 61 #define IPV6_DONTFRAG 62 #endif #ifndef IP6T_SO_GET_REVISION_MATCH #define IP6T_SO_GET_REVISION_MATCH 68 #define IP6T_SO_GET_REVISION_TARGET 69 #define IP6T_SO_ORIGINAL_DST 80 #endif #ifndef IPV6_AUTOFLOWLABEL #define IPV6_AUTOFLOWLABEL 70 #define IPV6_ADDR_PREFERENCES 72 #endif #ifndef IPV6_MINHOPCOUNT #define IPV6_MINHOPCOUNT 73 #define IPV6_ORIGDSTADDR 74 #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR #define IPV6_TRANSPARENT 75 #define IPV6_UNICAST_IF 76 #endif #ifndef IPV6_RECVFRAGSIZE #define IPV6_RECVFRAGSIZE 77 #endif /* netfilter/ipset/ipset.h */ #ifndef SO_IP_SET #define SO_IP_SET 83 #endif #ifndef IPV6_HDRINCL #define IPV6_HDRINCL 36 #endif /* asm/resource.h */ #ifndef RLIMIT_RTTIME #define RLIMIT_RTTIME 15 #endif /* sctp/user.h */ #ifndef SCTP_RTOINFO #define SCTP_RTOINFO 0 #define SCTP_ASSOCINFO 1 #define SCTP_INITMSG 2 #define SCTP_NODELAY 3 /* Get/set nodelay option. */ #define SCTP_AUTOCLOSE 4 #define SCTP_SET_PEER_PRIMARY_ADDR 5 #define SCTP_PRIMARY_ADDR 6 #define SCTP_ADAPTATION_LAYER 7 #define SCTP_DISABLE_FRAGMENTS 8 #define SCTP_PEER_ADDR_PARAMS 9 #define SCTP_DEFAULT_SEND_PARAM 10 #define SCTP_EVENTS 11 #define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ #define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ #define SCTP_STATUS 14 #define SCTP_GET_PEER_ADDR_INFO 15 #define SCTP_DELAYED_ACK_TIME 16 #define SCTP_CONTEXT 17 #define SCTP_FRAGMENT_INTERLEAVE 18 #define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ #define SCTP_MAX_BURST 20 /* Set/Get max burst */ #define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ #define SCTP_HMAC_IDENT 22 #define SCTP_AUTH_KEY 23 #define SCTP_AUTH_ACTIVE_KEY 24 #define SCTP_AUTH_DELETE_KEY 25 #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ #define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ #define SCTP_AUTO_ASCONF 30 #define SCTP_PEER_ADDR_THLDS 31 #endif #ifndef SCTP_SOCKOPT_BINDX_ADD #define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ #define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ #define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ #define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ #define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */ #define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ #define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ #define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ #define SCTP_GET_ASSOC_STATS 112 /* Read only */ #endif /* linux/rxrpc.h */ #ifndef RXRPC_USER_CALL_ID #define RXRPC_USER_CALL_ID 1 /* user call ID specifier */ #define RXRPC_ABORT 2 /* abort request / notification [terminal] */ #define RXRPC_ACK 3 /* [Server] RPC op final ACK received [terminal] */ #define RXRPC_NET_ERROR 5 /* network error received [terminal] */ #define RXRPC_BUSY 6 /* server busy received [terminal] */ #define RXRPC_LOCAL_ERROR 7 /* local error generated [terminal] */ #define RXRPC_NEW_CALL 8 /* [Server] new incoming call notification */ #define RXRPC_ACCEPT 9 /* [Server] accept request */ #endif /* net/bluetooth/bluetooth.h */ #ifndef BT_SECURITY #define BT_SECURITY 4 #define BT_DEFER_SETUP 7 #define BT_FLUSHABLE 8 #define BT_POWER 9 #define BT_CHANNEL_POLICY 10 #define SOL_HCI 0 #define SOL_L2CAP 6 #define SOL_SCO 17 #define SOL_RFCOMM 18 #endif #ifndef SOL_TLS #define SOL_TLS 282 #endif /* net/bluetooth/hci.h */ #ifndef HCI_DATA_DIR #define HCI_DATA_DIR 1 #define HCI_FILTER 2 #define HCI_TIME_STAMP 3 #endif /* net/bluetooth/l2cap.h */ #ifndef L2CAP_OPTIONS #define L2CAP_OPTIONS 0x01 #define L2CAP_LM 0x03 #endif /* net/bluetooth/rfcomm.h */ #ifndef RFCOMM_LM #define RFCOMM_LM 0x03 #endif /* net/iucv/af_iucv.h */ #ifndef SO_IPRMDATA_MSG #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ #define SO_MSGSIZE 0x0800 /* get maximum msgsize */ #endif /* linux/nfc.h */ #ifndef sockaddr_nfc #include struct sockaddr_nfc { sa_family_t sa_family; __u32 dev_idx; __u32 target_idx; __u32 nfc_protocol; }; #endif /* linux/inotify.h */ #ifndef IN_EXCL_UNLINK #define IN_EXCL_UNLINK 0x04000000 /* exclude events on unlinked objects */ #endif #ifndef MSG_COPY #define MSG_COPY 040000 #endif #ifndef MS_SNAP_STABLE #define MS_SNAP_STABLE (1<<27) #endif #ifndef MS_NOSEC #define MS_NOSEC (1<<28) #endif #ifndef MS_BORN #define MS_BORN (1<<29) #endif /* linux/kvm.h */ #ifndef KVM_GET_REG_LIST struct kvm_reg_list { __u64 n; /* number of regs */ __u64 reg[0]; }; #define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list) #endif #ifndef KVM_S390_UCAS_MAP struct kvm_s390_ucas_mapping { __u64 user_addr; __u64 vcpu_addr; __u64 length; }; #define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping) #endif #ifndef KVM_S390_UCAS_UNMAP #define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping) #endif #ifndef KVM_S390_VCPU_FAULT #define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long) #endif #ifndef KVM_XEN_HVM_CONFIG struct kvm_xen_hvm_config { __u32 flags; __u32 msr; __u64 blob_addr_32; __u64 blob_addr_64; __u8 blob_size_32; __u8 blob_size_64; __u8 pad2[30]; }; #define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config) #endif #ifndef KVM_PPC_GET_PVINFO struct kvm_ppc_pvinfo { /* out */ __u32 flags; __u32 hcall[4]; __u8 pad[108]; }; #define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo) #endif #ifndef KVM_SET_TSC_KHZ #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) #endif #ifndef KVM_GET_TSC_KHZ #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) #endif #ifndef KVM_ASSIGN_SET_INTX_MASK #define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, struct kvm_assigned_pci_dev) #endif #ifndef KVM_GET_DEBUGREGS struct kvm_debugregs { __u64 db[4]; __u64 dr6; __u64 dr7; __u64 flags; __u64 reserved[9]; }; #define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) #define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) #endif #ifndef KVM_ENABLE_CAP struct kvm_enable_cap { /* in */ __u32 cap; __u32 flags; __u64 args[4]; __u8 pad[64]; }; #define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) #endif #ifndef KVM_GET_XSAVE struct kvm_xsave { __u32 region[1024]; }; #define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave) #define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave) #endif #ifndef KVM_GET_XCRS #define KVM_MAX_XCRS 16 struct kvm_xcr { __u32 xcr; __u32 reserved; __u64 value; }; struct kvm_xcrs { __u32 nr_xcrs; __u32 flags; struct kvm_xcr xcrs[KVM_MAX_XCRS]; __u64 padding[16]; }; #define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs) #define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs) #endif #ifndef KVM_SIGNAL_MSI struct kvm_msi { __u32 address_lo; __u32 address_hi; __u32 data; __u32 flags; __u8 pad[16]; }; #define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi) #endif #ifndef KVM_DIRTY_TLB struct kvm_dirty_tlb { __u64 bitmap; __u32 num_dirty; }; #define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb) #endif #ifndef KVM_GET_ONE_REG struct kvm_one_reg { __u64 id; __u64 addr; }; #define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg) #endif #ifndef KVM_SET_ONE_REG #define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg) #endif #ifndef KVM_KVMCLOCK_CTRL #define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad) #endif #ifndef KVM_PPC_GET_SMMU_INFO #define KVM_PPC_PAGE_SIZES_MAX_SZ 8 struct kvm_ppc_one_page_size { __u32 page_shift; /* Page shift (or 0) */ __u32 pte_enc; /* Encoding in the HPTE (>>12) */ }; struct kvm_ppc_one_seg_page_size { __u32 page_shift; /* Base page shift of segment (or 0) */ __u32 slb_enc; /* SLB encoding for BookS */ struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ]; }; struct kvm_ppc_smmu_info { __u64 flags; __u32 slb_size; __u32 pad; struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ]; }; #define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info) #endif #ifndef KVM_PPC_ALLOCATE_HTAB #define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) #endif #ifndef KVM_PPC_GET_HTAB_FD struct kvm_get_htab_fd { __u64 flags; __u64 start_index; __u64 reserved[2]; }; #define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd) #endif #ifndef EM_ARM #define EM_ARM 40 #endif /* linux/mroute.h */ #ifndef MRT_TABLE #define MRT_TABLE (MRT_BASE+9) #endif #ifndef MRT_ADD_MFC_PROXY #define MRT_ADD_MFC_PROXY (MRT_BASE+10) #endif #ifndef MRT_DEL_MFC_PROXY #define MRT_DEL_MFC_PROXY (MRT_BASE+11) #endif /* sys/mount.h */ #ifndef MNT_DETACH #define MNT_DETACH 2 #endif #ifndef MNT_EXPIRE #define MNT_EXPIRE 4 #endif #ifndef UMOUNT_NOFOLLOW #define UMOUNT_NOFOLLOW 8 #endif /* if_ether.h */ #ifndef ETH_P_CANFD #define ETH_P_CANFD 0x000D #endif #ifndef ETH_P_CAIF #define ETH_P_CAIF 0x00F7 #endif #ifndef ETH_P_802_3_MIN #define ETH_P_802_3_MIN 0x0600 #endif #ifndef ETH_P_BATMAN #define ETH_P_BATMAN 0x4305 #endif #ifndef ETH_P_LINK_CTL #define ETH_P_LINK_CTL 0x886c #endif #ifndef ETH_P_8021AD #define ETH_P_8021AD 0x88A8 #endif #ifndef ETH_P_802_EX1 #define ETH_P_802_EX1 0x88B5 #endif #ifndef ETH_P_8021AH #define ETH_P_8021AH 0x88E7 #endif #ifndef ETH_P_MVRP #define ETH_P_MVRP 0x88F5 #endif #ifndef ETH_P_PRP #define ETH_P_PRP 0x88FB #endif #ifndef ETH_P_TDLS #define ETH_P_TDLS 0x890D #endif #ifndef ETH_P_QINQ1 #define ETH_P_QINQ1 0x9100 #endif #ifndef ETH_P_QINQ2 #define ETH_P_QINQ2 0x9200 #endif #ifndef ETH_P_QINQ3 #define ETH_P_QINQ3 0x9300 #endif #ifndef ETH_P_AF_IUCV #define ETH_P_AF_IUCV 0xFBFB #endif /* sched.h */ #ifndef SCHED_DEADLINE #define SCHED_DEADLINE 6 #endif #ifndef SCHED_IDLE #define SCHED_IDLE 5 #endif /* sys/swap.h */ #ifndef SWAP_FLAG_DISCARD #define SWAP_FLAG_DISCARD 0x10000 #endif /* linux/fs.h */ #ifndef SEEK_DATA #define SEEK_DATA 3 #endif #ifndef SEEK_HOLE #define SEEK_HOLE 4 #endif #ifndef RWF_HIPRI #define RWF_HIPRI 0x00000001 /* high priority request, poll if possible */ #endif #ifndef RWF_DSYNC #define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC */ #define RWF_SYNC 0x00000004 /* per-IO O_SYNC */ #endif /* sys/epoll.h */ #ifndef EPOLLWAKEUP #define EPOLLWAKEUP (1u << 29) #endif /* time.h */ #ifndef CLOCK_MONOTONIC_RAW #define CLOCK_MONOTONIC_RAW 4 #endif #ifndef CLOCK_BOOTTIME #define CLOCK_BOOTTIME 7 #endif /* asm-generic/poll.h */ #ifndef POLLFREE #define POLLFREE 0x4000 #endif #ifndef POLL_BUSY_LOOP #define POLL_BUSY_LOOP 0x8000 #endif /* asm/mman.h */ #ifndef MLOCK_ONFAULT #define MLOCK_ONFAULT 0x01 #endif #ifndef MREMAP_DONTUNMAP #define MREMAP_DONTUNMAP 4 #endif /* linux/nvme_ioctl.h */ #ifndef NVME_IOCTL_RESET #define NVME_IOCTL_RESET _IO('N', 0x44) #endif /* linux/shm.h */ #ifndef SHM_HUGE_SHIFT #define SHM_HUGE_SHIFT 26 #endif #ifndef SHM_HUGE_2MB #define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT) #define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT) #endif /* bits/shm.h */ #ifndef SHM_NORESERVE # define SHM_NORESERVE 010000 #endif /* linux/auto_fs4.h */ #ifndef AUTOFS_IOC_EXPIRE_INDIRECT #define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI #endif #ifndef AUTOFS_IOC_EXPIRE_DIRECT #define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI #endif /* linux/mount.h */ #ifndef MOVE_MOUNT_F_SYMLINKS #define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */ #define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */ #define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */ #define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */ #define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */ #define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */ #endif include/debug.h000066400000000000000000000010121445305223700137370ustar00rootroot00000000000000#pragma once #include "child.h" #include "syscall.h" #include "utils.h" void show_backtrace(void); extern void __BUG(const char *bugtxt, const char *filename, const char *funcname, unsigned int lineno); #define BUG(bugtxt) { \ __BUG(bugtxt, __FILE__, __func__, __LINE__); \ unreachable(); \ } #define BUG_ON(condition) do { if ((condition)) BUG(__stringify(condition)); } while (0) void dump_childdata(struct childdata *child); void dump_syscallrec(struct syscallrecord *rec); void syslogf(const char *fmt, ...); include/domains.h000066400000000000000000000003661445305223700143160ustar00rootroot00000000000000#pragma once extern const char * get_domain_name(unsigned int domain); extern void find_specific_domain(const char *domainarg); extern void parse_exclude_domains(const char *arg); extern unsigned int find_next_enabled_domain(unsigned int from); include/exit.h000066400000000000000000000022371445305223700136340ustar00rootroot00000000000000#pragma once extern unsigned char exit_reason; enum exit_reasons { STILL_RUNNING = 0, EXIT_NO_SYSCALLS_ENABLED = 1, EXIT_REACHED_COUNT = 2, EXIT_NO_FDS = 3, EXIT_LOST_CHILD = 4, EXIT_PID_OUT_OF_RANGE = 5, EXIT_SIGINT = 6, EXIT_KERNEL_TAINTED = 7, EXIT_SHM_CORRUPTION = 8, EXIT_REPARENT_PROBLEM = 9, EXIT_NO_FILES = 10, EXIT_MAIN_DISAPPEARED = 11, EXIT_UID_CHANGED = 12, EXIT_FD_INIT_FAILURE = 13, EXIT_FORK_FAILURE = 14, EXIT_LOCKING_CATASTROPHE = 15, EXIT_LOGFILE_OPEN_ERROR = 16, NUM_EXIT_REASONS = 17 }; static const char *reasons[NUM_EXIT_REASONS] = { "Still running.", "No more syscalls enabled.", "Completed maximum number of operations.", "No file descriptors open.", "Lost track of a child.", "shm corruption - Found a pid out of range.", "ctrl-c", "kernel became tainted.", "SHM was corrupted!", "Child reparenting problem", "No files in file list.", "Main process disappeared.", "UID changed.", "Something happened during fd init.", "fork() failure", "some kind of locking catastrophe", "error while opening logfiles", }; static inline const char * decode_exit(enum exit_reasons reason) { return reasons[reason]; } include/fanotify.h000066400000000000000000000004631445305223700145010ustar00rootroot00000000000000#pragma once unsigned long get_fanotify_init_flags(void); unsigned long get_fanotify_init_event_flags(void); // FIXME: Keep all this here until glibc supports it. #ifndef SYS_fanotify_init #ifdef __x86_64__ #define SYS_fanotify_init 300 #endif #ifdef __i386__ #define SYS_fanotify_init 338 #endif #endif include/fd.h000066400000000000000000000012771445305223700132570ustar00rootroot00000000000000#pragma once #include "child.h" #include "list.h" #include "syscall.h" #include "types.h" void setup_fd_providers(void); unsigned int open_fds(void); void process_fds_param(char *optarg, bool enable); struct fd_provider { struct list_head list; const char *name; int (*open)(void); int (*get)(void); bool enabled; bool initialized; }; void register_fd_provider(const struct fd_provider *prov); unsigned int check_if_fd(struct childdata *child, struct syscallrecord *rec); int get_random_fd(void); int get_new_random_fd(void); #define REG_FD_PROV(_struct) \ static void __attribute__((constructor)) register_##_struct(void) { \ register_fd_provider(&_struct); \ } include/files.h000066400000000000000000000003111445305223700137540ustar00rootroot00000000000000#pragma once #include #include "fd.h" unsigned long get_o_flags(void); void parse_devices(void); const char *map_dev(dev_t, mode_t); int open_with_fopen(const char *filename, int flags); include/ftrace.h000066400000000000000000000001431445305223700141210ustar00rootroot00000000000000#pragma once void setup_ftrace(void); void stop_ftrace(void); extern const char *ftracedumpname; include/futex.h000066400000000000000000000003351445305223700140130ustar00rootroot00000000000000#pragma once #include #include #include "types.h" struct __lock { uint32_t futex; pid_t owner_pid; }; void create_futexes(void); u32 * get_futex(void); struct __lock * get_random_lock(void); include/ioctls.h000066400000000000000000000026531445305223700141620ustar00rootroot00000000000000#pragma once #include #include #include "syscall.h" struct ioctl { const char *name; unsigned int request; }; #define DEV_CHAR 1 #define DEV_BLOCK 2 #define DEV_MISC 3 struct ioctl_group { /* optional user visible string that describes this group of ioctl * operations. */ const char *name; /* Non-NULL sanitise routine for this ioctl group. Initialize to * "pick_random_ioctl" to pick one random ioctl. */ void (*sanitise)(const struct ioctl_group *, struct syscallrecord *rec); /* Plug the available ioctls here. */ const struct ioctl *ioctls; size_t ioctls_cnt; /* One of the DEV_* constants. */ int devtype; /* List the device names from /proc/devices or /proc/misc that these * ioctl operations are valid for. */ const char *const *devs; size_t devs_cnt; /* Optional routine that should return 0 if the file descriptor is * valid for this group. */ int (*fd_test)(int fd, const struct stat *); }; void register_ioctl_group(const struct ioctl_group *); const struct ioctl_group *find_ioctl_group(int fd); const struct ioctl_group *get_random_ioctl_group(void); void pick_random_ioctl(const struct ioctl_group *, struct syscallrecord *rec); void dump_ioctls(void); #define IOCTL(_request) \ { .request = _request, .name = #_request, } #define REG_IOCTL_GROUP(_struct) \ static void __attribute__((constructor)) register_##_struct(void) { \ register_ioctl_group(&_struct); \ } include/kcov.h000066400000000000000000000004711445305223700136230ustar00rootroot00000000000000#pragma once #include #define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) #define KCOV_ENABLE _IO('c', 100) #define KCOV_DISABLE _IO('c', 101) #define COVER_SIZE (64<<10) void init_kcov(void); void enable_kcov(void); void dump_kcov_buffer(void); void disable_kcov(void); void shutdown_kcov(void); include/list.h000066400000000000000000000040731445305223700136360ustar00rootroot00000000000000#pragma once #include #include "types.h" /* * Simple linked-list routines, based on functions of the same name from the Linux kernel. */ struct list_head { struct list_head *next, *prev; }; static inline void INIT_LIST_HEAD(struct list_head *list) { list->next = list; list->prev = list; } static inline bool list_empty(const struct list_head *head) { return head->next == head; } static inline void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next) { next->prev = new; new->next = next; new->prev = prev; prev->next = new; } static inline void list_add(struct list_head *new, struct list_head *head) { __list_add(new, head, head->next); } static inline void list_add_tail(struct list_head *new, struct list_head *head) { __list_add(new, head->prev, head); } static inline void __list_del(struct list_head * prev, struct list_head * next) { next->prev = prev; prev->next = next; } static inline void list_del(struct list_head *entry) { __list_del(entry->prev, entry->next); entry->next = entry->prev = NULL; } static inline void __list_del_entry(struct list_head *entry) { __list_del(entry->prev, entry->next); } /** * list_move - delete from one list and add as another's head * @list: the entry to move * @head: the head that will precede our entry */ static inline void list_move(struct list_head *list, struct list_head *head) { __list_del_entry(list); list_add(list, head); } #define list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /** * list_for_each_safe - iterate over a list safe against removal of list entry * @pos: the &struct list_head to use as a loop cursor. * @n: another &struct list_head to use as temporary storage * @head: the head for your list. */ #define list_for_each_safe(pos, n, head) \ for (pos = (head)->next, n = pos->next; pos != (head); \ pos = n, n = pos->next) include/locks.h000066400000000000000000000005511445305223700137730ustar00rootroot00000000000000#pragma once #include #include "types.h" struct lock_struct { volatile unsigned char lock; pid_t owner; }; typedef struct lock_struct lock_t; #define UNLOCKED 0 #define LOCKING 1 #define LOCKED 2 bool trylock(lock_t *_lock); void lock(lock_t *_lock); void unlock(lock_t *_lock); bool check_all_locks(void); void bust_lock(lock_t *_lock); include/log.h000066400000000000000000000004201445305223700134340ustar00rootroot00000000000000#pragma once #include "child.h" #include "logfile.h" void init_logging(void); void shutdown_logging(void); enum { LOGGING_DISABLED, LOGGING_FILES, }; void init_child_logging(struct childdata *child); void shutdown_child_logging(struct childdata *child); include/logfile.h000066400000000000000000000003471445305223700143040ustar00rootroot00000000000000#pragma once #include "child.h" FILE *find_logfile_handle(void); void synclogs(void); extern FILE *mainlogfile; void open_main_logfile(void); void close_logfile(FILE **handle); void open_child_logfile(struct childdata *child); include/maps.h000066400000000000000000000017741445305223700136300ustar00rootroot00000000000000#pragma once #include #include "types.h" #include "list.h" #include "object-types.h" #define INITIAL_ANON 1 #define CHILD_ANON 2 #define MMAPED_FILE 3 #define MAPS_NAME_MAX_LEN PATH_MAX struct map { void *ptr; char *name; unsigned long size; int prot; unsigned char type; }; extern unsigned int num_initial_mappings; extern struct map *initial_mappings; #define NR_MAPPING_SIZES 6 extern unsigned long mapping_sizes[NR_MAPPING_SIZES]; struct object; void map_destructor(struct object *obj); void map_dump(struct object *obj, bool global); void setup_initial_mappings(void); struct map * get_map(void); struct map * common_set_mmap_ptr_len(void); void dirty_mapping(struct map *map); void dirty_random_mapping(void); struct faultfn { void (*func)(struct map *map); }; void random_map_readfn(struct map *map); void random_map_writefn(struct map *map); unsigned long get_rand_mmap_flags(void); void mmap_fd(int fd, const char *name, size_t len, int prot, bool global, enum objecttype type); include/memfd.h000066400000000000000000000007011445305223700137450ustar00rootroot00000000000000#pragma once #ifndef MFD_CLOEXEC #define MFD_CLOEXEC 0x0001U #define MFD_ALLOW_SEALING 0x0002U #define MFD_HUGETLB 0x0004U #endif // FIXME: Keep all this here until glibc supports it. #ifndef SYS_memfd_create #ifdef __x86_64__ #define SYS_memfd_create 319 #endif #ifdef __i386__ #define SYS_memfd_create 356 #endif #ifdef __sparc__ #define SYS_memfd_create 348 #endif #ifdef __ia64__ #define SYS_memfd_create 1340 #endif #endif include/net.h000066400000000000000000000073301445305223700134500ustar00rootroot00000000000000#pragma once #include #include #include #include "fd.h" #include "syscall.h" #include "socketinfo.h" extern unsigned int nr_sockets; /* protocol decoding */ extern unsigned int specific_domain; /* glibc headers might be older than the kernel, so chances are we know * about more protocols than glibc does. So we define our own PF_MAX */ #define TRINITY_PF_MAX 45 #define PF_NOHINT (-1) struct sock_option { const unsigned int name; const unsigned int len; }; struct sockopt { unsigned int level; unsigned long optname; unsigned long optval; unsigned long optlen; }; struct netproto { const char *name; struct socket_triplet *valid_triplets; struct socket_triplet *valid_privileged_triplets; void (*socket_setup)(int fd); void (*setsockopt)(struct sockopt *so, struct socket_triplet *triplet); void (*gen_sockaddr)(struct sockaddr **addr, socklen_t *addrlen); void (*gen_packet)(struct socket_triplet *st, void **ptr, size_t *len); unsigned int nr_triplets; unsigned int nr_privileged_triplets; }; struct protoptr { const struct netproto *proto; }; extern const struct protoptr net_protocols[TRINITY_PF_MAX]; struct socketinfo * get_rand_socketinfo(void); int fd_from_socketinfo(struct socketinfo *si); void generate_sockaddr(struct sockaddr **addr, socklen_t *addrlen, int pf); unsigned int sockoptlen(unsigned int len); void do_setsockopt(struct sockopt *so, struct socket_triplet *triplet); void rand_proto_type(struct socket_triplet *st); int sanitise_socket_triplet(struct socket_triplet *st); void gen_socket_args(struct socket_triplet *st); /* Ethernet */ int get_random_ether_type(void); /* ipv4 */ in_addr_t random_ipv4_address(void); extern const struct netproto proto_ipv4; extern const struct netproto proto_inet6; extern const struct netproto proto_pppol2tp; extern const struct netproto proto_unix; extern const struct netproto proto_caif; extern const struct netproto proto_alg; extern const struct netproto proto_nfc; extern const struct netproto proto_ax25; extern const struct netproto proto_ipx; extern const struct netproto proto_appletalk; extern const struct netproto proto_atmpvc; extern const struct netproto proto_atmsvc; extern const struct netproto proto_x25; extern const struct netproto proto_rose; extern const struct netproto proto_llc; extern const struct netproto proto_netlink; extern const struct netproto proto_packet; extern const struct netproto proto_econet; extern const struct netproto proto_irda; extern const struct netproto proto_can; extern const struct netproto proto_tipc; extern const struct netproto proto_phonet; extern const struct netproto proto_rds; extern const struct netproto proto_bluetooth; extern const struct netproto proto_netrom; extern const struct netproto proto_netbeui; extern const struct netproto proto_iucv; extern const struct netproto proto_rxrpc; extern const struct netproto proto_phonet; extern const struct netproto proto_kcm; extern const struct netproto proto_qipcrtr; extern const struct netproto proto_smc; extern const struct netproto proto_xdp; /* bpf */ void bpf_gen_filter(unsigned long **addr, unsigned long *addrlen); void bpf_gen_seccomp(unsigned long **addr, unsigned long *addrlen); /* ip setsockopt functions */ void tcp_setsockopt(struct sockopt *so, struct socket_triplet *triplet); void udp_setsockopt(struct sockopt *so, struct socket_triplet *triplet); void udplite_setsockopt(struct sockopt *so, struct socket_triplet *triplet); void icmpv6_setsockopt(struct sockopt *so, struct socket_triplet *triplet); void sctp_setsockopt(struct sockopt *so, struct socket_triplet *triplet); void raw_setsockopt(struct sockopt *so, struct socket_triplet *triplet); void dccp_setsockopt(struct sockopt *so, struct socket_triplet *triplet); include/object-types.h000066400000000000000000000005711445305223700152720ustar00rootroot00000000000000#pragma once enum objecttype { OBJ_MMAP_ANON, OBJ_MMAP_FILE, OBJ_MMAP_TESTFILE, OBJ_FD_PIPE, OBJ_FD_FILE, OBJ_FD_PERF, OBJ_FD_EPOLL, OBJ_FD_EVENTFD, OBJ_FD_TIMERFD, OBJ_FD_TESTFILE, OBJ_FD_MEMFD, OBJ_FD_DRM, OBJ_FD_INOTIFY, OBJ_FD_SOCKET, OBJ_FD_USERFAULTFD, OBJ_FD_FANOTIFY, OBJ_FD_BPF_MAP, OBJ_FD_BPF_PROG, OBJ_FUTEX, OBJ_SYSV_SHM, MAX_OBJECT_TYPES, }; include/objects.h000066400000000000000000000041021445305223700143050ustar00rootroot00000000000000#pragma once #include "futex.h" #include "list.h" #include "maps.h" #include "object-types.h" #include "socketinfo.h" #include "sysv-shm.h" #include "trinity.h" #include "types.h" struct fileobj { const char *filename; int flags; int fd; bool fopened; int fcntl_flags; }; struct pipeobj { int fd; int flags; bool reader; }; struct perfobj { void * eventattr; int fd; pid_t pid; int cpu; int group_fd; unsigned long flags; }; struct epollobj { int fd; bool create1; int flags; }; struct eventfdobj { int fd; int count; int flags; }; struct timerfdobj { int fd; int clockid; int flags; }; struct memfdobj { int fd; char *name; int flags; }; struct inotifyobj { int fd; int flags; }; struct userfaultobj { int fd; int flags; }; struct fanotifyobj { int fd; int flags; int eventflags; }; struct bpfobj { u32 map_type; int map_fd; }; struct object { struct list_head list; union { struct map map; struct fileobj fileobj; struct pipeobj pipeobj; struct perfobj perfobj; struct epollobj epollobj; struct eventfdobj eventfdobj; struct timerfdobj timerfdobj; struct fileobj testfileobj; struct memfdobj memfdobj; int drmfd; struct inotifyobj inotifyobj; struct userfaultobj userfaultobj; struct fanotifyobj fanotifyobj; struct bpfobj bpfobj; struct socketinfo sockinfo; struct __lock lock; /* futex */ struct sysv_shm sysv_shm; }; }; struct objhead { struct list_head *list; unsigned int num_entries; unsigned int max_entries; void (*destroy)(struct object *obj); void (*dump)(struct object *obj, bool global); }; #define OBJ_LOCAL 0 #define OBJ_GLOBAL 1 struct object * alloc_object(void); void add_object(struct object *obj, bool global, enum objecttype type); void destroy_object(struct object *obj, bool global, enum objecttype type); void destroy_global_objects(void); void init_object_lists(bool global); struct object * get_random_object(enum objecttype type, bool global); bool objects_empty(enum objecttype type); struct objhead * get_objhead(bool global, enum objecttype type); void prune_objects(void); include/params.h000066400000000000000000000031061445305223700141420ustar00rootroot00000000000000#pragma once #include "types.h" #include "net.h" #define TAINT_PROPRIETARY_MODULE 0 #define TAINT_FORCED_MODULE 1 #define TAINT_UNSAFE_SMP 2 #define TAINT_FORCED_RMMOD 3 #define TAINT_MACHINE_CHECK 4 #define TAINT_BAD_PAGE 5 #define TAINT_USER 6 #define TAINT_DIE 7 #define TAINT_OVERRIDDEN_ACPI_TABLE 8 #define TAINT_WARN 9 #define TAINT_CRAP 10 #define TAINT_FIRMWARE_WORKAROUND 11 #define TAINT_OOT_MODULE 12 /* command line args. */ void parse_args(int argc, char *argv[]); extern bool set_debug; extern bool do_32_arch; extern bool do_64_arch; extern bool do_specific_syscall; extern bool do_exclude_syscall; extern unsigned int specific_domain; extern bool do_specific_domain; extern char *specific_domain_optarg; extern bool no_domains[TRINITY_PF_MAX]; extern bool dry_run; extern bool show_unannotated; extern bool show_syscall_list; extern bool show_ioctl_list; extern unsigned char quiet_level; extern bool verbose; extern bool dangerous; extern bool dropprivs; extern bool do_syslog; extern int logging; extern char *logging_args; extern unsigned char desired_group; extern bool user_set_seed; extern char *victim_path; extern bool random_selection; extern unsigned int random_selection_num; extern bool clowntown; extern bool show_stats; extern unsigned int kernel_taint_mask; extern bool kernel_taint_param_occured; extern unsigned int user_specified_children; void enable_disable_fd_usage(void); include/pathnames.h000066400000000000000000000006251445305223700146420ustar00rootroot00000000000000#pragma once #include #include #include extern unsigned int nr_file_fds; extern char *victim_path; extern const char **fileindex; extern unsigned int files_in_index; #define MAX_PATH_LEN 4096 #define NR_FILE_FDS 250U int check_stat_file(const struct stat *sb); void generate_filelist(void); const char * get_filename(void); const char * generate_pathname(void); include/perf.h000066400000000000000000000001731445305223700136140ustar00rootroot00000000000000#pragma once #include "syscall.h" void sanitise_perf_event_open(struct syscallrecord *rec); int get_rand_perf_fd(void); include/perf_event.h000066400000000000000000000751151445305223700150250ustar00rootroot00000000000000#pragma once /* * Performance events: * * Copyright (C) 2008-2009, Thomas Gleixner * Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar * Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra * * Data type definitions, declarations, prototypes. * * Started by: Thomas Gleixner and Ingo Molnar * * For licencing details see kernel-base/COPYING */ #include #include #include /* * User-space ABI bits: */ /* * attr.type */ enum perf_type_id { PERF_TYPE_HARDWARE = 0, PERF_TYPE_SOFTWARE = 1, PERF_TYPE_TRACEPOINT = 2, PERF_TYPE_HW_CACHE = 3, PERF_TYPE_RAW = 4, PERF_TYPE_BREAKPOINT = 5, PERF_TYPE_MAX, /* non-ABI */ }; /* * Generalized performance event event_id types, used by the * attr.event_id parameter of the sys_perf_event_open() * syscall: */ enum perf_hw_id { /* * Common hardware events, generalized by the kernel: */ PERF_COUNT_HW_CPU_CYCLES = 0, PERF_COUNT_HW_INSTRUCTIONS = 1, PERF_COUNT_HW_CACHE_REFERENCES = 2, PERF_COUNT_HW_CACHE_MISSES = 3, PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, PERF_COUNT_HW_BRANCH_MISSES = 5, PERF_COUNT_HW_BUS_CYCLES = 6, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7, PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8, PERF_COUNT_HW_REF_CPU_CYCLES = 9, PERF_COUNT_HW_MAX, /* non-ABI */ }; /* * Generalized hardware cache events: * * { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x * { read, write, prefetch } x * { accesses, misses } */ enum perf_hw_cache_id { PERF_COUNT_HW_CACHE_L1D = 0, PERF_COUNT_HW_CACHE_L1I = 1, PERF_COUNT_HW_CACHE_LL = 2, PERF_COUNT_HW_CACHE_DTLB = 3, PERF_COUNT_HW_CACHE_ITLB = 4, PERF_COUNT_HW_CACHE_BPU = 5, PERF_COUNT_HW_CACHE_NODE = 6, PERF_COUNT_HW_CACHE_MAX, /* non-ABI */ }; enum perf_hw_cache_op_id { PERF_COUNT_HW_CACHE_OP_READ = 0, PERF_COUNT_HW_CACHE_OP_WRITE = 1, PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */ }; enum perf_hw_cache_op_result_id { PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, PERF_COUNT_HW_CACHE_RESULT_MISS = 1, PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */ }; /* * Special "software" events provided by the kernel, even if the hardware * does not support performance events. These events measure various * physical and sw events of the kernel (and allow the profiling of them as * well): */ enum perf_sw_ids { PERF_COUNT_SW_CPU_CLOCK = 0, PERF_COUNT_SW_TASK_CLOCK = 1, PERF_COUNT_SW_PAGE_FAULTS = 2, PERF_COUNT_SW_CONTEXT_SWITCHES = 3, PERF_COUNT_SW_CPU_MIGRATIONS = 4, PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, PERF_COUNT_SW_EMULATION_FAULTS = 8, PERF_COUNT_SW_DUMMY = 9, PERF_COUNT_SW_BPF_OUTPUT = 10, PERF_COUNT_SW_MAX, /* non-ABI */ }; /* * Bits that can be set in attr.sample_type to request information * in the overflow packets. */ enum perf_event_sample_format { PERF_SAMPLE_IP = 1U << 0, PERF_SAMPLE_TID = 1U << 1, PERF_SAMPLE_TIME = 1U << 2, PERF_SAMPLE_ADDR = 1U << 3, PERF_SAMPLE_READ = 1U << 4, PERF_SAMPLE_CALLCHAIN = 1U << 5, PERF_SAMPLE_ID = 1U << 6, PERF_SAMPLE_CPU = 1U << 7, PERF_SAMPLE_PERIOD = 1U << 8, PERF_SAMPLE_STREAM_ID = 1U << 9, PERF_SAMPLE_RAW = 1U << 10, PERF_SAMPLE_BRANCH_STACK = 1U << 11, PERF_SAMPLE_REGS_USER = 1U << 12, PERF_SAMPLE_STACK_USER = 1U << 13, PERF_SAMPLE_WEIGHT = 1U << 14, PERF_SAMPLE_DATA_SRC = 1U << 15, PERF_SAMPLE_IDENTIFIER = 1U << 16, PERF_SAMPLE_TRANSACTION = 1U << 17, PERF_SAMPLE_REGS_INTR = 1U << 18, PERF_SAMPLE_PHYS_ADDR = 1U << 19, PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ }; /* * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set * * If the user does not pass priv level information via branch_sample_type, * the kernel uses the event's priv level. Branch and event priv levels do * not have to match. Branch priv level is checked for permissions. * * The branch types can be combined, however BRANCH_ANY covers all types * of branches and therefore it supersedes all the other types. */ enum perf_branch_sample_type_shift { PERF_SAMPLE_BRANCH_USER_SHIFT = 0, /* user branches */ PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 1, /* kernel branches */ PERF_SAMPLE_BRANCH_HV_SHIFT = 2, /* hypervisor branches */ PERF_SAMPLE_BRANCH_ANY_SHIFT = 3, /* any branch types */ PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 4, /* any call branch */ PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 5, /* any return branch */ PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 6, /* indirect calls */ PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 7, /* transaction aborts */ PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 8, /* in transaction */ PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 9, /* not in transaction */ PERF_SAMPLE_BRANCH_COND_SHIFT = 10, /* conditional branches */ PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 11, /* call/ret stack */ PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT = 12, /* indirect jumps */ PERF_SAMPLE_BRANCH_CALL_SHIFT = 13, /* direct call */ PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14, /* no flags */ PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15, /* no cycles */ PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16, /* save branch type */ PERF_SAMPLE_BRANCH_MAX_SHIFT /* non-ABI */ }; enum perf_branch_sample_type { PERF_SAMPLE_BRANCH_USER = 1U << PERF_SAMPLE_BRANCH_USER_SHIFT, PERF_SAMPLE_BRANCH_KERNEL = 1U << PERF_SAMPLE_BRANCH_KERNEL_SHIFT, PERF_SAMPLE_BRANCH_HV = 1U << PERF_SAMPLE_BRANCH_HV_SHIFT, PERF_SAMPLE_BRANCH_ANY = 1U << PERF_SAMPLE_BRANCH_ANY_SHIFT, PERF_SAMPLE_BRANCH_ANY_CALL = 1U << PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT, PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT, PERF_SAMPLE_BRANCH_IND_CALL = 1U << PERF_SAMPLE_BRANCH_IND_CALL_SHIFT, PERF_SAMPLE_BRANCH_ABORT_TX = 1U << PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT, PERF_SAMPLE_BRANCH_IN_TX = 1U << PERF_SAMPLE_BRANCH_IN_TX_SHIFT, PERF_SAMPLE_BRANCH_NO_TX = 1U << PERF_SAMPLE_BRANCH_NO_TX_SHIFT, PERF_SAMPLE_BRANCH_COND = 1U << PERF_SAMPLE_BRANCH_COND_SHIFT, PERF_SAMPLE_BRANCH_CALL_STACK = 1U << PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT, PERF_SAMPLE_BRANCH_IND_JUMP = 1U << PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT, PERF_SAMPLE_BRANCH_CALL = 1U << PERF_SAMPLE_BRANCH_CALL_SHIFT, PERF_SAMPLE_BRANCH_NO_FLAGS = 1U << PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT, PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT, PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT, PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT, }; /* * Common flow change classification */ enum { PERF_BR_UNKNOWN = 0, /* unknown */ PERF_BR_COND = 1, /* conditional */ PERF_BR_UNCOND = 2, /* unconditional */ PERF_BR_IND = 3, /* indirect */ PERF_BR_CALL = 4, /* function call */ PERF_BR_IND_CALL = 5, /* indirect function call */ PERF_BR_RET = 6, /* function return */ PERF_BR_SYSCALL = 7, /* syscall */ PERF_BR_SYSRET = 8, /* syscall return */ PERF_BR_COND_CALL = 9, /* conditional function call */ PERF_BR_COND_RET = 10, /* conditional function return */ PERF_BR_MAX, }; #define PERF_SAMPLE_BRANCH_PLM_ALL \ (PERF_SAMPLE_BRANCH_USER|\ PERF_SAMPLE_BRANCH_KERNEL|\ PERF_SAMPLE_BRANCH_HV) /* * Values to determine ABI of the registers dump. */ enum perf_sample_regs_abi { PERF_SAMPLE_REGS_ABI_NONE = 0, PERF_SAMPLE_REGS_ABI_32 = 1, PERF_SAMPLE_REGS_ABI_64 = 2, }; /* * Values for the memory transaction event qualifier, mostly for * abort events. Multiple bits can be set. */ enum { PERF_TXN_ELISION = (1 << 0), /* From elision */ PERF_TXN_TRANSACTION = (1 << 1), /* From transaction */ PERF_TXN_SYNC = (1 << 2), /* Instruction is related */ PERF_TXN_ASYNC = (1 << 3), /* Instruction not related */ PERF_TXN_RETRY = (1 << 4), /* Retry possible */ PERF_TXN_CONFLICT = (1 << 5), /* Conflict abort */ PERF_TXN_CAPACITY_WRITE = (1 << 6), /* Capacity write abort */ PERF_TXN_CAPACITY_READ = (1 << 7), /* Capacity read abort */ PERF_TXN_MAX = (1 << 8), /* non-ABI */ /* bits 32..63 are reserved for the abort code */ PERF_TXN_ABORT_MASK = (0xffffffffULL << 32), PERF_TXN_ABORT_SHIFT = 32, }; /* * The format of the data returned by read() on a perf event fd, * as specified by attr.read_format: * * struct read_format { * { u64 value; * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING * { u64 id; } && PERF_FORMAT_ID * } && !PERF_FORMAT_GROUP * * { u64 nr; * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING * { u64 value; * { u64 id; } && PERF_FORMAT_ID * } cntr[nr]; * } && PERF_FORMAT_GROUP * }; */ enum perf_event_read_format { PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, PERF_FORMAT_ID = 1U << 2, PERF_FORMAT_GROUP = 1U << 3, PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ }; #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ #define PERF_ATTR_SIZE_VER1 72 /* add: config2 */ #define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ #define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */ /* add: sample_stack_user */ #define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */ #define PERF_ATTR_SIZE_VER5 112 /* add: aux_watermark */ /* * Hardware event_id to monitor via a performance monitoring event: * * @sample_max_stack: Max number of frame pointers in a callchain, * should be < /proc/sys/kernel/perf_event_max_stack */ struct perf_event_attr { /* * Major type: hardware/software/tracepoint/etc. */ __u32 type; /* * Size of the attr structure, for fwd/bwd compat. */ __u32 size; /* * Type specific configuration information. */ __u64 config; union { __u64 sample_period; __u64 sample_freq; }; __u64 sample_type; __u64 read_format; __u64 disabled : 1, /* off by default */ inherit : 1, /* children inherit it */ pinned : 1, /* must always be on PMU */ exclusive : 1, /* only group on PMU */ exclude_user : 1, /* don't count user */ exclude_kernel : 1, /* ditto kernel */ exclude_hv : 1, /* ditto hypervisor */ exclude_idle : 1, /* don't count when idle */ mmap : 1, /* include mmap data */ comm : 1, /* include comm data */ freq : 1, /* use freq, not period */ inherit_stat : 1, /* per task counts */ enable_on_exec : 1, /* next exec enables */ task : 1, /* trace fork/exit */ watermark : 1, /* wakeup_watermark */ /* * precise_ip: * * 0 - SAMPLE_IP can have arbitrary skid * 1 - SAMPLE_IP must have constant skid * 2 - SAMPLE_IP requested to have 0 skid * 3 - SAMPLE_IP must have 0 skid * * See also PERF_RECORD_MISC_EXACT_IP */ precise_ip : 2, /* skid constraint */ mmap_data : 1, /* non-exec mmap data */ sample_id_all : 1, /* sample_type all events */ exclude_host : 1, /* don't count in host */ exclude_guest : 1, /* don't count in guest */ exclude_callchain_kernel : 1, /* exclude kernel callchains */ exclude_callchain_user : 1, /* exclude user callchains */ mmap2 : 1, /* include mmap with inode data */ comm_exec : 1, /* flag comm events that are due to an exec */ use_clockid : 1, /* use @clockid for time fields */ context_switch : 1, /* context switch data */ write_backward : 1, /* Write ring buffer from end to beginning */ namespaces : 1, /* include namespaces data */ __reserved_1 : 35; union { __u32 wakeup_events; /* wakeup every n events */ __u32 wakeup_watermark; /* bytes before wakeup */ }; __u32 bp_type; union { __u64 bp_addr; __u64 config1; /* extension of config */ }; union { __u64 bp_len; __u64 config2; /* extension of config1 */ }; __u64 branch_sample_type; /* enum perf_branch_sample_type */ /* * Defines set of user regs to dump on samples. * See asm/perf_regs.h for details. */ __u64 sample_regs_user; /* * Defines size of the user stack to dump on samples. */ __u32 sample_stack_user; __s32 clockid; /* * Defines set of regs to dump for each sample * state captured on: * - precise = 0: PMU interrupt * - precise > 0: sampled instruction * * See asm/perf_regs.h for details. */ __u64 sample_regs_intr; /* * Wakeup watermark for AUX area */ __u32 aux_watermark; __u16 sample_max_stack; __u16 __reserved_2; /* align to __u64 */ }; #define perf_flags(attr) (*(&(attr)->read_format + 1)) /* * Ioctls that can be done on a perf event fd: */ #define PERF_EVENT_IOC_ENABLE _IO ('$', 0) #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) #define PERF_EVENT_IOC_RESET _IO ('$', 3) #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) #define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *) #define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, __u32) #define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) enum perf_event_ioc_flags { PERF_IOC_FLAG_GROUP = 1U << 0, }; /* * Structure of the page that can be mapped via mmap */ struct perf_event_mmap_page { __u32 version; /* version number of this structure */ __u32 compat_version; /* lowest version this is compat with */ /* * Bits needed to read the hw events in user-space. * * u32 seq, time_mult, time_shift, index, width; * u64 count, enabled, running; * u64 cyc, time_offset; * s64 pmc = 0; * * do { * seq = pc->lock; * barrier() * * enabled = pc->time_enabled; * running = pc->time_running; * * if (pc->cap_usr_time && enabled != running) { * cyc = rdtsc(); * time_offset = pc->time_offset; * time_mult = pc->time_mult; * time_shift = pc->time_shift; * } * * index = pc->index; * count = pc->offset; * if (pc->cap_user_rdpmc && index) { * width = pc->pmc_width; * pmc = rdpmc(index - 1); * } * * barrier(); * } while (pc->lock != seq); * * NOTE: for obvious reason this only works on self-monitoring * processes. */ __u32 lock; /* seqlock for synchronization */ __u32 index; /* hardware event identifier */ __s64 offset; /* add to hardware event value */ __u64 time_enabled; /* time event active */ __u64 time_running; /* time event on cpu */ union { __u64 capabilities; struct { __u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */ cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */ cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */ cap_user_time : 1, /* The time_* fields are used */ cap_user_time_zero : 1, /* The time_zero field is used */ cap_____res : 59; }; }; /* * If cap_user_rdpmc this field provides the bit-width of the value * read using the rdpmc() or equivalent instruction. This can be used * to sign extend the result like: * * pmc <<= 64 - width; * pmc >>= 64 - width; // signed shift right * count += pmc; */ __u16 pmc_width; /* * If cap_usr_time the below fields can be used to compute the time * delta since time_enabled (in ns) using rdtsc or similar. * * u64 quot, rem; * u64 delta; * * quot = (cyc >> time_shift); * rem = cyc & (((u64)1 << time_shift) - 1); * delta = time_offset + quot * time_mult + * ((rem * time_mult) >> time_shift); * * Where time_offset,time_mult,time_shift and cyc are read in the * seqcount loop described above. This delta can then be added to * enabled and possible running (if index), improving the scaling: * * enabled += delta; * if (index) * running += delta; * * quot = count / running; * rem = count % running; * count = quot * enabled + (rem * enabled) / running; */ __u16 time_shift; __u32 time_mult; __u64 time_offset; /* * If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated * from sample timestamps. * * time = timestamp - time_zero; * quot = time / time_mult; * rem = time % time_mult; * cyc = (quot << time_shift) + (rem << time_shift) / time_mult; * * And vice versa: * * quot = cyc >> time_shift; * rem = cyc & (((u64)1 << time_shift) - 1); * timestamp = time_zero + quot * time_mult + * ((rem * time_mult) >> time_shift); */ __u64 time_zero; __u32 size; /* Header size up to __reserved[] fields. */ /* * Hole for extension of the self monitor capabilities */ __u8 __reserved[118*8+4]; /* align to 1k. */ /* * Control data for the mmap() data buffer. * * User-space reading the @data_head value should issue an smp_rmb(), * after reading this value. * * When the mapping is PROT_WRITE the @data_tail value should be * written by userspace to reflect the last read data, after issueing * an smp_mb() to separate the data read from the ->data_tail store. * In this case the kernel will not over-write unread data. * * See perf_output_put_handle() for the data ordering. * * data_{offset,size} indicate the location and size of the perf record * buffer within the mmapped area. */ __u64 data_head; /* head in the data section */ __u64 data_tail; /* user-space written tail */ __u64 data_offset; /* where the buffer starts */ __u64 data_size; /* data buffer size */ /* * AUX area is defined by aux_{offset,size} fields that should be set * by the userspace, so that * * aux_offset >= data_offset + data_size * * prior to mmap()ing it. Size of the mmap()ed area should be aux_size. * * Ring buffer pointers aux_{head,tail} have the same semantics as * data_{head,tail} and same ordering rules apply. */ __u64 aux_head; __u64 aux_tail; __u64 aux_offset; __u64 aux_size; }; #define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0) #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) #define PERF_RECORD_MISC_KERNEL (1 << 0) #define PERF_RECORD_MISC_USER (2 << 0) #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) #define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) #define PERF_RECORD_MISC_GUEST_USER (5 << 0) /* * Indicates that /proc/PID/maps parsing are truncated by time out. */ #define PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT (1 << 12) /* * PERF_RECORD_MISC_MMAP_DATA and PERF_RECORD_MISC_COMM_EXEC are used on * different events so can reuse the same bit position. * Ditto PERF_RECORD_MISC_SWITCH_OUT. */ #define PERF_RECORD_MISC_MMAP_DATA (1 << 13) #define PERF_RECORD_MISC_COMM_EXEC (1 << 13) #define PERF_RECORD_MISC_SWITCH_OUT (1 << 13) /* * Indicates that the content of PERF_SAMPLE_IP points to * the actual instruction that triggered the event. See also * perf_event_attr::precise_ip. */ #define PERF_RECORD_MISC_EXACT_IP (1 << 14) /* * Reserve the last bit to indicate some extended misc field */ #define PERF_RECORD_MISC_EXT_RESERVED (1 << 15) struct perf_event_header { __u32 type; __u16 misc; __u16 size; }; struct perf_ns_link_info { __u64 dev; __u64 ino; }; enum { NET_NS_INDEX = 0, UTS_NS_INDEX = 1, IPC_NS_INDEX = 2, PID_NS_INDEX = 3, USER_NS_INDEX = 4, MNT_NS_INDEX = 5, CGROUP_NS_INDEX = 6, NR_NAMESPACES, /* number of available namespaces */ }; enum perf_event_type { /* * If perf_event_attr.sample_id_all is set then all event types will * have the sample_type selected fields related to where/when * (identity) an event took place (TID, TIME, ID, STREAM_ID, CPU, * IDENTIFIER) described in PERF_RECORD_SAMPLE below, it will be stashed * just after the perf_event_header and the fields already present for * the existing fields, i.e. at the end of the payload. That way a newer * perf.data file will be supported by older perf tools, with these new * optional fields being ignored. * * struct sample_id { * { u32 pid, tid; } && PERF_SAMPLE_TID * { u64 time; } && PERF_SAMPLE_TIME * { u64 id; } && PERF_SAMPLE_ID * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID * { u32 cpu, res; } && PERF_SAMPLE_CPU * { u64 id; } && PERF_SAMPLE_IDENTIFIER * } && perf_event_attr::sample_id_all * * Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. The * advantage of PERF_SAMPLE_IDENTIFIER is that its position is fixed * relative to header.size. */ /* * The MMAP events record the PROT_EXEC mappings so that we can * correlate userspace IPs to code. They have the following structure: * * struct { * struct perf_event_header header; * * u32 pid, tid; * u64 addr; * u64 len; * u64 pgoff; * char filename[]; * struct sample_id sample_id; * }; */ PERF_RECORD_MMAP = 1, /* * struct { * struct perf_event_header header; * u64 id; * u64 lost; * struct sample_id sample_id; * }; */ PERF_RECORD_LOST = 2, /* * struct { * struct perf_event_header header; * * u32 pid, tid; * char comm[]; * struct sample_id sample_id; * }; */ PERF_RECORD_COMM = 3, /* * struct { * struct perf_event_header header; * u32 pid, ppid; * u32 tid, ptid; * u64 time; * struct sample_id sample_id; * }; */ PERF_RECORD_EXIT = 4, /* * struct { * struct perf_event_header header; * u64 time; * u64 id; * u64 stream_id; * struct sample_id sample_id; * }; */ PERF_RECORD_THROTTLE = 5, PERF_RECORD_UNTHROTTLE = 6, /* * struct { * struct perf_event_header header; * u32 pid, ppid; * u32 tid, ptid; * u64 time; * struct sample_id sample_id; * }; */ PERF_RECORD_FORK = 7, /* * struct { * struct perf_event_header header; * u32 pid, tid; * * struct read_format values; * struct sample_id sample_id; * }; */ PERF_RECORD_READ = 8, /* * struct { * struct perf_event_header header; * * # * # Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. * # The advantage of PERF_SAMPLE_IDENTIFIER is that its position * # is fixed relative to header. * # * * { u64 id; } && PERF_SAMPLE_IDENTIFIER * { u64 ip; } && PERF_SAMPLE_IP * { u32 pid, tid; } && PERF_SAMPLE_TID * { u64 time; } && PERF_SAMPLE_TIME * { u64 addr; } && PERF_SAMPLE_ADDR * { u64 id; } && PERF_SAMPLE_ID * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID * { u32 cpu, res; } && PERF_SAMPLE_CPU * { u64 period; } && PERF_SAMPLE_PERIOD * * { struct read_format values; } && PERF_SAMPLE_READ * * { u64 nr, * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN * * # * # The RAW record below is opaque data wrt the ABI * # * # That is, the ABI doesn't make any promises wrt to * # the stability of its content, it may vary depending * # on event, hardware, kernel version and phase of * # the moon. * # * # In other words, PERF_SAMPLE_RAW contents are not an ABI. * # * * { u32 size; * char data[size];}&& PERF_SAMPLE_RAW * * { u64 nr; * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK * * { u64 abi; # enum perf_sample_regs_abi * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER * * { u64 size; * char data[size]; * u64 dyn_size; } && PERF_SAMPLE_STACK_USER * * { u64 weight; } && PERF_SAMPLE_WEIGHT * { u64 data_src; } && PERF_SAMPLE_DATA_SRC * { u64 transaction; } && PERF_SAMPLE_TRANSACTION * { u64 abi; # enum perf_sample_regs_abi * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR * { u64 phys_addr;} && PERF_SAMPLE_PHYS_ADDR * }; */ PERF_RECORD_SAMPLE = 9, /* * The MMAP2 records are an augmented version of MMAP, they add * maj, min, ino numbers to be used to uniquely identify each mapping * * struct { * struct perf_event_header header; * * u32 pid, tid; * u64 addr; * u64 len; * u64 pgoff; * u32 maj; * u32 min; * u64 ino; * u64 ino_generation; * u32 prot, flags; * char filename[]; * struct sample_id sample_id; * }; */ PERF_RECORD_MMAP2 = 10, /* * Records that new data landed in the AUX buffer part. * * struct { * struct perf_event_header header; * * u64 aux_offset; * u64 aux_size; * u64 flags; * struct sample_id sample_id; * }; */ PERF_RECORD_AUX = 11, /* * Indicates that instruction trace has started * * struct { * struct perf_event_header header; * u32 pid; * u32 tid; * }; */ PERF_RECORD_ITRACE_START = 12, /* * Records the dropped/lost sample number. * * struct { * struct perf_event_header header; * * u64 lost; * struct sample_id sample_id; * }; */ PERF_RECORD_LOST_SAMPLES = 13, /* * Records a context switch in or out (flagged by * PERF_RECORD_MISC_SWITCH_OUT). See also * PERF_RECORD_SWITCH_CPU_WIDE. * * struct { * struct perf_event_header header; * struct sample_id sample_id; * }; */ PERF_RECORD_SWITCH = 14, /* * CPU-wide version of PERF_RECORD_SWITCH with next_prev_pid and * next_prev_tid that are the next (switching out) or previous * (switching in) pid/tid. * * struct { * struct perf_event_header header; * u32 next_prev_pid; * u32 next_prev_tid; * struct sample_id sample_id; * }; */ PERF_RECORD_SWITCH_CPU_WIDE = 15, /* * struct { * struct perf_event_header header; * u32 pid; * u32 tid; * u64 nr_namespaces; * { u64 dev, inode; } [nr_namespaces]; * struct sample_id sample_id; * }; */ PERF_RECORD_NAMESPACES = 16, PERF_RECORD_MAX, /* non-ABI */ }; #define PERF_MAX_STACK_DEPTH 127 #define PERF_MAX_CONTEXTS_PER_STACK 8 enum perf_callchain_context { PERF_CONTEXT_HV = (__u64)-32, PERF_CONTEXT_KERNEL = (__u64)-128, PERF_CONTEXT_USER = (__u64)-512, PERF_CONTEXT_GUEST = (__u64)-2048, PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176, PERF_CONTEXT_GUEST_USER = (__u64)-2560, PERF_CONTEXT_MAX = (__u64)-4095, }; /** * PERF_RECORD_AUX::flags bits */ #define PERF_AUX_FLAG_TRUNCATED 0x01 /* record was truncated to fit */ #define PERF_AUX_FLAG_OVERWRITE 0x02 /* snapshot from overwrite mode */ #define PERF_AUX_FLAG_PARTIAL 0x04 /* record contains gaps */ #define PERF_FLAG_FD_NO_GROUP (1UL << 0) #define PERF_FLAG_FD_OUTPUT (1UL << 1) #define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */ #define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */ #if defined(__LITTLE_ENDIAN_BITFIELD) union perf_mem_data_src { __u64 val; struct { __u64 mem_op:5, /* type of opcode */ mem_lvl:14, /* memory hierarchy level */ mem_snoop:5, /* snoop mode */ mem_lock:2, /* lock instr */ mem_dtlb:7, /* tlb access */ mem_lvl_num:4, /* memory hierarchy level number */ mem_remote:1, /* remote */ mem_snoopx:2, /* snoop mode, ext */ mem_rsvd:24; }; }; #elif defined(__BIG_ENDIAN_BITFIELD) union perf_mem_data_src { __u64 val; struct { __u64 mem_rsvd:24, mem_snoopx:2, /* snoop mode, ext */ mem_remote:1, /* remote */ mem_lvl_num:4, /* memory hierarchy level number */ mem_dtlb:7, /* tlb access */ mem_lock:2, /* lock instr */ mem_snoop:5, /* snoop mode */ mem_lvl:14, /* memory hierarchy level */ mem_op:5; /* type of opcode */ }; }; #else #error "Unknown endianness" #endif /* type of opcode (load/store/prefetch,code) */ #define PERF_MEM_OP_NA 0x01 /* not available */ #define PERF_MEM_OP_LOAD 0x02 /* load instruction */ #define PERF_MEM_OP_STORE 0x04 /* store instruction */ #define PERF_MEM_OP_PFETCH 0x08 /* prefetch */ #define PERF_MEM_OP_EXEC 0x10 /* code (execution) */ #define PERF_MEM_OP_SHIFT 0 /* memory hierarchy (memory level, hit or miss) */ #define PERF_MEM_LVL_NA 0x01 /* not available */ #define PERF_MEM_LVL_HIT 0x02 /* hit level */ #define PERF_MEM_LVL_MISS 0x04 /* miss level */ #define PERF_MEM_LVL_L1 0x08 /* L1 */ #define PERF_MEM_LVL_LFB 0x10 /* Line Fill Buffer */ #define PERF_MEM_LVL_L2 0x20 /* L2 */ #define PERF_MEM_LVL_L3 0x40 /* L3 */ #define PERF_MEM_LVL_LOC_RAM 0x80 /* Local DRAM */ #define PERF_MEM_LVL_REM_RAM1 0x100 /* Remote DRAM (1 hop) */ #define PERF_MEM_LVL_REM_RAM2 0x200 /* Remote DRAM (2 hops) */ #define PERF_MEM_LVL_REM_CCE1 0x400 /* Remote Cache (1 hop) */ #define PERF_MEM_LVL_REM_CCE2 0x800 /* Remote Cache (2 hops) */ #define PERF_MEM_LVL_IO 0x1000 /* I/O memory */ #define PERF_MEM_LVL_UNC 0x2000 /* Uncached memory */ #define PERF_MEM_LVL_SHIFT 5 #define PERF_MEM_REMOTE_REMOTE 0x01 /* Remote */ #define PERF_MEM_REMOTE_SHIFT 37 #define PERF_MEM_LVLNUM_L1 0x01 /* L1 */ #define PERF_MEM_LVLNUM_L2 0x02 /* L2 */ #define PERF_MEM_LVLNUM_L3 0x03 /* L3 */ #define PERF_MEM_LVLNUM_L4 0x04 /* L4 */ /* 5-0xa available */ #define PERF_MEM_LVLNUM_ANY_CACHE 0x0b /* Any cache */ #define PERF_MEM_LVLNUM_LFB 0x0c /* LFB */ #define PERF_MEM_LVLNUM_RAM 0x0d /* RAM */ #define PERF_MEM_LVLNUM_PMEM 0x0e /* PMEM */ #define PERF_MEM_LVLNUM_NA 0x0f /* N/A */ #define PERF_MEM_LVLNUM_SHIFT 33 /* snoop mode */ #define PERF_MEM_SNOOP_NA 0x01 /* not available */ #define PERF_MEM_SNOOP_NONE 0x02 /* no snoop */ #define PERF_MEM_SNOOP_HIT 0x04 /* snoop hit */ #define PERF_MEM_SNOOP_MISS 0x08 /* snoop miss */ #define PERF_MEM_SNOOP_HITM 0x10 /* snoop hit modified */ #define PERF_MEM_SNOOP_SHIFT 19 #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ /* 1 free */ #define PERF_MEM_SNOOPX_SHIFT 37 /* locked instruction */ #define PERF_MEM_LOCK_NA 0x01 /* not available */ #define PERF_MEM_LOCK_LOCKED 0x02 /* locked transaction */ #define PERF_MEM_LOCK_SHIFT 24 /* TLB access */ #define PERF_MEM_TLB_NA 0x01 /* not available */ #define PERF_MEM_TLB_HIT 0x02 /* hit level */ #define PERF_MEM_TLB_MISS 0x04 /* miss level */ #define PERF_MEM_TLB_L1 0x08 /* L1 */ #define PERF_MEM_TLB_L2 0x10 /* L2 */ #define PERF_MEM_TLB_WK 0x20 /* Hardware Walker*/ #define PERF_MEM_TLB_OS 0x40 /* OS fault handler */ #define PERF_MEM_TLB_SHIFT 26 #define PERF_MEM_S(a, s) \ (((__u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT) /* * single taken branch record layout: * * from: source instruction (may not always be a branch insn) * to: branch target * mispred: branch target was mispredicted * predicted: branch target was predicted * * support for mispred, predicted is optional. In case it * is not supported mispred = predicted = 0. * * in_tx: running in a hardware transaction * abort: aborting a hardware transaction * cycles: cycles from last branch (or 0 if not supported) * type: branch type */ struct perf_branch_entry { __u64 from; __u64 to; __u64 mispred:1, /* target mispredicted */ predicted:1,/* target predicted */ in_tx:1, /* in transaction */ abort:1, /* transaction abort */ cycles:16, /* cycle count to last branch */ type:4, /* branch type */ reserved:40; }; include/pids.h000066400000000000000000000006061445305223700136200ustar00rootroot00000000000000#pragma once #include #include "child.h" #include "types.h" extern pid_t *pids; extern pid_t mainpid; #define for_each_child(i) for (i = 0; i < max_children; i++) #define CHILD_NOT_FOUND -1 #define EMPTY_PIDSLOT -1 bool pid_alive(pid_t pid); int find_childno(pid_t mypid); bool pidmap_empty(void); void dump_childnos(void); int pid_is_valid(pid_t); void pids_init(void); include/pipes.h000066400000000000000000000000521445305223700137740ustar00rootroot00000000000000#pragma once int get_rand_pipe_fd(void); include/post-mortem.h000066400000000000000000000000551445305223700151450ustar00rootroot00000000000000#pragma once void tainted_postmortem(void); include/random.h000066400000000000000000000013371445305223700141430ustar00rootroot00000000000000#pragma once #include #include "child.h" #include "types.h" int rnd(void); #define ONE_IN(x) ((rnd() % x) == 0) // limit of RAND_MAX-1 #define RAND_BOOL() (rnd() & 1) #define RAND_BYTE() (rnd() & 0xff) #define RAND_RANGE(min, max) (min + rnd() / (RAND_MAX / (max - min + 1) + 1)) extern unsigned int seed; unsigned int init_seed(unsigned int seed); void set_seed(struct childdata *child); void reseed(void); void generate_rand_bytes(unsigned char *ptr, unsigned int len); void generate_random_page(char *page); unsigned short rand16(void); unsigned int rand32(void); u64 rand64(void); unsigned long rand_single_bit(unsigned char size); unsigned long set_rand_bitmask(unsigned int num, const unsigned long *values); include/results.h000066400000000000000000000001241445305223700143550ustar00rootroot00000000000000#pragma once #include "syscall.h" void handle_success(struct syscallrecord *rec); include/sanitise.h000066400000000000000000000013221445305223700144740ustar00rootroot00000000000000#pragma once #include "syscall.h" void generic_sanitise(struct syscallrecord *rec); void generic_free_arg(struct syscallrecord *rec); unsigned long get_interesting_value(void); unsigned long get_argval(struct syscallrecord *rec, unsigned int argnum); void *get_address(void); void *get_non_null_address(void); void *get_writable_address(unsigned long size); unsigned long find_previous_arg_address(struct syscallrecord *rec, unsigned int argnum); struct iovec * alloc_iovec(unsigned int num); unsigned long get_len(void); unsigned int get_pid(void); void gen_unicode_page(char *page); enum argtype get_argtype(struct syscallentry *entry, unsigned int argnum); void generate_syscall_args(struct syscallrecord *rec); include/shm.h000066400000000000000000000035241445305223700134520ustar00rootroot00000000000000#pragma once #include "arch.h" #include "child.h" #include "exit.h" #include "files.h" #include "locks.h" #include "net.h" #include "stats.h" #include "syscall.h" #include "types.h" void create_shm(void); void init_shm(void); struct shm_s { struct childdata **children; struct stats_s stats; unsigned int running_childs; /* rng related state */ unsigned int seed; /* Indices of syscall in syscall table that are active. * All indices shifted by +1. Empty index equals to 0. * * 'active_syscalls' is only used on uniarch. The other two * are only used on biarch. */ int active_syscalls32[MAX_NR_SYSCALL]; int active_syscalls64[MAX_NR_SYSCALL]; int active_syscalls[MAX_NR_SYSCALL]; unsigned int nr_active_syscalls; unsigned int nr_active_32bit_syscalls; unsigned int nr_active_64bit_syscalls; #ifdef ARCH_IS_BIARCH /* Check that 32bit emulation is available. */ unsigned int syscalls32_succeeded; unsigned int syscalls32_attempted; #endif /* generic object cache*/ struct objhead global_objects[MAX_OBJECT_TYPES]; /* file descriptor info */ int current_fd; unsigned int fd_lifetime; /* to protect from multiple child processes from * trying to disable the same syscall at the same time. */ lock_t syscalltable_lock; /* child<>child mutex, used so only one child spews debug output */ lock_t buglock; /* various flags. */ enum exit_reasons exit_reason; bool dont_make_it_fail; bool spawn_no_more; bool ready; bool postmortem_in_progress; /* global debug flag. * This is in the shm so we can do things like gdb to the main pid, * and have the children automatically take notice. * This can be useful if for some reason we don't want to gdb to the child. */ bool debug; /* set to true if a child hits an EPERM trying to unshare() */ bool unshare_perm_err; }; extern struct shm_s *shm; extern unsigned int shm_size; include/signals.h000066400000000000000000000001731445305223700143200ustar00rootroot00000000000000#pragma once #include extern jmp_buf ret_jump; void mask_signals_child(void); void setup_main_signals(void); include/socketinfo.h000066400000000000000000000003771445305223700150320ustar00rootroot00000000000000#pragma once struct socket_triplet { unsigned int family; unsigned int type; unsigned int protocol; }; /* We create one of these per socket fd we open, and store them in shm->sockets */ struct socketinfo { struct socket_triplet triplet; int fd; }; include/stats.h000066400000000000000000000004401445305223700140130ustar00rootroot00000000000000#pragma once /* Various statistics. */ struct stats_s { unsigned long op_count; unsigned long successes; unsigned long failures; /* Counts to tell if we're making progress or not. */ unsigned long previous_op_count; /* combined total of all children */ }; void dump_stats(void); include/syscall.h000066400000000000000000000073131445305223700143350ustar00rootroot00000000000000#pragma once #include #include #include "locks.h" #include "types.h" #include "utils.h" #define PREBUFFER_LEN 4096 * 6 #define POSTBUFFER_LEN 128 #define MAX_NR_SYSCALL 1024 enum syscallstate { UNKNOWN, /* new child */ PREP, /* doing sanitize */ BEFORE, /* about to do syscall */ GOING_AWAY, /* used when we don't expect to come back (execve for eg) */ AFTER, /* returned from doing syscall. */ }; struct syscallrecord { unsigned int nr; unsigned long a1; unsigned long a2; unsigned long a3; unsigned long a4; unsigned long a5; unsigned long a6; unsigned long retval; /* timestamp (written before the syscall, and updated afterwards. */ struct timespec tp; int errno_post; /* what errno was after the syscall. */ bool do32bit; lock_t lock; enum syscallstate state; char prebuffer[PREBUFFER_LEN]; char postbuffer[POSTBUFFER_LEN]; }; enum argtype { ARG_UNDEFINED, ARG_FD, ARG_LEN, ARG_ADDRESS, ARG_MODE_T, ARG_NON_NULL_ADDRESS, ARG_PID, ARG_RANGE, ARG_OP, ARG_LIST, ARG_CPU, ARG_PATHNAME, ARG_IOVEC, ARG_IOVECLEN, ARG_SOCKADDR, ARG_SOCKADDRLEN, ARG_MMAP, ARG_SOCKETINFO, }; struct arglist { unsigned int num; unsigned long *values; }; #define ARGLIST(vals) \ { \ .num = ARRAY_SIZE(vals),\ .values = vals, \ } #define NR_ERRNOS 133 // Number in /usr/include/asm-generic/errno.h struct results { union { // ARG_FD. -1 = Avoid. 0 = untested. 1 = Works. int fdmap[1024]; // ARG_LEN unsigned int min, max; }; }; struct syscallentry { void (*sanitise)(struct syscallrecord *rec); void (*post)(struct syscallrecord *rec); int (*init)(void); char * (*decode)(struct syscallrecord *rec, unsigned int argnum); unsigned int number; unsigned int active_number; const char name[80]; const unsigned int num_args; unsigned int flags; const enum argtype arg1type; const enum argtype arg2type; const enum argtype arg3type; const enum argtype arg4type; const enum argtype arg5type; const enum argtype arg6type; const char *arg1name; const char *arg2name; const char *arg3name; const char *arg4name; const char *arg5name; const char *arg6name; struct results results1; struct results results2; struct results results3; struct results results4; struct results results5; struct results results6; unsigned int successes, failures, attempted; unsigned int errnos[NR_ERRNOS]; /* FIXME: At some point, if we grow more type specific parts here, * it may be worth union-ising this */ /* ARG_RANGE */ const unsigned int low1range, hi1range; const unsigned int low2range, hi2range; const unsigned int low3range, hi3range; const unsigned int low4range, hi4range; const unsigned int low5range, hi5range; const unsigned int low6range, hi6range; /* ARG_OP / ARG_LIST */ const struct arglist arg1list; const struct arglist arg2list; const struct arglist arg3list; const struct arglist arg4list; const struct arglist arg5list; const struct arglist arg6list; const unsigned int group; const int rettype; }; #define RET_BORING -1 #define RET_NONE 0 #define RET_ZERO_SUCCESS 1 #define RET_FD 2 #define RET_KEY_SERIAL_T 3 #define RET_PID_T 4 #define RET_PATH 5 #define RET_NUM_BYTES 6 #define RET_GID_T 7 #define RET_UID_T 8 #define GROUP_NONE 0 #define GROUP_VM 1 #define GROUP_VFS 2 struct syscalltable { struct syscallentry *entry; }; #define AVOID_SYSCALL (1<<0) #define NI_SYSCALL (1<<1) #define BORING (1<<2) #define ACTIVE (1<<3) #define TO_BE_DEACTIVATED (1<<4) #define NEED_ALARM (1<<5) #define EXTRA_FORK (1<<6) #define IGNORE_ENOSYS (1<<7) #define EXPENSIVE (1<<8) void do_syscall(struct syscallrecord *rec); void handle_syscall_ret(struct syscallrecord *rec); #define for_each_arg(_e, _i) \ for (_i = 1; _i <= _e->num_args; _i++) include/syscalls-aarch64.h000066400000000000000000000300731445305223700157450ustar00rootroot00000000000000#pragma once /* * Derived from arch/arm64/include/asm/unistd.h * (inherits from include/uapi/asm-generic/unistd.h) */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_aarch64[] = { /* 0 */ { .entry = &syscall_io_setup }, /* 1 */ { .entry = &syscall_io_destroy }, /* 2 */ { .entry = &syscall_io_submit }, /* 3 */ { .entry = &syscall_io_cancel }, /* 4 */ { .entry = &syscall_io_getevents }, /* 5 */ { .entry = &syscall_setxattr }, /* 6 */ { .entry = &syscall_lsetxattr }, /* 7 */ { .entry = &syscall_fsetxattr }, /* 8 */ { .entry = &syscall_getxattr }, /* 9 */ { .entry = &syscall_lgetxattr }, /* 10 */ { .entry = &syscall_fgetxattr }, /* 11 */ { .entry = &syscall_listxattr }, /* 12 */ { .entry = &syscall_llistxattr }, /* 13 */ { .entry = &syscall_flistxattr }, /* 14 */ { .entry = &syscall_removexattr }, /* 15 */ { .entry = &syscall_lremovexattr }, /* 16 */ { .entry = &syscall_fremovexattr }, /* 17 */ { .entry = &syscall_getcwd }, /* 18 */ { .entry = &syscall_lookup_dcookie }, /* 19 */ { .entry = &syscall_eventfd2 }, /* 20 */ { .entry = &syscall_epoll_create1 }, /* 21 */ { .entry = &syscall_epoll_ctl }, /* 22 */ { .entry = &syscall_epoll_pwait }, /* 23 */ { .entry = &syscall_dup }, /* 24 */ { .entry = &syscall_dup3 }, /* 25 */ { .entry = &syscall_fcntl }, /* 26 */ { .entry = &syscall_inotify_init1 }, /* 27 */ { .entry = &syscall_inotify_add_watch }, /* 28 */ { .entry = &syscall_inotify_rm_watch }, /* 29 */ { .entry = &syscall_ioctl }, /* 30 */ { .entry = &syscall_ioprio_set }, /* 31 */ { .entry = &syscall_ioprio_get }, /* 32 */ { .entry = &syscall_flock }, /* 33 */ { .entry = &syscall_mknodat }, /* 34 */ { .entry = &syscall_mkdirat }, /* 35 */ { .entry = &syscall_unlinkat }, /* 36 */ { .entry = &syscall_symlinkat }, /* 37 */ { .entry = &syscall_linkat }, /* 38 */ { .entry = &syscall_renameat }, /* 39 */ { .entry = &syscall_umount }, /* 40 */ { .entry = &syscall_mount }, /* 41 */ { .entry = &syscall_pivot_root }, /* 42 */ { .entry = &syscall_ni_syscall }, /* 43 */ { .entry = &syscall_statfs }, /* 44 */ { .entry = &syscall_fstatfs }, /* 45 */ { .entry = &syscall_truncate }, /* 46 */ { .entry = &syscall_ftruncate }, /* 47 */ { .entry = &syscall_fallocate }, /* 48 */ { .entry = &syscall_faccessat }, /* 49 */ { .entry = &syscall_chdir }, /* 50 */ { .entry = &syscall_fchdir }, /* 51 */ { .entry = &syscall_chroot }, /* 52 */ { .entry = &syscall_fchmod }, /* 53 */ { .entry = &syscall_fchmodat }, /* 54 */ { .entry = &syscall_fchownat }, /* 55 */ { .entry = &syscall_fchown }, /* 56 */ { .entry = &syscall_openat }, /* 57 */ { .entry = &syscall_close }, /* 58 */ { .entry = &syscall_vhangup }, /* 59 */ { .entry = &syscall_pipe2 }, /* 60 */ { .entry = &syscall_quotactl }, /* 61 */ { .entry = &syscall_getdents64 }, /* 62 */ { .entry = &syscall_lseek }, /* 63 */ { .entry = &syscall_read }, /* 64 */ { .entry = &syscall_write }, /* 65 */ { .entry = &syscall_readv }, /* 66 */ { .entry = &syscall_writev }, /* 67 */ { .entry = &syscall_pread64 }, /* 68 */ { .entry = &syscall_pwrite64 }, /* 69 */ { .entry = &syscall_preadv }, /* 70 */ { .entry = &syscall_pwritev }, /* 71 */ { .entry = &syscall_sendfile64 }, /* 72 */ { .entry = &syscall_pselect6 }, /* 73 */ { .entry = &syscall_ppoll }, /* 74 */ { .entry = &syscall_signalfd4 }, /* 75 */ { .entry = &syscall_vmsplice }, /* 76 */ { .entry = &syscall_splice }, /* 77 */ { .entry = &syscall_tee }, /* 78 */ { .entry = &syscall_readlinkat }, /* 79 */ { .entry = &syscall_newfstatat }, /* 80 */ { .entry = &syscall_newfstat }, /* 81 */ { .entry = &syscall_sync }, /* 82 */ { .entry = &syscall_fsync }, /* 83 */ { .entry = &syscall_fdatasync }, /* 84 */ { .entry = &syscall_sync_file_range }, /* 85 */ { .entry = &syscall_timerfd_create }, /* 86 */ { .entry = &syscall_timerfd_settime }, /* 87 */ { .entry = &syscall_timerfd_gettime }, /* 88 */ { .entry = &syscall_utimensat }, /* 89 */ { .entry = &syscall_acct }, /* 90 */ { .entry = &syscall_capget }, /* 91 */ { .entry = &syscall_capset }, /* 92 */ { .entry = &syscall_personality }, /* 93 */ { .entry = &syscall_exit }, /* 94 */ { .entry = &syscall_exit_group }, /* 95 */ { .entry = &syscall_waitid }, /* 96 */ { .entry = &syscall_set_tid_address }, /* 97 */ { .entry = &syscall_unshare }, /* 98 */ { .entry = &syscall_futex }, /* 99 */ { .entry = &syscall_set_robust_list }, /* 100 */ { .entry = &syscall_get_robust_list }, /* 101 */ { .entry = &syscall_nanosleep }, /* 102 */ { .entry = &syscall_getitimer }, /* 103 */ { .entry = &syscall_setitimer }, /* 104 */ { .entry = &syscall_kexec_load }, /* 105 */ { .entry = &syscall_init_module }, /* 106 */ { .entry = &syscall_delete_module }, /* 107 */ { .entry = &syscall_timer_create }, /* 108 */ { .entry = &syscall_timer_gettime }, /* 109 */ { .entry = &syscall_timer_getoverrun }, /* 110 */ { .entry = &syscall_timer_settime }, /* 111 */ { .entry = &syscall_timer_delete }, /* 112 */ { .entry = &syscall_clock_settime }, /* 113 */ { .entry = &syscall_clock_gettime }, /* 114 */ { .entry = &syscall_clock_getres }, /* 115 */ { .entry = &syscall_clock_nanosleep }, /* 116 */ { .entry = &syscall_syslog }, /* 117 */ { .entry = &syscall_ptrace }, /* 118 */ { .entry = &syscall_sched_setparam }, /* 119 */ { .entry = &syscall_sched_setscheduler }, /* 120 */ { .entry = &syscall_sched_getscheduler }, /* 121 */ { .entry = &syscall_sched_getparam }, /* 122 */ { .entry = &syscall_sched_setaffinity }, /* 123 */ { .entry = &syscall_sched_getaffinity }, /* 124 */ { .entry = &syscall_sched_yield }, /* 125 */ { .entry = &syscall_sched_get_priority_max }, /* 126 */ { .entry = &syscall_sched_get_priority_min }, /* 127 */ { .entry = &syscall_sched_rr_get_interval }, /* 128 */ { .entry = &syscall_restart_syscall }, /* 129 */ { .entry = &syscall_kill }, /* 130 */ { .entry = &syscall_tkill }, /* 131 */ { .entry = &syscall_tgkill }, /* 132 */ { .entry = &syscall_sigaltstack }, /* 133 */ { .entry = &syscall_rt_sigsuspend }, /* 134 */ { .entry = &syscall_rt_sigaction }, /* 135 */ { .entry = &syscall_rt_sigprocmask }, /* 136 */ { .entry = &syscall_rt_sigpending }, /* 137 */ { .entry = &syscall_rt_sigtimedwait }, /* 138 */ { .entry = &syscall_rt_sigqueueinfo }, /* 139 */ { .entry = &syscall_rt_sigreturn }, /* 140 */ { .entry = &syscall_setpriority }, /* 141 */ { .entry = &syscall_getpriority }, /* 142 */ { .entry = &syscall_reboot }, /* 143 */ { .entry = &syscall_setregid }, /* 144 */ { .entry = &syscall_setgid }, /* 145 */ { .entry = &syscall_setreuid }, /* 146 */ { .entry = &syscall_setuid }, /* 147 */ { .entry = &syscall_setresuid }, /* 148 */ { .entry = &syscall_getresuid }, /* 149 */ { .entry = &syscall_setresgid }, /* 150 */ { .entry = &syscall_getresgid }, /* 151 */ { .entry = &syscall_setfsuid }, /* 152 */ { .entry = &syscall_setfsgid }, /* 153 */ { .entry = &syscall_times }, /* 154 */ { .entry = &syscall_setpgid }, /* 155 */ { .entry = &syscall_getpgid }, /* 156 */ { .entry = &syscall_getsid }, /* 157 */ { .entry = &syscall_setsid }, /* 158 */ { .entry = &syscall_getgroups }, /* 159 */ { .entry = &syscall_setgroups }, /* 160 */ { .entry = &syscall_newuname }, /* 161 */ { .entry = &syscall_sethostname }, /* 162 */ { .entry = &syscall_setdomainname }, /* 163 */ { .entry = &syscall_getrlimit }, /* 164 */ { .entry = &syscall_setrlimit }, /* 165 */ { .entry = &syscall_getrusage }, /* 166 */ { .entry = &syscall_umask }, /* 167 */ { .entry = &syscall_prctl }, /* 168 */ { .entry = &syscall_getcpu }, /* 169 */ { .entry = &syscall_gettimeofday }, /* 170 */ { .entry = &syscall_settimeofday }, /* 171 */ { .entry = &syscall_adjtimex }, /* 172 */ { .entry = &syscall_getpid }, /* 173 */ { .entry = &syscall_getppid }, /* 174 */ { .entry = &syscall_getuid }, /* 175 */ { .entry = &syscall_geteuid }, /* 176 */ { .entry = &syscall_getgid }, /* 177 */ { .entry = &syscall_getegid }, /* 178 */ { .entry = &syscall_gettid }, /* 179 */ { .entry = &syscall_sysinfo }, /* 180 */ { .entry = &syscall_mq_open }, /* 181 */ { .entry = &syscall_mq_unlink }, /* 182 */ { .entry = &syscall_mq_timedsend }, /* 183 */ { .entry = &syscall_mq_timedreceive }, /* 184 */ { .entry = &syscall_mq_notify }, /* 185 */ { .entry = &syscall_mq_getsetattr }, /* 186 */ { .entry = &syscall_msgget }, /* 187 */ { .entry = &syscall_msgctl }, /* 188 */ { .entry = &syscall_msgrcv }, /* 189 */ { .entry = &syscall_msgsnd }, /* 190 */ { .entry = &syscall_semget }, /* 191 */ { .entry = &syscall_semctl }, /* 192 */ { .entry = &syscall_semtimedop }, /* 193 */ { .entry = &syscall_semop }, /* 194 */ { .entry = &syscall_shmget }, /* 195 */ { .entry = &syscall_shmctl }, /* 196 */ { .entry = &syscall_shmat }, /* 197 */ { .entry = &syscall_shmdt }, /* 198 */ { .entry = &syscall_socket }, /* 199 */ { .entry = &syscall_socketpair }, /* 200 */ { .entry = &syscall_bind }, /* 201 */ { .entry = &syscall_listen }, /* 202 */ { .entry = &syscall_accept }, /* 203 */ { .entry = &syscall_connect }, /* 204 */ { .entry = &syscall_getsockname }, /* 205 */ { .entry = &syscall_getpeername }, /* 206 */ { .entry = &syscall_sendto }, /* 207 */ { .entry = &syscall_recvfrom }, /* 208 */ { .entry = &syscall_setsockopt }, /* 209 */ { .entry = &syscall_getsockopt }, /* 210 */ { .entry = &syscall_shutdown }, /* 211 */ { .entry = &syscall_sendmsg }, /* 212 */ { .entry = &syscall_recvmsg }, /* 213 */ { .entry = &syscall_readahead }, /* 214 */ { .entry = &syscall_brk }, /* 215 */ { .entry = &syscall_munmap }, /* 216 */ { .entry = &syscall_mremap }, /* 217 */ { .entry = &syscall_add_key }, /* 218 */ { .entry = &syscall_request_key }, /* 219 */ { .entry = &syscall_keyctl }, /* 220 */ { .entry = &syscall_clone }, /* 221 */ { .entry = &syscall_execve }, /* 222 */ { .entry = &syscall_mmap }, /* 223 */ { .entry = &syscall_fadvise64_64 }, /* 224 */ { .entry = &syscall_swapon }, /* 225 */ { .entry = &syscall_swapoff }, /* 226 */ { .entry = &syscall_mprotect }, /* 227 */ { .entry = &syscall_msync }, /* 228 */ { .entry = &syscall_mlock }, /* 229 */ { .entry = &syscall_munlock }, /* 230 */ { .entry = &syscall_mlockall }, /* 231 */ { .entry = &syscall_munlockall }, /* 232 */ { .entry = &syscall_mincore }, /* 233 */ { .entry = &syscall_madvise }, /* 234 */ { .entry = &syscall_remap_file_pages }, /* 235 */ { .entry = &syscall_mbind }, /* 236 */ { .entry = &syscall_get_mempolicy }, /* 237 */ { .entry = &syscall_set_mempolicy }, /* 238 */ { .entry = &syscall_migrate_pages }, /* 239 */ { .entry = &syscall_move_pages }, /* 240 */ { .entry = &syscall_rt_tgsigqueueinfo }, /* 241 */ { .entry = &syscall_perf_event_open }, /* 242 */ { .entry = &syscall_accept4 }, /* 243 */ { .entry = &syscall_recvmmsg }, /* 244 */ { .entry = &syscall_ni_syscall }, /* 245 */ { .entry = &syscall_ni_syscall }, /* 246 */ { .entry = &syscall_ni_syscall }, /* 247 */ { .entry = &syscall_ni_syscall }, /* 248 */ { .entry = &syscall_ni_syscall }, /* 249 */ { .entry = &syscall_ni_syscall }, /* 250 */ { .entry = &syscall_ni_syscall }, /* 251 */ { .entry = &syscall_ni_syscall }, /* 252 */ { .entry = &syscall_ni_syscall }, /* 253 */ { .entry = &syscall_ni_syscall }, /* 254 */ { .entry = &syscall_ni_syscall }, /* 255 */ { .entry = &syscall_ni_syscall }, /* 256 */ { .entry = &syscall_ni_syscall }, /* 257 */ { .entry = &syscall_ni_syscall }, /* 258 */ { .entry = &syscall_ni_syscall }, /* 259 */ { .entry = &syscall_ni_syscall }, /* 260 */ { .entry = &syscall_wait4 }, /* 261 */ { .entry = &syscall_prlimit64 }, /* 262 */ { .entry = &syscall_fanotify_init }, /* 263 */ { .entry = &syscall_fanotify_mark }, /* 264 */ { .entry = &syscall_name_to_handle_at }, /* 265 */ { .entry = &syscall_open_by_handle_at }, /* 266 */ { .entry = &syscall_clock_adjtime }, /* 267 */ { .entry = &syscall_syncfs }, /* 268 */ { .entry = &syscall_setns }, /* 269 */ { .entry = &syscall_sendmmsg }, /* 270 */ { .entry = &syscall_process_vm_readv }, /* 271 */ { .entry = &syscall_process_vm_writev }, /* 272 */ { .entry = &syscall_kcmp }, /* 273 */ { .entry = &syscall_finit_module }, /* 274 */ { .entry = &syscall_sched_setattr }, /* 275 */ { .entry = &syscall_sched_getattr }, /* 276 */ { .entry = &syscall_renameat2 }, /* 277 */ { .entry = &syscall_seccomp }, /* 278 */ { .entry = &syscall_getrandom }, /* 279 */ { .entry = &syscall_memfd_create }, #ifdef USE_BPF /* 280 */ { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif /* 281 */ { .entry = &syscall_execveat }, }; include/syscalls-alpha.h000066400000000000000000000604661445305223700156130ustar00rootroot00000000000000#pragma once /* * The Alpha Linux syscall table in all its gory mess. * * Derived from arch/alpha/include/uapi/asm/unistd.h */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_alpha[] = { /* 0 */ { .entry = &syscall_ni_syscall }, /* osf_syscall */ /* 1 */ { .entry = &syscall_exit }, /* 2 */ { .entry = &syscall_fork }, /* 3 */ { .entry = &syscall_read }, /* 4 */ { .entry = &syscall_write }, /* 5 */ { .entry = &syscall_ni_syscall }, /* osf_old_open */ /* 6 */ { .entry = &syscall_close }, /* 7 */ { .entry = &syscall_ni_syscall }, /* osf_wait4 */ /* 8 */ { .entry = &syscall_ni_syscall }, /* osf_old_creat */ /* 9 */ { .entry = &syscall_link }, /* 10 */ { .entry = &syscall_unlink }, /* 11 */ { .entry = &syscall_ni_syscall }, /* osf_execve */ /* 12 */ { .entry = &syscall_chdir }, /* 13 */ { .entry = &syscall_fchdir }, /* 14 */ { .entry = &syscall_mknod }, /* 15 */ { .entry = &syscall_chmod }, /* 16 */ { .entry = &syscall_chown }, /* 17 */ { .entry = &syscall_brk }, /* 18 */ { .entry = &syscall_ni_syscall }, /* osf_getfsstat */ /* 19 */ { .entry = &syscall_lseek }, /* 20 */ { .entry = &syscall_ni_syscall }, /* getxpid */ /* 21 */ { .entry = &syscall_ni_syscall }, /* osf_mount */ /* 22 */ { .entry = &syscall_umount }, /* 23 */ { .entry = &syscall_setuid }, /* 24 */ { .entry = &syscall_ni_syscall }, /* getxuid */ /* 25 */ { .entry = &syscall_ni_syscall }, /* exec_with_loader */ /* 26 */ { .entry = &syscall_ptrace }, /* 27 */ { .entry = &syscall_ni_syscall }, /* osf_nrecvmsg */ /* 28 */ { .entry = &syscall_ni_syscall }, /* osf_nsendmsg */ /* 29 */ { .entry = &syscall_ni_syscall }, /* osf_nrecvfrom */ /* 30 */ { .entry = &syscall_ni_syscall }, /* osf_naccept */ /* 31 */ { .entry = &syscall_ni_syscall }, /* osf_ngetpeername */ /* 32 */ { .entry = &syscall_ni_syscall }, /* osf_ngetsockname */ /* 33 */ { .entry = &syscall_access }, /* 34 */ { .entry = &syscall_ni_syscall }, /* osf_chflags */ /* 35 */ { .entry = &syscall_ni_syscall }, /* osf_fchflags */ /* 36 */ { .entry = &syscall_sync }, /* 37 */ { .entry = &syscall_kill }, /* 38 */ { .entry = &syscall_ni_syscall }, /* osf_old_stat */ /* 39 */ { .entry = &syscall_setpgid }, /* 40 */ { .entry = &syscall_ni_syscall }, /* osf_old_lstat */ /* 41 */ { .entry = &syscall_dup }, /* 42 */ { .entry = &syscall_pipe }, /* 43 */ { .entry = &syscall_ni_syscall }, /* osf_set_program_attributes */ /* 44 */ { .entry = &syscall_ni_syscall }, /* osf_profil */ /* 45 */ { .entry = &syscall_open }, /* 46 */ { .entry = &syscall_ni_syscall }, /* osf_old_sigaction */ /* 47 */ { .entry = &syscall_ni_syscall }, /* getxgid */ /* 48 */ { .entry = &syscall_ni_syscall }, /* osf_sigprocmask */ /* 49 */ { .entry = &syscall_ni_syscall }, /* osf_getlogin */ /* 50 */ { .entry = &syscall_ni_syscall }, /* osf_setlogin */ /* 51 */ { .entry = &syscall_acct }, /* 52 */ { .entry = &syscall_sigpending }, /* 53 */ { .entry = &syscall_ni_syscall }, /* 54 */ { .entry = &syscall_ioctl }, /* 55 */ { .entry = &syscall_ni_syscall }, /* osf_reboot */ /* 56 */ { .entry = &syscall_ni_syscall }, /* osf_revoke */ /* 57 */ { .entry = &syscall_symlink }, /* 58 */ { .entry = &syscall_readlink }, /* 59 */ { .entry = &syscall_execve }, /* 60 */ { .entry = &syscall_umask }, /* 61 */ { .entry = &syscall_chroot }, /* 62 */ { .entry = &syscall_ni_syscall }, /* osf_old_fstat */ /* 63 */ { .entry = &syscall_getpgrp }, /* 64 */ { .entry = &syscall_getpagesize }, /* 65 */ { .entry = &syscall_ni_syscall }, /* osf_mremap */ /* 66 */ { .entry = &syscall_vfork }, /* 67 */ { .entry = &syscall_stat }, /* 68 */ { .entry = &syscall_lstat }, /* 69 */ { .entry = &syscall_ni_syscall }, /* osf_sbrk */ /* 70 */ { .entry = &syscall_ni_syscall }, /* osf_sstk */ /* 71 */ { .entry = &syscall_mmap }, /* OSF/1 mmap is superset of Linux */ /* 72 */ { .entry = &syscall_ni_syscall }, /* osf_old_vadvise */ /* 73 */ { .entry = &syscall_munmap }, /* 74 */ { .entry = &syscall_mprotect }, /* 75 */ { .entry = &syscall_madvise }, /* 76 */ { .entry = &syscall_vhangup }, /* 77 */ { .entry = &syscall_ni_syscall }, /* osf_kmodcall */ /* 78 */ { .entry = &syscall_ni_syscall }, /* osf_mincore */ /* 79 */ { .entry = &syscall_getgroups }, /* 80 */ { .entry = &syscall_setgroups }, /* 81 */ { .entry = &syscall_ni_syscall }, /* osf_old_getpgrp */ /* 82 */ { .entry = &syscall_ni_syscall }, /* setpgrp (BSD alias for setpgid) */ /* 83 */ { .entry = &syscall_ni_syscall }, /* osf_setitimer */ /* 84 */ { .entry = &syscall_ni_syscall }, /* osf_old_wait */ /* 85 */ { .entry = &syscall_ni_syscall }, /* osf_table */ /* 86 */ { .entry = &syscall_ni_syscall }, /* osf_getitimer */ /* 87 */ { .entry = &syscall_ni_syscall }, /* sys_gethostname */ /* 88 */ { .entry = &syscall_sethostname }, /* 89 */ { .entry = &syscall_ni_syscall }, /* getdtablesize */ /* 90 */ { .entry = &syscall_dup2 }, /* 91 */ { .entry = &syscall_ni_syscall }, /* sys_fstat */ /* 92 */ { .entry = &syscall_fcntl }, /* 93 */ { .entry = &syscall_ni_syscall }, /* osf_select */ /* 94 */ { .entry = &syscall_poll }, /* 95 */ { .entry = &syscall_fsync }, /* 96 */ { .entry = &syscall_setpriority }, /* 97 */ { .entry = &syscall_socket }, /* 98 */ { .entry = &syscall_connect }, /* 99 */ { .entry = &syscall_accept }, /* 100 */ { .entry = &syscall_getpriority }, /* 101 */ { .entry = &syscall_send }, /* 102 */ { .entry = &syscall_recv }, /* 103 */ { .entry = &syscall_sigreturn }, /* 104 */ { .entry = &syscall_bind }, /* 105 */ { .entry = &syscall_setsockopt }, /* 106 */ { .entry = &syscall_listen }, /* 107 */ { .entry = &syscall_ni_syscall }, /* osf_plock */ /* 108 */ { .entry = &syscall_ni_syscall }, /* osf_old_sigvec */ /* 109 */ { .entry = &syscall_ni_syscall }, /* osf_old_sigblock */ /* 110 */ { .entry = &syscall_ni_syscall }, /* osf_old_sigsetmask */ /* 111 */ { .entry = &syscall_sigsuspend }, /* 112 */ { .entry = &syscall_ni_syscall }, /* osf_sigstack */ /* 113 */ { .entry = &syscall_recvmsg }, /* 114 */ { .entry = &syscall_sendmsg }, /* 115 */ { .entry = &syscall_ni_syscall }, /* osf_old_vtrace */ /* 116 */ { .entry = &syscall_ni_syscall }, /* osf_gettimeofday */ /* 117 */ { .entry = &syscall_ni_syscall }, /* osf_getrusage */ /* 118 */ { .entry = &syscall_getsockopt }, /* 119 */ { .entry = &syscall_ni_syscall }, /* 120 */ { .entry = &syscall_readv }, /* 121 */ { .entry = &syscall_writev }, /* 122 */ { .entry = &syscall_ni_syscall }, /* osf_settimeofday */ /* 123 */ { .entry = &syscall_fchown }, /* 124 */ { .entry = &syscall_fchmod }, /* 125 */ { .entry = &syscall_recvfrom }, /* 126 */ { .entry = &syscall_setreuid }, /* 127 */ { .entry = &syscall_setregid }, /* 128 */ { .entry = &syscall_rename }, /* 129 */ { .entry = &syscall_truncate }, /* 130 */ { .entry = &syscall_ftruncate }, /* 131 */ { .entry = &syscall_flock }, /* 132 */ { .entry = &syscall_setgid }, /* 133 */ { .entry = &syscall_sendto }, /* 134 */ { .entry = &syscall_shutdown }, /* 135 */ { .entry = &syscall_socketpair }, /* 136 */ { .entry = &syscall_mkdir }, /* 137 */ { .entry = &syscall_rmdir }, /* 138 */ { .entry = &syscall_ni_syscall }, /* osf_utimes */ /* 139 */ { .entry = &syscall_ni_syscall }, /* osf_old_sigreturn */ /* 140 */ { .entry = &syscall_ni_syscall }, /* osf_adjtime */ /* 141 */ { .entry = &syscall_getpeername }, /* 142 */ { .entry = &syscall_ni_syscall }, /* osf_gethostid */ /* 143 */ { .entry = &syscall_ni_syscall }, /* osf_sethostid */ /* 144 */ { .entry = &syscall_getrlimit }, /* 145 */ { .entry = &syscall_setrlimit }, /* 146 */ { .entry = &syscall_ni_syscall }, /* osf_old_killpg */ /* 147 */ { .entry = &syscall_setsid }, /* 148 */ { .entry = &syscall_quotactl }, /* 149 */ { .entry = &syscall_ni_syscall }, /* osf_oldquota */ /* 150 */ { .entry = &syscall_getsockname }, /* 151 */ { .entry = &syscall_ni_syscall }, /* 152 */ { .entry = &syscall_ni_syscall }, /* 153 */ { .entry = &syscall_ni_syscall }, /* osf_pid_block */ /* 154 */ { .entry = &syscall_ni_syscall }, /* osf_pid_unblock */ /* 155 */ { .entry = &syscall_ni_syscall }, /* 156 */ { .entry = &syscall_sigaction }, /* 157 */ { .entry = &syscall_ni_syscall }, /* osf_sigwaitprim */ /* 158 */ { .entry = &syscall_ni_syscall }, /* osf_nfssvc */ /* 159 */ { .entry = &syscall_ni_syscall }, /* osf_getdirentries */ /* 160 */ { .entry = &syscall_ni_syscall }, /* osf_statfs */ /* 161 */ { .entry = &syscall_ni_syscall }, /* osf_fstatfs */ /* 162 */ { .entry = &syscall_ni_syscall }, /* 163 */ { .entry = &syscall_ni_syscall }, /* osf_asynch_daemon */ /* 164 */ { .entry = &syscall_ni_syscall }, /* osf_getfh */ /* 165 */ { .entry = &syscall_ni_syscall }, /* osf_getdomainname */ /* 166 */ { .entry = &syscall_setdomainname }, /* 167 */ { .entry = &syscall_ni_syscall }, /* 168 */ { .entry = &syscall_ni_syscall }, /* 169 */ { .entry = &syscall_ni_syscall }, /* osf_exportfs */ /* 170 */ { .entry = &syscall_ni_syscall }, /* 171 */ { .entry = &syscall_ni_syscall }, /* 172 */ { .entry = &syscall_ni_syscall }, /* 173 */ { .entry = &syscall_ni_syscall }, /* 174 */ { .entry = &syscall_ni_syscall }, /* 175 */ { .entry = &syscall_ni_syscall }, /* 176 */ { .entry = &syscall_ni_syscall }, /* 177 */ { .entry = &syscall_ni_syscall }, /* 178 */ { .entry = &syscall_ni_syscall }, /* 179 */ { .entry = &syscall_ni_syscall }, /* 180 */ { .entry = &syscall_ni_syscall }, /* 181 */ { .entry = &syscall_ni_syscall }, /* osf_alt_plock */ /* 182 */ { .entry = &syscall_ni_syscall }, /* 183 */ { .entry = &syscall_ni_syscall }, /* 184 */ { .entry = &syscall_ni_syscall }, /* osf_getmnt */ /* 185 */ { .entry = &syscall_ni_syscall }, /* 186 */ { .entry = &syscall_ni_syscall }, /* 187 */ { .entry = &syscall_ni_syscall }, /* osf_alt_sigpending */ /* 188 */ { .entry = &syscall_ni_syscall }, /* osf_alt_setsid */ /* 189 */ { .entry = &syscall_ni_syscall }, /* 190 */ { .entry = &syscall_ni_syscall }, /* 191 */ { .entry = &syscall_ni_syscall }, /* 192 */ { .entry = &syscall_ni_syscall }, /* 193 */ { .entry = &syscall_ni_syscall }, /* 194 */ { .entry = &syscall_ni_syscall }, /* 195 */ { .entry = &syscall_ni_syscall }, /* 196 */ { .entry = &syscall_ni_syscall }, /* 197 */ { .entry = &syscall_ni_syscall }, /* 198 */ { .entry = &syscall_ni_syscall }, /* 199 */ { .entry = &syscall_ni_syscall }, /* osf_swapon */ /* 200 */ { .entry = &syscall_msgctl }, /* 201 */ { .entry = &syscall_msgget }, /* 202 */ { .entry = &syscall_msgrcv }, /* 203 */ { .entry = &syscall_msgsnd }, /* 204 */ { .entry = &syscall_semctl }, /* 205 */ { .entry = &syscall_semget }, /* 206 */ { .entry = &syscall_semop }, /* 207 */ { .entry = &syscall_ni_syscall }, /* osf_utsname */ /* 208 */ { .entry = &syscall_lchown }, /* 209 */ { .entry = &syscall_ni_syscall }, /* osf_shmat */ /* 210 */ { .entry = &syscall_shmctl }, /* 211 */ { .entry = &syscall_shmdt }, /* 212 */ { .entry = &syscall_shmget }, /* 213 */ { .entry = &syscall_ni_syscall }, /* osf_mvalid */ /* 214 */ { .entry = &syscall_ni_syscall }, /* osf_getaddressconf */ /* 215 */ { .entry = &syscall_ni_syscall }, /* osf_msleep */ /* 216 */ { .entry = &syscall_ni_syscall }, /* osf_mwakeup */ /* 217 */ { .entry = &syscall_msync }, /* 218 */ { .entry = &syscall_ni_syscall }, /* osf_signal */ /* 219 */ { .entry = &syscall_ni_syscall }, /* osf_utc_gettime */ /* 220 */ { .entry = &syscall_ni_syscall }, /* osf_utc_adjtime */ /* 221 */ { .entry = &syscall_ni_syscall }, /* 222 */ { .entry = &syscall_ni_syscall }, /* osf_security */ /* 223 */ { .entry = &syscall_ni_syscall }, /* osf_kloadcall */ /* 224 */ { .entry = &syscall_ni_syscall }, /* osf_stat */ /* 225 */ { .entry = &syscall_ni_syscall }, /* osf_lstat */ /* 226 */ { .entry = &syscall_ni_syscall }, /* osf_fstat */ /* 227 */ { .entry = &syscall_ni_syscall }, /* osf_statfs64 */ /* 228 */ { .entry = &syscall_ni_syscall }, /* osf_fstatfs64 */ /* 229 */ { .entry = &syscall_ni_syscall }, /* 230 */ { .entry = &syscall_ni_syscall }, /* 231 */ { .entry = &syscall_ni_syscall }, /* 232 */ { .entry = &syscall_ni_syscall }, /* 233 */ { .entry = &syscall_getpgid }, /* 234 */ { .entry = &syscall_getsid }, /* 235 */ { .entry = &syscall_sigaltstack }, /* 236 */ { .entry = &syscall_ni_syscall }, /* osf_waitid */ /* 237 */ { .entry = &syscall_ni_syscall }, /* osf_priocntlset */ /* 238 */ { .entry = &syscall_ni_syscall }, /* osf_sigsendset */ /* 239 */ { .entry = &syscall_ni_syscall }, /* osf_set_speculative */ /* 240 */ { .entry = &syscall_ni_syscall }, /* osf_msfs_syscall */ /* 241 */ { .entry = &syscall_ni_syscall }, /* osf_sysinfo */ /* 242 */ { .entry = &syscall_ni_syscall }, /* osf_uadmin */ /* 243 */ { .entry = &syscall_ni_syscall }, /* osf_fuser */ /* 244 */ { .entry = &syscall_ni_syscall }, /* osf_proplist_syscall */ /* 245 */ { .entry = &syscall_ni_syscall }, /* osf_ntp_adjtime */ /* 246 */ { .entry = &syscall_ni_syscall }, /* osf_ntp_gettime */ /* 247 */ { .entry = &syscall_ni_syscall }, /* osf_pathconf */ /* 248 */ { .entry = &syscall_ni_syscall }, /* osf_fpathconf */ /* 249 */ { .entry = &syscall_ni_syscall }, /* 250 */ { .entry = &syscall_ni_syscall }, /* osf_uswitch */ /* 251 */ { .entry = &syscall_ni_syscall }, /* osf_usleep_thread */ /* 252 */ { .entry = &syscall_ni_syscall }, /* osf_audcntl */ /* 253 */ { .entry = &syscall_ni_syscall }, /* osf_audgen */ /* 254 */ { .entry = &syscall_sysfs }, /* 255 */ { .entry = &syscall_ni_syscall }, /* osf_subsys_info */ /* 256 */ { .entry = &syscall_ni_syscall }, /* osf_getsysinfo */ /* 257 */ { .entry = &syscall_ni_syscall }, /* osf_setsysinfo */ /* 258 */ { .entry = &syscall_ni_syscall }, /* osf_afs_syscall */ /* 259 */ { .entry = &syscall_ni_syscall }, /* osf_swapctl */ /* 260 */ { .entry = &syscall_ni_syscall }, /* osf_memcntl */ /* 261 */ { .entry = &syscall_ni_syscall }, /* osf_fdatasync */ /* 262 */ { .entry = &syscall_ni_syscall }, /* 263 */ { .entry = &syscall_ni_syscall }, /* 264 */ { .entry = &syscall_ni_syscall }, /* 265 */ { .entry = &syscall_ni_syscall }, /* 266 */ { .entry = &syscall_ni_syscall }, /* 267 */ { .entry = &syscall_ni_syscall }, /* 268 */ { .entry = &syscall_ni_syscall }, /* 269 */ { .entry = &syscall_ni_syscall }, /* 270 */ { .entry = &syscall_ni_syscall }, /* 271 */ { .entry = &syscall_ni_syscall }, /* 272 */ { .entry = &syscall_ni_syscall }, /* 273 */ { .entry = &syscall_ni_syscall }, /* 274 */ { .entry = &syscall_ni_syscall }, /* 275 */ { .entry = &syscall_ni_syscall }, /* 276 */ { .entry = &syscall_ni_syscall }, /* 277 */ { .entry = &syscall_ni_syscall }, /* 278 */ { .entry = &syscall_ni_syscall }, /* 279 */ { .entry = &syscall_ni_syscall }, /* 280 */ { .entry = &syscall_ni_syscall }, /* 281 */ { .entry = &syscall_ni_syscall }, /* 282 */ { .entry = &syscall_ni_syscall }, /* 283 */ { .entry = &syscall_ni_syscall }, /* 284 */ { .entry = &syscall_ni_syscall }, /* 285 */ { .entry = &syscall_ni_syscall }, /* 286 */ { .entry = &syscall_ni_syscall }, /* 287 */ { .entry = &syscall_ni_syscall }, /* 288 */ { .entry = &syscall_ni_syscall }, /* 289 */ { .entry = &syscall_ni_syscall }, /* 290 */ { .entry = &syscall_ni_syscall }, /* 291 */ { .entry = &syscall_ni_syscall }, /* 292 */ { .entry = &syscall_ni_syscall }, /* 293 */ { .entry = &syscall_ni_syscall }, /* 294 */ { .entry = &syscall_ni_syscall }, /* 295 */ { .entry = &syscall_ni_syscall }, /* 296 */ { .entry = &syscall_ni_syscall }, /* 297 */ { .entry = &syscall_ni_syscall }, /* 298 */ { .entry = &syscall_ni_syscall }, /* 299 */ { .entry = &syscall_ni_syscall }, /* 300 */ { .entry = &syscall_bdflush }, /* 301 */ { .entry = &syscall_ni_syscall }, /* sethae */ /* 302 */ { .entry = &syscall_mount }, /* 303 */ { .entry = &syscall_ni_syscall }, /* old_adjtimex */ /* 304 */ { .entry = &syscall_swapoff }, /* 305 */ { .entry = &syscall_getdents }, /* 306 */ { .entry = &syscall_ni_syscall }, /* sys_create_module */ /* 307 */ { .entry = &syscall_init_module }, /* 308 */ { .entry = &syscall_delete_module }, /* 309 */ { .entry = &syscall_ni_syscall }, /* sys_get_kernel_syms */ /* 310 */ { .entry = &syscall_syslog }, /* 311 */ { .entry = &syscall_reboot }, /* 312 */ { .entry = &syscall_clone }, /* 313 */ { .entry = &syscall_uselib }, /* 314 */ { .entry = &syscall_mlock }, /* 315 */ { .entry = &syscall_munlock }, /* 316 */ { .entry = &syscall_mlockall }, /* 317 */ { .entry = &syscall_munlockall }, /* 318 */ { .entry = &syscall_sysinfo }, /* 319 */ { .entry = &syscall_sysctl }, /* 320 */ { .entry = &syscall_ni_syscall }, /* sys_idle */ /* 321 */ { .entry = &syscall_oldumount }, /* 322 */ { .entry = &syscall_swapon }, /* 323 */ { .entry = &syscall_times }, /* 324 */ { .entry = &syscall_personality }, /* 325 */ { .entry = &syscall_setfsuid }, /* 326 */ { .entry = &syscall_setfsgid }, /* 327 */ { .entry = &syscall_ustat }, /* 328 */ { .entry = &syscall_statfs }, /* 329 */ { .entry = &syscall_fstatfs }, /* 330 */ { .entry = &syscall_sched_setparam }, /* 331 */ { .entry = &syscall_sched_getparam }, /* 332 */ { .entry = &syscall_sched_setscheduler }, /* 333 */ { .entry = &syscall_sched_getscheduler }, /* 334 */ { .entry = &syscall_sched_yield }, /* 335 */ { .entry = &syscall_sched_get_priority_max }, /* 336 */ { .entry = &syscall_sched_get_priority_min }, /* 337 */ { .entry = &syscall_sched_rr_get_interval }, /* 338 */ { .entry = &syscall_ni_syscall }, /* sys_afs_syscall */ /* 339 */ { .entry = &syscall_uname }, /* 340 */ { .entry = &syscall_nanosleep }, /* 341 */ { .entry = &syscall_mremap }, /* 342 */ { .entry = &syscall_nfsservctl }, /* 343 */ { .entry = &syscall_setresuid }, /* 344 */ { .entry = &syscall_getresuid }, /* 345 */ { .entry = &syscall_pciconfig_read }, /* 346 */ { .entry = &syscall_pciconfig_write }, /* 347 */ { .entry = &syscall_ni_syscall }, /* sys_query_module */ /* 348 */ { .entry = &syscall_prctl }, /* 349 */ { .entry = &syscall_pread64 }, /* 350 */ { .entry = &syscall_pwrite64 }, /* 351 */ { .entry = &syscall_rt_sigreturn }, /* 352 */ { .entry = &syscall_rt_sigaction }, /* 353 */ { .entry = &syscall_rt_sigprocmask }, /* 354 */ { .entry = &syscall_rt_sigpending }, /* 355 */ { .entry = &syscall_rt_sigtimedwait }, /* 356 */ { .entry = &syscall_rt_sigqueueinfo }, /* 357 */ { .entry = &syscall_rt_sigsuspend }, /* 358 */ { .entry = &syscall_select }, /* 359 */ { .entry = &syscall_gettimeofday }, /* 360 */ { .entry = &syscall_settimeofday }, /* 361 */ { .entry = &syscall_getitimer }, /* 362 */ { .entry = &syscall_setitimer }, /* 363 */ { .entry = &syscall_utimes }, /* 364 */ { .entry = &syscall_getrusage }, /* 365 */ { .entry = &syscall_wait4 }, /* 366 */ { .entry = &syscall_adjtimex }, /* 367 */ { .entry = &syscall_getcwd }, /* 368 */ { .entry = &syscall_capget }, /* 369 */ { .entry = &syscall_capset }, /* 370 */ { .entry = &syscall_sendfile }, /* 371 */ { .entry = &syscall_setresgid }, /* 372 */ { .entry = &syscall_getresgid }, /* 373 */ { .entry = &syscall_ni_syscall }, /* dipc */ /* 374 */ { .entry = &syscall_pivot_root }, /* 375 */ { .entry = &syscall_mincore }, /* 376 */ { .entry = &syscall_pciconfig_iobase }, /* 377 */ { .entry = &syscall_getdents64 }, /* 378 */ { .entry = &syscall_gettid }, /* 379 */ { .entry = &syscall_readahead }, /* 380 */ { .entry = &syscall_ni_syscall }, /* 381 */ { .entry = &syscall_tkill }, /* 382 */ { .entry = &syscall_setxattr }, /* 383 */ { .entry = &syscall_lsetxattr }, /* 384 */ { .entry = &syscall_fsetxattr }, /* 385 */ { .entry = &syscall_getxattr }, /* 386 */ { .entry = &syscall_lgetxattr }, /* 387 */ { .entry = &syscall_fgetxattr }, /* 388 */ { .entry = &syscall_listxattr }, /* 389 */ { .entry = &syscall_llistxattr }, /* 390 */ { .entry = &syscall_flistxattr }, /* 391 */ { .entry = &syscall_removexattr }, /* 392 */ { .entry = &syscall_lremovexattr }, /* 393 */ { .entry = &syscall_fremovexattr }, /* 394 */ { .entry = &syscall_futex }, /* 395 */ { .entry = &syscall_sched_setaffinity }, /* 396 */ { .entry = &syscall_sched_getaffinity }, /* 397 */ { .entry = &syscall_ni_syscall }, /* tuxcall */ /* 398 */ { .entry = &syscall_io_setup }, /* 399 */ { .entry = &syscall_io_destroy }, /* 400 */ { .entry = &syscall_io_getevents }, /* 401 */ { .entry = &syscall_io_submit }, /* 402 */ { .entry = &syscall_io_cancel }, /* 405 */ { .entry = &syscall_exit_group }, /* 406 */ { .entry = &syscall_lookup_dcookie }, /* 407 */ { .entry = &syscall_epoll_create }, /* 408 */ { .entry = &syscall_epoll_ctl }, /* 409 */ { .entry = &syscall_epoll_wait }, /* 410 */ { .entry = &syscall_remap_file_pages }, /* 411 */ { .entry = &syscall_set_tid_address }, /* 412 */ { .entry = &syscall_restart_syscall }, /* 413 */ { .entry = &syscall_fadvise64 }, /* 414 */ { .entry = &syscall_timer_create }, /* 415 */ { .entry = &syscall_timer_settime }, /* 416 */ { .entry = &syscall_timer_gettime }, /* 417 */ { .entry = &syscall_timer_getoverrun }, /* 418 */ { .entry = &syscall_timer_delete }, /* 419 */ { .entry = &syscall_clock_settime }, /* 420 */ { .entry = &syscall_clock_gettime }, /* 421 */ { .entry = &syscall_clock_getres }, /* 422 */ { .entry = &syscall_clock_nanosleep }, /* 423 */ { .entry = &syscall_semtimedop }, /* 424 */ { .entry = &syscall_tgkill }, /* 425 */ { .entry = &syscall_stat64 }, /* 426 */ { .entry = &syscall_lstat64 }, /* 427 */ { .entry = &syscall_fstat64 }, /* 428 */ { .entry = &syscall_ni_syscall }, /* sys_vserver */ /* 429 */ { .entry = &syscall_mbind }, /* 430 */ { .entry = &syscall_get_mempolicy }, /* 431 */ { .entry = &syscall_set_mempolicy }, /* 432 */ { .entry = &syscall_mq_open }, /* 433 */ { .entry = &syscall_mq_unlink }, /* 434 */ { .entry = &syscall_mq_timedsend }, /* 435 */ { .entry = &syscall_mq_timedreceive }, /* 436 */ { .entry = &syscall_mq_notify }, /* 437 */ { .entry = &syscall_mq_getsetattr }, /* 438 */ { .entry = &syscall_waitid }, /* 439 */ { .entry = &syscall_add_key }, /* 440 */ { .entry = &syscall_request_key }, /* 441 */ { .entry = &syscall_keyctl }, /* 442 */ { .entry = &syscall_ioprio_set }, /* 443 */ { .entry = &syscall_ioprio_get }, /* 444 */ { .entry = &syscall_inotify_init }, /* 445 */ { .entry = &syscall_inotify_add_watch }, /* 446 */ { .entry = &syscall_inotify_rm_watch }, /* 447 */ { .entry = &syscall_fdatasync }, /* 448 */ { .entry = &syscall_kexec_load }, /* 449 */ { .entry = &syscall_migrate_pages }, /* 450 */ { .entry = &syscall_openat }, /* 451 */ { .entry = &syscall_mkdirat }, /* 452 */ { .entry = &syscall_mknodat }, /* 453 */ { .entry = &syscall_fchownat }, /* 454 */ { .entry = &syscall_futimesat }, /* 455 */ { .entry = &syscall_fstatat64 }, /* 456 */ { .entry = &syscall_unlinkat }, /* 457 */ { .entry = &syscall_renameat }, /* 458 */ { .entry = &syscall_linkat }, /* 459 */ { .entry = &syscall_symlinkat }, /* 460 */ { .entry = &syscall_readlinkat }, /* 461 */ { .entry = &syscall_fchmodat }, /* 462 */ { .entry = &syscall_faccessat }, /* 463 */ { .entry = &syscall_pselect6 }, /* 464 */ { .entry = &syscall_ppoll }, /* 465 */ { .entry = &syscall_unshare }, /* 466 */ { .entry = &syscall_set_robust_list }, /* 467 */ { .entry = &syscall_get_robust_list }, /* 468 */ { .entry = &syscall_splice }, /* 469 */ { .entry = &syscall_sync_file_range }, /* 470 */ { .entry = &syscall_tee }, /* 471 */ { .entry = &syscall_vmsplice }, /* 472 */ { .entry = &syscall_move_pages }, /* 473 */ { .entry = &syscall_getcpu }, /* 474 */ { .entry = &syscall_epoll_pwait }, /* 475 */ { .entry = &syscall_utimensat }, /* 476 */ { .entry = &syscall_signalfd }, /* 477 */ { .entry = &syscall_ni_syscall }, /* sys_timerfd */ /* 478 */ { .entry = &syscall_eventfd }, /* 479 */ { .entry = &syscall_recvmmsg }, /* 480 */ { .entry = &syscall_fallocate }, /* 481 */ { .entry = &syscall_timerfd_create }, /* 482 */ { .entry = &syscall_timerfd_settime }, /* 483 */ { .entry = &syscall_timerfd_gettime }, /* 484 */ { .entry = &syscall_signalfd4 }, /* 485 */ { .entry = &syscall_eventfd2 }, /* 486 */ { .entry = &syscall_epoll_create1 }, /* 487 */ { .entry = &syscall_dup3 }, /* 488 */ { .entry = &syscall_pipe2 }, /* 489 */ { .entry = &syscall_inotify_init1 }, /* 490 */ { .entry = &syscall_preadv }, /* 491 */ { .entry = &syscall_pwritev }, /* 492 */ { .entry = &syscall_rt_tgsigqueueinfo }, /* 493 */ { .entry = &syscall_perf_event_open }, /* 494 */ { .entry = &syscall_fanotify_init }, /* 495 */ { .entry = &syscall_fanotify_mark }, /* 496 */ { .entry = &syscall_prlimit64 }, /* 497 */ { .entry = &syscall_name_to_handle_at }, /* 498 */ { .entry = &syscall_open_by_handle_at }, /* 499 */ { .entry = &syscall_clock_adjtime }, /* 500 */ { .entry = &syscall_syncfs }, /* 501 */ { .entry = &syscall_setns }, /* 502 */ { .entry = &syscall_accept4 }, /* 503 */ { .entry = &syscall_sendmmsg }, /* 504 */ { .entry = &syscall_process_vm_readv }, /* 505 */ { .entry = &syscall_process_vm_writev }, /* 506 */ { .entry = &syscall_kcmp }, /* 507 */ { .entry = &syscall_finit_module }, /* 508 */ { .entry = &syscall_sched_setattr }, /* 509 */ { .entry = &syscall_sched_getattr }, /* 510 */ { .entry = &syscall_renameat2 }, /* 511 */ { .entry = &syscall_getrandom }, /* 512 */ { .entry = &syscall_memfd_create }, /* 513 */ { .entry = &syscall_execveat }, }; include/syscalls-arm.h000066400000000000000000000362311445305223700152760ustar00rootroot00000000000000#pragma once /* * derived from arch/arm/include/uapi/asm/unistd.h */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_arm[] = { /* 0 */ { .entry = &syscall_restart_syscall }, { .entry = &syscall_exit }, { .entry = &syscall_fork }, { .entry = &syscall_read }, { .entry = &syscall_write }, /* 5 */ { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_ni_syscall }, /* was sys_waitpid */ { .entry = &syscall_creat }, { .entry = &syscall_link }, /* 10 */ { .entry = &syscall_unlink }, { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_time }, /* used by libc4 */ { .entry = &syscall_mknod }, /* 15 */ { .entry = &syscall_chmod }, { .entry = &syscall_lchown16 }, { .entry = &syscall_ni_syscall }, /* was sys_break */ { .entry = &syscall_ni_syscall }, /* was sys_stat */ { .entry = &syscall_lseek }, /* 20 */ { .entry = &syscall_getpid }, { .entry = &syscall_mount }, { .entry = &syscall_oldumount }, /* used by libc4 */ { .entry = &syscall_setuid16 }, { .entry = &syscall_getuid16 }, /* 25 */ { .entry = &syscall_stime }, { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, /* used by libc4 */ { .entry = &syscall_ni_syscall }, /* was sys_fstat */ { .entry = &syscall_pause }, /* 30 */ { .entry = &syscall_utime }, /* used by libc4 */ { .entry = &syscall_ni_syscall }, /* was sys_stty */ { .entry = &syscall_ni_syscall }, /* was sys_getty */ { .entry = &syscall_access }, { .entry = &syscall_nice }, /* 35 */ { .entry = &syscall_ni_syscall }, /* was sys_ftime */ { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, /* 40 */ { .entry = &syscall_rmdir }, { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_ni_syscall }, /* was sys_prof */ /* 45 */ { .entry = &syscall_brk }, { .entry = &syscall_setgid16 }, { .entry = &syscall_getgid16 }, { .entry = &syscall_ni_syscall }, /* was sys_signal */ { .entry = &syscall_geteuid16 }, /* 50 */ { .entry = &syscall_getegid16 }, { .entry = &syscall_acct }, { .entry = &syscall_umount }, { .entry = &syscall_ni_syscall }, /* was sys_lock */ { .entry = &syscall_ioctl }, /* 55 */ { .entry = &syscall_fcntl }, { .entry = &syscall_ni_syscall }, /* was sys_mpx */ { .entry = &syscall_setpgid }, { .entry = &syscall_ni_syscall }, /* was sys_ulimit */ { .entry = &syscall_ni_syscall }, /* was sys_olduname */ /* 60 */ { .entry = &syscall_umask }, { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_getppid }, /* 65 */ { .entry = &syscall_getpgrp }, { .entry = &syscall_setsid }, { .entry = &syscall_sigaction }, { .entry = &syscall_ni_syscall }, /* was sys_sgetmask */ { .entry = &syscall_ni_syscall }, /* was sys_ssetmask */ /* 70 */ { .entry = &syscall_setreuid16 }, { .entry = &syscall_setregid16 }, { .entry = &syscall_sigsuspend }, { .entry = &syscall_sigpending }, { .entry = &syscall_sethostname }, /* 75 */ { .entry = &syscall_setrlimit }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_old_getrlimit },*/ /* used by libc4 */ { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, /* 80 */ { .entry = &syscall_getgroups16 }, { .entry = &syscall_setgroups16 }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_old_select },*/ /* used by libc4 */ { .entry = &syscall_symlink }, { .entry = &syscall_ni_syscall }, /* was sys_lstat */ /* 85 */ { .entry = &syscall_readlink }, { .entry = &syscall_uselib }, { .entry = &syscall_swapon }, { .entry = &syscall_reboot }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_old_readdir },*/ /* used by libc4 */ /* 90 */ { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_old_mmap },*/ /* used by libc4 */ { .entry = &syscall_munmap }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, /* 95 */ { .entry = &syscall_fchown16 }, { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_ni_syscall }, /* was sys_profil */ { .entry = &syscall_statfs }, /* 100 */ { .entry = &syscall_fstatfs }, { .entry = &syscall_ni_syscall }, /* sys_ioperm */ { .entry = &syscall_socketcall }, { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, /* 105 */ { .entry = &syscall_getitimer }, { .entry = &syscall_newstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_ni_syscall }, /* was sys_uname */ /* 110 */ { .entry = &syscall_ni_syscall }, /* was sys_iopl */ { .entry = &syscall_vhangup }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_syscall },*/ /* call a syscall */ { .entry = &syscall_wait4 }, /* 115 */ { .entry = &syscall_swapoff }, { .entry = &syscall_sysinfo }, { .entry = &syscall_ipc }, { .entry = &syscall_fsync }, { .entry = &syscall_sigreturn }, /* 120 */ { .entry = &syscall_clone }, { .entry = &syscall_setdomainname }, { .entry = &syscall_newuname }, { .entry = &syscall_ni_syscall }, /* modify_ldt */ { .entry = &syscall_adjtimex }, /* 125 */ { .entry = &syscall_mprotect }, { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, /* was sys_create_module */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, /* 130 */ { .entry = &syscall_ni_syscall }, /* was sys_get_kernel_syms */ { .entry = &syscall_quotactl }, { .entry = &syscall_getpgid }, { .entry = &syscall_fchdir }, { .entry = &syscall_bdflush }, /* 135 */ { .entry = &syscall_sysfs }, { .entry = &syscall_personality }, { .entry = &syscall_ni_syscall }, /* reserved for afs_syscall */ { .entry = &syscall_setfsuid16 }, { .entry = &syscall_setfsgid16 }, /* 140 */ { .entry = &syscall_llseek }, { .entry = &syscall_getdents }, { .entry = &syscall_select }, { .entry = &syscall_flock }, { .entry = &syscall_msync }, /* 145 */ { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_sysctl }, /* 150 */ { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, /* 155 */ { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, /* 160 */ { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_setresuid16 }, /* 165 */ { .entry = &syscall_getresuid16 }, { .entry = &syscall_ni_syscall }, /* vm86 */ { .entry = &syscall_ni_syscall }, /* was sys_query_module */ { .entry = &syscall_poll }, { .entry = &syscall_ni_syscall }, /* was nfsservctl */ /* 170 */ { .entry = &syscall_setresgid16 }, { .entry = &syscall_getresgid16 }, { .entry = &syscall_prctl }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, /* 175 */ { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, /* 180 */ { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_chown16 }, { .entry = &syscall_getcwd }, { .entry = &syscall_capget }, /* 185 */ { .entry = &syscall_capset }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_sendfile }, { .entry = &syscall_ni_syscall }, /* getpmsg */ { .entry = &syscall_ni_syscall }, /* putpmsg */ /* 190 */ { .entry = &syscall_vfork }, { .entry = &syscall_getrlimit }, { .entry = &syscall_mmap2 }, { .entry = &syscall_truncate64 }, { .entry = &syscall_ftruncate64 }, /* 195 */ { .entry = &syscall_stat64 }, { .entry = &syscall_lstat64 }, { .entry = &syscall_fstat64 }, { .entry = &syscall_lchown }, { .entry = &syscall_getuid }, /* 200 */ { .entry = &syscall_getgid }, { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, /* 205 */ { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_fchown }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, /* 210 */ { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_chown }, { .entry = &syscall_setuid }, { .entry = &syscall_setgid }, /* 215 */ { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_getdents64 }, { .entry = &syscall_pivot_root }, { .entry = &syscall_mincore }, /* 220 */ { .entry = &syscall_madvise }, { .entry = &syscall_fcntl }, /* fcntl64 */ { .entry = &syscall_ni_syscall }, /* TUX */ { .entry = &syscall_ni_syscall }, { .entry = &syscall_gettid }, /* 225 */ { .entry = &syscall_readahead }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, /* 230 */ { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, /* 235 */ { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_tkill }, { .entry = &syscall_sendfile64 }, /* 240 */ { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, /* 245 */ { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_exit_group }, { .entry = &syscall_lookup_dcookie }, /* 250 */ { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_remap_file_pages }, { .entry = &syscall_ni_syscall }, /* sys_set_thread_area */ /* 255 */ { .entry = &syscall_ni_syscall }, /* sys_get_thread_area */ { .entry = &syscall_set_tid_address }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, /* 260 */ { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, /* 265 */ { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_tgkill }, { .entry = &syscall_utimes }, /* 270 */ { .entry = &syscall_arm_fadvise64_64 }, { .entry = &syscall_pciconfig_iobase }, { .entry = &syscall_pciconfig_read }, { .entry = &syscall_pciconfig_write }, { .entry = &syscall_mq_open }, /* 275 */ { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, /* 280 */ { .entry = &syscall_waitid }, { .entry = &syscall_socket }, { .entry = &syscall_bind }, { .entry = &syscall_connect }, { .entry = &syscall_listen }, /* 285 */ { .entry = &syscall_accept }, { .entry = &syscall_getsockname }, { .entry = &syscall_getpeername }, { .entry = &syscall_socketpair }, { .entry = &syscall_send }, /* 290 */ { .entry = &syscall_sendto }, { .entry = &syscall_recv }, { .entry = &syscall_recvfrom }, { .entry = &syscall_shutdown }, { .entry = &syscall_setsockopt }, /* 295 */ { .entry = &syscall_getsockopt }, { .entry = &syscall_sendmsg }, { .entry = &syscall_recvmsg }, { .entry = &syscall_semop }, { .entry = &syscall_semget }, /* 300 */ { .entry = &syscall_semctl }, { .entry = &syscall_msgsnd }, { .entry = &syscall_msgrcv }, { .entry = &syscall_msgget }, { .entry = &syscall_msgctl }, /* 305 */ { .entry = &syscall_shmat }, { .entry = &syscall_shmdt }, { .entry = &syscall_shmget }, { .entry = &syscall_shmctl }, { .entry = &syscall_add_key }, /* 310 */ { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_semtimedop }, /* vserver */ { .entry = &syscall_ni_syscall }, { .entry = &syscall_ioprio_set }, /* 315 */ { .entry = &syscall_ioprio_get }, { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_mbind }, /* 320 */ { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, /* 325 */ { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, /* 330 */ { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, /* 335 */ { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, /* 340 */ { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range2 }, { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, /* 345 */ { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_kexec_load }, { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, /* 350 */ { .entry = &syscall_timerfd_create }, { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, /* 355 */ { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, /* 360 */ { .entry = &syscall_inotify_init1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, /* 365 */ { .entry = &syscall_recvmmsg }, { .entry = &syscall_accept4 }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, /* 370 */ { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, /* 375 */ { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, /* 380 */ { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_renameat2 }, { .entry = &syscall_seccomp }, { .entry = &syscall_getrandom }, /* 385 */ { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif { .entry = &syscall_execveat }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, }; include/syscalls-i386.h000066400000000000000000000374371445305223700152210ustar00rootroot00000000000000#pragma once /* Syscalls from arch/x86/entry/syscalls/syscall_32.tbl */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_i386[] = { { .entry = &syscall_restart_syscall }, { .entry = &syscall_exit }, { .entry = &syscall_fork }, { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_waitpid }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_time }, { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, { .entry = &syscall_lchown16 }, { .entry = &syscall_ni_syscall }, /* obsolete "break" syscall */ { .entry = &syscall_statfs }, { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, { .entry = &syscall_mount }, { .entry = &syscall_oldumount }, { .entry = &syscall_setuid16 }, { .entry = &syscall_getuid16 }, { .entry = &syscall_stime }, { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, { .entry = &syscall_fstatfs }, { .entry = &syscall_pause }, { .entry = &syscall_utime }, { .entry = &syscall_ni_syscall }, /* obsolete "stty" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "gtty" syscall */ { .entry = &syscall_access }, { .entry = &syscall_nice }, { .entry = &syscall_ni_syscall }, /* obsolete "ftime" syscall */ { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_ni_syscall }, /* obsolete "prof" syscall */ { .entry = &syscall_brk }, { .entry = &syscall_setgid16 }, { .entry = &syscall_getgid16 }, { .entry = &syscall_signal }, { .entry = &syscall_geteuid16 }, { .entry = &syscall_getegid16 }, { .entry = &syscall_acct }, { .entry = &syscall_umount }, { .entry = &syscall_ni_syscall }, /* obsolete "lock" syscall */ { .entry = &syscall_ioctl }, { .entry = &syscall_fcntl }, { .entry = &syscall_ni_syscall }, /* obsolete "mpx" syscall */ { .entry = &syscall_setpgid }, { .entry = &syscall_ni_syscall }, /* obsolete "ulimit" syscall */ { .entry = &syscall_olduname }, { .entry = &syscall_umask }, { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, { .entry = &syscall_setsid }, { .entry = &syscall_sigaction }, { .entry = &syscall_sgetmask }, { .entry = &syscall_ssetmask }, { .entry = &syscall_setreuid16 }, { .entry = &syscall_setregid16 }, { .entry = &syscall_sigsuspend }, { .entry = &syscall_sigpending }, { .entry = &syscall_sethostname }, { .entry = &syscall_setrlimit }, { .entry = &syscall_getrlimit }, { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, { .entry = &syscall_getgroups16 }, { .entry = &syscall_setgroups16 }, { .entry = &syscall_select }, { .entry = &syscall_symlink }, { .entry = &syscall_lstat }, { .entry = &syscall_readlink }, { .entry = &syscall_uselib }, { .entry = &syscall_swapon }, { .entry = &syscall_reboot }, { .entry = &syscall_oldreaddir }, { .entry = &syscall_mmap }, { .entry = &syscall_munmap }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, { .entry = &syscall_fchown16 }, { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_ni_syscall }, /* obsolete "profil" syscall */ { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, { .entry = &syscall_ioperm }, { .entry = &syscall_socketcall }, { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, { .entry = &syscall_getitimer }, { .entry = &syscall_newstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_uname }, { .entry = &syscall_iopl }, { .entry = &syscall_vhangup }, { .entry = &syscall_ni_syscall }, /* obsolete "idle" syscall */ { .entry = &syscall_vm86old }, { .entry = &syscall_wait4 }, { .entry = &syscall_swapoff }, { .entry = &syscall_sysinfo }, { .entry = &syscall_ipc }, { .entry = &syscall_fsync }, { .entry = &syscall_sigreturn }, { .entry = &syscall_clone }, { .entry = &syscall_setdomainname }, { .entry = &syscall_uname }, { .entry = &syscall_modify_ldt }, { .entry = &syscall_adjtimex }, { .entry = &syscall_mprotect }, { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, /* obsolete "create_module" syscall */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* obsolete "get_kernel_syms" syscall */ { .entry = &syscall_quotactl }, { .entry = &syscall_getpgid }, { .entry = &syscall_fchdir }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, { .entry = &syscall_personality }, { .entry = &syscall_ni_syscall }, /* obsolete "afs" syscall */ { .entry = &syscall_setfsuid16 }, { .entry = &syscall_setfsgid16 }, { .entry = &syscall_llseek }, { .entry = &syscall_getdents }, { .entry = &syscall_select }, { .entry = &syscall_flock }, { .entry = &syscall_msync }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_sysctl }, { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_setresuid16 }, { .entry = &syscall_getresuid16 }, { .entry = &syscall_vm86 }, { .entry = &syscall_ni_syscall }, /* obsolete "query_module" syscall */ { .entry = &syscall_poll }, { .entry = &syscall_nfsservctl }, { .entry = &syscall_setresgid16 }, { .entry = &syscall_getresgid16 }, { .entry = &syscall_prctl }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_chown16 }, { .entry = &syscall_getcwd }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_sendfile }, { .entry = &syscall_ni_syscall }, /* obsolete "streams1" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "streams2" syscall */ { .entry = &syscall_vfork }, { .entry = &syscall_getrlimit }, { .entry = &syscall_mmap2 }, { .entry = &syscall_truncate64 }, { .entry = &syscall_ftruncate64 }, { .entry = &syscall_stat64 }, { .entry = &syscall_lstat64 }, { .entry = &syscall_fstat64 }, { .entry = &syscall_lchown }, { .entry = &syscall_getuid }, { .entry = &syscall_getgid }, { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_fchown }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_chown }, { .entry = &syscall_setuid }, { .entry = &syscall_setgid }, { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_pivot_root }, { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, { .entry = &syscall_getdents64 }, { .entry = &syscall_fcntl }, /* fcntl64 */ { .entry = &syscall_ni_syscall }, /* obsolete "tux" syscall */ { .entry = &syscall_ni_syscall }, /* unused slot */ { .entry = &syscall_gettid }, { .entry = &syscall_readahead }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_tkill }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_ni_syscall }, /* obsolete "set_thread_area" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "get_thread_area" syscall */ { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_fadvise64 }, { .entry = &syscall_ni_syscall }, /* obsolete "set_zone_reclaim" syscall */ { .entry = &syscall_exit_group }, { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_remap_file_pages }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_tgkill }, { .entry = &syscall_utimes }, { .entry = &syscall_fadvise64_64 }, { .entry = &syscall_ni_syscall }, /* obsolete "vserver" syscall */ { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_kexec_load }, { .entry = &syscall_waitid }, { .entry = &syscall_ni_syscall }, /* obsolete "setaltroot" syscall */ { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_renameat2 }, { .entry = &syscall_seccomp }, { .entry = &syscall_getrandom }, { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif { .entry = &syscall_execveat }, { .entry = &syscall_socket }, { .entry = &syscall_socketpair }, { .entry = &syscall_bind }, { .entry = &syscall_connect }, { .entry = &syscall_listen }, { .entry = &syscall_accept4 }, { .entry = &syscall_getsockopt }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockname }, { .entry = &syscall_getpeername }, { .entry = &syscall_sendto }, { .entry = &syscall_sendmsg }, { .entry = &syscall_recvfrom }, { .entry = &syscall_recvmsg }, { .entry = &syscall_shutdown }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, { .entry = &syscall_mlock2 }, { .entry = &syscall_copy_file_range }, { .entry = &syscall_preadv2 }, { .entry = &syscall_pwritev2 }, { .entry = &syscall_pkey_mprotect }, { .entry = &syscall_pkey_alloc }, { .entry = &syscall_pkey_free }, { .entry = &syscall_statx }, { .entry = NULL }, /* we don't care about arch_prctl */ { .entry = &syscall_io_pgetevents }, { .entry = &syscall_rseq }, { .entry = &syscall_semget }, { .entry = &syscall_semctl }, { .entry = &syscall_shmget }, { .entry = &syscall_shmctl }, { .entry = &syscall_shmat }, { .entry = &syscall_shmdt }, { .entry = &syscall_msgget }, { .entry = &syscall_msgsnd }, { .entry = &syscall_msgrcv }, { .entry = &syscall_msgctl }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_utimensat }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_io_pgetevents }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_semtimedop }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_futex }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_pidfd_send_signal }, { .entry = &syscall_io_uring_setup }, { .entry = &syscall_io_uring_enter }, { .entry = &syscall_io_uring_register }, { .entry = &syscall_open_tree}, { .entry = &syscall_move_mount}, { .entry = &syscall_fsopen }, { .entry = &syscall_fsconfig }, { .entry = &syscall_fsmount }, { .entry = &syscall_fspick }, { .entry = &syscall_pidfd_open }, { .entry = &syscall_clone3 }, { .entry = &syscall_close_range }, { .entry = &syscall_openat2 }, { .entry = &syscall_pidfd_getfd }, { .entry = &syscall_faccessat2 }, { .entry = &syscall_process_madvise }, { .entry = &syscall_epoll_pwait2 }, { .entry = &syscall_mount_setattr }, { .entry = &syscall_quotactl_fd }, { .entry = &syscall_landlock_create_ruleset }, { .entry = &syscall_landlock_add_rule }, { .entry = &syscall_landlock_restrict_self }, { .entry = &syscall_memfd_secret }, { .entry = &syscall_process_mrelease }, { .entry = &syscall_futex_waitv }, { .entry = &syscall_set_mempolicy_home_node }, }; include/syscalls-ia64.h000066400000000000000000000261601445305223700152620ustar00rootroot00000000000000#pragma once /* Syscalls from arch/ia64/kernel/entry.S */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_ia64[] = { { .entry = &syscall_ni_syscall }, { .entry = &syscall_exit }, { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_fchdir }, { .entry = &syscall_utimes }, { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, { .entry = &syscall_chown }, { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, { .entry = &syscall_getppid }, { .entry = &syscall_mount }, { .entry = &syscall_umount }, { .entry = &syscall_setuid }, { .entry = &syscall_getuid }, { .entry = &syscall_geteuid }, { .entry = &syscall_ptrace }, { .entry = &syscall_access }, { .entry = &syscall_sync }, { .entry = &syscall_fsync }, { .entry = &syscall_fdatasync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_brk }, { .entry = &syscall_setgid }, { .entry = &syscall_getgid }, { .entry = &syscall_getegid }, { .entry = &syscall_acct }, { .entry = &syscall_ioctl }, { .entry = &syscall_fcntl }, { .entry = &syscall_umask }, { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_getresuid }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresgid }, { .entry = &syscall_setresgid }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_getpgid }, { .entry = &syscall_setpgid }, { .entry = &syscall_setsid }, { .entry = &syscall_getsid }, { .entry = &syscall_sethostname }, { .entry = &syscall_setrlimit }, { .entry = &syscall_getrlimit }, { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, { .entry = &syscall_select }, { .entry = &syscall_poll }, { .entry = &syscall_symlink }, { .entry = &syscall_readlink }, { .entry = &syscall_uselib }, { .entry = &syscall_swapon }, { .entry = &syscall_swapoff }, { .entry = &syscall_reboot }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, { .entry = &syscall_fchown }, { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, { .entry = &syscall_gettid }, { .entry = &syscall_semget }, { .entry = &syscall_semop }, { .entry = &syscall_semctl }, { .entry = &syscall_msgget }, { .entry = &syscall_msgsnd }, { .entry = &syscall_msgrcv }, { .entry = &syscall_msgctl }, { .entry = &syscall_shmget }, { .entry = &syscall_shmat }, { .entry = &syscall_shmdt }, { .entry = &syscall_shmctl }, { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, { .entry = &syscall_getitimer }, { .entry = &syscall_ni_syscall }, /* obsolete "tux" syscall */ { .entry = &syscall_ni_syscall }, // ia64_oldlstat { .entry = &syscall_ni_syscall }, // ia64_oldfstat { .entry = &syscall_vhangup }, { .entry = &syscall_lchown }, { .entry = &syscall_remap_file_pages }, { .entry = &syscall_wait4 }, { .entry = &syscall_sysinfo }, { .entry = &syscall_clone }, { .entry = &syscall_setdomainname }, { .entry = &syscall_newuname }, { .entry = &syscall_adjtimex }, { .entry = &syscall_ni_syscall }, /* obsolete "create_module" syscall */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, // ? { .entry = &syscall_ni_syscall }, /* obsolete "query_module" syscall */ { .entry = &syscall_quotactl }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, { .entry = &syscall_personality }, { .entry = &syscall_ni_syscall }, /* obsolete "afs" syscall */ { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_getdents }, { .entry = &syscall_flock }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_sysctl }, { .entry = &syscall_mmap }, { .entry = &syscall_munmap }, { .entry = &syscall_mlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_mprotect }, { .entry = &syscall_mremap }, { .entry = &syscall_msync }, { .entry = &syscall_munlock }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_nfsservctl }, { .entry = &syscall_prctl }, { .entry = &syscall_getpagesize }, { .entry = &syscall_mmap2 }, { .entry = &syscall_pciconfig_read }, { .entry = &syscall_pciconfig_write }, { .entry = &syscall_perfmonctl }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_getcwd }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_ni_syscall }, /* obsolete "getpmsg" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "putpmsg" syscall */ { .entry = &syscall_socket }, { .entry = &syscall_bind }, { .entry = &syscall_connect }, { .entry = &syscall_listen }, { .entry = &syscall_accept }, { .entry = &syscall_getsockname }, { .entry = &syscall_getpeername }, { .entry = &syscall_socketpair }, { .entry = &syscall_send }, { .entry = &syscall_sendto }, { .entry = &syscall_recv }, { .entry = &syscall_recvfrom }, { .entry = &syscall_shutdown }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockopt }, { .entry = &syscall_sendmsg }, { .entry = &syscall_recvmsg }, { .entry = &syscall_pivot_root }, { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, { .entry = &syscall_newstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_clone2 }, { .entry = &syscall_getdents64 }, { .entry = &syscall_getunwind }, { .entry = &syscall_readahead }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_tkill }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_fadvise64_64 }, { .entry = &syscall_tgkill }, { .entry = &syscall_exit_group }, { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_restart_syscall }, { .entry = &syscall_semtimedop }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_statfs64 }, { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_kexec_load }, { .entry = &syscall_ni_syscall }, /* obsolete "vserver" syscall */ { .entry = &syscall_waitid }, { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_ni_syscall }, /* ? */ { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_newfstatat }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ni_syscall }, /* ? */ { .entry = &syscall_unshare }, { .entry = &syscall_splice }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, { .entry = &syscall_fallocate }, { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, { .entry = &syscall_ni_syscall }, /* ? */ { .entry = &syscall_eventfd }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_setns }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_accept4 }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_renameat2 }, { .entry = &syscall_getrandom }, { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, { .entry = &syscall_kcmp }, }; include/syscalls-mips-64.h000066400000000000000000000303331445305223700157130ustar00rootroot00000000000000#pragma once /* Syscalls from arch/mips/kernel/scall64-64.S */ struct syscalltable syscalls_mips[] = { { .entry = &syscall_read }, /* 5000 */ { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_newstat }, { .entry = &syscall_newfstat }, /* 5005 */ { .entry = &syscall_newlstat }, { .entry = &syscall_poll }, { .entry = &syscall_lseek }, { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_mips_mmap }, */ { .entry = &syscall_mprotect }, /* 5010 */ { .entry = &syscall_munmap }, { .entry = &syscall_brk }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_ioctl }, /* 5015 */ { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_access }, /* 5020 */ { .entry = &syscall_pipe }, { .entry = &syscall_select }, { .entry = &syscall_sched_yield }, { .entry = &syscall_mremap }, { .entry = &syscall_msync }, /* 5025 */ { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, { .entry = &syscall_shmget }, { .entry = &syscall_shmat }, { .entry = &syscall_shmctl }, /* 5030 */ { .entry = &syscall_dup }, { .entry = &syscall_dup2 }, { .entry = &syscall_pause }, { .entry = &syscall_nanosleep }, { .entry = &syscall_getitimer }, /* 5035 */ { .entry = &syscall_setitimer }, { .entry = &syscall_alarm }, { .entry = &syscall_getpid }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_socket }, /* 5040 */ { .entry = &syscall_connect }, { .entry = &syscall_accept }, { .entry = &syscall_sendto }, { .entry = &syscall_recvfrom }, { .entry = &syscall_sendmsg }, /* 5045 */ { .entry = &syscall_recvmsg }, { .entry = &syscall_shutdown }, { .entry = &syscall_bind }, { .entry = &syscall_listen }, { .entry = &syscall_getsockname }, /* 5050 */ { .entry = &syscall_getpeername }, { .entry = &syscall_socketpair }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockopt }, { .entry = &syscall_clone }, /* 5055 */ { .entry = &syscall_fork }, { .entry = &syscall_execve }, { .entry = &syscall_exit }, { .entry = &syscall_wait4 }, { .entry = &syscall_kill }, /* 5060 */ { .entry = &syscall_newuname }, { .entry = &syscall_semget }, { .entry = &syscall_semop }, { .entry = &syscall_semctl }, { .entry = &syscall_shmdt }, /* 5065 */ { .entry = &syscall_msgget }, { .entry = &syscall_msgsnd }, { .entry = &syscall_msgrcv }, { .entry = &syscall_msgctl }, { .entry = &syscall_fcntl }, /* 5070 */ { .entry = &syscall_flock }, { .entry = &syscall_fsync }, { .entry = &syscall_fdatasync }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, /* 5075 */ { .entry = &syscall_getdents }, { .entry = &syscall_getcwd }, { .entry = &syscall_chdir }, { .entry = &syscall_fchdir }, { .entry = &syscall_rename }, /* 5080 */ { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, /* 5085 */ { .entry = &syscall_symlink }, { .entry = &syscall_readlink }, { .entry = &syscall_chmod }, { .entry = &syscall_fchmod }, { .entry = &syscall_chown }, /* 5090 */ { .entry = &syscall_fchown }, { .entry = &syscall_lchown }, { .entry = &syscall_umask }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_getrlimit }, /* 5095 */ { .entry = &syscall_getrusage }, { .entry = &syscall_sysinfo }, { .entry = &syscall_times }, { .entry = &syscall_ptrace }, { .entry = &syscall_getuid }, /* 5100 */ { .entry = &syscall_syslog }, { .entry = &syscall_getgid }, { .entry = &syscall_setuid }, { .entry = &syscall_setgid }, { .entry = &syscall_geteuid }, /* 5105 */ { .entry = &syscall_getegid }, { .entry = &syscall_setpgid }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, { .entry = &syscall_setsid }, /* 5110 */ { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_setresuid }, /* 5115 */ { .entry = &syscall_getresuid }, { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_getpgid }, { .entry = &syscall_setfsuid }, /* 5120 */ { .entry = &syscall_setfsgid }, { .entry = &syscall_getsid }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_rt_sigpending }, /* 5125 */ { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_utime }, /* 5130 */ { .entry = &syscall_mknod }, { .entry = &syscall_personality }, { .entry = &syscall_ustat }, { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, /* 5135 */ { .entry = &syscall_sysfs }, { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, /* 5140 */ { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, /* 5145 */ { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_vhangup }, /* 5150 */ { .entry = &syscall_pivot_root }, { .entry = &syscall_sysctl }, { .entry = &syscall_prctl }, { .entry = &syscall_adjtimex }, { .entry = &syscall_setrlimit }, /* 5155 */ { .entry = &syscall_chroot }, { .entry = &syscall_sync }, { .entry = &syscall_acct }, { .entry = &syscall_settimeofday }, { .entry = &syscall_mount }, /* 5160 */ { .entry = &syscall_umount }, { .entry = &syscall_swapon }, { .entry = &syscall_swapoff }, { .entry = &syscall_reboot }, { .entry = &syscall_sethostname }, /* 5165 */ { .entry = &syscall_setdomainname }, { .entry = &syscall_ni_syscall }, /* was create_module */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* 5170, was get_kernel_syms */ { .entry = &syscall_ni_syscall }, /* was query_module */ { .entry = &syscall_quotactl }, { .entry = &syscall_ni_syscall }, /* was nfsservctl */ { .entry = &syscall_ni_syscall }, /* res. for getpmsg */ { .entry = &syscall_ni_syscall }, /* 5175 for putpmsg */ { .entry = &syscall_ni_syscall }, /* res. for afs_syscall */ { .entry = &syscall_ni_syscall }, /* res. for security */ { .entry = &syscall_gettid }, { .entry = &syscall_readahead }, { .entry = &syscall_setxattr }, /* 5180 */ { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, /* 5185 */ { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, /* 5190 */ { .entry = &syscall_fremovexattr }, { .entry = &syscall_tkill }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, /* 5195 */ { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_cacheflush }, */ { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_cachectl }, */ { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_sysmips }, */ { .entry = &syscall_io_setup }, /* 5200 */ { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_exit_group }, /* 5205 */ { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_remap_file_pages }, /* 5210 */ { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_restart_syscall }, { .entry = &syscall_semtimedop }, { .entry = &syscall_fadvise64_64 }, /* 5215 */ { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, /* 5220 */ { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_tgkill }, /* 5225 */ { .entry = &syscall_utimes }, { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_mq_open }, /* 5230 */ { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, /* 5235 */ { .entry = &syscall_ni_syscall }, /* sys_vserver */ { .entry = &syscall_waitid }, { .entry = &syscall_ni_syscall }, /* available, was setaltroot */ { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, /* 5240 */ { .entry = &syscall_keyctl }, { .entry = &syscall_ni_syscall }, /* obsolete "set_thread_area" syscall */ { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, /* 5245 */ { .entry = &syscall_migrate_pages }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, /* 5250 */ { .entry = &syscall_futimesat }, { .entry = &syscall_newfstatat }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, /* 5255 */ { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_pselect6 }, /* 5260 */ { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_tee }, /* 5265 */ { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_kexec_load }, /* 5270 */ { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_utimensat }, /* 5275 */ { .entry = &syscall_signalfd }, { .entry = &syscall_ni_syscall }, /* was timerfd */ { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, { .entry = &syscall_timerfd_create }, /* 5280 */ { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, /* 5285 */ { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, /* 5290 */ { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_accept4 }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_fanotify_init }, /* 5295 */ { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, /* 5300 */ { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, /* 5305 */ { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_getdents64 }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, /* 5310 */ { .entry = &syscall_renameat2 }, { .entry = &syscall_seccomp }, { .entry = &syscall_getrandom }, { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, /* 5315 */ #else { .entry = NULL }, #endif { .entry = &syscall_execveat }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, { .entry = &syscall_mlock2 }, { .entry = &syscall_copy_file_range }, /* 5320 */ { .entry = &syscall_preadv2 }, { .entry = &syscall_pwritev2 }, { .entry = &syscall_pkey_mprotect }, { .entry = &syscall_pkey_alloc }, { .entry = &syscall_pkey_free }, /* 5325 */ { .entry = &syscall_statx }, }; include/syscalls-mips-n32.h000066400000000000000000000306441445305223700160710ustar00rootroot00000000000000#pragma once /* Syscalls from arch/mips/kernel/scall64-n32.S */ struct syscalltable syscalls_mips[] = { { .entry = &syscall_read }, /* 6000 */ { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_newstat }, { .entry = &syscall_newfstat }, /* 6005 */ { .entry = &syscall_newlstat }, { .entry = &syscall_poll }, { .entry = &syscall_lseek }, { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_mips_mmap }, */ { .entry = &syscall_mprotect }, /* 6010 */ { .entry = &syscall_munmap }, { .entry = &syscall_brk }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_ioctl }, /* 6015 */ { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_access }, /* 6020 */ { .entry = &syscall_pipe }, { .entry = &syscall_select }, { .entry = &syscall_sched_yield }, { .entry = &syscall_mremap }, { .entry = &syscall_msync }, /* 6025 */ { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, { .entry = &syscall_shmget }, { .entry = &syscall_shmat }, { .entry = &syscall_shmctl }, /* 6030 */ { .entry = &syscall_dup }, { .entry = &syscall_dup2 }, { .entry = &syscall_pause }, { .entry = &syscall_nanosleep }, { .entry = &syscall_getitimer }, /* 6035 */ { .entry = &syscall_setitimer }, { .entry = &syscall_alarm }, { .entry = &syscall_getpid }, { .entry = &syscall_sendfile }, { .entry = &syscall_socket }, /* 6040 */ { .entry = &syscall_connect }, { .entry = &syscall_accept }, { .entry = &syscall_sendto }, { .entry = &syscall_recvfrom }, { .entry = &syscall_sendmsg }, /* 6045 */ { .entry = &syscall_recvmsg }, { .entry = &syscall_shutdown }, { .entry = &syscall_bind }, { .entry = &syscall_listen }, { .entry = &syscall_getsockname }, /* 6050 */ { .entry = &syscall_getpeername }, { .entry = &syscall_socketpair }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockopt }, { .entry = &syscall_clone }, /* 6055 */ { .entry = &syscall_fork }, { .entry = &syscall_execve }, { .entry = &syscall_exit }, { .entry = &syscall_wait4 }, { .entry = &syscall_kill }, /* 6060 */ { .entry = &syscall_newuname }, { .entry = &syscall_semget }, { .entry = &syscall_semop }, { .entry = &syscall_semctl }, { .entry = &syscall_shmdt }, /* 6065 */ { .entry = &syscall_msgget }, { .entry = &syscall_msgsnd }, { .entry = &syscall_msgrcv }, { .entry = &syscall_msgctl }, { .entry = &syscall_fcntl }, /* 6070 */ { .entry = &syscall_flock }, { .entry = &syscall_fsync }, { .entry = &syscall_fdatasync }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, /* 6075 */ { .entry = &syscall_getdents }, { .entry = &syscall_getcwd }, { .entry = &syscall_chdir }, { .entry = &syscall_fchdir }, { .entry = &syscall_rename }, /* 6080 */ { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, /* 6085 */ { .entry = &syscall_symlink }, { .entry = &syscall_readlink }, { .entry = &syscall_chmod }, { .entry = &syscall_fchmod }, { .entry = &syscall_chown }, /* 6090 */ { .entry = &syscall_fchown }, { .entry = &syscall_lchown }, { .entry = &syscall_umask }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_getrlimit }, /* 6095 */ { .entry = &syscall_getrusage }, { .entry = &syscall_sysinfo }, { .entry = &syscall_times }, { .entry = &syscall_ptrace }, { .entry = &syscall_getuid }, /* 6100 */ { .entry = &syscall_syslog }, { .entry = &syscall_getgid }, { .entry = &syscall_setuid }, { .entry = &syscall_setgid }, { .entry = &syscall_geteuid }, /* 6105 */ { .entry = &syscall_getegid }, { .entry = &syscall_setpgid }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, { .entry = &syscall_setsid }, /* 6110 */ { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_setresuid }, /* 6115 */ { .entry = &syscall_getresuid }, { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_getpgid }, { .entry = &syscall_setfsuid }, /* 6120 */ { .entry = &syscall_setfsgid }, { .entry = &syscall_getsid }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_rt_sigpending }, /* 6125 */ { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_utime }, /* 6130 */ { .entry = &syscall_mknod }, { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_32_personality }, */ { .entry = &syscall_ustat }, { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, /* 6135 */ { .entry = &syscall_sysfs }, { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, /* 6140 */ { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, /* 6145 */ { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_vhangup }, /* 6150 */ { .entry = &syscall_pivot_root }, { .entry = &syscall_sysctl }, { .entry = &syscall_prctl }, { .entry = &syscall_adjtimex }, { .entry = &syscall_setrlimit }, /* 6155 */ { .entry = &syscall_chroot }, { .entry = &syscall_sync }, { .entry = &syscall_acct }, { .entry = &syscall_settimeofday }, { .entry = &syscall_mount }, /* 6160 */ { .entry = &syscall_umount }, { .entry = &syscall_swapon }, { .entry = &syscall_swapoff }, { .entry = &syscall_reboot }, { .entry = &syscall_sethostname }, /* 6165 */ { .entry = &syscall_setdomainname }, { .entry = &syscall_ni_syscall }, /* was create_module */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* 6170, was get_kernel_syms */ { .entry = &syscall_ni_syscall }, /* was query_module */ { .entry = &syscall_quotactl }, { .entry = &syscall_ni_syscall }, /* was nfsservctl */ { .entry = &syscall_ni_syscall }, /* res. for getpmsg */ { .entry = &syscall_ni_syscall }, /* 6175 for putpmsg */ { .entry = &syscall_ni_syscall }, /* res. for afs_syscall */ { .entry = &syscall_ni_syscall }, /* res. for security */ { .entry = &syscall_gettid }, { .entry = &syscall_readahead }, { .entry = &syscall_setxattr }, /* 6180 */ { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, /* 6185 */ { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, /* 6190 */ { .entry = &syscall_fremovexattr }, { .entry = &syscall_tkill }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, /* 6195 */ { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_cacheflush }, */ { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_cachectl }, */ { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_sysmips }, */ { .entry = &syscall_io_setup }, /* 6200 */ { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_exit_group }, /* 6205 */ { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_remap_file_pages }, /* 6210 */ { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_fcntl64 }, */ { .entry = &syscall_set_tid_address }, { .entry = &syscall_restart_syscall }, { .entry = &syscall_semtimedop }, /* 6215 */ { .entry = &syscall_fadvise64_64 }, { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_timer_create }, /* 6220 */ { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, /* 6225 */ { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_tgkill }, { .entry = &syscall_utimes }, /* 6230 */ { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, /* 6235 */ { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_ni_syscall }, /* 6240, sys_vserver */ { .entry = &syscall_waitid }, { .entry = &syscall_ni_syscall }, /* available, was setaltroot */ { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, /* 6245 */ { .entry = &syscall_ni_syscall }, /* obsolete "set_thread_area" syscall */ { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_migrate_pages }, /* 6250 */ { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, /* 6255 */ { .entry = &syscall_newfstatat }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, /* 6260 */ { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, /* 6265 */ { .entry = &syscall_unshare }, { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, /* 6270 */ { .entry = &syscall_move_pages }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_kexec_load }, { .entry = &syscall_getcpu }, /* 6275 */ { .entry = &syscall_epoll_pwait }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, /* 6280 */ { .entry = &syscall_ni_syscall }, /* was timerfd */ { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_timerfd_gettime }, /* 6285 */ { .entry = &syscall_timerfd_settime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, /* 6290 */ { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, /* 6295 */ { .entry = &syscall_perf_event_open }, { .entry = &syscall_accept4 }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_getdents64 }, { .entry = &syscall_fanotify_init }, /* 6300 */ { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, /* 6305 */ { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, /* 6310 */ { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_renameat2 }, /* 6315 */ { .entry = &syscall_seccomp }, { .entry = &syscall_getrandom }, { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif { .entry = &syscall_execveat }, /* 6320 */ { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, { .entry = &syscall_mlock2 }, { .entry = &syscall_copy_file_range }, { .entry = &syscall_preadv2 }, /* 6325 */ { .entry = &syscall_pwritev2 }, { .entry = &syscall_pkey_mprotect }, { .entry = &syscall_pkey_alloc }, { .entry = &syscall_pkey_free }, { .entry = &syscall_statx }, /* 6330 */ }; include/syscalls-mips-o32.h000066400000000000000000000342771445305223700161000ustar00rootroot00000000000000#pragma once /* Syscalls from arch/mips/kernel/scall32-o32.S */ struct syscalltable syscalls_mips[] = { { .entry = &syscall_ni_syscall }, /* 4000 */ /* { .entry = &syscall_syscall }, 4000 */ { .entry = &syscall_exit }, { .entry = &syscall_fork }, { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, /* 4005 */ { .entry = &syscall_close }, { .entry = &syscall_waitpid }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, /* 4010 */ { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_time }, { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, /* 4015 */ { .entry = &syscall_lchown }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_ni_syscall }, /* was sys_stat */ { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, /* 4020 */ { .entry = &syscall_mount }, { .entry = &syscall_oldumount }, { .entry = &syscall_setuid }, { .entry = &syscall_getuid }, { .entry = &syscall_stime }, /* 4025 */ { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, { .entry = &syscall_ni_syscall }, /* was sys_fstat */ { .entry = &syscall_pause }, { .entry = &syscall_utime }, /* 4030 */ { .entry = &syscall_ni_syscall }, /* was sys_stty */ { .entry = &syscall_ni_syscall }, /* was sys_getty */ { .entry = &syscall_access }, { .entry = &syscall_nice }, { .entry = &syscall_ni_syscall }, /* 4035 */ { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, /* 4040 */ { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_brk }, /* 4045 */ { .entry = &syscall_setgid }, { .entry = &syscall_getgid }, { .entry = &syscall_ni_syscall }, /* was signal(2) */ { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, /* 4050 */ { .entry = &syscall_acct }, { .entry = &syscall_umount }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_ioctl }, { .entry = &syscall_fcntl }, /* 4055 */ { .entry = &syscall_ni_syscall }, { .entry = &syscall_setpgid }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_olduname }, { .entry = &syscall_umask }, /* 4060 */ { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, /* 4065 */ { .entry = &syscall_setsid }, { .entry = &syscall_sigaction }, { .entry = &syscall_sgetmask }, { .entry = &syscall_ssetmask }, { .entry = &syscall_setreuid }, /* 4070 */ { .entry = &syscall_setregid }, { .entry = &syscall_sigsuspend }, { .entry = &syscall_sigpending }, { .entry = &syscall_sethostname }, { .entry = &syscall_setrlimit }, /* 4075 */ { .entry = &syscall_getrlimit }, { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, { .entry = &syscall_getgroups }, /* 4080 */ { .entry = &syscall_setgroups }, { .entry = &syscall_ni_syscall }, /* old_select */ { .entry = &syscall_symlink }, { .entry = &syscall_ni_syscall }, /* was sys_lstat */ { .entry = &syscall_readlink }, /* 4085 */ { .entry = &syscall_uselib }, { .entry = &syscall_swapon }, { .entry = &syscall_reboot }, { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_old_readdir }, */ /* { .entry = &syscall_mips_mmap }, 4090 */ { .entry = &syscall_ni_syscall }, /* 4090 */ { .entry = &syscall_munmap }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, { .entry = &syscall_fchown }, /* 4095 */ { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, /* 4100 */ { .entry = &syscall_ni_syscall }, { .entry = &syscall_socketcall }, { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, { .entry = &syscall_getitimer }, /* 4105 */ { .entry = &syscall_newstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_uname }, { .entry = &syscall_ni_syscall }, /* 4110 was ioperm(2) */ { .entry = &syscall_vhangup }, { .entry = &syscall_ni_syscall }, /* was sys_idle() */ { .entry = &syscall_ni_syscall }, /* was sys_vm86 */ { .entry = &syscall_wait4 }, { .entry = &syscall_swapoff }, /* 4115 */ { .entry = &syscall_sysinfo }, { .entry = &syscall_ipc }, { .entry = &syscall_fsync }, { .entry = &syscall_sigreturn }, { .entry = &syscall_clone }, /* 4120 */ { .entry = &syscall_setdomainname }, { .entry = &syscall_newuname }, { .entry = &syscall_ni_syscall }, /* sys_modify_ldt */ { .entry = &syscall_adjtimex }, { .entry = &syscall_mprotect }, /* 4125 */ { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, /* was sys_create_module */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* 4130 was sys_get_kernel_syms */ { .entry = &syscall_quotactl }, { .entry = &syscall_getpgid }, { .entry = &syscall_fchdir }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, /* 4135 */ { .entry = &syscall_personality }, { .entry = &syscall_ni_syscall }, /* reserved for afs_syscall */ { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_llseek }, /* 4140 */ { .entry = &syscall_getdents }, { .entry = &syscall_select }, { .entry = &syscall_flock }, { .entry = &syscall_msync }, { .entry = &syscall_readv }, /* 4145 */ { .entry = &syscall_writev }, /* { .entry = &syscall_cacheflush }, */ { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_cachectl }, */ { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_sysmips }, */ { .entry = &syscall_ni_syscall }, { .entry = &syscall_ni_syscall }, /* 4150 */ { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_sysctl }, { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, /* 4155 */ { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setscheduler }, /* 4160 */ { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, /* 4165 */ { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_accept }, { .entry = &syscall_bind }, { .entry = &syscall_connect }, /* 4170 */ { .entry = &syscall_getpeername }, { .entry = &syscall_getsockname }, { .entry = &syscall_getsockopt }, { .entry = &syscall_listen }, { .entry = &syscall_recv }, /* 4175 */ { .entry = &syscall_recvfrom }, { .entry = &syscall_recvmsg }, { .entry = &syscall_send }, { .entry = &syscall_sendmsg }, { .entry = &syscall_sendto }, /* 4180 */ { .entry = &syscall_setsockopt }, { .entry = &syscall_shutdown }, { .entry = &syscall_socket }, { .entry = &syscall_socketpair }, { .entry = &syscall_setresuid }, /* 4185 */ { .entry = &syscall_getresuid }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_poll }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_setresgid }, /* 4190 */ { .entry = &syscall_getresgid }, { .entry = &syscall_prctl }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, /* 4195 */ { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_pread64 }, /* 4200 */ { .entry = &syscall_pwrite64 }, { .entry = &syscall_chown }, { .entry = &syscall_getcwd }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, /* 4205 */ { .entry = &syscall_sigaltstack }, { .entry = &syscall_sendfile }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_ni_syscall }, /* { .entry = &syscall_mips_mmap2 }, 4210 */ { .entry = &syscall_ni_syscall }, /* 4210 */ { .entry = &syscall_truncate64 }, { .entry = &syscall_ftruncate64 }, { .entry = &syscall_stat64 }, { .entry = &syscall_lstat64 }, { .entry = &syscall_fstat64 }, /* 4215 */ { .entry = &syscall_pivot_root }, { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, { .entry = &syscall_getdents64 }, /* { .entry = &syscall_fcntl64 }, 4220 */ { .entry = &syscall_ni_syscall }, /* 4220 */ { .entry = &syscall_ni_syscall }, { .entry = &syscall_gettid }, { .entry = &syscall_readahead }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, /* 4225 */ { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, /* 4230 */ { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, /* 4235 */ { .entry = &syscall_tkill }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity },/* 4240 */ { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, /* 4245 */ { .entry = &syscall_exit_group }, { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, /* 4250 */ { .entry = &syscall_remap_file_pages }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_restart_syscall }, { .entry = &syscall_fadvise64_64 }, { .entry = &syscall_statfs64 }, /* 4255 */ { .entry = &syscall_fstatfs64 }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, /* 4260 */ { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, /* 4265 */ { .entry = &syscall_tgkill }, { .entry = &syscall_utimes }, { .entry = &syscall_mbind }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_ni_syscall }, /* 4270 */ { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, /* 4275 */ { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_waitid }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_add_key }, /* 4280 */ { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_ni_syscall }, /* obsolete "set_thread_area" syscall */ { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch },/* 4285 */ { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, /* 4290 */ { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, /* 4295 */ { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, /* 4300 */ { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range }, /* 4305 */ { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, /* 4310 */ /* vserver */ { .entry = &syscall_kexec_load }, { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, /* 4315 */ { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, /* 4320 */ { .entry = &syscall_timerfd_create }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, /* 4325 */ { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_preadv }, /* 4330 */ { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_accept4 }, { .entry = &syscall_recvmmsg }, /* 4335 */ { .entry = &syscall_accept4 }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at },/* 4340 */ { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, /* 4345 */ { .entry = &syscall_process_vm_writev }, { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, /* 4350 */ { .entry = &syscall_renameat2 }, { .entry = &syscall_seccomp }, { .entry = &syscall_getrandom }, { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, /* 4355 */ #else { .entry = NULL }, #endif { .entry = &syscall_execveat }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, { .entry = &syscall_mlock2 }, { .entry = &syscall_copy_file_range }, /* 4360 */ { .entry = &syscall_preadv2 }, { .entry = &syscall_pwritev2 }, { .entry = &syscall_pkey_mprotect }, { .entry = &syscall_pkey_alloc }, { .entry = &syscall_pkey_free }, /* 4365 */ { .entry = &syscall_statx }, }; include/syscalls-mips.h000066400000000000000000000004501445305223700154610ustar00rootroot00000000000000#pragma once #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" #if _MIPS_SIM == _ABIO32 #include "syscalls-mips-o32.h" #elif _MIPS_SIM == _ABIN32 #include "syscalls-mips-n32.h" #elif _MIPS_SIM == _ABI64 #include "syscalls-mips-64.h" #else #error Unknown MIPS ABI #endif include/syscalls-parisc.h000066400000000000000000000304301445305223700157730ustar00rootroot00000000000000#pragma once /* Syscalls from arch/parisc/kernel/syscall_table.S */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_parisc[] = { { .entry = &syscall_restart_syscall }, { .entry = &syscall_exit }, { .entry = &syscall_fork }, /* FIXME: fork_wrapper */ { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_waitpid }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_time }, { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, { .entry = &syscall_lchown }, { .entry = &syscall_socket }, { .entry = &syscall_newstat }, { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, { .entry = &syscall_mount }, { .entry = &syscall_bind }, { .entry = &syscall_setuid }, { .entry = &syscall_getuid }, { .entry = &syscall_stime }, { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, { .entry = &syscall_newfstat }, { .entry = &syscall_pause }, { .entry = &syscall_utime }, { .entry = &syscall_connect }, { .entry = &syscall_listen }, { .entry = &syscall_access }, { .entry = &syscall_nice }, { .entry = &syscall_accept }, { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_getsockname }, { .entry = &syscall_brk }, { .entry = &syscall_setgid }, { .entry = &syscall_getgid }, { .entry = &syscall_signal }, { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_acct }, { .entry = &syscall_umount }, { .entry = &syscall_getpeername }, { .entry = &syscall_ioctl }, { .entry = &syscall_fcntl }, { .entry = &syscall_socketpair }, { .entry = &syscall_setpgid }, { .entry = &syscall_send }, { .entry = &syscall_newuname }, { .entry = &syscall_umask }, { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, { .entry = &syscall_setsid }, { .entry = &syscall_pivot_root }, { .entry = &syscall_sgetmask }, { .entry = &syscall_ssetmask }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_mincore }, { .entry = &syscall_sigpending }, { .entry = &syscall_sethostname }, { .entry = &syscall_setrlimit }, { .entry = &syscall_getrlimit }, { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_sendto }, { .entry = &syscall_symlink }, { .entry = &syscall_newlstat }, { .entry = &syscall_readlink }, { .entry = &syscall_ni_syscall }, /* was uselib */ { .entry = &syscall_swapon }, { .entry = &syscall_reboot }, { .entry = &syscall_mmap2 }, { .entry = &syscall_mmap }, { .entry = &syscall_munmap }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, { .entry = &syscall_fchown }, { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_recv }, { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, { .entry = &syscall_stat64 }, { .entry = &syscall_ni_syscall }, /* was socketcall */ { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, { .entry = &syscall_getitimer }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_getcwd }, { .entry = &syscall_vhangup }, { .entry = &syscall_fstat64 }, { .entry = &syscall_vfork }, { .entry = &syscall_wait4 }, { .entry = &syscall_swapoff }, { .entry = &syscall_sysinfo }, { .entry = &syscall_shutdown }, { .entry = &syscall_fsync }, { .entry = &syscall_madvise }, { .entry = &syscall_clone }, { .entry = &syscall_setdomainname }, { .entry = &syscall_sendfile }, { .entry = &syscall_recvfrom }, { .entry = &syscall_adjtimex }, { .entry = &syscall_mprotect }, { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, /* obsolete "create_module" syscall */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* was get_kernel_syms */ { .entry = &syscall_quotactl }, { .entry = &syscall_getpgid }, { .entry = &syscall_fchdir }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, { .entry = &syscall_personality }, { .entry = &syscall_ni_syscall }, /* obsolete "afs" syscall */ { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_llseek }, { .entry = &syscall_getdents }, { .entry = &syscall_select }, { .entry = &syscall_flock }, { .entry = &syscall_msync }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_sysctl }, { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_ni_syscall }, /* obsolete "query_module" syscall */ { .entry = &syscall_poll }, { .entry = &syscall_ni_syscall }, /* was nfsserverctl */ { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_prctl }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_chown }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockopt }, { .entry = &syscall_sendmsg }, { .entry = &syscall_recvmsg }, { .entry = &syscall_semop }, { .entry = &syscall_semget }, { .entry = &syscall_semctl }, { .entry = &syscall_msgsnd }, { .entry = &syscall_msgrcv }, { .entry = &syscall_msgget }, { .entry = &syscall_msgctl }, { .entry = &syscall_shmat }, { .entry = &syscall_shmdt }, { .entry = &syscall_shmget }, { .entry = &syscall_shmctl }, { .entry = &syscall_ni_syscall }, /* streams1 */ { .entry = &syscall_ni_syscall }, /* streams2 */ { .entry = &syscall_lstat64 }, { .entry = &syscall_truncate64 }, { .entry = &syscall_ftruncate64 }, { .entry = &syscall_getdents64 }, { .entry = &syscall_ni_syscall }, // FIXME: fcntl64 { .entry = &syscall_ni_syscall }, /* obsolete "attrctl" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "acl_get" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "acl_set" syscall */ { .entry = &syscall_gettid }, { .entry = &syscall_readahead }, { .entry = &syscall_tkill }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_ni_syscall }, /* set_thread_area */ { .entry = &syscall_ni_syscall }, /* get_thread_area */ { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_ni_syscall }, /* FIXME alloc_hugepages */ { .entry = &syscall_ni_syscall }, /* FIXME free_hugepages */ { .entry = &syscall_exit_group }, { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_remap_file_pages }, { .entry = &syscall_semtimedop }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_waitid }, { .entry = &syscall_fadvise64_64 }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_tgkill }, { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_ni_syscall }, /* obsolete "vserver" syscall */ { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_unshare }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_kexec_load }, { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, { .entry = &syscall_ni_syscall }, /* was timerfd */ { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_accept4 }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_syncfs }, { .entry = &syscall_setns }, { .entry = &syscall_sendmmsg }, /* obsolete "putpmsg" syscall */ { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_utimes }, { .entry = &syscall_renameat2 }, { .entry = &syscall_seccomp }, { .entry = &syscall_getrandom }, { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif { .entry = &syscall_execveat }, { .entry = &syscall_membarrier }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_mlock2 }, { .entry = &syscall_copy_file_range }, { .entry = &syscall_preadv2 }, { .entry = &syscall_pwritev2 }, { .entry = &syscall_statx }, }; include/syscalls-ppc.h000066400000000000000000000314131445305223700152760ustar00rootroot00000000000000#pragma once /* Syscalls from arch/powerpc/include/asm/systbl.h as of 3.15-rc8 */ #include "sanitise.h" #include #include #include #include "syscalls/syscalls.h" struct syscalltable syscalls_ppc[] = { { .entry = &syscall_restart_syscall }, { .entry = &syscall_exit }, { .entry = &syscall_fork }, { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_waitpid }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_time }, { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, { .entry = &syscall_lchown }, { .entry = &syscall_ni_syscall }, /* obsolete "break" syscall */ { .entry = &syscall_stat }, { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, { .entry = &syscall_mount }, { .entry = &syscall_oldumount }, { .entry = &syscall_setuid }, { .entry = &syscall_getuid }, { .entry = &syscall_stime }, { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, { .entry = &syscall_ni_syscall }, // was OLDSYS(fstat) { .entry = &syscall_pause }, { .entry = &syscall_utime }, { .entry = &syscall_ni_syscall }, // (old stty syscall holder).h { .entry = &syscall_ni_syscall }, // (old gtty syscall holder).h { .entry = &syscall_access }, { .entry = &syscall_nice }, { .entry = &syscall_ni_syscall }, // old ftime syscall holder { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_ni_syscall }, // (old prof syscall holder) { .entry = &syscall_brk }, { .entry = &syscall_setgid }, { .entry = &syscall_getgid }, { .entry = &syscall_signal }, { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_acct }, { .entry = &syscall_umount }, // recycled never used phys() { .entry = &syscall_ni_syscall }, // old lock syscall holder { .entry = &syscall_ioctl }, { .entry = &syscall_fcntl }, { .entry = &syscall_ni_syscall }, // old mpx syscall holder { .entry = &syscall_setpgid }, { .entry = &syscall_ni_syscall }, // old ulimit syscall holder { .entry = &syscall_olduname }, { .entry = &syscall_umask }, { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, { .entry = &syscall_setsid }, { .entry = &syscall_sigaction }, { .entry = &syscall_sgetmask }, { .entry = &syscall_ssetmask }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_sigsuspend }, { .entry = &syscall_sigpending }, { .entry = &syscall_sethostname }, { .entry = &syscall_setrlimit }, { .entry = &syscall_ni_syscall }, // was COMPAT_SYS(old_getrlimit) { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_select }, { .entry = &syscall_symlink }, { .entry = &syscall_lstat }, { .entry = &syscall_readlink }, { .entry = &syscall_uselib }, { .entry = &syscall_swapon }, { .entry = &syscall_reboot }, { .entry = &syscall_oldreaddir }, { .entry = &syscall_mmap }, { .entry = &syscall_munmap }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, { .entry = &syscall_fchown }, { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_ni_syscall }, // old profil syscall holder { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_socketcall }, { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, { .entry = &syscall_getitimer }, { .entry = &syscall_newstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_uname }, { .entry = &syscall_ni_syscall }, // (105)" { .entry = &syscall_vhangup }, { .entry = &syscall_ni_syscall }, // old 'idle' system call? { .entry = &syscall_ni_syscall }, // 108 { .entry = &syscall_wait4 }, { .entry = &syscall_swapoff }, { .entry = &syscall_sysinfo }, { .entry = &syscall_ipc }, { .entry = &syscall_fsync }, { .entry = &syscall_sigreturn }, { .entry = &syscall_clone }, { .entry = &syscall_setdomainname }, { .entry = &syscall_newuname }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_adjtimex }, { .entry = &syscall_mprotect }, { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, // old create module { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, // old get_kernel_syms { .entry = &syscall_quotactl }, { .entry = &syscall_getpgid }, { .entry = &syscall_fchdir }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, { .entry = &syscall_personality }, { .entry = &syscall_ni_syscall }, /* obsolete "afs" syscall */ { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_llseek }, { .entry = &syscall_getdents }, { .entry = &syscall_select }, { .entry = &syscall_flock }, { .entry = &syscall_msync }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_sysctl }, { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, { .entry = &syscall_ni_syscall }, // Old sys_query_module { .entry = &syscall_poll }, { .entry = &syscall_nfsservctl }, { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_prctl }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_chown }, { .entry = &syscall_getcwd }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_sendfile }, { .entry = &syscall_ni_syscall }, // reserved for streams1 { .entry = &syscall_ni_syscall }, // reserved for streams2 { .entry = &syscall_vfork }, { .entry = &syscall_getrlimit }, { .entry = &syscall_readahead }, { .entry = &syscall_mmap2 }, { .entry = &syscall_truncate64 }, { .entry = &syscall_ftruncate64 }, { .entry = &syscall_stat64 }, { .entry = &syscall_lstat64 }, { .entry = &syscall_fstat64 }, { .entry = &syscall_ni_syscall }, // TODO: pciconfig_read { .entry = &syscall_ni_syscall }, // TODO: pciconfig_write { .entry = &syscall_ni_syscall }, // TODO: pciconfig_iobase { .entry = &syscall_ni_syscall }, // 201 { .entry = &syscall_getdents64 }, { .entry = &syscall_pivot_root }, { .entry = &syscall_fcntl }, /* fcntl64 */ { .entry = &syscall_madvise }, { .entry = &syscall_mincore }, { .entry = &syscall_gettid }, { .entry = &syscall_tkill }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_fadvise64 }, { .entry = &syscall_exit_group }, { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_remap_file_pages }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_ni_syscall }, // TODO: ppc64_swapcontext { .entry = &syscall_tgkill }, { .entry = &syscall_utimes }, { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_fadvise64_64 }, { .entry = &syscall_rtas }, { .entry = &syscall_ni_syscall }, // TODO: debug_setcontext { .entry = &syscall_ni_syscall }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_kexec_load }, { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_waitid }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_ni_syscall }, // TODO: spu_run { .entry = &syscall_ni_syscall }, // TODO: spu_create { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_splice }, { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_move_pages }, { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_eventfd }, { .entry = &syscall_sync_file_range2 }, { .entry = &syscall_fallocate }, { .entry = &syscall_ni_syscall }, // TODO: subpage_prot { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_socket }, { .entry = &syscall_bind }, { .entry = &syscall_connect }, { .entry = &syscall_listen }, { .entry = &syscall_accept }, { .entry = &syscall_getsockname }, { .entry = &syscall_getpeername }, { .entry = &syscall_socketpair }, { .entry = &syscall_send }, { .entry = &syscall_sendto }, { .entry = &syscall_recv }, { .entry = &syscall_recvfrom }, { .entry = &syscall_shutdown }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockopt }, { .entry = &syscall_sendmsg }, { .entry = &syscall_recvmsg }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_accept4 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_finit_module }, { .entry = &syscall_kcmp }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_renameat2 }, }; include/syscalls-riscv64.h000066400000000000000000000301051445305223700160110ustar00rootroot00000000000000#pragma once /* * Derived from arch/riscv/include/asm/unistd.h * (inherits from include/uapi/asm-generic/unistd.h) */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_riscv64[] = { /* 0 */ { .entry = &syscall_io_setup }, /* 1 */ { .entry = &syscall_io_destroy }, /* 2 */ { .entry = &syscall_io_submit }, /* 3 */ { .entry = &syscall_io_cancel }, /* 4 */ { .entry = &syscall_io_getevents }, /* 5 */ { .entry = &syscall_setxattr }, /* 6 */ { .entry = &syscall_lsetxattr }, /* 7 */ { .entry = &syscall_fsetxattr }, /* 8 */ { .entry = &syscall_getxattr }, /* 9 */ { .entry = &syscall_lgetxattr }, /* 10 */ { .entry = &syscall_fgetxattr }, /* 11 */ { .entry = &syscall_listxattr }, /* 12 */ { .entry = &syscall_llistxattr }, /* 13 */ { .entry = &syscall_flistxattr }, /* 14 */ { .entry = &syscall_removexattr }, /* 15 */ { .entry = &syscall_lremovexattr }, /* 16 */ { .entry = &syscall_fremovexattr }, /* 17 */ { .entry = &syscall_getcwd }, /* 18 */ { .entry = &syscall_lookup_dcookie }, /* 19 */ { .entry = &syscall_eventfd2 }, /* 20 */ { .entry = &syscall_epoll_create1 }, /* 21 */ { .entry = &syscall_epoll_ctl }, /* 22 */ { .entry = &syscall_epoll_pwait }, /* 23 */ { .entry = &syscall_dup }, /* 24 */ { .entry = &syscall_dup3 }, /* 25 */ { .entry = &syscall_fcntl }, /* 26 */ { .entry = &syscall_inotify_init1 }, /* 27 */ { .entry = &syscall_inotify_add_watch }, /* 28 */ { .entry = &syscall_inotify_rm_watch }, /* 29 */ { .entry = &syscall_ioctl }, /* 30 */ { .entry = &syscall_ioprio_set }, /* 31 */ { .entry = &syscall_ioprio_get }, /* 32 */ { .entry = &syscall_flock }, /* 33 */ { .entry = &syscall_mknodat }, /* 34 */ { .entry = &syscall_mkdirat }, /* 35 */ { .entry = &syscall_unlinkat }, /* 36 */ { .entry = &syscall_symlinkat }, /* 37 */ { .entry = &syscall_linkat }, /* 38 */ { .entry = &syscall_ni_syscall }, /* 39 */ { .entry = &syscall_umount }, /* 40 */ { .entry = &syscall_mount }, /* 41 */ { .entry = &syscall_pivot_root }, /* 42 */ { .entry = &syscall_ni_syscall }, /* 43 */ { .entry = &syscall_statfs }, /* 44 */ { .entry = &syscall_fstatfs }, /* 45 */ { .entry = &syscall_truncate }, /* 46 */ { .entry = &syscall_ftruncate }, /* 47 */ { .entry = &syscall_fallocate }, /* 48 */ { .entry = &syscall_faccessat }, /* 49 */ { .entry = &syscall_chdir }, /* 50 */ { .entry = &syscall_fchdir }, /* 51 */ { .entry = &syscall_chroot }, /* 52 */ { .entry = &syscall_fchmod }, /* 53 */ { .entry = &syscall_fchmodat }, /* 54 */ { .entry = &syscall_fchownat }, /* 55 */ { .entry = &syscall_fchown }, /* 56 */ { .entry = &syscall_openat }, /* 57 */ { .entry = &syscall_close }, /* 58 */ { .entry = &syscall_vhangup }, /* 59 */ { .entry = &syscall_pipe2 }, /* 60 */ { .entry = &syscall_quotactl }, /* 61 */ { .entry = &syscall_getdents64 }, /* 62 */ { .entry = &syscall_lseek }, /* 63 */ { .entry = &syscall_read }, /* 64 */ { .entry = &syscall_write }, /* 65 */ { .entry = &syscall_readv }, /* 66 */ { .entry = &syscall_writev }, /* 67 */ { .entry = &syscall_pread64 }, /* 68 */ { .entry = &syscall_pwrite64 }, /* 69 */ { .entry = &syscall_preadv }, /* 70 */ { .entry = &syscall_pwritev }, /* 71 */ { .entry = &syscall_sendfile64 }, /* 72 */ { .entry = &syscall_pselect6 }, /* 73 */ { .entry = &syscall_ppoll }, /* 74 */ { .entry = &syscall_signalfd4 }, /* 75 */ { .entry = &syscall_vmsplice }, /* 76 */ { .entry = &syscall_splice }, /* 77 */ { .entry = &syscall_tee }, /* 78 */ { .entry = &syscall_readlinkat }, /* 79 */ { .entry = &syscall_newfstatat }, /* 80 */ { .entry = &syscall_newfstat }, /* 81 */ { .entry = &syscall_sync }, /* 82 */ { .entry = &syscall_fsync }, /* 83 */ { .entry = &syscall_fdatasync }, /* 84 */ { .entry = &syscall_sync_file_range }, /* 85 */ { .entry = &syscall_timerfd_create }, /* 86 */ { .entry = &syscall_timerfd_settime }, /* 87 */ { .entry = &syscall_timerfd_gettime }, /* 88 */ { .entry = &syscall_utimensat }, /* 89 */ { .entry = &syscall_acct }, /* 90 */ { .entry = &syscall_capget }, /* 91 */ { .entry = &syscall_capset }, /* 92 */ { .entry = &syscall_personality }, /* 93 */ { .entry = &syscall_exit }, /* 94 */ { .entry = &syscall_exit_group }, /* 95 */ { .entry = &syscall_waitid }, /* 96 */ { .entry = &syscall_set_tid_address }, /* 97 */ { .entry = &syscall_unshare }, /* 98 */ { .entry = &syscall_futex }, /* 99 */ { .entry = &syscall_set_robust_list }, /* 100 */ { .entry = &syscall_get_robust_list }, /* 101 */ { .entry = &syscall_nanosleep }, /* 102 */ { .entry = &syscall_getitimer }, /* 103 */ { .entry = &syscall_setitimer }, /* 104 */ { .entry = &syscall_kexec_load }, /* 105 */ { .entry = &syscall_init_module }, /* 106 */ { .entry = &syscall_delete_module }, /* 107 */ { .entry = &syscall_timer_create }, /* 108 */ { .entry = &syscall_timer_gettime }, /* 109 */ { .entry = &syscall_timer_getoverrun }, /* 110 */ { .entry = &syscall_timer_settime }, /* 111 */ { .entry = &syscall_timer_delete }, /* 112 */ { .entry = &syscall_clock_settime }, /* 113 */ { .entry = &syscall_clock_gettime }, /* 114 */ { .entry = &syscall_clock_getres }, /* 115 */ { .entry = &syscall_clock_nanosleep }, /* 116 */ { .entry = &syscall_syslog }, /* 117 */ { .entry = &syscall_ptrace }, /* 118 */ { .entry = &syscall_sched_setparam }, /* 119 */ { .entry = &syscall_sched_setscheduler }, /* 120 */ { .entry = &syscall_sched_getscheduler }, /* 121 */ { .entry = &syscall_sched_getparam }, /* 122 */ { .entry = &syscall_sched_setaffinity }, /* 123 */ { .entry = &syscall_sched_getaffinity }, /* 124 */ { .entry = &syscall_sched_yield }, /* 125 */ { .entry = &syscall_sched_get_priority_max }, /* 126 */ { .entry = &syscall_sched_get_priority_min }, /* 127 */ { .entry = &syscall_sched_rr_get_interval }, /* 128 */ { .entry = &syscall_restart_syscall }, /* 129 */ { .entry = &syscall_kill }, /* 130 */ { .entry = &syscall_tkill }, /* 131 */ { .entry = &syscall_tgkill }, /* 132 */ { .entry = &syscall_sigaltstack }, /* 133 */ { .entry = &syscall_rt_sigsuspend }, /* 134 */ { .entry = &syscall_rt_sigaction }, /* 135 */ { .entry = &syscall_rt_sigprocmask }, /* 136 */ { .entry = &syscall_rt_sigpending }, /* 137 */ { .entry = &syscall_rt_sigtimedwait }, /* 138 */ { .entry = &syscall_rt_sigqueueinfo }, /* 139 */ { .entry = &syscall_rt_sigreturn }, /* 140 */ { .entry = &syscall_setpriority }, /* 141 */ { .entry = &syscall_getpriority }, /* 142 */ { .entry = &syscall_reboot }, /* 143 */ { .entry = &syscall_setregid }, /* 144 */ { .entry = &syscall_setgid }, /* 145 */ { .entry = &syscall_setreuid }, /* 146 */ { .entry = &syscall_setuid }, /* 147 */ { .entry = &syscall_setresuid }, /* 148 */ { .entry = &syscall_getresuid }, /* 149 */ { .entry = &syscall_setresgid }, /* 150 */ { .entry = &syscall_getresgid }, /* 151 */ { .entry = &syscall_setfsuid }, /* 152 */ { .entry = &syscall_setfsgid }, /* 153 */ { .entry = &syscall_times }, /* 154 */ { .entry = &syscall_setpgid }, /* 155 */ { .entry = &syscall_getpgid }, /* 156 */ { .entry = &syscall_getsid }, /* 157 */ { .entry = &syscall_setsid }, /* 158 */ { .entry = &syscall_getgroups }, /* 159 */ { .entry = &syscall_setgroups }, /* 160 */ { .entry = &syscall_newuname }, /* 161 */ { .entry = &syscall_sethostname }, /* 162 */ { .entry = &syscall_setdomainname }, /* 163 */ { .entry = &syscall_getrlimit }, /* 164 */ { .entry = &syscall_setrlimit }, /* 165 */ { .entry = &syscall_getrusage }, /* 166 */ { .entry = &syscall_umask }, /* 167 */ { .entry = &syscall_prctl }, /* 168 */ { .entry = &syscall_getcpu }, /* 169 */ { .entry = &syscall_gettimeofday }, /* 170 */ { .entry = &syscall_settimeofday }, /* 171 */ { .entry = &syscall_adjtimex }, /* 172 */ { .entry = &syscall_getpid }, /* 173 */ { .entry = &syscall_getppid }, /* 174 */ { .entry = &syscall_getuid }, /* 175 */ { .entry = &syscall_geteuid }, /* 176 */ { .entry = &syscall_getgid }, /* 177 */ { .entry = &syscall_getegid }, /* 178 */ { .entry = &syscall_gettid }, /* 179 */ { .entry = &syscall_sysinfo }, /* 180 */ { .entry = &syscall_mq_open }, /* 181 */ { .entry = &syscall_mq_unlink }, /* 182 */ { .entry = &syscall_mq_timedsend }, /* 183 */ { .entry = &syscall_mq_timedreceive }, /* 184 */ { .entry = &syscall_mq_notify }, /* 185 */ { .entry = &syscall_mq_getsetattr }, /* 186 */ { .entry = &syscall_msgget }, /* 187 */ { .entry = &syscall_msgctl }, /* 188 */ { .entry = &syscall_msgrcv }, /* 189 */ { .entry = &syscall_msgsnd }, /* 190 */ { .entry = &syscall_semget }, /* 191 */ { .entry = &syscall_semctl }, /* 192 */ { .entry = &syscall_semtimedop }, /* 193 */ { .entry = &syscall_semop }, /* 194 */ { .entry = &syscall_shmget }, /* 195 */ { .entry = &syscall_shmctl }, /* 196 */ { .entry = &syscall_shmat }, /* 197 */ { .entry = &syscall_shmdt }, /* 198 */ { .entry = &syscall_socket }, /* 199 */ { .entry = &syscall_socketpair }, /* 200 */ { .entry = &syscall_bind }, /* 201 */ { .entry = &syscall_listen }, /* 202 */ { .entry = &syscall_accept }, /* 203 */ { .entry = &syscall_connect }, /* 204 */ { .entry = &syscall_getsockname }, /* 205 */ { .entry = &syscall_getpeername }, /* 206 */ { .entry = &syscall_sendto }, /* 207 */ { .entry = &syscall_recvfrom }, /* 208 */ { .entry = &syscall_setsockopt }, /* 209 */ { .entry = &syscall_getsockopt }, /* 210 */ { .entry = &syscall_shutdown }, /* 211 */ { .entry = &syscall_sendmsg }, /* 212 */ { .entry = &syscall_recvmsg }, /* 213 */ { .entry = &syscall_readahead }, /* 214 */ { .entry = &syscall_brk }, /* 215 */ { .entry = &syscall_munmap }, /* 216 */ { .entry = &syscall_mremap }, /* 217 */ { .entry = &syscall_add_key }, /* 218 */ { .entry = &syscall_request_key }, /* 219 */ { .entry = &syscall_keyctl }, /* 220 */ { .entry = &syscall_clone }, /* 221 */ { .entry = &syscall_execve }, /* 222 */ { .entry = &syscall_mmap }, /* 223 */ { .entry = &syscall_fadvise64_64 }, /* 224 */ { .entry = &syscall_swapon }, /* 225 */ { .entry = &syscall_swapoff }, /* 226 */ { .entry = &syscall_mprotect }, /* 227 */ { .entry = &syscall_msync }, /* 228 */ { .entry = &syscall_mlock }, /* 229 */ { .entry = &syscall_munlock }, /* 230 */ { .entry = &syscall_mlockall }, /* 231 */ { .entry = &syscall_munlockall }, /* 232 */ { .entry = &syscall_mincore }, /* 233 */ { .entry = &syscall_madvise }, /* 234 */ { .entry = &syscall_remap_file_pages }, /* 235 */ { .entry = &syscall_mbind }, /* 236 */ { .entry = &syscall_get_mempolicy }, /* 237 */ { .entry = &syscall_set_mempolicy }, /* 238 */ { .entry = &syscall_migrate_pages }, /* 239 */ { .entry = &syscall_move_pages }, /* 240 */ { .entry = &syscall_rt_tgsigqueueinfo }, /* 241 */ { .entry = &syscall_perf_event_open }, /* 242 */ { .entry = &syscall_accept4 }, /* 243 */ { .entry = &syscall_recvmmsg }, /* 244 */ { .entry = &syscall_ni_syscall }, /* 245 */ { .entry = &syscall_ni_syscall }, /* 246 */ { .entry = &syscall_ni_syscall }, /* 247 */ { .entry = &syscall_ni_syscall }, /* 248 */ { .entry = &syscall_ni_syscall }, /* 249 */ { .entry = &syscall_ni_syscall }, /* 250 */ { .entry = &syscall_ni_syscall }, /* 251 */ { .entry = &syscall_ni_syscall }, /* 252 */ { .entry = &syscall_ni_syscall }, /* 253 */ { .entry = &syscall_ni_syscall }, /* 254 */ { .entry = &syscall_ni_syscall }, /* 255 */ { .entry = &syscall_ni_syscall }, /* 256 */ { .entry = &syscall_ni_syscall }, /* 257 */ { .entry = &syscall_ni_syscall }, /* 258 */ { .entry = &syscall_ni_syscall }, /* 259 */ { .entry = &syscall_riscv_flush_icache }, /* 260 */ { .entry = &syscall_wait4 }, /* 261 */ { .entry = &syscall_prlimit64 }, /* 262 */ { .entry = &syscall_fanotify_init }, /* 263 */ { .entry = &syscall_fanotify_mark }, /* 264 */ { .entry = &syscall_name_to_handle_at }, /* 265 */ { .entry = &syscall_open_by_handle_at }, /* 266 */ { .entry = &syscall_clock_adjtime }, /* 267 */ { .entry = &syscall_syncfs }, /* 268 */ { .entry = &syscall_setns }, /* 269 */ { .entry = &syscall_sendmmsg }, /* 270 */ { .entry = &syscall_process_vm_readv }, /* 271 */ { .entry = &syscall_process_vm_writev }, /* 272 */ { .entry = &syscall_kcmp }, /* 273 */ { .entry = &syscall_finit_module }, /* 274 */ { .entry = &syscall_sched_setattr }, /* 275 */ { .entry = &syscall_sched_getattr }, /* 276 */ { .entry = &syscall_renameat2 }, /* 277 */ { .entry = &syscall_seccomp }, /* 278 */ { .entry = &syscall_getrandom }, /* 279 */ { .entry = &syscall_memfd_create }, #ifdef USE_BPF /* 280 */ { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif /* 281 */ { .entry = &syscall_execveat }, }; include/syscalls-s390.h000066400000000000000000000340361445305223700152160ustar00rootroot00000000000000#pragma once /* from arch/s390/kernel/syscalls.S */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_s390[] = { { .entry = &syscall_ni_syscall }, /* No 0 unused system call */ { .entry = &syscall_exit }, { .entry = &syscall_fork }, { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_restart_syscall }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_time }, { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, { .entry = &syscall_lchown16 }, { .entry = &syscall_ni_syscall }, /* No 17 unused system call */ { .entry = &syscall_ni_syscall }, /* No 18 unused system call */ { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, { .entry = &syscall_mount }, { .entry = &syscall_oldumount }, { .entry = &syscall_setuid16 }, { .entry = &syscall_getuid16 }, { .entry = &syscall_stime }, { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, { .entry = &syscall_ni_syscall }, /* No 28 unused system call */ { .entry = &syscall_pause }, { .entry = &syscall_utime }, { .entry = &syscall_ni_syscall }, /* No 31 unused system call */ { .entry = &syscall_ni_syscall }, /* No 32 unused system call */ { .entry = &syscall_access }, { .entry = &syscall_nice }, { .entry = &syscall_ni_syscall }, /* No 35 unused system call */ { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_ni_syscall }, /* No 44 unused system call */ { .entry = &syscall_brk }, { .entry = &syscall_setgid16 }, { .entry = &syscall_getgid16 }, { .entry = &syscall_signal }, { .entry = &syscall_geteuid16 }, { .entry = &syscall_getegid16 }, { .entry = &syscall_acct }, { .entry = &syscall_umount }, { .entry = &syscall_ni_syscall }, /* No 53 unused system call */ { .entry = &syscall_ioctl }, { .entry = &syscall_fcntl }, { .entry = &syscall_ni_syscall }, /* No 56 unused system call */ { .entry = &syscall_setpgid }, { .entry = &syscall_ni_syscall }, /* No 58 unused system call */ { .entry = &syscall_ni_syscall }, /* No 59 unused system call */ { .entry = &syscall_umask }, { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, { .entry = &syscall_setsid }, { .entry = &syscall_sigaction }, { .entry = &syscall_ni_syscall }, /* No 68 unused system call */ { .entry = &syscall_ni_syscall }, /* No 69 unused system call */ { .entry = &syscall_setreuid16 }, { .entry = &syscall_setregid16 }, { .entry = &syscall_sigsuspend }, { .entry = &syscall_sigpending }, { .entry = &syscall_sethostname }, { .entry = &syscall_setrlimit }, { .entry = &syscall_getrlimit }, /* old_getrlimit */ { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, { .entry = &syscall_getgroups16 }, { .entry = &syscall_setgroups16 }, { .entry = &syscall_ni_syscall }, /* No 82 unused system call */ { .entry = &syscall_symlink }, { .entry = &syscall_ni_syscall }, /* No 84 unused system call */ { .entry = &syscall_readlink }, { .entry = &syscall_uselib }, { .entry = &syscall_swapon }, { .entry = &syscall_reboot }, { .entry = &syscall_oldreaddir }, { .entry = &syscall_mmap }, /* old_mmap */ { .entry = &syscall_munmap }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, { .entry = &syscall_fchown16 }, { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_ni_syscall }, /* No 98 unused system call */ { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, { .entry = &syscall_ni_syscall }, /* Non-existant ioperm svc */ { .entry = &syscall_socketcall }, { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, { .entry = &syscall_getitimer }, { .entry = &syscall_newstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_ni_syscall }, /* No 109 unused system call */ { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_vhangup }, { .entry = &syscall_ni_syscall }, /* Non-existant idle svc */ { .entry = &syscall_ni_syscall }, /* No 113 unused system call */ { .entry = &syscall_wait4 }, { .entry = &syscall_swapoff }, { .entry = &syscall_sysinfo }, { .entry = &syscall_ipc }, /* s390_ipc */ { .entry = &syscall_fsync }, { .entry = &syscall_sigreturn }, { .entry = &syscall_clone }, { .entry = &syscall_setdomainname }, { .entry = &syscall_newuname }, { .entry = &syscall_ni_syscall }, /* No 123 unused system call */ { .entry = &syscall_adjtimex }, { .entry = &syscall_mprotect }, { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, /* Non-existant create_module svc */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* Non-existant get_kernel_syms svc */ { .entry = &syscall_quotactl }, { .entry = &syscall_getpgid }, { .entry = &syscall_fchdir }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, { .entry = &syscall_personality }, { .entry = &syscall_ni_syscall }, /* Non-existant afs_syscall svc */ { .entry = &syscall_setfsuid16 }, { .entry = &syscall_setfsgid16 }, { .entry = &syscall_llseek }, { .entry = &syscall_getdents }, { .entry = &syscall_select }, { .entry = &syscall_flock }, { .entry = &syscall_msync }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_sysctl }, { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_setresuid16 }, { .entry = &syscall_getresuid16 }, { .entry = &syscall_ni_syscall }, /* No 166 unused system call */ { .entry = &syscall_ni_syscall }, /* Non-existant query_module svc */ { .entry = &syscall_poll }, { .entry = &syscall_ni_syscall }, /* Non-existant nfsservctl svc */ { .entry = &syscall_setresgid16 }, { .entry = &syscall_getresgid16 }, { .entry = &syscall_prctl }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_chown16 }, { .entry = &syscall_getcwd }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_sendfile }, { .entry = &syscall_ni_syscall }, /* Non-existant getpmsg svc */ { .entry = &syscall_ni_syscall }, /* Non-existant putpmsg svc */ { .entry = &syscall_vfork }, { .entry = &syscall_getrlimit }, { .entry = &syscall_mmap2 }, { .entry = &syscall_truncate64 }, { .entry = &syscall_ftruncate64 }, { .entry = &syscall_stat64 }, { .entry = &syscall_lstat64 }, { .entry = &syscall_fstat64 }, { .entry = &syscall_lchown }, { .entry = &syscall_getuid }, { .entry = &syscall_getgid }, { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_fchown }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_chown }, { .entry = &syscall_setuid }, { .entry = &syscall_setgid }, { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_pivot_root }, { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, { .entry = &syscall_getdents64 }, { .entry = &syscall_fcntl }, /* fcntl64 */ { .entry = &syscall_readahead }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_gettid }, { .entry = &syscall_tkill }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_tgkill }, { .entry = &syscall_ni_syscall }, /* No 242 unused system call */ { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_exit_group }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_fadvise64 }, /* s390_fadvise64 */ { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_ni_syscall }, /* No 263 unused system call */ { .entry = &syscall_fadvise64_64 }, /* s390_fadvise64_64 */ { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_remap_file_pages }, { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_kexec_load }, { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_waitid }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_utimes }, { .entry = &syscall_fallocate}, /* s390_fallocate */ { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, { .entry = &syscall_ni_syscall }, /* Non-existant timerfd svc */ { .entry = &syscall_eventfd }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_dup3 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_runtime_instr }, /* s390_runtime_instr svc */ { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_renameat2 }, { .entry = &syscall_seccomp }, { .entry = &syscall_getrandom }, { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif { .entry = &syscall_s390_pci_mmio_write }, { .entry = &syscall_s390_pci_mmio_read }, { .entry = &syscall_execveat }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_socket }, { .entry = &syscall_socketpair }, { .entry = &syscall_bind }, { .entry = &syscall_connect }, { .entry = &syscall_listen }, { .entry = &syscall_accept4 }, { .entry = &syscall_getsockopt }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockname }, { .entry = &syscall_getpeername }, { .entry = &syscall_sendto }, { .entry = &syscall_sendmsg }, { .entry = &syscall_recvfrom }, { .entry = &syscall_recvmsg }, { .entry = &syscall_shutdown }, { .entry = &syscall_mlock2 }, { .entry = &syscall_copy_file_range }, { .entry = &syscall_preadv2 }, { .entry = &syscall_pwritev2 }, { .entry = &syscall_s390_guarded_storage }, { .entry = &syscall_statx }, { .entry = &syscall_s390_sthyi }, }; include/syscalls-s390x.h000066400000000000000000000360231445305223700154040ustar00rootroot00000000000000#pragma once /* from arch/s390/kernel/syscalls.S */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_s390x[] = { { .entry = &syscall_ni_syscall }, /* No 0 unused system call */ { .entry = &syscall_exit }, { .entry = &syscall_fork }, { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_restart_syscall }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_ni_syscall }, /* No 13 unused system call */ { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, { .entry = &syscall_ni_syscall }, /* No 16 unused system call */ { .entry = &syscall_ni_syscall }, /* No 17 unused system call */ { .entry = &syscall_ni_syscall }, /* No 18 unused system call */ { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, { .entry = &syscall_mount }, { .entry = &syscall_oldumount }, { .entry = &syscall_ni_syscall }, /* No 23 unused system call */ { .entry = &syscall_ni_syscall }, /* No 24 unused system call */ { .entry = &syscall_ni_syscall }, /* No 25 unused system call */ { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, { .entry = &syscall_ni_syscall }, /* No 28 unused system call */ { .entry = &syscall_pause }, { .entry = &syscall_utime }, { .entry = &syscall_ni_syscall }, /* No 31 unused system call */ { .entry = &syscall_ni_syscall }, /* No 32 unused system call */ { .entry = &syscall_access }, { .entry = &syscall_nice }, { .entry = &syscall_ni_syscall }, /* No 35 unused system call */ { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_ni_syscall }, /* No 44 unused system call */ { .entry = &syscall_brk }, { .entry = &syscall_ni_syscall }, /* No 46 unused system call */ { .entry = &syscall_ni_syscall }, /* No 47 unused system call */ { .entry = &syscall_signal }, { .entry = &syscall_ni_syscall }, /* No 49 unused system call */ { .entry = &syscall_ni_syscall }, /* No 50 unused system call */ { .entry = &syscall_acct }, { .entry = &syscall_umount }, { .entry = &syscall_ni_syscall }, /* No 53 unused system call */ { .entry = &syscall_ioctl }, { .entry = &syscall_fcntl }, { .entry = &syscall_ni_syscall }, /* No 56 unused system call */ { .entry = &syscall_setpgid }, { .entry = &syscall_ni_syscall }, /* No 58 unused system call */ { .entry = &syscall_ni_syscall }, /* No 59 unused system call */ { .entry = &syscall_umask }, { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, { .entry = &syscall_setsid }, { .entry = &syscall_sigaction }, { .entry = &syscall_ni_syscall }, /* No 68 unused system call */ { .entry = &syscall_ni_syscall }, /* No 69 unused system call */ { .entry = &syscall_ni_syscall }, /* No 70 unused system call */ { .entry = &syscall_ni_syscall }, /* No 71 unused system call */ { .entry = &syscall_sigsuspend }, { .entry = &syscall_sigpending }, { .entry = &syscall_sethostname }, { .entry = &syscall_setrlimit }, { .entry = &syscall_ni_syscall }, /* No 76 unused system call */ { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, { .entry = &syscall_ni_syscall }, /* No 80 unused system call */ { .entry = &syscall_ni_syscall }, /* No 81 unused system call */ { .entry = &syscall_ni_syscall }, /* No 82 unused system call */ { .entry = &syscall_symlink }, { .entry = &syscall_ni_syscall }, /* No 84 unused system call */ { .entry = &syscall_readlink }, { .entry = &syscall_uselib }, { .entry = &syscall_swapon }, { .entry = &syscall_reboot }, { .entry = &syscall_ni_syscall }, /* No 89 unused system call */ { .entry = &syscall_mmap }, /* old_mmap */ { .entry = &syscall_munmap }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, { .entry = &syscall_ni_syscall }, /* No 95 unused system call */ { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_ni_syscall }, /* No 98 unused system call */ { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, { .entry = &syscall_ni_syscall }, /* Non-existant ioperm svc */ { .entry = &syscall_socketcall }, { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, { .entry = &syscall_getitimer }, { .entry = &syscall_newstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_ni_syscall }, /* No 109 unused system call */ { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_vhangup }, { .entry = &syscall_ni_syscall }, /* Non-existant idle svc */ { .entry = &syscall_ni_syscall }, /* No 113 unused system call */ { .entry = &syscall_wait4 }, { .entry = &syscall_swapoff }, { .entry = &syscall_sysinfo }, { .entry = &syscall_ipc }, /* s390_ipc */ { .entry = &syscall_fsync }, { .entry = &syscall_sigreturn }, { .entry = &syscall_clone }, { .entry = &syscall_setdomainname }, { .entry = &syscall_newuname }, { .entry = &syscall_ni_syscall }, /* No 123 unused system call */ { .entry = &syscall_adjtimex }, { .entry = &syscall_mprotect }, { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, /* Non-existant create_module svc */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* Non-existant get_kernel_syms svc */ { .entry = &syscall_quotactl }, { .entry = &syscall_getpgid }, { .entry = &syscall_fchdir }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, { .entry = &syscall_personality }, /* s390_personality */ { .entry = &syscall_ni_syscall }, /* Non-existant afs_syscall svc */ { .entry = &syscall_ni_syscall }, /* No 138 unused system call */ { .entry = &syscall_ni_syscall }, /* No 139 unused system call */ { .entry = &syscall_ni_syscall }, /* No 140 unused system call */ { .entry = &syscall_getdents }, { .entry = &syscall_select }, { .entry = &syscall_flock }, { .entry = &syscall_msync }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_sysctl }, { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_ni_syscall }, /* No 164 unused system call */ { .entry = &syscall_ni_syscall }, /* No 165 unused system call */ { .entry = &syscall_ni_syscall }, /* No 166 unused system call */ { .entry = &syscall_ni_syscall }, /* Non-existant query_module svc */ { .entry = &syscall_poll }, { .entry = &syscall_ni_syscall }, /* Non-existant nfsservctl svc */ { .entry = &syscall_ni_syscall }, /* No 170 unused system call */ { .entry = &syscall_ni_syscall }, /* No 171 unused system call */ { .entry = &syscall_prctl }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_ni_syscall }, /* No 182 unused system call */ { .entry = &syscall_getcwd }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_ni_syscall }, /* Non-existant getpmsg svc */ { .entry = &syscall_ni_syscall }, /* Non-existant putpmsg svc */ { .entry = &syscall_vfork }, { .entry = &syscall_getrlimit }, { .entry = &syscall_ni_syscall }, /* No 192 unused system call */ { .entry = &syscall_ni_syscall }, /* No 193 unused system call */ { .entry = &syscall_ni_syscall }, /* No 194 unused system call */ { .entry = &syscall_ni_syscall }, /* No 195 unused system call */ { .entry = &syscall_ni_syscall }, /* No 196 unused system call */ { .entry = &syscall_ni_syscall }, /* No 197 unused system call */ { .entry = &syscall_lchown }, { .entry = &syscall_getuid }, { .entry = &syscall_getgid }, { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_fchown }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_chown }, { .entry = &syscall_setuid }, { .entry = &syscall_setgid }, { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_pivot_root }, { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, { .entry = &syscall_getdents64 }, { .entry = &syscall_ni_syscall }, /* No 221 unused system call */ { .entry = &syscall_readahead }, { .entry = &syscall_ni_syscall }, /* No 223 unused system call */ { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_gettid }, { .entry = &syscall_tkill }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_tgkill }, { .entry = &syscall_ni_syscall }, /* No 242 unused system call */ { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_exit_group }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_fadvise64_64 }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_ni_syscall }, /* No 263 unused system call */ { .entry = &syscall_ni_syscall }, /* No 264 unused system call */ { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_remap_file_pages }, { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_kexec_load }, { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_waitid }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_newfstatat }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_utimes }, { .entry = &syscall_fallocate }, { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, { .entry = &syscall_ni_syscall }, /* Non-existant timerfd svc */ { .entry = &syscall_eventfd }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_dup3 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_runtime_instr }, /* s390_runtime_instr svc */ { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_renameat2 }, { .entry = &syscall_seccomp }, { .entry = &syscall_getrandom }, { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif { .entry = &syscall_s390_pci_mmio_write }, { .entry = &syscall_s390_pci_mmio_read }, { .entry = &syscall_execveat }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_socket }, { .entry = &syscall_socketpair }, { .entry = &syscall_bind }, { .entry = &syscall_connect }, { .entry = &syscall_listen }, { .entry = &syscall_accept4 }, { .entry = &syscall_getsockopt }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockname }, { .entry = &syscall_getpeername }, { .entry = &syscall_sendto }, { .entry = &syscall_sendmsg }, { .entry = &syscall_recvfrom }, { .entry = &syscall_recvmsg }, { .entry = &syscall_shutdown }, { .entry = &syscall_mlock2 }, { .entry = &syscall_copy_file_range }, { .entry = &syscall_preadv2 }, { .entry = &syscall_pwritev2 }, { .entry = &syscall_s390_guarded_storage }, { .entry = &syscall_statx }, { .entry = &syscall_s390_sthyi }, }; include/syscalls-sh.h000066400000000000000000000717111445305223700151330ustar00rootroot00000000000000#pragma once #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" #include #if WORD_BIT == 64 /* arch/sh/kernel/syscalls_64.S */ struct syscalltable syscalls_sh[] = { { .entry = &syscall_restart_syscall }, /* 0 - old "setup()" system call */ { .entry = &syscall_exit }, { .entry = &syscall_fork }, { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, /* 5 */ { .entry = &syscall_close }, { .entry = &syscall_waitpid }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, /* 10 */ { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_time }, { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, /* 15 */ { .entry = &syscall_lchown16 }, { .entry = &syscall_ni_syscall }, /* old break syscall holder */ { .entry = &syscall_stat }, { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, /* 20 */ { .entry = &syscall_mount }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_oldumount },*/ { .entry = &syscall_setuid16 }, { .entry = &syscall_getuid16 }, { .entry = &syscall_stime }, /* 25 */ { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_fstat },*/ { .entry = &syscall_pause }, { .entry = &syscall_utime }, /* 30 */ { .entry = &syscall_ni_syscall }, /* old stty syscall holder */ { .entry = &syscall_ni_syscall }, /* old gtty syscall holder */ { .entry = &syscall_access }, { .entry = &syscall_nice }, { .entry = &syscall_ni_syscall }, /* 35 */ /* old ftime syscall holder */ { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, /* 40 */ { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_ni_syscall }, /* old prof syscall holder */ { .entry = &syscall_brk }, /* 45 */ { .entry = &syscall_setgid16 }, { .entry = &syscall_getgid16 }, { .entry = &syscall_signal }, { .entry = &syscall_geteuid16 }, { .entry = &syscall_getegid16 }, /* 50 */ { .entry = &syscall_acct }, { .entry = &syscall_umount }, /* recycled never used phys( */ { .entry = &syscall_ni_syscall }, /* old lock syscall holder */ { .entry = &syscall_ioctl }, { .entry = &syscall_fcntl }, /* 55 */ { .entry = &syscall_ni_syscall }, /* old mpx syscall holder */ { .entry = &syscall_setpgid }, { .entry = &syscall_ni_syscall }, /* old ulimit syscall holder */ { .entry = &syscall_ni_syscall }, /* sys_olduname */ { .entry = &syscall_umask }, /* 60 */ { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, /* 65 */ { .entry = &syscall_setsid }, { .entry = &syscall_sigaction }, { .entry = &syscall_sgetmask }, { .entry = &syscall_ssetmask }, { .entry = &syscall_setreuid16 }, /* 70 */ { .entry = &syscall_setregid16 }, { .entry = &syscall_sigsuspend }, { .entry = &syscall_sigpending }, { .entry = &syscall_sethostname }, { .entry = &syscall_setrlimit }, /* 75 */ { .entry = &syscall_getrlimit }, /* old_getrlimit */ { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, { .entry = &syscall_getgroups16 }, /* 80 */ { .entry = &syscall_setgroups16 }, { .entry = &syscall_ni_syscall }, /* sys_oldselect */ { .entry = &syscall_symlink }, { .entry = &syscall_lstat }, { .entry = &syscall_readlink }, /* 85 */ { .entry = &syscall_uselib }, { .entry = &syscall_swapon }, { .entry = &syscall_reboot }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_old_readdir },*/ { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_old_mmap },*/ /* 90 */ { .entry = &syscall_munmap }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, { .entry = &syscall_fchown16 }, /* 95 */ { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_ni_syscall }, /* old profil syscall holder */ { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, /* 100 */ { .entry = &syscall_ni_syscall }, /* ioperm */ { .entry = &syscall_socketcall }, /* Obsolete implementation of socket syscall */ { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, { .entry = &syscall_getitimer }, /* 105 */ { .entry = &syscall_newstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_uname }, { .entry = &syscall_ni_syscall }, /* 110 */ /* iopl */ { .entry = &syscall_vhangup }, { .entry = &syscall_ni_syscall }, /* idle */ { .entry = &syscall_ni_syscall }, /* vm86old */ { .entry = &syscall_wait4 }, { .entry = &syscall_swapoff }, /* 115 */ { .entry = &syscall_sysinfo }, { .entry = &syscall_ipc }, /* Obsolete ipc syscall implementation */ { .entry = &syscall_fsync }, { .entry = &syscall_sigreturn }, { .entry = &syscall_clone }, /* 120 */ { .entry = &syscall_setdomainname }, { .entry = &syscall_newuname }, { .entry = &syscall_sh_cacheflush }, /* x86: sys_modify_ldt */ { .entry = &syscall_adjtimex }, { .entry = &syscall_mprotect }, /* 125 */ { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, /* old "create_module" */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* 130: old "get_kernel_syms" */ { .entry = &syscall_quotactl }, { .entry = &syscall_getpgid }, { .entry = &syscall_fchdir }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, /* 135 */ { .entry = &syscall_personality }, { .entry = &syscall_ni_syscall }, /* for afs_syscall */ { .entry = &syscall_setfsuid16 }, { .entry = &syscall_setfsgid16 }, { .entry = &syscall_llseek }, /* 140 */ { .entry = &syscall_getdents }, { .entry = &syscall_select }, { .entry = &syscall_flock }, { .entry = &syscall_msync }, { .entry = &syscall_readv }, /* 145 */ { .entry = &syscall_writev }, { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_sysctl }, { .entry = &syscall_mlock }, /* 150 */ { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, /* 155 */ { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, /* 160 */ { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_setresuid16 }, { .entry = &syscall_getresuid16 }, /* 165 */ { .entry = &syscall_ni_syscall }, /* vm86 */ { .entry = &syscall_ni_syscall }, /* old "query_module" */ { .entry = &syscall_poll }, { .entry = &syscall_ni_syscall }, /* was nfsservctl */ { .entry = &syscall_setresgid16 }, /* 170 */ { .entry = &syscall_getresgid16 }, { .entry = &syscall_prctl }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, /* 175 */ { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_pread64 }, /* 180 */ { .entry = &syscall_pwrite64 }, { .entry = &syscall_chown16 }, { .entry = &syscall_getcwd }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, /* 185 */ { .entry = &syscall_sigaltstack }, { .entry = &syscall_sendfile }, { .entry = &syscall_ni_syscall }, /* getpmsg */ { .entry = &syscall_ni_syscall }, /* putpmsg */ { .entry = &syscall_vfork }, /* 190 */ { .entry = &syscall_getrlimit }, { .entry = &syscall_mmap2 }, { .entry = &syscall_truncate64 }, { .entry = &syscall_ftruncate64 }, { .entry = &syscall_stat64 }, /* 195 */ { .entry = &syscall_lstat64 }, { .entry = &syscall_fstat64 }, { .entry = &syscall_lchown }, { .entry = &syscall_getuid }, { .entry = &syscall_getgid }, /* 200 */ { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_getgroups }, /* 205 */ { .entry = &syscall_setgroups }, { .entry = &syscall_fchown }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, { .entry = &syscall_setresgid }, /* 210 */ { .entry = &syscall_getresgid }, { .entry = &syscall_chown }, { .entry = &syscall_setuid }, { .entry = &syscall_setgid }, { .entry = &syscall_setfsuid }, /* 215 */ { .entry = &syscall_setfsgid }, { .entry = &syscall_pivot_root }, { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, /* Broken-out socket family (maintain backwards compatibility in syscall numbering with 2.4) */ { .entry = &syscall_socket }, /* 220 */ { .entry = &syscall_bind }, { .entry = &syscall_connect }, { .entry = &syscall_listen }, { .entry = &syscall_accept }, { .entry = &syscall_getsockname }, /* 225 */ { .entry = &syscall_getpeername }, { .entry = &syscall_socketpair }, { .entry = &syscall_send }, { .entry = &syscall_sendto }, { .entry = &syscall_recv }, /* 230*/ { .entry = &syscall_recvfrom }, { .entry = &syscall_shutdown }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockopt }, { .entry = &syscall_sendmsg }, /* 235 */ { .entry = &syscall_recvmsg }, /* Broken-out IPC family (maintain backwards compatibility in syscall numbering with 2.4) */ { .entry = &syscall_semop }, { .entry = &syscall_semget }, { .entry = &syscall_semctl }, { .entry = &syscall_msgsnd }, /* 240 */ { .entry = &syscall_msgrcv }, { .entry = &syscall_msgget }, { .entry = &syscall_msgctl }, { .entry = &syscall_shmat }, { .entry = &syscall_shmdt }, /* 245 */ { .entry = &syscall_shmget }, { .entry = &syscall_shmctl }, /* Rest of syscalls listed in 2.4 i386 unistd.h */ { .entry = &syscall_getdents64 }, { .entry = &syscall_fcntl }, /* fcntl64 */ { .entry = &syscall_ni_syscall }, /* 250 reserved for TUX */ { .entry = &syscall_ni_syscall }, /* Reserved for Security */ { .entry = &syscall_gettid }, { .entry = &syscall_readahead }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, /* 255 */ { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, /* 260 */ { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, /* 265 */ { .entry = &syscall_tkill }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, /* 270 */ { .entry = &syscall_ni_syscall }, /* reserved for set_thread_area */ { .entry = &syscall_ni_syscall }, /* reserved for get_thread_area */ { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, /* 275 */ { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_fadvise64 }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_exit_group }, /* 280 */ /* Rest of new 2.6 syscalls */ { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_remap_file_pages }, /* 285 */ { .entry = &syscall_set_tid_address }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, /* 290 */ { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, /* 295 */ { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_tgkill }, { .entry = &syscall_utimes }, { .entry = &syscall_fadvise64_64 }, /* 300 */ { .entry = &syscall_ni_syscall }, /* Reserved for vserver */ { .entry = &syscall_ni_syscall }, /* Reserved for mbind */ { .entry = &syscall_ni_syscall }, /* get_mempolicy */ { .entry = &syscall_ni_syscall }, /* set_mempolicy */ { .entry = &syscall_mq_open }, /* 305 */ { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, /* 310 */ { .entry = &syscall_ni_syscall }, /* Reserved for kexec */ { .entry = &syscall_waitid }, { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, /* 315 */ { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, /* 320 */ { .entry = &syscall_ni_syscall }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, /* 325 */ { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, /* 330 */ { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, /* 335 */ { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, /* 340 */ { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_tee }, { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, /* 345 */ { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, { .entry = &syscall_timerfd_create }, /* 350 */ { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_signalfd4 }, /* 355 */ { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, /* 360 */ { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_recvmmsg }, /* 365 */ { .entry = &syscall_accept4 }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, /* 370 */ { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_setns }, /* 375 */ { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, }; #else /* arch/sh/kernel/syscalls_32.S */ struct syscalltable syscalls_sh[] = { { .entry = &syscall_restart_syscall }, /* 0 - old "setup()" system call*/ { .entry = &syscall_exit }, { .entry = &syscall_fork }, { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, /* 5 */ { .entry = &syscall_close }, { .entry = &syscall_waitpid }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, /* 10 */ { .entry = &syscall_execve }, { .entry = &syscall_chdir }, { .entry = &syscall_time }, { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, /* 15 */ { .entry = &syscall_lchown16 }, { .entry = &syscall_ni_syscall }, /* old break syscall holder */ { .entry = &syscall_stat }, { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, /* 20 */ { .entry = &syscall_mount }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_oldumount },*/ { .entry = &syscall_setuid16 }, { .entry = &syscall_getuid16 }, { .entry = &syscall_stime }, /* 25 */ { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, /*{ .entry = &syscall_fstat },*/ { .entry = &syscall_ni_syscall }, { .entry = &syscall_pause }, { .entry = &syscall_utime }, /* 30 */ { .entry = &syscall_ni_syscall }, /* old stty syscall holder */ { .entry = &syscall_ni_syscall }, /* old gtty syscall holder */ { .entry = &syscall_access }, { .entry = &syscall_nice }, { .entry = &syscall_ni_syscall }, /* 35 */ /* old ftime syscall holder */ { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, /* 40 */ { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_ni_syscall }, /* old prof syscall holder */ { .entry = &syscall_brk }, /* 45 */ { .entry = &syscall_setgid16 }, { .entry = &syscall_getgid16 }, { .entry = &syscall_signal }, { .entry = &syscall_geteuid16 }, { .entry = &syscall_getegid16 }, /* 50 */ { .entry = &syscall_acct }, { .entry = &syscall_umount }, /* recycled never used phys() */ { .entry = &syscall_ni_syscall }, /* old lock syscall holder */ { .entry = &syscall_ioctl }, { .entry = &syscall_fcntl }, /* 55 */ { .entry = &syscall_ni_syscall }, /* old mpx syscall holder */ { .entry = &syscall_setpgid }, { .entry = &syscall_ni_syscall }, /* old ulimit syscall holder */ { .entry = &syscall_ni_syscall }, /* sys_olduname */ { .entry = &syscall_umask }, /* 60 */ { .entry = &syscall_chroot }, { .entry = &syscall_ustat }, { .entry = &syscall_dup2 }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, /* 65 */ { .entry = &syscall_setsid }, { .entry = &syscall_sigaction }, { .entry = &syscall_sgetmask }, { .entry = &syscall_ssetmask }, { .entry = &syscall_setreuid16 }, /* 70 */ { .entry = &syscall_setregid16 }, { .entry = &syscall_sigsuspend }, { .entry = &syscall_sigpending }, { .entry = &syscall_sethostname }, { .entry = &syscall_setrlimit }, /* 75 */ { .entry = &syscall_getrlimit }, /* old_getrlimit */ { .entry = &syscall_getrusage }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_settimeofday }, { .entry = &syscall_getgroups16 }, /* 80 */ { .entry = &syscall_setgroups16 }, { .entry = &syscall_ni_syscall }, /* sys_oldselect */ { .entry = &syscall_symlink }, { .entry = &syscall_lstat }, { .entry = &syscall_readlink }, /* 85 */ { .entry = &syscall_uselib }, { .entry = &syscall_swapon }, { .entry = &syscall_reboot }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_old_readdir },*/ { .entry = &syscall_mmap }, /* 90 */ { .entry = &syscall_munmap }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_fchmod }, { .entry = &syscall_fchown16 }, /* 95 */ { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_ni_syscall }, /* old profil syscall holder */ { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, /* 100 */ { .entry = &syscall_ni_syscall }, /* ioperm */ { .entry = &syscall_socketcall }, { .entry = &syscall_syslog }, { .entry = &syscall_setitimer }, { .entry = &syscall_getitimer }, /* 105 */ { .entry = &syscall_newstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_uname }, { .entry = &syscall_ni_syscall }, /* 110 */ /* iopl */ { .entry = &syscall_vhangup }, { .entry = &syscall_ni_syscall }, /* idle */ { .entry = &syscall_ni_syscall }, /* vm86old */ { .entry = &syscall_wait4 }, { .entry = &syscall_swapoff }, /* 115 */ { .entry = &syscall_sysinfo }, { .entry = &syscall_ipc }, { .entry = &syscall_fsync }, { .entry = &syscall_sigreturn }, { .entry = &syscall_clone }, /* 120 */ { .entry = &syscall_setdomainname }, { .entry = &syscall_newuname }, { .entry = &syscall_sh_cacheflush }, /* x86: sys_modify_ldt */ { .entry = &syscall_adjtimex }, { .entry = &syscall_mprotect }, /* 125 */ { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, /* old "create_module" */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* 130: old "get_kernel_syms" */ { .entry = &syscall_quotactl }, { .entry = &syscall_getpgid }, { .entry = &syscall_fchdir }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, /* 135 */ { .entry = &syscall_personality }, { .entry = &syscall_ni_syscall }, /* for afs_syscall */ { .entry = &syscall_setfsuid16 }, { .entry = &syscall_setfsgid16 }, { .entry = &syscall_llseek }, /* 140 */ { .entry = &syscall_getdents }, { .entry = &syscall_select }, { .entry = &syscall_flock }, { .entry = &syscall_msync }, { .entry = &syscall_readv }, /* 145 */ { .entry = &syscall_writev }, { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_sysctl }, { .entry = &syscall_mlock }, /* 150 */ { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, /* 155 */ { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, /* 160 */ { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_setresuid16 }, { .entry = &syscall_getresuid16 }, /* 165 */ { .entry = &syscall_ni_syscall }, /* vm86 */ { .entry = &syscall_ni_syscall }, /* old "query_module" */ { .entry = &syscall_poll }, { .entry = &syscall_ni_syscall }, /* was nfsservctl */ { .entry = &syscall_setresgid16 }, /* 170 */ { .entry = &syscall_getresgid16 }, { .entry = &syscall_prctl }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, /* 175 */ { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_pread_wrapper },*/ /* 180 */ { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_pwrite_wrapper },*/ { .entry = &syscall_chown16 }, { .entry = &syscall_getcwd }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, /* 185 */ { .entry = &syscall_sigaltstack }, { .entry = &syscall_sendfile }, { .entry = &syscall_ni_syscall }, /* getpmsg */ { .entry = &syscall_ni_syscall }, /* putpmsg */ { .entry = &syscall_vfork }, /* 190 */ { .entry = &syscall_getrlimit }, { .entry = &syscall_mmap2 }, { .entry = &syscall_truncate64 }, { .entry = &syscall_ftruncate64 }, { .entry = &syscall_stat64 }, /* 195 */ { .entry = &syscall_lstat64 }, { .entry = &syscall_fstat64 }, { .entry = &syscall_lchown }, { .entry = &syscall_getuid }, { .entry = &syscall_getgid }, /* 200 */ { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_getgroups }, /* 205 */ { .entry = &syscall_setgroups }, { .entry = &syscall_fchown }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, { .entry = &syscall_setresgid }, /* 210 */ { .entry = &syscall_getresgid }, { .entry = &syscall_chown }, { .entry = &syscall_setuid }, { .entry = &syscall_setgid }, { .entry = &syscall_setfsuid }, /* 215 */ { .entry = &syscall_setfsgid }, { .entry = &syscall_pivot_root }, { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, { .entry = &syscall_getdents64 }, /* 220 */ { .entry = &syscall_fcntl }, /* fcntl64 */ { .entry = &syscall_ni_syscall }, /* reserved for TUX */ { .entry = &syscall_ni_syscall }, /* Reserved for Security */ { .entry = &syscall_gettid }, { .entry = &syscall_readahead }, /* 225 */ { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, /* 230 */ { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, /* 235 */ { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_tkill }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_futex }, /* 240 */ { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_ni_syscall }, /* reserved for set_thread_area */ { .entry = &syscall_ni_syscall }, /* reserved for get_thread_area */ { .entry = &syscall_io_setup }, /* 245 */ { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_fadvise64 }, /* 250 */ { .entry = &syscall_ni_syscall }, { .entry = &syscall_exit_group }, { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, /* 255 */ { .entry = &syscall_epoll_wait }, { .entry = &syscall_remap_file_pages }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, /* 260 */ { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, /* 265 */ { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_tgkill }, /* 270 */ { .entry = &syscall_utimes }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_fadvise64_64_wrapper },*/ { .entry = &syscall_ni_syscall }, /* Reserved for vserver */ { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, /* 275 */ { .entry = &syscall_set_mempolicy }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, /* 280 */ { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_kexec_load }, { .entry = &syscall_waitid }, { .entry = &syscall_add_key }, /* 285 */ { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_inotify_init }, /* 290 */ { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_openat }, /* 295 */ { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, /* 300 */ { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, /* 305 */ { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, /* 310 */ { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_splice }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_tee }, /* 315 */ { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_utimensat }, /* 320 */ { .entry = &syscall_signalfd }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, { .entry = &syscall_timerfd_settime }, /* 325 */ { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, /* 330 */ { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, /* 335 */ { .entry = &syscall_perf_event_open }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, /* Broken-out socket family */ { .entry = &syscall_socket }, /* 340 */ { .entry = &syscall_bind }, { .entry = &syscall_connect }, { .entry = &syscall_listen }, { .entry = &syscall_accept }, { .entry = &syscall_getsockname }, /* 345 */ { .entry = &syscall_getpeername }, { .entry = &syscall_socketpair }, { .entry = &syscall_send }, { .entry = &syscall_sendto }, { .entry = &syscall_recv }, /* 350 */ { .entry = &syscall_recvfrom }, { .entry = &syscall_shutdown }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockopt }, { .entry = &syscall_sendmsg }, /* 355 */ { .entry = &syscall_recvmsg }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_accept4 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, /* 360 */ { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, /* 365 */ { .entry = &syscall_process_vm_writev }, { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, }; include/syscalls-sparc.h000066400000000000000000000302211445305223700156200ustar00rootroot00000000000000#pragma once /* Syscalls from arch/sparc/kernel/systbls_{32,64}.S */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_sparc[] = { { .entry = &syscall_restart_syscall }, { .entry = &syscall_exit }, { .entry = &syscall_fork }, { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_wait4 }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, { .entry = &syscall_ni_syscall }, // (sunos_execv) { .entry = &syscall_chdir }, { .entry = &syscall_chown }, { .entry = &syscall_mknod }, { .entry = &syscall_chmod }, { .entry = &syscall_lchown }, { .entry = &syscall_brk }, { .entry = &syscall_ni_syscall }, /* perfctr */ { .entry = &syscall_lseek }, { .entry = &syscall_getpid }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_setuid }, { .entry = &syscall_getuid }, { .entry = &syscall_vmsplice }, { .entry = &syscall_ptrace }, { .entry = &syscall_alarm }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_pause }, { .entry = &syscall_utime }, { .entry = &syscall_ni_syscall }, // (old stty syscall holder) { .entry = &syscall_ni_syscall }, // (old gtty syscall holder) { .entry = &syscall_access }, { .entry = &syscall_nice }, { .entry = &syscall_ni_syscall }, // (old ftime syscall holder) { .entry = &syscall_sync }, { .entry = &syscall_kill }, { .entry = &syscall_newstat }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_newlstat }, { .entry = &syscall_dup }, { .entry = &syscall_pipe }, { .entry = &syscall_times }, { .entry = &syscall_ni_syscall }, // (old prof syscall holder) { .entry = &syscall_umount }, { .entry = &syscall_setgid }, { .entry = &syscall_getgid }, { .entry = &syscall_signal }, { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_acct }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_memory_ordering },*/ { .entry = &syscall_getgid }, { .entry = &syscall_ioctl }, { .entry = &syscall_reboot }, { .entry = &syscall_mmap2 }, { .entry = &syscall_symlink }, { .entry = &syscall_readlink }, { .entry = &syscall_execve }, { .entry = &syscall_umask }, { .entry = &syscall_chroot }, { .entry = &syscall_newfstat }, { .entry = &syscall_fstat64 }, { .entry = &syscall_getpagesize }, { .entry = &syscall_msync }, { .entry = &syscall_vfork }, { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_mmap }, { .entry = &syscall_setreuid }, { .entry = &syscall_munmap }, { .entry = &syscall_mprotect }, { .entry = &syscall_madvise }, { .entry = &syscall_vhangup }, { .entry = &syscall_truncate64 }, { .entry = &syscall_mincore }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_getpgrp }, { .entry = &syscall_setgroups }, { .entry = &syscall_setitimer }, { .entry = &syscall_ftruncate64 }, { .entry = &syscall_swapon }, { .entry = &syscall_getitimer }, { .entry = &syscall_setuid }, { .entry = &syscall_sethostname }, { .entry = &syscall_setgid }, { .entry = &syscall_dup2 }, { .entry = &syscall_setfsuid }, { .entry = &syscall_fcntl }, { .entry = &syscall_select }, { .entry = &syscall_setfsgid }, { .entry = &syscall_fsync }, { .entry = &syscall_setpriority }, { .entry = &syscall_socket }, { .entry = &syscall_connect }, { .entry = &syscall_accept }, { .entry = &syscall_getpriority }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_setregid }, { .entry = &syscall_recvmsg }, { .entry = &syscall_sendmsg }, { .entry = &syscall_getgroups }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_getrusage }, { .entry = &syscall_getsockopt }, { .entry = &syscall_getcwd }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_settimeofday }, { .entry = &syscall_fchown }, { .entry = &syscall_fchmod }, { .entry = &syscall_recvfrom }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_rename }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_flock }, { .entry = &syscall_lstat64 }, { .entry = &syscall_sendto }, { .entry = &syscall_shutdown }, { .entry = &syscall_socketpair }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_utimes }, { .entry = &syscall_stat64 }, { .entry = &syscall_sendfile64 }, { .entry = &syscall_getpeername }, { .entry = &syscall_futex }, { .entry = &syscall_gettid }, { .entry = &syscall_getrlimit }, { .entry = &syscall_setrlimit }, { .entry = &syscall_pivot_root }, { .entry = &syscall_prctl }, { .entry = &syscall_pciconfig_read }, { .entry = &syscall_pciconfig_write }, { .entry = &syscall_getsockname }, { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_poll }, { .entry = &syscall_getdents64 }, { .entry = &syscall_fcntl }, /* fcntl64 */ { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, { .entry = &syscall_oldumount }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_getdomainname },*/ { .entry = &syscall_setdomainname }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_utrap_install },*/ { .entry = &syscall_quotactl }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_mount }, { .entry = &syscall_ustat }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_getdents }, { .entry = &syscall_setsid }, { .entry = &syscall_fchdir }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_sigpending }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_setpgid }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_tkill }, { .entry = &syscall_exit_group }, { .entry = &syscall_newuname }, { .entry = &syscall_init_module }, { .entry = &syscall_personality }, { .entry = &syscall_remap_file_pages }, { .entry = &syscall_epoll_create }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_getppid }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_sgetmask }, { .entry = &syscall_ssetmask }, { .entry = &syscall_sigsuspend }, { .entry = &syscall_newlstat }, { .entry = &syscall_uselib }, { .entry = &syscall_ni_syscall }, /*{ .entry = &syscall_old_readdir },*/ { .entry = &syscall_readahead }, { .entry = &syscall_socketcall }, { .entry = &syscall_syslog }, { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_fadvise64 }, { .entry = &syscall_fadvise64_64 }, { .entry = &syscall_tgkill }, { .entry = &syscall_waitpid }, { .entry = &syscall_swapoff }, { .entry = &syscall_sysinfo }, { .entry = &syscall_ipc }, { .entry = &syscall_sigreturn }, { .entry = &syscall_clone }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_adjtimex }, { .entry = &syscall_sigprocmask }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_getpgid }, { .entry = &syscall_bdflush }, { .entry = &syscall_sysfs }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_select }, { .entry = &syscall_time }, { .entry = &syscall_splice }, { .entry = &syscall_stime }, { .entry = &syscall_statfs64 }, { .entry = &syscall_fstatfs64 }, { .entry = &syscall_llseek }, { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_yield }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_nanosleep }, { .entry = &syscall_mremap }, { .entry = &syscall_sysctl }, { .entry = &syscall_getsid }, { .entry = &syscall_fdatasync }, { .entry = &syscall_nfsservctl }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_timer_create }, { .entry = &syscall_ni_syscall }, { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_io_getevents }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_waitid }, { .entry = &syscall_tee }, { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_mbind }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_kexec_load }, { .entry = &syscall_move_pages }, { .entry = &syscall_getcpu }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_utimensat }, { .entry = &syscall_signalfd }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_accept4 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_setns }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_kern_features }, { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_renameat2 }, { .entry = &syscall_seccomp }, { .entry = &syscall_getrandom }, { .entry = &syscall_memfd_create }, #ifdef USE_BPF { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif { .entry = &syscall_execveat }, }; include/syscalls-tile.h000066400000000000000000000325731445305223700154610ustar00rootroot00000000000000#pragma once /* * Derived from arch/tile/include/asm/unistd.h */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_tile[] = { /* 0 */ { .entry = &syscall_io_setup }, /* 1 */ { .entry = &syscall_io_destroy }, /* 2 */ { .entry = &syscall_io_submit }, /* 3 */ { .entry = &syscall_io_cancel }, /* 4 */ { .entry = &syscall_io_getevents }, /* 5 */ { .entry = &syscall_setxattr }, /* 6 */ { .entry = &syscall_lsetxattr }, /* 7 */ { .entry = &syscall_fsetxattr }, /* 8 */ { .entry = &syscall_getxattr }, /* 9 */ { .entry = &syscall_lgetxattr }, /* 10 */ { .entry = &syscall_fgetxattr }, /* 11 */ { .entry = &syscall_listxattr }, /* 12 */ { .entry = &syscall_llistxattr }, /* 13 */ { .entry = &syscall_flistxattr }, /* 14 */ { .entry = &syscall_removexattr }, /* 15 */ { .entry = &syscall_lremovexattr }, /* 16 */ { .entry = &syscall_fremovexattr }, /* 17 */ { .entry = &syscall_getcwd }, /* 18 */ { .entry = &syscall_lookup_dcookie }, /* 19 */ { .entry = &syscall_eventfd2 }, /* 20 */ { .entry = &syscall_epoll_create1 }, /* 21 */ { .entry = &syscall_epoll_ctl }, /* 22 */ { .entry = &syscall_epoll_pwait }, /* 23 */ { .entry = &syscall_dup }, /* 24 */ { .entry = &syscall_dup3 }, /* 25 */ { .entry = &syscall_fcntl }, /* 26 */ { .entry = &syscall_inotify_init1 }, /* 27 */ { .entry = &syscall_inotify_add_watch }, /* 28 */ { .entry = &syscall_inotify_rm_watch }, /* 29 */ { .entry = &syscall_ioctl }, /* 30 */ { .entry = &syscall_ioprio_set }, /* 31 */ { .entry = &syscall_ioprio_get }, /* 32 */ { .entry = &syscall_flock }, /* 33 */ { .entry = &syscall_mknodat }, /* 34 */ { .entry = &syscall_mkdirat }, /* 35 */ { .entry = &syscall_unlinkat }, /* 36 */ { .entry = &syscall_symlinkat }, /* 37 */ { .entry = &syscall_linkat }, /* 38 */ { .entry = &syscall_renameat }, /* 39 */ { .entry = &syscall_umount }, /* 40 */ { .entry = &syscall_mount }, /* 41 */ { .entry = &syscall_pivot_root }, /* 42 */ { .entry = &syscall_ni_syscall }, /* 43 */ { .entry = &syscall_statfs }, /* 44 */ { .entry = &syscall_fstatfs }, /* 45 */ { .entry = &syscall_truncate }, /* 46 */ { .entry = &syscall_ftruncate }, /* 47 */ { .entry = &syscall_fallocate }, /* 48 */ { .entry = &syscall_faccessat }, /* 49 */ { .entry = &syscall_chdir }, /* 50 */ { .entry = &syscall_fchdir }, /* 51 */ { .entry = &syscall_chroot }, /* 52 */ { .entry = &syscall_fchmod }, /* 53 */ { .entry = &syscall_fchmodat }, /* 54 */ { .entry = &syscall_fchownat }, /* 55 */ { .entry = &syscall_fchown }, /* 56 */ { .entry = &syscall_openat }, /* 57 */ { .entry = &syscall_close }, /* 58 */ { .entry = &syscall_vhangup }, /* 59 */ { .entry = &syscall_pipe2 }, /* 60 */ { .entry = &syscall_quotactl }, /* 61 */ { .entry = &syscall_getdents64 }, /* 62 */ { .entry = &syscall_lseek }, /* 63 */ { .entry = &syscall_read }, /* 64 */ { .entry = &syscall_write }, /* 65 */ { .entry = &syscall_readv }, /* 66 */ { .entry = &syscall_writev }, /* 67 */ { .entry = &syscall_pread64 }, /* 68 */ { .entry = &syscall_pwrite64 }, /* 69 */ { .entry = &syscall_preadv }, /* 70 */ { .entry = &syscall_pwritev }, /* 71 */ { .entry = &syscall_sendfile64 }, /* 72 */ { .entry = &syscall_pselect6 }, /* 73 */ { .entry = &syscall_ppoll }, /* 74 */ { .entry = &syscall_signalfd4 }, /* 75 */ { .entry = &syscall_vmsplice }, /* 76 */ { .entry = &syscall_splice }, /* 77 */ { .entry = &syscall_tee }, /* 78 */ { .entry = &syscall_readlinkat }, /* 79 */ { .entry = &syscall_newfstatat }, /* 80 */ { .entry = &syscall_newfstat }, /* 81 */ { .entry = &syscall_sync }, /* 82 */ { .entry = &syscall_fsync }, /* 83 */ { .entry = &syscall_fdatasync }, /* 84 */ { .entry = &syscall_sync_file_range }, /* 85 */ { .entry = &syscall_timerfd_create }, /* 86 */ { .entry = &syscall_timerfd_settime }, /* 87 */ { .entry = &syscall_timerfd_gettime }, /* 88 */ { .entry = &syscall_utimensat }, /* 89 */ { .entry = &syscall_acct }, /* 90 */ { .entry = &syscall_capget }, /* 91 */ { .entry = &syscall_capset }, /* 92 */ { .entry = &syscall_personality }, /* 93 */ { .entry = &syscall_exit }, /* 94 */ { .entry = &syscall_exit_group }, /* 95 */ { .entry = &syscall_waitid }, /* 96 */ { .entry = &syscall_set_tid_address }, /* 97 */ { .entry = &syscall_unshare }, /* 98 */ { .entry = &syscall_futex }, /* 99 */ { .entry = &syscall_set_robust_list }, /* 100 */ { .entry = &syscall_get_robust_list }, /* 101 */ { .entry = &syscall_nanosleep }, /* 102 */ { .entry = &syscall_getitimer }, /* 103 */ { .entry = &syscall_setitimer }, /* 104 */ { .entry = &syscall_kexec_load }, /* 105 */ { .entry = &syscall_init_module }, /* 106 */ { .entry = &syscall_delete_module }, /* 107 */ { .entry = &syscall_timer_create }, /* 108 */ { .entry = &syscall_timer_gettime }, /* 109 */ { .entry = &syscall_timer_getoverrun }, /* 110 */ { .entry = &syscall_timer_settime }, /* 111 */ { .entry = &syscall_timer_delete }, /* 112 */ { .entry = &syscall_clock_settime }, /* 113 */ { .entry = &syscall_clock_gettime }, /* 114 */ { .entry = &syscall_clock_getres }, /* 115 */ { .entry = &syscall_clock_nanosleep }, /* 116 */ { .entry = &syscall_syslog }, /* 117 */ { .entry = &syscall_ptrace }, /* 118 */ { .entry = &syscall_sched_setparam }, /* 119 */ { .entry = &syscall_sched_setscheduler }, /* 120 */ { .entry = &syscall_sched_getscheduler }, /* 121 */ { .entry = &syscall_sched_getparam }, /* 122 */ { .entry = &syscall_sched_setaffinity }, /* 123 */ { .entry = &syscall_sched_getaffinity }, /* 124 */ { .entry = &syscall_sched_yield }, /* 125 */ { .entry = &syscall_sched_get_priority_max }, /* 126 */ { .entry = &syscall_sched_get_priority_min }, /* 127 */ { .entry = &syscall_sched_rr_get_interval }, /* 128 */ { .entry = &syscall_restart_syscall }, /* 129 */ { .entry = &syscall_kill }, /* 130 */ { .entry = &syscall_tkill }, /* 131 */ { .entry = &syscall_tgkill }, /* 132 */ { .entry = &syscall_sigaltstack }, /* 133 */ { .entry = &syscall_rt_sigsuspend }, /* 134 */ { .entry = &syscall_rt_sigaction }, /* 135 */ { .entry = &syscall_rt_sigprocmask }, /* 136 */ { .entry = &syscall_rt_sigpending }, /* 137 */ { .entry = &syscall_rt_sigtimedwait }, /* 138 */ { .entry = &syscall_rt_sigqueueinfo }, /* 139 */ { .entry = &syscall_rt_sigreturn }, /* 140 */ { .entry = &syscall_setpriority }, /* 141 */ { .entry = &syscall_getpriority }, /* 142 */ { .entry = &syscall_reboot }, /* 143 */ { .entry = &syscall_setregid }, /* 144 */ { .entry = &syscall_setgid }, /* 145 */ { .entry = &syscall_setreuid }, /* 146 */ { .entry = &syscall_setuid }, /* 147 */ { .entry = &syscall_setresuid }, /* 148 */ { .entry = &syscall_getresuid }, /* 149 */ { .entry = &syscall_setresgid }, /* 150 */ { .entry = &syscall_getresgid }, /* 151 */ { .entry = &syscall_setfsuid }, /* 152 */ { .entry = &syscall_setfsgid }, /* 153 */ { .entry = &syscall_times }, /* 154 */ { .entry = &syscall_setpgid }, /* 155 */ { .entry = &syscall_getpgid }, /* 156 */ { .entry = &syscall_getsid }, /* 157 */ { .entry = &syscall_setsid }, /* 158 */ { .entry = &syscall_getgroups }, /* 159 */ { .entry = &syscall_setgroups }, /* 160 */ { .entry = &syscall_newuname }, /* 161 */ { .entry = &syscall_sethostname }, /* 162 */ { .entry = &syscall_setdomainname }, /* 163 */ { .entry = &syscall_getrlimit }, /* 164 */ { .entry = &syscall_setrlimit }, /* 165 */ { .entry = &syscall_getrusage }, /* 166 */ { .entry = &syscall_umask }, /* 167 */ { .entry = &syscall_prctl }, /* 168 */ { .entry = &syscall_getcpu }, /* 169 */ { .entry = &syscall_gettimeofday }, /* 170 */ { .entry = &syscall_settimeofday }, /* 171 */ { .entry = &syscall_adjtimex }, /* 172 */ { .entry = &syscall_getpid }, /* 173 */ { .entry = &syscall_getppid }, /* 174 */ { .entry = &syscall_getuid }, /* 175 */ { .entry = &syscall_geteuid }, /* 176 */ { .entry = &syscall_getgid }, /* 177 */ { .entry = &syscall_getegid }, /* 178 */ { .entry = &syscall_gettid }, /* 179 */ { .entry = &syscall_sysinfo }, /* 180 */ { .entry = &syscall_mq_open }, /* 181 */ { .entry = &syscall_mq_unlink }, /* 182 */ { .entry = &syscall_mq_timedsend }, /* 183 */ { .entry = &syscall_mq_timedreceive }, /* 184 */ { .entry = &syscall_mq_notify }, /* 185 */ { .entry = &syscall_mq_getsetattr }, /* 186 */ { .entry = &syscall_msgget }, /* 187 */ { .entry = &syscall_msgctl }, /* 188 */ { .entry = &syscall_msgrcv }, /* 189 */ { .entry = &syscall_msgsnd }, /* 190 */ { .entry = &syscall_semget }, /* 191 */ { .entry = &syscall_semctl }, /* 192 */ { .entry = &syscall_semtimedop }, /* 193 */ { .entry = &syscall_semop }, /* 194 */ { .entry = &syscall_shmget }, /* 195 */ { .entry = &syscall_shmctl }, /* 196 */ { .entry = &syscall_shmat }, /* 197 */ { .entry = &syscall_shmdt }, /* 198 */ { .entry = &syscall_socket }, /* 199 */ { .entry = &syscall_socketpair }, /* 200 */ { .entry = &syscall_bind }, /* 201 */ { .entry = &syscall_listen }, /* 202 */ { .entry = &syscall_accept }, /* 203 */ { .entry = &syscall_connect }, /* 204 */ { .entry = &syscall_getsockname }, /* 205 */ { .entry = &syscall_getpeername }, /* 206 */ { .entry = &syscall_sendto }, /* 207 */ { .entry = &syscall_recvfrom }, /* 208 */ { .entry = &syscall_setsockopt }, /* 209 */ { .entry = &syscall_getsockopt }, /* 210 */ { .entry = &syscall_shutdown }, /* 211 */ { .entry = &syscall_sendmsg }, /* 212 */ { .entry = &syscall_recvmsg }, /* 213 */ { .entry = &syscall_readahead }, /* 214 */ { .entry = &syscall_brk }, /* 215 */ { .entry = &syscall_munmap }, /* 216 */ { .entry = &syscall_mremap }, /* 217 */ { .entry = &syscall_add_key }, /* 218 */ { .entry = &syscall_request_key }, /* 219 */ { .entry = &syscall_keyctl }, /* 220 */ { .entry = &syscall_clone }, /* 221 */ { .entry = &syscall_execve }, /* 222 */ { .entry = &syscall_mmap }, /* 223 */ { .entry = &syscall_fadvise64_64 }, /* 224 */ { .entry = &syscall_swapon }, /* 225 */ { .entry = &syscall_swapoff }, /* 226 */ { .entry = &syscall_mprotect }, /* 227 */ { .entry = &syscall_msync }, /* 228 */ { .entry = &syscall_mlock }, /* 229 */ { .entry = &syscall_munlock }, /* 230 */ { .entry = &syscall_mlockall }, /* 231 */ { .entry = &syscall_munlockall }, /* 232 */ { .entry = &syscall_mincore }, /* 233 */ { .entry = &syscall_madvise }, /* 234 */ { .entry = &syscall_remap_file_pages }, /* 235 */ { .entry = &syscall_mbind }, /* 236 */ { .entry = &syscall_get_mempolicy }, /* 237 */ { .entry = &syscall_set_mempolicy }, /* 238 */ { .entry = &syscall_migrate_pages }, /* 239 */ { .entry = &syscall_move_pages }, /* 240 */ { .entry = &syscall_rt_tgsigqueueinfo }, /* 241 */ { .entry = &syscall_perf_event_open }, /* 242 */ { .entry = &syscall_accept4 }, /* 243 */ { .entry = &syscall_recvmmsg }, /* 244 */ { .entry = &syscall_ni_syscall }, /* 245 */ { .entry = &syscall_ni_syscall }, /* 246 */ { .entry = &syscall_ni_syscall }, /* 247 */ { .entry = &syscall_ni_syscall }, /* 248 */ { .entry = &syscall_ni_syscall }, /* 249 */ { .entry = &syscall_ni_syscall }, /* 250 */ { .entry = &syscall_ni_syscall }, /* 251 */ { .entry = &syscall_ni_syscall }, /* 252 */ { .entry = &syscall_ni_syscall }, /* 253 */ { .entry = &syscall_ni_syscall }, /* 254 */ { .entry = &syscall_ni_syscall }, /* 255 */ { .entry = &syscall_ni_syscall }, /* 256 */ { .entry = &syscall_ni_syscall }, /* 257 */ { .entry = &syscall_ni_syscall }, /* 258 */ { .entry = &syscall_ni_syscall }, /* 259 */ { .entry = &syscall_ni_syscall }, /* 260 */ { .entry = &syscall_wait4 }, /* 261 */ { .entry = &syscall_prlimit64 }, /* 262 */ { .entry = &syscall_fanotify_init }, /* 263 */ { .entry = &syscall_fanotify_mark }, /* 264 */ { .entry = &syscall_name_to_handle_at }, /* 265 */ { .entry = &syscall_open_by_handle_at }, /* 266 */ { .entry = &syscall_clock_adjtime }, /* 267 */ { .entry = &syscall_syncfs }, /* 268 */ { .entry = &syscall_setns }, /* 269 */ { .entry = &syscall_sendmmsg }, /* 270 */ { .entry = &syscall_process_vm_readv }, /* 271 */ { .entry = &syscall_process_vm_writev }, /* 272 */ { .entry = &syscall_kcmp }, /* 273 */ { .entry = &syscall_finit_module }, /* 274 */ { .entry = &syscall_sched_setattr }, /* 275 */ { .entry = &syscall_sched_getattr }, /* 276 */ { .entry = &syscall_renameat2 }, /* 277 */ { .entry = &syscall_seccomp }, /* 278 */ { .entry = &syscall_getrandom }, }; include/syscalls-x86_64.h000066400000000000000000000363721445305223700154630ustar00rootroot00000000000000#pragma once /* Syscalls from arch/x86/syscalls/syscall_64.tbl */ #include "sanitise.h" #include "syscall.h" #include "syscalls/syscalls.h" struct syscalltable syscalls_x86_64[] = { { .entry = &syscall_read }, { .entry = &syscall_write }, { .entry = &syscall_open }, { .entry = &syscall_close }, { .entry = &syscall_newstat }, { .entry = &syscall_newfstat }, { .entry = &syscall_newlstat }, { .entry = &syscall_poll }, { .entry = &syscall_lseek }, { .entry = &syscall_mmap }, { .entry = &syscall_mprotect }, { .entry = &syscall_munmap }, { .entry = &syscall_brk }, { .entry = &syscall_rt_sigaction }, { .entry = &syscall_rt_sigprocmask }, { .entry = &syscall_rt_sigreturn }, { .entry = &syscall_ioctl }, { .entry = &syscall_pread64 }, { .entry = &syscall_pwrite64 }, { .entry = &syscall_readv }, { .entry = &syscall_writev }, { .entry = &syscall_access }, { .entry = &syscall_pipe }, { .entry = &syscall_select }, { .entry = &syscall_sched_yield }, { .entry = &syscall_mremap }, { .entry = &syscall_msync }, { .entry = &syscall_mincore }, { .entry = &syscall_madvise }, { .entry = &syscall_shmget }, { .entry = &syscall_shmat }, { .entry = &syscall_shmctl }, { .entry = &syscall_dup }, { .entry = &syscall_dup2 }, { .entry = &syscall_pause }, { .entry = &syscall_nanosleep }, { .entry = &syscall_getitimer }, { .entry = &syscall_alarm }, { .entry = &syscall_setitimer }, { .entry = &syscall_getpid }, { .entry = &syscall_sendfile }, { .entry = &syscall_socket }, { .entry = &syscall_connect }, { .entry = &syscall_accept }, { .entry = &syscall_sendto }, { .entry = &syscall_recvfrom }, { .entry = &syscall_sendmsg }, { .entry = &syscall_recvmsg }, { .entry = &syscall_shutdown }, { .entry = &syscall_bind }, { .entry = &syscall_listen }, { .entry = &syscall_getsockname }, { .entry = &syscall_getpeername }, { .entry = &syscall_socketpair }, { .entry = &syscall_setsockopt }, { .entry = &syscall_getsockopt }, { .entry = &syscall_clone }, { .entry = &syscall_fork }, { .entry = &syscall_vfork }, { .entry = &syscall_execve }, { .entry = &syscall_exit }, { .entry = &syscall_wait4 }, { .entry = &syscall_kill }, { .entry = &syscall_uname }, { .entry = &syscall_semget }, { .entry = &syscall_semop }, { .entry = &syscall_semctl }, { .entry = &syscall_shmdt }, { .entry = &syscall_msgget }, { .entry = &syscall_msgsnd }, { .entry = &syscall_msgrcv }, { .entry = &syscall_msgctl }, { .entry = &syscall_fcntl }, { .entry = &syscall_flock }, { .entry = &syscall_fsync }, { .entry = &syscall_fdatasync }, { .entry = &syscall_truncate }, { .entry = &syscall_ftruncate }, { .entry = &syscall_getdents }, { .entry = &syscall_getcwd }, { .entry = &syscall_chdir }, { .entry = &syscall_fchdir }, { .entry = &syscall_rename }, { .entry = &syscall_mkdir }, { .entry = &syscall_rmdir }, { .entry = &syscall_creat }, { .entry = &syscall_link }, { .entry = &syscall_unlink }, { .entry = &syscall_symlink }, { .entry = &syscall_readlink }, { .entry = &syscall_chmod }, { .entry = &syscall_fchmod }, { .entry = &syscall_chown }, { .entry = &syscall_fchown }, { .entry = &syscall_lchown }, { .entry = &syscall_umask }, { .entry = &syscall_gettimeofday }, { .entry = &syscall_getrlimit }, { .entry = &syscall_getrusage }, { .entry = &syscall_sysinfo }, { .entry = &syscall_times }, { .entry = &syscall_ptrace }, { .entry = &syscall_getuid }, { .entry = &syscall_syslog }, { .entry = &syscall_getgid }, { .entry = &syscall_setuid }, { .entry = &syscall_setgid }, { .entry = &syscall_geteuid }, { .entry = &syscall_getegid }, { .entry = &syscall_setpgid }, { .entry = &syscall_getppid }, { .entry = &syscall_getpgrp }, { .entry = &syscall_setsid }, { .entry = &syscall_setreuid }, { .entry = &syscall_setregid }, { .entry = &syscall_getgroups }, { .entry = &syscall_setgroups }, { .entry = &syscall_setresuid }, { .entry = &syscall_getresuid }, { .entry = &syscall_setresgid }, { .entry = &syscall_getresgid }, { .entry = &syscall_getpgid }, { .entry = &syscall_setfsuid }, { .entry = &syscall_setfsgid }, { .entry = &syscall_getsid }, { .entry = &syscall_capget }, { .entry = &syscall_capset }, { .entry = &syscall_rt_sigpending }, { .entry = &syscall_rt_sigtimedwait }, { .entry = &syscall_rt_sigqueueinfo }, { .entry = &syscall_rt_sigsuspend }, { .entry = &syscall_sigaltstack }, { .entry = &syscall_utime }, { .entry = &syscall_mknod }, { .entry = &syscall_uselib }, { .entry = &syscall_personality }, { .entry = &syscall_ustat }, { .entry = &syscall_statfs }, { .entry = &syscall_fstatfs }, { .entry = &syscall_sysfs }, { .entry = &syscall_getpriority }, { .entry = &syscall_setpriority }, { .entry = &syscall_sched_setparam }, { .entry = &syscall_sched_getparam }, { .entry = &syscall_sched_setscheduler }, { .entry = &syscall_sched_getscheduler }, { .entry = &syscall_sched_get_priority_max }, { .entry = &syscall_sched_get_priority_min }, { .entry = &syscall_sched_rr_get_interval }, { .entry = &syscall_mlock }, { .entry = &syscall_munlock }, { .entry = &syscall_mlockall }, { .entry = &syscall_munlockall }, { .entry = &syscall_vhangup }, { .entry = &syscall_modify_ldt }, { .entry = &syscall_pivot_root }, { .entry = &syscall_sysctl }, { .entry = &syscall_prctl }, { .entry = &syscall_arch_prctl }, { .entry = &syscall_adjtimex }, { .entry = &syscall_setrlimit }, { .entry = &syscall_chroot }, { .entry = &syscall_sync }, { .entry = &syscall_acct }, { .entry = &syscall_settimeofday }, { .entry = &syscall_mount }, { .entry = &syscall_umount }, { .entry = &syscall_swapon }, { .entry = &syscall_swapoff }, { .entry = &syscall_reboot }, { .entry = &syscall_sethostname }, { .entry = &syscall_setdomainname }, { .entry = &syscall_iopl }, { .entry = &syscall_ioperm }, { .entry = &syscall_ni_syscall }, /* obsolete "create_module" syscall */ { .entry = &syscall_init_module }, { .entry = &syscall_delete_module }, { .entry = &syscall_ni_syscall }, /* obsolete "get_kernel_syms" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "query_module" syscall */ { .entry = &syscall_quotactl }, { .entry = &syscall_nfsservctl }, { .entry = &syscall_ni_syscall }, /* obsolete "getpmsg" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "putpmsg" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "afs" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "tux" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "security" syscall */ { .entry = &syscall_gettid }, { .entry = &syscall_readahead }, { .entry = &syscall_setxattr }, { .entry = &syscall_lsetxattr }, { .entry = &syscall_fsetxattr }, { .entry = &syscall_getxattr }, { .entry = &syscall_lgetxattr }, { .entry = &syscall_fgetxattr }, { .entry = &syscall_listxattr }, { .entry = &syscall_llistxattr }, { .entry = &syscall_flistxattr }, { .entry = &syscall_removexattr }, { .entry = &syscall_lremovexattr }, { .entry = &syscall_fremovexattr }, { .entry = &syscall_tkill }, { .entry = &syscall_time }, { .entry = &syscall_futex }, { .entry = &syscall_sched_setaffinity }, { .entry = &syscall_sched_getaffinity }, { .entry = &syscall_ni_syscall }, /* obsolete "set_thread_area" syscall */ { .entry = &syscall_io_setup }, { .entry = &syscall_io_destroy }, { .entry = &syscall_io_getevents }, { .entry = &syscall_io_submit }, { .entry = &syscall_io_cancel }, { .entry = &syscall_ni_syscall }, /* obsolete "get_thread_area" syscall */ { .entry = &syscall_lookup_dcookie }, { .entry = &syscall_epoll_create }, { .entry = &syscall_ni_syscall }, /* obsolete "epoll_ctl_old" syscall */ { .entry = &syscall_ni_syscall }, /* obsolete "epoll_wait_old" syscall */ { .entry = &syscall_remap_file_pages }, { .entry = &syscall_getdents64 }, { .entry = &syscall_set_tid_address }, { .entry = &syscall_restart_syscall }, { .entry = &syscall_semtimedop }, { .entry = &syscall_fadvise64 }, { .entry = &syscall_timer_create }, { .entry = &syscall_timer_settime }, { .entry = &syscall_timer_gettime }, { .entry = &syscall_timer_getoverrun }, { .entry = &syscall_timer_delete }, { .entry = &syscall_clock_settime }, { .entry = &syscall_clock_gettime }, { .entry = &syscall_clock_getres }, { .entry = &syscall_clock_nanosleep }, { .entry = &syscall_exit_group }, { .entry = &syscall_epoll_wait }, { .entry = &syscall_epoll_ctl }, { .entry = &syscall_tgkill }, { .entry = &syscall_utimes }, { .entry = &syscall_ni_syscall }, /* obsolete "vserver" syscall */ { .entry = &syscall_mbind }, { .entry = &syscall_set_mempolicy }, { .entry = &syscall_get_mempolicy }, { .entry = &syscall_mq_open }, { .entry = &syscall_mq_unlink }, { .entry = &syscall_mq_timedsend }, { .entry = &syscall_mq_timedreceive }, { .entry = &syscall_mq_notify }, { .entry = &syscall_mq_getsetattr }, { .entry = &syscall_kexec_load }, { .entry = &syscall_waitid }, { .entry = &syscall_add_key }, { .entry = &syscall_request_key }, { .entry = &syscall_keyctl }, { .entry = &syscall_ioprio_set }, { .entry = &syscall_ioprio_get }, { .entry = &syscall_inotify_init }, { .entry = &syscall_inotify_add_watch }, { .entry = &syscall_inotify_rm_watch }, { .entry = &syscall_migrate_pages }, { .entry = &syscall_openat }, { .entry = &syscall_mkdirat }, { .entry = &syscall_mknodat }, { .entry = &syscall_fchownat }, { .entry = &syscall_futimesat }, { .entry = &syscall_fstatat64 }, { .entry = &syscall_unlinkat }, { .entry = &syscall_renameat }, { .entry = &syscall_linkat }, { .entry = &syscall_symlinkat }, { .entry = &syscall_readlinkat }, { .entry = &syscall_fchmodat }, { .entry = &syscall_faccessat }, { .entry = &syscall_pselect6 }, { .entry = &syscall_ppoll }, { .entry = &syscall_unshare }, { .entry = &syscall_set_robust_list }, { .entry = &syscall_get_robust_list }, { .entry = &syscall_splice }, { .entry = &syscall_tee }, { .entry = &syscall_sync_file_range }, { .entry = &syscall_vmsplice }, { .entry = &syscall_move_pages }, { .entry = &syscall_utimensat }, { .entry = &syscall_epoll_pwait }, { .entry = &syscall_signalfd }, { .entry = &syscall_timerfd_create }, { .entry = &syscall_eventfd }, { .entry = &syscall_fallocate }, { .entry = &syscall_timerfd_settime }, { .entry = &syscall_timerfd_gettime }, { .entry = &syscall_accept4 }, { .entry = &syscall_signalfd4 }, { .entry = &syscall_eventfd2 }, { .entry = &syscall_epoll_create1 }, { .entry = &syscall_dup3 }, { .entry = &syscall_pipe2 }, { .entry = &syscall_inotify_init1 }, { .entry = &syscall_preadv }, { .entry = &syscall_pwritev }, { .entry = &syscall_rt_tgsigqueueinfo }, { .entry = &syscall_perf_event_open }, { .entry = &syscall_recvmmsg }, { .entry = &syscall_fanotify_init }, { .entry = &syscall_fanotify_mark }, { .entry = &syscall_prlimit64 }, { .entry = &syscall_name_to_handle_at }, { .entry = &syscall_open_by_handle_at }, { .entry = &syscall_clock_adjtime }, { .entry = &syscall_syncfs }, { .entry = &syscall_sendmmsg }, { .entry = &syscall_setns }, { .entry = &syscall_getcpu }, { .entry = &syscall_process_vm_readv }, { .entry = &syscall_process_vm_writev }, { .entry = &syscall_kcmp }, { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, { .entry = &syscall_renameat2 }, { .entry = &syscall_getrandom }, { .entry = &syscall_seccomp }, { .entry = &syscall_memfd_create }, { .entry = &syscall_kexec_file_load }, #ifdef USE_BPF { .entry = &syscall_bpf }, #else { .entry = NULL }, #endif { .entry = &syscall_execveat }, { .entry = &syscall_userfaultfd }, { .entry = &syscall_membarrier }, { .entry = &syscall_mlock2 }, { .entry = &syscall_copy_file_range }, { .entry = &syscall_preadv2 }, { .entry = &syscall_pwritev2 }, { .entry = &syscall_pkey_mprotect }, { .entry = &syscall_pkey_alloc }, { .entry = &syscall_pkey_free }, { .entry = &syscall_statx }, { .entry = &syscall_io_pgetevents }, { .entry = &syscall_rseq }, // 334 { .entry = NULL }, // 335 { .entry = NULL }, // 336 { .entry = NULL }, // 337 { .entry = NULL }, // 338 { .entry = NULL }, // 339 { .entry = NULL }, // 340 { .entry = NULL }, // 341 { .entry = NULL }, // 342 { .entry = NULL }, // 343 { .entry = NULL }, // 344 { .entry = NULL }, // 345 { .entry = NULL }, // 346 { .entry = NULL }, // 347 { .entry = NULL }, // 348 { .entry = NULL }, // 349 { .entry = NULL }, // 350 { .entry = NULL }, // 351 { .entry = NULL }, // 352 { .entry = NULL }, // 353 { .entry = NULL }, // 354 { .entry = NULL }, // 355 { .entry = NULL }, // 356 { .entry = NULL }, // 357 { .entry = NULL }, // 358 { .entry = NULL }, // 359 { .entry = NULL }, // 360 { .entry = NULL }, // 361 { .entry = NULL }, // 362 { .entry = NULL }, // 363 { .entry = NULL }, // 364 { .entry = NULL }, // 365 { .entry = NULL }, // 366 { .entry = NULL }, // 367 { .entry = NULL }, // 368 { .entry = NULL }, // 369 { .entry = NULL }, // 370 { .entry = NULL }, // 371 { .entry = NULL }, // 372 { .entry = NULL }, // 373 { .entry = NULL }, // 374 { .entry = NULL }, // 375 { .entry = NULL }, // 376 { .entry = NULL }, // 377 { .entry = NULL }, // 378 { .entry = NULL }, // 379 { .entry = NULL }, // 380 { .entry = NULL }, // 381 { .entry = NULL }, // 382 { .entry = NULL }, // 383 { .entry = NULL }, // 384 { .entry = NULL }, // 385 { .entry = NULL }, // 386 { .entry = NULL }, // 387 { .entry = NULL }, // 388 { .entry = NULL }, // 389 { .entry = NULL }, // 390 { .entry = NULL }, // 391 { .entry = NULL }, // 392 { .entry = NULL }, // 393 { .entry = NULL }, // 394 { .entry = NULL }, // 395 { .entry = NULL }, // 396 { .entry = NULL }, // 397 { .entry = NULL }, // 398 { .entry = NULL }, // 399 { .entry = NULL }, // 400 { .entry = NULL }, // 401 { .entry = NULL }, // 402 { .entry = NULL }, // 403 { .entry = NULL }, // 404 { .entry = NULL }, // 405 { .entry = NULL }, // 406 { .entry = NULL }, // 407 { .entry = NULL }, // 408 { .entry = NULL }, // 409 { .entry = NULL }, // 400 { .entry = NULL }, // 411 { .entry = NULL }, // 412 { .entry = NULL }, // 413 { .entry = NULL }, // 414 { .entry = NULL }, // 415 { .entry = NULL }, // 416 { .entry = NULL }, // 417 { .entry = NULL }, // 418 { .entry = NULL }, // 419 { .entry = NULL }, // 420 { .entry = NULL }, // 421 { .entry = NULL }, // 422 { .entry = NULL }, // 423 { .entry = &syscall_pidfd_send_signal }, // 424 { .entry = &syscall_io_uring_setup }, { .entry = &syscall_io_uring_enter }, { .entry = &syscall_io_uring_register }, { .entry = &syscall_open_tree}, { .entry = &syscall_move_mount}, { .entry = &syscall_fsopen }, { .entry = &syscall_fsconfig }, { .entry = &syscall_fsmount }, { .entry = &syscall_fspick }, { .entry = &syscall_pidfd_open }, { .entry = &syscall_clone3 }, { .entry = &syscall_close_range }, { .entry = &syscall_openat2 }, { .entry = &syscall_pidfd_getfd }, { .entry = &syscall_faccessat2 }, { .entry = &syscall_process_madvise }, { .entry = &syscall_epoll_pwait2 }, { .entry = &syscall_mount_setattr }, { .entry = &syscall_quotactl_fd }, { .entry = &syscall_landlock_create_ruleset }, { .entry = &syscall_landlock_add_rule }, { .entry = &syscall_landlock_restrict_self }, { .entry = &syscall_memfd_secret }, { .entry = &syscall_process_mrelease }, { .entry = &syscall_futex_waitv }, { .entry = &syscall_set_mempolicy_home_node }, }; include/sysv-shm.h000066400000000000000000000001601445305223700144450ustar00rootroot00000000000000#pragma once void create_sysv_shms(void); struct sysv_shm { void *ptr; int id; size_t size; int flags; }; include/tables.h000066400000000000000000000064611445305223700141400ustar00rootroot00000000000000#pragma once #include "types.h" #include "syscall.h" extern const struct syscalltable *syscalls; extern const struct syscalltable *syscalls_32bit; extern const struct syscalltable *syscalls_64bit; extern unsigned long syscalls_todo; extern unsigned int max_nr_syscalls; extern unsigned int max_nr_32bit_syscalls; extern unsigned int max_nr_64bit_syscalls; extern bool use_32bit; extern bool use_64bit; void validate_specific_syscall(const struct syscalltable *table, int call); void activate_syscall_in_table(unsigned int calln, unsigned int *nr_active, const struct syscalltable *table, int *active_syscall); void deactivate_syscall_in_table(unsigned int calln, unsigned int *nr_active, const struct syscalltable *table, int *active_syscall); void check_user_specified_arch(const char *arg, char **arg_name, bool *only_64bit, bool *only_32bit); void clear_check_user_specified_arch(const char *arg, char **arg_name); void select_syscall_tables(void); int search_syscall_table(const struct syscalltable *table, unsigned int nr_syscalls, const char *arg); void mark_all_syscalls_active(void); void mark_all_syscalls_active_uniarch(void); void mark_all_syscalls_active_biarch(void); void toggle_syscall(const char *arg, bool state); void toggle_syscall_biarch(const char *arg, bool state); void toggle_syscall_n(int calln, bool state, const char *arg, const char *arg_name); void activate_syscall(unsigned int calln); void activate_syscall32(unsigned int calln); void activate_syscall64(unsigned int calln); void deactivate_syscall(unsigned int calln, bool do32bit); void deactivate_syscall_uniarch(unsigned int calln); void deactivate_syscall32(unsigned int calln); void deactivate_syscall64(unsigned int calln); void show_state(unsigned int state); void dump_syscall_tables(void); void dump_syscall_tables_uniarch(void); void dump_syscall_tables_biarch(void); void show_unannotated_args(void); int setup_syscall_group(unsigned int desired_group); int setup_syscall_group_uniarch(unsigned int desired_group); int setup_syscall_group_biarch(unsigned int desired_group); int validate_syscall_tables(void); bool no_syscalls_enabled(void); int validate_syscall_table_64(void); int validate_syscall_table_32(void); void sanity_check_tables(void); const char * print_syscall_name(unsigned int callno, bool is32bit); void enable_random_syscalls_biarch(void); void enable_random_syscalls_uniarch(void); int validate_specific_syscall_silent(const struct syscalltable *table, int call); void deactivate_disabled_syscalls(void); void deactivate_disabled_syscalls_biarch(void); void deactivate_disabled_syscalls_uniarch(void); void count_syscalls_enabled(void); void display_enabled_syscalls(void); void display_enabled_syscalls_uniarch(void); void display_enabled_syscalls_biarch(void); void log_enabled_syscalls(void); void log_enabled_syscalls_uniarch(void); void log_enabled_syscalls_biarch(void); void init_syscalls(void); void init_syscalls_biarch(void); void init_syscalls_uniarch(void); int munge_tables(void); struct syscallentry * get_syscall_entry(unsigned int calln, bool do32); bool this_syscallname(const char *thisname); #define for_each_32bit_syscall(i) \ for (i = 0; i < max_nr_32bit_syscalls; i++) #define for_each_64bit_syscall(i) \ for (i = 0; i < max_nr_64bit_syscalls; i++) #define for_each_syscall(i) \ for (i = 0; i < max_nr_syscalls; i++) include/taint.h000066400000000000000000000003261445305223700137770ustar00rootroot00000000000000#pragma once #include "types.h" #define TAINT_NAME_LEN 32 extern int kernel_taint_initial; int get_taint(void); bool is_tainted(void); void process_taint_arg(char *taintarg); void init_taint_checking(void); include/testfile.h000066400000000000000000000000561445305223700144770ustar00rootroot00000000000000#pragma once int get_rand_testfile_fd(void); include/tls.h000066400000000000000000000017631445305223700134700ustar00rootroot00000000000000#pragma once /* From linux/tls.h */ struct tls_crypto_info { unsigned short version; unsigned short cipher_type; }; #define TLS_CIPHER_AES_GCM_128_IV_SIZE 8 #define TLS_CIPHER_AES_GCM_128_KEY_SIZE 16 #define TLS_CIPHER_AES_GCM_128_SALT_SIZE 4 #define TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE 8 #define TLS_VERSION_MINOR(ver) ((ver) & 0xFF) #define TLS_VERSION_MAJOR(ver) (((ver) >> 8) & 0xFF) #define TLS_VERSION_NUMBER(id) ((((id##_VERSION_MAJOR) & 0xFF) << 8) | \ ((id##_VERSION_MINOR) & 0xFF)) #define TLS_1_2_VERSION_MAJOR 0x3 #define TLS_1_2_VERSION_MINOR 0x3 #define TLS_1_2_VERSION TLS_VERSION_NUMBER(TLS_1_2) #define TLS_CIPHER_AES_GCM_128 51 #define TLS_TX 1 struct tls12_crypto_info_aes_gcm_128 { struct tls_crypto_info info; unsigned char iv[TLS_CIPHER_AES_GCM_128_IV_SIZE]; unsigned char key[TLS_CIPHER_AES_GCM_128_KEY_SIZE]; unsigned char salt[TLS_CIPHER_AES_GCM_128_SALT_SIZE]; unsigned char rec_seq[TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE]; }; include/trinity.h000066400000000000000000000010601445305223700143560ustar00rootroot00000000000000#pragma once #include "types.h" extern unsigned int num_online_cpus; extern struct rlimit max_files_rlimit; extern bool no_bind_to_cpu; extern char *progname; void main_loop(void); void panic(int reason); #define __unused__ __attribute((unused)) #define FAIL 0 #define SUCCESS 1 // output stuff that's used pretty much everywhere, so may as well be here. #define MAX_LOGLEVEL 3 #define CONT -1 void output(char level, const char *fmt, ...); void outputerr(const char *fmt, ...); void outputstd(const char *fmt, ...); void debugf(const char *fmt, ...); include/types.h000066400000000000000000000001731445305223700140240ustar00rootroot00000000000000#pragma once #include typedef enum { FALSE = 0, TRUE = 1 } bool; typedef uint32_t u32; typedef uint64_t u64; include/uid.h000066400000000000000000000003401445305223700134350ustar00rootroot00000000000000#pragma once #include "child.h" void dump_uids(void); void init_uids(void); void do_uid0_check(void); void check_uid(void); extern uid_t orig_uid; extern gid_t orig_gid; extern uid_t nobody_uid; extern gid_t nobody_gid; include/userfaultfd.h000066400000000000000000000002301445305223700151760ustar00rootroot00000000000000#pragma once // FIXME: Keep all this here until glibc supports it. #ifndef SYS_userfaultfd #ifdef __x86_64__ #define SYS_userfaultfd 323 #endif #endif include/utils.h000066400000000000000000000032571445305223700140260ustar00rootroot00000000000000#pragma once #include #include #include #include #include #define MB(_x) (_x * 1024UL * 1024UL) #define GB(_x) (_x * 1024UL * MB(1)) void * alloc_shared(unsigned int size); void * __zmalloc(size_t size, const char *func); #define zmalloc(size) __zmalloc(size, __func__) #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define min(x, y) ({ \ typeof(x) _min1 = (x); \ typeof(y) _min2 = (y); \ (void) (&_min1 == &_min2); \ _min1 < _min2 ? _min1 : _min2; }) #define max(x, y) ({ \ typeof(x) _max1 = (x); \ typeof(y) _max2 = (y); \ (void) (&_max1 == &_max2); \ _max1 > _max2 ? _max1 : _max2; }) #ifndef offsetof # define offsetof(type, member) ((size_t) &((type *) 0)->member) #endif #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) /* * swap - swap value of @a and @b */ #define swap(a, b) \ do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) #define MAX_ERRNO 4095 #define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO) static inline long IS_ERR(unsigned long x) { return IS_ERR_VALUE(x); } void sizeunit(unsigned long size, char *buf); void kill_pid(pid_t pid); void freeptr(unsigned long *p); int get_num_fds(void); #define __stringify_1(x...) #x #define __stringify(x...) __stringify_1(x) #define unreachable() do { } while (1) #define RAND_ELEMENT(_array, _element) \ _array[rnd() % ARRAY_SIZE(_array)]._element #define RAND_ARRAY(_array) _array[rnd() % ARRAY_SIZE(_array)] #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) ioctls/000077500000000000000000000000001445305223700123605ustar00rootroot00000000000000ioctls/autofs.c000066400000000000000000000171361445305223700140350ustar00rootroot00000000000000#include #include #include "ioctls.h" #include "maps.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "syscall.h" #include "utils.h" #include "compat.h" /* include/linux/auto_dev-ioctl.h */ /* * Copyright 2008 Red Hat, Inc. All rights reserved. * Copyright 2008 Ian Kent * * This file is part of the Linux kernel and is made available under * the terms of the GNU General Public License, version 2, or at your * option, any later version, incorporated herein by reference. */ #include #define AUTOFS_DEVICE_NAME "autofs" #define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1 #define AUTOFS_DEV_IOCTL_VERSION_MINOR 0 #define AUTOFS_DEVID_LEN 16 #define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl) /* * An ioctl interface for autofs mount point control. */ struct args_protover { __u32 version; }; struct args_protosubver { __u32 sub_version; }; struct args_openmount { __u32 devid; }; struct args_ready { __u32 token; }; struct args_fail { __u32 token; __s32 status; }; struct args_setpipefd { __s32 pipefd; }; struct args_timeout { __u64 timeout; }; struct args_requester { __u32 uid; __u32 gid; }; struct args_expire { __u32 how; }; struct args_askumount { __u32 may_umount; }; struct args_ismountpoint { union { struct args_in { __u32 type; } in; struct args_out { __u32 devid; __u32 magic; } out; }; }; /* * All the ioctls use this structure. * When sending a path size must account for the total length * of the chunk of memory otherwise is is the size of the * structure. */ struct autofs_dev_ioctl { __u32 ver_major; __u32 ver_minor; __u32 size; /* total size of data passed in * including this struct */ __s32 ioctlfd; /* automount command fd */ /* Command parameters */ union { struct args_protover protover; struct args_protosubver protosubver; struct args_openmount openmount; struct args_ready ready; struct args_fail fail; struct args_setpipefd setpipefd; struct args_timeout timeout; struct args_requester requester; struct args_expire expire; struct args_askumount askumount; struct args_ismountpoint ismountpoint; }; char path[0]; }; static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in) { memset(in, 0, sizeof(struct autofs_dev_ioctl)); in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR; in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; in->size = sizeof(struct autofs_dev_ioctl); in->ioctlfd = -1; return; } /* * If you change this make sure you make the corresponding change * to autofs-dev-ioctl.c:lookup_ioctl() */ enum { /* Get various version info */ AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71, AUTOFS_DEV_IOCTL_PROTOVER_CMD, AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, /* Open mount ioctl fd */ AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, /* Close mount ioctl fd */ AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, /* Mount/expire status returns */ AUTOFS_DEV_IOCTL_READY_CMD, AUTOFS_DEV_IOCTL_FAIL_CMD, /* Activate/deactivate autofs mount */ AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, AUTOFS_DEV_IOCTL_CATATONIC_CMD, /* Expiry timeout */ AUTOFS_DEV_IOCTL_TIMEOUT_CMD, /* Get mount last requesting uid and gid */ AUTOFS_DEV_IOCTL_REQUESTER_CMD, /* Check for eligible expire candidates */ AUTOFS_DEV_IOCTL_EXPIRE_CMD, /* Request busy status */ AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, /* Check if path is a mountpoint */ AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, }; #define AUTOFS_IOCTL 0x93 #define AUTOFS_DEV_IOCTL_VERSION \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_PROTOVER \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_PROTOSUBVER \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_OPENMOUNT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_CLOSEMOUNT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_READY \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_FAIL \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_SETPIPEFD \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_CATATONIC \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_TIMEOUT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_REQUESTER \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_EXPIRE \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_ASKUMOUNT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl) static const struct ioctl autofs_ioctls[] = { IOCTL(AUTOFS_IOC_READY), IOCTL(AUTOFS_IOC_FAIL), IOCTL(AUTOFS_IOC_CATATONIC), IOCTL(AUTOFS_IOC_PROTOVER), /* IOCTL(AUTOFS_IOC_SETTIMEOUT32), */ IOCTL(AUTOFS_IOC_SETTIMEOUT), IOCTL(AUTOFS_IOC_EXPIRE), IOCTL(AUTOFS_IOC_EXPIRE_MULTI), /* Both defines removed by kernel commit * 1f28c5d055032e7e8ee5e48198dca7e125d0eec6 */ #ifdef AUTOFS_IOC_EXPIRE_INDIRECT IOCTL(AUTOFS_IOC_EXPIRE_INDIRECT), #endif #ifdef AUTOFS_IOC_EXPIRE_DIRECT IOCTL(AUTOFS_IOC_EXPIRE_DIRECT), #endif IOCTL(AUTOFS_IOC_PROTOSUBVER), IOCTL(AUTOFS_IOC_ASKUMOUNT), IOCTL(AUTOFS_DEV_IOCTL_VERSION), IOCTL(AUTOFS_DEV_IOCTL_PROTOVER), IOCTL(AUTOFS_DEV_IOCTL_PROTOSUBVER), IOCTL(AUTOFS_DEV_IOCTL_OPENMOUNT), IOCTL(AUTOFS_DEV_IOCTL_CLOSEMOUNT), IOCTL(AUTOFS_DEV_IOCTL_READY), IOCTL(AUTOFS_DEV_IOCTL_FAIL), IOCTL(AUTOFS_DEV_IOCTL_SETPIPEFD), IOCTL(AUTOFS_DEV_IOCTL_CATATONIC), IOCTL(AUTOFS_DEV_IOCTL_TIMEOUT), IOCTL(AUTOFS_DEV_IOCTL_REQUESTER), IOCTL(AUTOFS_DEV_IOCTL_EXPIRE), IOCTL(AUTOFS_DEV_IOCTL_ASKUMOUNT), IOCTL(AUTOFS_DEV_IOCTL_ISMOUNTPOINT), }; static const char *const autofs_devs[] = { "autofs", }; static void autofs_sanitise(const struct ioctl_group *grp, struct syscallrecord *rec) { struct autofs_dev_ioctl *arg; pick_random_ioctl(grp, rec); rec->a3 = (unsigned long) get_address(); switch (rec->a2) { case AUTOFS_DEV_IOCTL_VERSION: case AUTOFS_DEV_IOCTL_PROTOVER: case AUTOFS_DEV_IOCTL_PROTOSUBVER: case AUTOFS_DEV_IOCTL_OPENMOUNT: case AUTOFS_DEV_IOCTL_CLOSEMOUNT: case AUTOFS_DEV_IOCTL_READY: case AUTOFS_DEV_IOCTL_FAIL: case AUTOFS_DEV_IOCTL_SETPIPEFD: case AUTOFS_DEV_IOCTL_CATATONIC: case AUTOFS_DEV_IOCTL_TIMEOUT: case AUTOFS_DEV_IOCTL_REQUESTER: case AUTOFS_DEV_IOCTL_EXPIRE: case AUTOFS_DEV_IOCTL_ASKUMOUNT: case AUTOFS_DEV_IOCTL_ISMOUNTPOINT: arg = (struct autofs_dev_ioctl *) rec->a3; init_autofs_dev_ioctl(arg); arg->ioctlfd = get_random_fd(); arg->fail.token = rnd(); arg->fail.status = rnd(); if (RAND_BOOL()) { arg->size += 5; arg->path[0] = '/'; arg->path[1] = rnd(); arg->path[2] = rnd(); arg->path[3] = rnd(); arg->path[4] = 0; } else { int i; arg->size += rnd(); for (i=0; i < 10; ++i) arg->path[i] = rnd(); } break; default: break; } } static const struct ioctl_group autofs_grp = { .devtype = DEV_MISC, .devs = autofs_devs, .devs_cnt = ARRAY_SIZE(autofs_devs), .sanitise = autofs_sanitise, .ioctls = autofs_ioctls, .ioctls_cnt = ARRAY_SIZE(autofs_ioctls), }; REG_IOCTL_GROUP(autofs_grp) ioctls/binder.c000066400000000000000000000246201445305223700137730ustar00rootroot00000000000000#include #include #include #include #define __user /* drivers/staging/android/binder.h */ /* * Copyright (C) 2008 Google, Inc. * * Based on, but no longer compatible with, the original * OpenBinder.org binder driver interface, which is: * * Copyright (c) 2005 Palmsource, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #define B_PACK_CHARS(c1, c2, c3, c4) \ ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4)) #define B_TYPE_LARGE 0x85 enum { BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE), BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE), BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), }; enum { FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, }; /* * This is the flattened representation of a Binder object for transfer * between processes. The 'offsets' supplied as part of a binder transaction * contains offsets into the data where these structures occur. The Binder * driver takes care of re-writing the structure type and data as it moves * between processes. */ struct flat_binder_object { /* 8 bytes for large_flat_header. */ unsigned long type; unsigned long flags; /* 8 bytes of data. */ union { void __user *binder; /* local object */ signed long handle; /* remote object */ }; /* extra data associated with local object */ void __user *cookie; }; /* * On 64-bit platforms where user code may run in 32-bits the driver must * translate the buffer (and local binder) addresses appropriately. */ struct binder_write_read { signed long write_size; /* bytes to write */ signed long write_consumed; /* bytes consumed by driver */ unsigned long write_buffer; signed long read_size; /* bytes to read */ signed long read_consumed; /* bytes consumed by driver */ unsigned long read_buffer; }; /* Use with BINDER_VERSION, driver fills in fields. */ struct binder_version { /* driver protocol version -- increment with incompatible change */ signed long protocol_version; }; /* This is the current protocol version. */ #define BINDER_CURRENT_PROTOCOL_VERSION 7 #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, int64_t) #define BINDER_SET_MAX_THREADS _IOW('b', 5, size_t) #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, int) #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, int) #define BINDER_THREAD_EXIT _IOW('b', 8, int) #define BINDER_VERSION _IOWR('b', 9, struct binder_version) /* * NOTE: Two special error codes you should check for when calling * in to the driver are: * * EINTR -- The operation has been interupted. This should be * handled by retrying the ioctl() until a different error code * is returned. * * ECONNREFUSED -- The driver is no longer accepting operations * from your process. That is, the process is being destroyed. * You should handle this by exiting from your process. Note * that once this error code is returned, all further calls to * the driver from any thread will return this same code. */ enum transaction_flags { TF_ONE_WAY = 0x01, /* this is a one-way call: async, no return */ TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */ TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */ TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */ }; struct binder_transaction_data { /* The first two are only used for bcTRANSACTION and brTRANSACTION, * identifying the target and contents of the transaction. */ union { size_t handle; /* target descriptor of command transaction */ void *ptr; /* target descriptor of return transaction */ } target; void *cookie; /* target object cookie */ unsigned int code; /* transaction command */ /* General information about the transaction. */ unsigned int flags; pid_t sender_pid; uid_t sender_euid; size_t data_size; /* number of bytes of data */ size_t offsets_size; /* number of bytes of offsets */ /* If this transaction is inline, the data immediately * follows here; otherwise, it ends with a pointer to * the data buffer. */ union { struct { /* transaction data */ const void __user *buffer; /* offsets from buffer to flat_binder_object structs */ const void __user *offsets; } ptr; uint8_t buf[8]; } data; }; struct binder_ptr_cookie { void *ptr; void *cookie; }; struct binder_pri_desc { int priority; int desc; }; struct binder_pri_ptr_cookie { int priority; void *ptr; void *cookie; }; enum BinderDriverReturnProtocol { BR_ERROR = _IOR('r', 0, int), /* * int: error code */ BR_OK = _IO('r', 1), /* No parameters! */ BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data), BR_REPLY = _IOR('r', 3, struct binder_transaction_data), /* * binder_transaction_data: the received command. */ BR_ACQUIRE_RESULT = _IOR('r', 4, int), /* * not currently supported * int: 0 if the last bcATTEMPT_ACQUIRE was not successful. * Else the remote object has acquired a primary reference. */ BR_DEAD_REPLY = _IO('r', 5), /* * The target of the last transaction (either a bcTRANSACTION or * a bcATTEMPT_ACQUIRE) is no longer with us. No parameters. */ BR_TRANSACTION_COMPLETE = _IO('r', 6), /* * No parameters... always refers to the last transaction requested * (including replies). Note that this will be sent even for * asynchronous transactions. */ BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie), BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie), BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie), BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie), /* * void *: ptr to binder * void *: cookie for binder */ BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie), /* * not currently supported * int: priority * void *: ptr to binder * void *: cookie for binder */ BR_NOOP = _IO('r', 12), /* * No parameters. Do nothing and examine the next command. It exists * primarily so that we can replace it with a BR_SPAWN_LOOPER command. */ BR_SPAWN_LOOPER = _IO('r', 13), /* * No parameters. The driver has determined that a process has no * threads waiting to service incomming transactions. When a process * receives this command, it must spawn a new service thread and * register it via bcENTER_LOOPER. */ BR_FINISHED = _IO('r', 14), /* * not currently supported * stop threadpool thread */ BR_DEAD_BINDER = _IOR('r', 15, void *), /* * void *: cookie */ BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, void *), /* * void *: cookie */ BR_FAILED_REPLY = _IO('r', 17), /* * The the last transaction (either a bcTRANSACTION or * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. */ }; enum BinderDriverCommandProtocol { BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), BC_REPLY = _IOW('c', 1, struct binder_transaction_data), /* * binder_transaction_data: the sent command. */ BC_ACQUIRE_RESULT = _IOW('c', 2, int), /* * not currently supported * int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful. * Else you have acquired a primary reference on the object. */ BC_FREE_BUFFER = _IOW('c', 3, int), /* * void *: ptr to transaction data received on a read */ BC_INCREFS = _IOW('c', 4, int), BC_ACQUIRE = _IOW('c', 5, int), BC_RELEASE = _IOW('c', 6, int), BC_DECREFS = _IOW('c', 7, int), /* * int: descriptor */ BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie), BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie), /* * void *: ptr to binder * void *: cookie for binder */ BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc), /* * not currently supported * int: priority * int: descriptor */ BC_REGISTER_LOOPER = _IO('c', 11), /* * No parameters. * Register a spawned looper thread with the device. */ BC_ENTER_LOOPER = _IO('c', 12), BC_EXIT_LOOPER = _IO('c', 13), /* * No parameters. * These two commands are sent as an application-level thread * enters and exits the binder loop, respectively. They are * used so the binder can have an accurate count of the number * of looping threads it has available. */ BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_ptr_cookie), /* * void *: ptr to binder * void *: cookie */ BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_ptr_cookie), /* * void *: ptr to binder * void *: cookie */ BC_DEAD_BINDER_DONE = _IOW('c', 16, void *), /* * void *: cookie */ }; #include "shm.h" #include "utils.h" #include "ioctls.h" static const struct ioctl binder_ioctls[] = { IOCTL(BINDER_WRITE_READ), IOCTL(BINDER_SET_IDLE_TIMEOUT), IOCTL(BINDER_SET_MAX_THREADS), IOCTL(BINDER_SET_IDLE_PRIORITY), IOCTL(BINDER_SET_CONTEXT_MGR), IOCTL(BINDER_THREAD_EXIT), IOCTL(BINDER_VERSION), IOCTL(BR_ERROR), IOCTL(BR_OK), IOCTL(BR_TRANSACTION), IOCTL(BR_REPLY), IOCTL(BR_ACQUIRE_RESULT), IOCTL(BR_DEAD_REPLY), IOCTL(BR_TRANSACTION_COMPLETE), IOCTL(BR_INCREFS), IOCTL(BR_ACQUIRE), IOCTL(BR_RELEASE), IOCTL(BR_DECREFS), IOCTL(BR_ATTEMPT_ACQUIRE), IOCTL(BR_NOOP), IOCTL(BR_SPAWN_LOOPER), IOCTL(BR_FINISHED), IOCTL(BR_DEAD_BINDER), IOCTL(BR_CLEAR_DEATH_NOTIFICATION_DONE), IOCTL(BR_FAILED_REPLY), IOCTL(BC_TRANSACTION), IOCTL(BC_REPLY), IOCTL(BC_ACQUIRE_RESULT), IOCTL(BC_FREE_BUFFER), IOCTL(BC_INCREFS), IOCTL(BC_ACQUIRE), IOCTL(BC_RELEASE), IOCTL(BC_DECREFS), IOCTL(BC_INCREFS_DONE), IOCTL(BC_ACQUIRE_DONE), IOCTL(BC_ATTEMPT_ACQUIRE), IOCTL(BC_REGISTER_LOOPER), IOCTL(BC_ENTER_LOOPER), IOCTL(BC_EXIT_LOOPER), IOCTL(BC_REQUEST_DEATH_NOTIFICATION), IOCTL(BC_CLEAR_DEATH_NOTIFICATION), IOCTL(BC_DEAD_BINDER_DONE), }; static const char *const binder_miscdevs[] = { "binder", }; static const struct ioctl_group binder_grp = { .devtype = DEV_MISC, .devs = binder_miscdevs, .devs_cnt = ARRAY_SIZE(binder_miscdevs), .sanitise = pick_random_ioctl, .ioctls = binder_ioctls, .ioctls_cnt = ARRAY_SIZE(binder_ioctls), }; REG_IOCTL_GROUP(binder_grp) ioctls/btrfs-control.c000066400000000000000000000011361445305223700153230ustar00rootroot00000000000000 #ifdef USE_BTRFS #include #include #include "utils.h" #include "ioctls.h" static const struct ioctl btrfs_control_ioctls[] = { IOCTL(BTRFS_IOC_SCAN_DEV), IOCTL(BTRFS_IOC_DEVICES_READY), }; static const char *const btrfs_control_devs[] = { "btrfs-control", }; static const struct ioctl_group btrfs_control_grp = { .devtype = DEV_MISC, .devs = btrfs_control_devs, .devs_cnt = ARRAY_SIZE(btrfs_control_devs), .sanitise = pick_random_ioctl, .ioctls = btrfs_control_ioctls, .ioctls_cnt = ARRAY_SIZE(btrfs_control_ioctls), }; REG_IOCTL_GROUP(btrfs_control_grp) #endif ioctls/btrfs.c000066400000000000000000000127141445305223700136510ustar00rootroot00000000000000#ifdef USE_BTRFS #include #include #include #include "ioctls.h" #include "shm.h" #include "utils.h" #ifndef BTRFS_LABEL_SIZE #define BTRFS_LABEL_SIZE 256 #endif #ifndef BTRFS_IOC_SET_RECEIVED_SUBVOL_32 /* If we have a 32-bit userspace and 64-bit kernel, then the UAPI * structures are incorrect, as the timespec structure from userspace * is 4 bytes too small. We define these alternatives here to teach * the kernel about the 32-bit struct packing. */ struct btrfs_ioctl_timespec_32 { __u64 sec; __u32 nsec; } __attribute__ ((__packed__)); struct btrfs_ioctl_received_subvol_args_32 { char uuid[BTRFS_UUID_SIZE]; /* in */ __u64 stransid; /* in */ __u64 rtransid; /* out */ struct btrfs_ioctl_timespec_32 stime; /* in */ struct btrfs_ioctl_timespec_32 rtime; /* out */ __u64 flags; /* in */ __u64 reserved[16]; /* in */ }; #define BTRFS_IOC_SET_RECEIVED_SUBVOL_32 _IOWR(BTRFS_IOCTL_MAGIC, 37, \ struct btrfs_ioctl_received_subvol_args_32) #endif static int btrfs_fd_test(int fd, const struct stat *st __attribute__((unused))) { struct list_head *globallist, *node; globallist = shm->global_objects[OBJ_FD_TESTFILE].list; list_for_each(node, globallist) { struct object *obj; obj = (struct object *) node; if (obj->testfileobj.fd == fd) return 0; } return -1; } static const struct ioctl btrfs_ioctls[] = { { .name = "FS_IOC_GETFLAGS", .request = FS_IOC_GETFLAGS, }, { .name = "FS_IOC_SETFLAGS", .request = FS_IOC_SETFLAGS, }, { .name = "FS_IOC_GETVERSION", .request = FS_IOC_GETVERSION, }, { .name = "FITRIM", .request = FITRIM, }, { .name = "BTRFS_IOC_SNAP_CREATE", .request = BTRFS_IOC_SNAP_CREATE, }, { .name = "BTRFS_IOC_SNAP_CREATE_V2", .request = BTRFS_IOC_SNAP_CREATE_V2, }, { .name = "BTRFS_IOC_SUBVOL_CREATE", .request = BTRFS_IOC_SUBVOL_CREATE, }, { .name = "BTRFS_IOC_SUBVOL_CREATE_V2", .request = BTRFS_IOC_SUBVOL_CREATE_V2, }, { .name = "BTRFS_IOC_SNAP_DESTROY", .request = BTRFS_IOC_SNAP_DESTROY, }, { .name = "BTRFS_IOC_SUBVOL_GETFLAGS", .request = BTRFS_IOC_SUBVOL_GETFLAGS, }, { .name = "BTRFS_IOC_SUBVOL_SETFLAGS", .request = BTRFS_IOC_SUBVOL_SETFLAGS, }, { .name = "BTRFS_IOC_DEFAULT_SUBVOL", .request = BTRFS_IOC_DEFAULT_SUBVOL, }, { .name = "BTRFS_IOC_DEFRAG", .request = BTRFS_IOC_DEFRAG, }, { .name = "BTRFS_IOC_DEFRAG_RANGE", .request = BTRFS_IOC_DEFRAG_RANGE, }, { .name = "BTRFS_IOC_RESIZE", .request = BTRFS_IOC_RESIZE, }, { .name = "BTRFS_IOC_ADD_DEV", .request = BTRFS_IOC_ADD_DEV, }, { .name = "BTRFS_IOC_RM_DEV", .request = BTRFS_IOC_RM_DEV, }, { .name = "BTRFS_IOC_FS_INFO", .request = BTRFS_IOC_FS_INFO, }, { .name = "BTRFS_IOC_DEV_INFO", .request = BTRFS_IOC_DEV_INFO, }, { .name = "BTRFS_IOC_BALANCE", .request = BTRFS_IOC_BALANCE, }, { .name = "BTRFS_IOC_TRANS_START", .request = BTRFS_IOC_TRANS_START, }, { .name = "BTRFS_IOC_TRANS_END", .request = BTRFS_IOC_TRANS_END, }, { .name = "BTRFS_IOC_TREE_SEARCH", .request = BTRFS_IOC_TREE_SEARCH, }, { .name = "BTRFS_IOC_TREE_SEARCH_V2", .request = BTRFS_IOC_TREE_SEARCH_V2, }, { .name = "BTRFS_IOC_INO_LOOKUP", .request = BTRFS_IOC_INO_LOOKUP, }, { .name = "BTRFS_IOC_INO_PATHS", .request = BTRFS_IOC_INO_PATHS, }, { .name = "BTRFS_IOC_LOGICAL_INO", .request = BTRFS_IOC_LOGICAL_INO, }, { .name = "BTRFS_IOC_SPACE_INFO", .request = BTRFS_IOC_SPACE_INFO, }, { .name = "BTRFS_IOC_SYNC", .request = BTRFS_IOC_SYNC, }, { .name = "BTRFS_IOC_START_SYNC", .request = BTRFS_IOC_START_SYNC, }, { .name = "BTRFS_IOC_WAIT_SYNC", .request = BTRFS_IOC_WAIT_SYNC, }, { .name = "BTRFS_IOC_SCRUB", .request = BTRFS_IOC_SCRUB, }, { .name = "BTRFS_IOC_SCRUB_CANCEL", .request = BTRFS_IOC_SCRUB_CANCEL, }, { .name = "BTRFS_IOC_SCRUB_PROGRESS", .request = BTRFS_IOC_SCRUB_PROGRESS, }, { .name = "BTRFS_IOC_BALANCE_V2", .request = BTRFS_IOC_BALANCE_V2, }, { .name = "BTRFS_IOC_BALANCE_CTL", .request = BTRFS_IOC_BALANCE_CTL, }, { .name = "BTRFS_IOC_BALANCE_PROGRESS", .request = BTRFS_IOC_BALANCE_PROGRESS, }, { .name = "BTRFS_IOC_SET_RECEIVED_SUBVOL", .request = BTRFS_IOC_SET_RECEIVED_SUBVOL, }, { .name = "BTRFS_IOC_SET_RECEIVED_SUBVOL_32", .request = BTRFS_IOC_SET_RECEIVED_SUBVOL_32, }, { .name = "BTRFS_IOC_SEND", .request = BTRFS_IOC_SEND, }, { .name = "BTRFS_IOC_GET_DEV_STATS", .request = BTRFS_IOC_GET_DEV_STATS, }, { .name = "BTRFS_IOC_QUOTA_CTL", .request = BTRFS_IOC_QUOTA_CTL, }, { .name = "BTRFS_IOC_QGROUP_ASSIGN", .request = BTRFS_IOC_QGROUP_ASSIGN, }, { .name = "BTRFS_IOC_QGROUP_CREATE", .request = BTRFS_IOC_QGROUP_CREATE, }, { .name = "BTRFS_IOC_QGROUP_LIMIT", .request = BTRFS_IOC_QGROUP_LIMIT, }, { .name = "BTRFS_IOC_QUOTA_RESCAN", .request = BTRFS_IOC_QUOTA_RESCAN, }, { .name = "BTRFS_IOC_QUOTA_RESCAN_STATUS", .request = BTRFS_IOC_QUOTA_RESCAN_STATUS, }, { .name = "BTRFS_IOC_QUOTA_RESCAN_WAIT", .request = BTRFS_IOC_QUOTA_RESCAN_WAIT, }, { .name = "BTRFS_IOC_DEV_REPLACE", .request = BTRFS_IOC_DEV_REPLACE, }, { .name = "BTRFS_IOC_GET_FSLABEL", .request = BTRFS_IOC_GET_FSLABEL, }, { .name = "BTRFS_IOC_SET_FSLABEL", .request = BTRFS_IOC_SET_FSLABEL, }, { .name = "BTRFS_IOC_GET_SUPPORTED_FEATURES", .request = BTRFS_IOC_GET_SUPPORTED_FEATURES, }, { .name = "BTRFS_IOC_GET_FEATURES", .request = BTRFS_IOC_GET_FEATURES, }, { .name = "BTRFS_IOC_SET_FEATURES", .request = BTRFS_IOC_SET_FEATURES, }, }; static const struct ioctl_group btrfs_grp = { .name = "btrfs", .fd_test = btrfs_fd_test, .sanitise = pick_random_ioctl, .ioctls = btrfs_ioctls, .ioctls_cnt = ARRAY_SIZE(btrfs_ioctls), }; REG_IOCTL_GROUP(btrfs_grp) #endif /* USE_BTRFS */ ioctls/cdrom.c000066400000000000000000000027571445305223700136430ustar00rootroot00000000000000#include #include "utils.h" #include "ioctls.h" static const struct ioctl cdrom_ioctls[] = { IOCTL(CDROMPAUSE), IOCTL(CDROMRESUME), IOCTL(CDROMPLAYMSF), IOCTL(CDROMPLAYTRKIND), IOCTL(CDROMREADTOCHDR), IOCTL(CDROMREADTOCENTRY), IOCTL(CDROMSTOP), IOCTL(CDROMSTART), IOCTL(CDROMEJECT), IOCTL(CDROMVOLCTRL), IOCTL(CDROMSUBCHNL), IOCTL(CDROMREADMODE2), IOCTL(CDROMREADMODE1), IOCTL(CDROMREADAUDIO), IOCTL(CDROMEJECT_SW), IOCTL(CDROMMULTISESSION), IOCTL(CDROM_GET_MCN), IOCTL(CDROMRESET), IOCTL(CDROMVOLREAD), IOCTL(CDROMREADRAW), IOCTL(CDROMREADCOOKED), IOCTL(CDROMSEEK), IOCTL(CDROMPLAYBLK), IOCTL(CDROMREADALL), IOCTL(CDROMGETSPINDOWN), IOCTL(CDROMSETSPINDOWN), IOCTL(CDROMCLOSETRAY), IOCTL(CDROM_SET_OPTIONS), IOCTL(CDROM_CLEAR_OPTIONS), IOCTL(CDROM_SELECT_SPEED), IOCTL(CDROM_SELECT_DISC), IOCTL(CDROM_MEDIA_CHANGED), IOCTL(CDROM_DRIVE_STATUS), IOCTL(CDROM_DISC_STATUS), IOCTL(CDROM_CHANGER_NSLOTS), IOCTL(CDROM_LOCKDOOR), IOCTL(CDROM_DEBUG), IOCTL(CDROM_GET_CAPABILITY), IOCTL(CDROMAUDIOBUFSIZ), IOCTL(DVD_READ_STRUCT), IOCTL(DVD_WRITE_STRUCT), IOCTL(DVD_AUTH), IOCTL(CDROM_SEND_PACKET), IOCTL(CDROM_NEXT_WRITABLE), IOCTL(CDROM_LAST_WRITTEN), }; static const char *const cdrom_devs[] = { "sr", }; static const struct ioctl_group cdrom_grp = { .devtype = DEV_BLOCK, .devs = cdrom_devs, .devs_cnt = ARRAY_SIZE(cdrom_devs), .sanitise = pick_random_ioctl, .ioctls = cdrom_ioctls, .ioctls_cnt = ARRAY_SIZE(cdrom_ioctls), }; REG_IOCTL_GROUP(cdrom_grp) ioctls/dm.c000066400000000000000000000032371445305223700131310ustar00rootroot00000000000000#include #include #include "shm.h" #include "maps.h" #include "utils.h" #include "ioctls.h" #include "random.h" #include "sanitise.h" static const struct ioctl dm_ioctls[] = { IOCTL(DM_VERSION), IOCTL(DM_REMOVE_ALL), IOCTL(DM_LIST_DEVICES), IOCTL(DM_DEV_CREATE), IOCTL(DM_DEV_REMOVE), IOCTL(DM_DEV_RENAME), IOCTL(DM_DEV_SUSPEND), IOCTL(DM_DEV_STATUS), IOCTL(DM_DEV_WAIT), IOCTL(DM_TABLE_LOAD), IOCTL(DM_TABLE_CLEAR), IOCTL(DM_TABLE_DEPS), IOCTL(DM_TABLE_STATUS), IOCTL(DM_LIST_VERSIONS), IOCTL(DM_TARGET_MSG), IOCTL(DM_DEV_SET_GEOMETRY), }; static const char *const dm_devs[] = { "device-mapper", }; static void dm_sanitise(const struct ioctl_group *grp, struct syscallrecord *rec) { struct dm_ioctl *dm; pick_random_ioctl(grp, rec); rec->a3 = (unsigned long) get_writable_address(sizeof(struct dm_ioctl)); dm = (struct dm_ioctl *) rec->a3; /* set a sensible version to get past the initial checks */ dm->version[0] = DM_VERSION_MAJOR; dm->version[1] = DM_VERSION_MINOR; dm->version[2] = DM_VERSION_PATCHLEVEL; /* clear one of these strings to pass some kernel validation */ if (RAND_BOOL()) dm->name[0] = 0; else dm->uuid[0] = 0; } static const struct ioctl_group dm_grp_misc = { .devtype = DEV_MISC, .devs = dm_devs, .devs_cnt = ARRAY_SIZE(dm_devs), .sanitise = dm_sanitise, .ioctls = dm_ioctls, .ioctls_cnt = ARRAY_SIZE(dm_ioctls), }; REG_IOCTL_GROUP(dm_grp_misc) static const struct ioctl_group dm_grp_block = { .devtype = DEV_BLOCK, .devs = dm_devs, .devs_cnt = ARRAY_SIZE(dm_devs), .sanitise = dm_sanitise, .ioctls = dm_ioctls, .ioctls_cnt = ARRAY_SIZE(dm_ioctls), }; REG_IOCTL_GROUP(dm_grp_block) ioctls/drm.c000066400000000000000000000374071445305223700133210ustar00rootroot00000000000000 #ifdef USE_DRM #include #include #include #ifdef USE_DRM_EXYNOS #include #endif #ifdef USE_DRM_I810 #include #endif #include #ifdef USE_DRM_MGA #include #endif #include #ifdef USE_DRM_R128 #include #endif #include #ifdef USE_DRM_SAVAGE #include #endif #include "ioctls.h" #include "utils.h" /* Copy-paste relevant stuff from header, as it is buggy. */ /* #include */ /* SiS specific ioctls */ #define NOT_USED_0_3 #define DRM_SIS_FB_ALLOC 0x04 #define DRM_SIS_FB_FREE 0x05 #define NOT_USED_6_12 #define DRM_SIS_AGP_INIT 0x13 #define DRM_SIS_AGP_ALLOC 0x14 #define DRM_SIS_AGP_FREE 0x15 #define DRM_SIS_FB_INIT 0x16 #define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_FB_ALLOC, drm_sis_mem_t) #define DRM_IOCTL_SIS_FB_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_FREE, drm_sis_mem_t) #define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_INIT, drm_sis_agp_t) #define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_ALLOC, drm_sis_mem_t) #define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_AGP_FREE, drm_sis_mem_t) #define DRM_IOCTL_SIS_FB_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_INIT, drm_sis_fb_t) /* #define DRM_IOCTL_SIS_FLIP DRM_IOW( 0x48, drm_sis_flip_t) #define DRM_IOCTL_SIS_FLIP_INIT DRM_IO( 0x49) #define DRM_IOCTL_SIS_FLIP_FINAL DRM_IO( 0x50) */ /* deprecated nouveau ioctls */ /* * Copyright 2005 Stephane Marchesin. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DRM_IOCTL_NOUVEAU_GETPARAM struct drm_nouveau_getparam { uint64_t param; uint64_t value; }; #define DRM_IOCTL_NOUVEAU_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam) #endif #ifndef DRM_IOCTL_NOUVEAU_SETPARAM struct drm_nouveau_setparam { uint64_t param; uint64_t value; }; #define DRM_IOCTL_NOUVEAU_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam) #endif #ifndef DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC struct drm_nouveau_channel_alloc { uint32_t fb_ctxdma_handle; uint32_t tt_ctxdma_handle; int channel; uint32_t pushbuf_domains; /* Notifier memory */ uint32_t notifier_handle; /* DRM-enforced subchannel assignments */ struct { uint32_t handle; uint32_t grclass; } subchan[8]; uint32_t nr_subchan; }; #define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc) #endif #ifndef DRM_IOCTL_NOUVEAU_CHANNEL_FREE struct drm_nouveau_channel_free { int channel; }; #define DRM_IOCTL_NOUVEAU_CHANNEL_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free) #endif #ifndef DRM_IOCTL_NOUVEAU_GROBJ_ALLOC struct drm_nouveau_grobj_alloc { int channel; uint32_t handle; int class; }; #define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc) #endif #ifndef DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC struct drm_nouveau_notifierobj_alloc { uint32_t channel; uint32_t handle; uint32_t size; uint32_t offset; }; #define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc) #endif #ifndef DRM_IOCTL_NOUVEAU_GPUOBJ_FREE struct drm_nouveau_gpuobj_free { int channel; uint32_t handle; }; #define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free) #endif typedef struct { int context; unsigned long offset; unsigned long size; unsigned long free; } drm_sis_mem_t; typedef struct { unsigned long offset, size; } drm_sis_agp_t; typedef struct { unsigned long offset, size; } drm_sis_fb_t; /* header is buggy. */ /* #include */ static const struct ioctl drm_ioctls[] = { /* drm/drm.h */ IOCTL(DRM_IOCTL_VERSION), IOCTL(DRM_IOCTL_GET_UNIQUE), IOCTL(DRM_IOCTL_GET_MAGIC), IOCTL(DRM_IOCTL_IRQ_BUSID), IOCTL(DRM_IOCTL_GET_MAP), IOCTL(DRM_IOCTL_GET_CLIENT), IOCTL(DRM_IOCTL_GET_STATS), IOCTL(DRM_IOCTL_SET_VERSION), IOCTL(DRM_IOCTL_MODESET_CTL), IOCTL(DRM_IOCTL_GEM_CLOSE), IOCTL(DRM_IOCTL_GEM_FLINK), IOCTL(DRM_IOCTL_GEM_OPEN), #ifdef DRM_IOCTL_GET_CAP IOCTL(DRM_IOCTL_GET_CAP), #endif IOCTL(DRM_IOCTL_SET_UNIQUE), IOCTL(DRM_IOCTL_AUTH_MAGIC), IOCTL(DRM_IOCTL_BLOCK), IOCTL(DRM_IOCTL_UNBLOCK), IOCTL(DRM_IOCTL_CONTROL), IOCTL(DRM_IOCTL_ADD_MAP), IOCTL(DRM_IOCTL_ADD_BUFS), IOCTL(DRM_IOCTL_MARK_BUFS), IOCTL(DRM_IOCTL_INFO_BUFS), IOCTL(DRM_IOCTL_MAP_BUFS), IOCTL(DRM_IOCTL_FREE_BUFS), IOCTL(DRM_IOCTL_RM_MAP), IOCTL(DRM_IOCTL_SET_SAREA_CTX), IOCTL(DRM_IOCTL_GET_SAREA_CTX), IOCTL(DRM_IOCTL_SET_MASTER), IOCTL(DRM_IOCTL_DROP_MASTER), IOCTL(DRM_IOCTL_ADD_CTX), IOCTL(DRM_IOCTL_RM_CTX), IOCTL(DRM_IOCTL_MOD_CTX), IOCTL(DRM_IOCTL_GET_CTX), IOCTL(DRM_IOCTL_SWITCH_CTX), IOCTL(DRM_IOCTL_NEW_CTX), IOCTL(DRM_IOCTL_RES_CTX), IOCTL(DRM_IOCTL_ADD_DRAW), IOCTL(DRM_IOCTL_RM_DRAW), IOCTL(DRM_IOCTL_DMA), IOCTL(DRM_IOCTL_LOCK), IOCTL(DRM_IOCTL_UNLOCK), IOCTL(DRM_IOCTL_FINISH), #ifdef DRM_IOCTL_PRIME_HANDLE_TO_FD IOCTL(DRM_IOCTL_PRIME_HANDLE_TO_FD), #endif #ifdef DRM_IOCTL_PRIME_FD_TO_HANDLE IOCTL(DRM_IOCTL_PRIME_FD_TO_HANDLE), #endif IOCTL(DRM_IOCTL_AGP_ACQUIRE), IOCTL(DRM_IOCTL_AGP_RELEASE), IOCTL(DRM_IOCTL_AGP_ENABLE), IOCTL(DRM_IOCTL_AGP_INFO), IOCTL(DRM_IOCTL_AGP_ALLOC), IOCTL(DRM_IOCTL_AGP_FREE), IOCTL(DRM_IOCTL_AGP_BIND), IOCTL(DRM_IOCTL_AGP_UNBIND), IOCTL(DRM_IOCTL_SG_ALLOC), IOCTL(DRM_IOCTL_SG_FREE), IOCTL(DRM_IOCTL_WAIT_VBLANK), IOCTL(DRM_IOCTL_UPDATE_DRAW), IOCTL(DRM_IOCTL_MODE_GETRESOURCES), IOCTL(DRM_IOCTL_MODE_GETCRTC), IOCTL(DRM_IOCTL_MODE_SETCRTC), IOCTL(DRM_IOCTL_MODE_CURSOR), IOCTL(DRM_IOCTL_MODE_GETGAMMA), IOCTL(DRM_IOCTL_MODE_SETGAMMA), IOCTL(DRM_IOCTL_MODE_GETENCODER), IOCTL(DRM_IOCTL_MODE_GETCONNECTOR), IOCTL(DRM_IOCTL_MODE_ATTACHMODE), IOCTL(DRM_IOCTL_MODE_DETACHMODE), IOCTL(DRM_IOCTL_MODE_GETPROPERTY), IOCTL(DRM_IOCTL_MODE_SETPROPERTY), IOCTL(DRM_IOCTL_MODE_GETPROPBLOB), IOCTL(DRM_IOCTL_MODE_GETFB), IOCTL(DRM_IOCTL_MODE_ADDFB), IOCTL(DRM_IOCTL_MODE_RMFB), IOCTL(DRM_IOCTL_MODE_PAGE_FLIP), IOCTL(DRM_IOCTL_MODE_DIRTYFB), #ifdef DRM_IOCTL_MODE_CREATE_DUMB IOCTL(DRM_IOCTL_MODE_CREATE_DUMB), #endif #ifdef DRM_IOCTL_MODE_MAP_DUMB IOCTL(DRM_IOCTL_MODE_MAP_DUMB), #endif #ifdef DRM_IOCTL_MODE_DESTROY_DUMB IOCTL(DRM_IOCTL_MODE_DESTROY_DUMB), #endif #ifdef DRM_IOCTL_MODE_GETPLANERESOURCES IOCTL(DRM_IOCTL_MODE_GETPLANERESOURCES), #endif #ifdef DRM_IOCTL_MODE_GETPLANE IOCTL(DRM_IOCTL_MODE_GETPLANE), #endif #ifdef DRM_IOCTL_MODE_SETPLANE IOCTL(DRM_IOCTL_MODE_SETPLANE), #endif #ifdef DRM_IOCTL_MODE_ADDFB2 IOCTL(DRM_IOCTL_MODE_ADDFB2), #endif #ifdef DRM_IOCTL_MODE_OBJ_GETPROPERTIES IOCTL(DRM_IOCTL_MODE_OBJ_GETPROPERTIES), #endif #ifdef DRM_IOCTL_MODE_OBJ_SETPROPERTY IOCTL(DRM_IOCTL_MODE_OBJ_SETPROPERTY), #endif #ifdef USE_DRM_EXYNOS /* exynos_drm.h */ IOCTL(DRM_IOCTL_EXYNOS_GEM_CREATE), #ifdef DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET IOCTL(DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET), #endif #ifdef DRM_IOCTL_EXYNOS_GEM_MMAP IOCTL(DRM_IOCTL_EXYNOS_GEM_MMAP), #endif #ifdef DRM_IOCTL_EXYNOS_GEM_GET IOCTL(DRM_IOCTL_EXYNOS_GEM_GET), #endif #ifdef DRM_IOCTL_EXYNOS_VIDI_CONNECTION IOCTL(DRM_IOCTL_EXYNOS_VIDI_CONNECTION), #endif #ifdef DRM_IOCTL_EXYNOS_G2D_GET_VER IOCTL(DRM_IOCTL_EXYNOS_G2D_GET_VER), #endif #ifdef DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST IOCTL(DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST), #endif #ifdef DRM_IOCTL_EXYNOS_G2D_EXEC IOCTL(DRM_IOCTL_EXYNOS_G2D_EXEC), #endif #endif #ifdef USE_DRM_I810 /* i810_drm.h */ IOCTL(DRM_IOCTL_I810_INIT), IOCTL(DRM_IOCTL_I810_VERTEX), IOCTL(DRM_IOCTL_I810_CLEAR), IOCTL(DRM_IOCTL_I810_FLUSH), IOCTL(DRM_IOCTL_I810_GETAGE), IOCTL(DRM_IOCTL_I810_GETBUF), IOCTL(DRM_IOCTL_I810_SWAP), IOCTL(DRM_IOCTL_I810_COPY), IOCTL(DRM_IOCTL_I810_DOCOPY), IOCTL(DRM_IOCTL_I810_OV0INFO), IOCTL(DRM_IOCTL_I810_FSTATUS), IOCTL(DRM_IOCTL_I810_OV0FLIP), IOCTL(DRM_IOCTL_I810_MC), IOCTL(DRM_IOCTL_I810_RSTATUS), IOCTL(DRM_IOCTL_I810_FLIP), #endif /* i915_drm.h */ IOCTL(DRM_IOCTL_I915_INIT), IOCTL(DRM_IOCTL_I915_FLUSH), IOCTL(DRM_IOCTL_I915_FLIP), IOCTL(DRM_IOCTL_I915_BATCHBUFFER), IOCTL(DRM_IOCTL_I915_IRQ_EMIT), IOCTL(DRM_IOCTL_I915_IRQ_WAIT), IOCTL(DRM_IOCTL_I915_GETPARAM), IOCTL(DRM_IOCTL_I915_SETPARAM), IOCTL(DRM_IOCTL_I915_ALLOC), IOCTL(DRM_IOCTL_I915_FREE), IOCTL(DRM_IOCTL_I915_INIT_HEAP), IOCTL(DRM_IOCTL_I915_CMDBUFFER), IOCTL(DRM_IOCTL_I915_DESTROY_HEAP), IOCTL(DRM_IOCTL_I915_SET_VBLANK_PIPE), IOCTL(DRM_IOCTL_I915_GET_VBLANK_PIPE), IOCTL(DRM_IOCTL_I915_VBLANK_SWAP), #ifdef DRM_IOCTL_I915_HWS_ADDR IOCTL(DRM_IOCTL_I915_HWS_ADDR), #endif IOCTL(DRM_IOCTL_I915_GEM_INIT), IOCTL(DRM_IOCTL_I915_GEM_EXECBUFFER), IOCTL(DRM_IOCTL_I915_GEM_EXECBUFFER2), IOCTL(DRM_IOCTL_I915_GEM_PIN), IOCTL(DRM_IOCTL_I915_GEM_UNPIN), IOCTL(DRM_IOCTL_I915_GEM_BUSY), #ifdef DRM_IOCTL_I915_GEM_SET_CACHING IOCTL(DRM_IOCTL_I915_GEM_SET_CACHING), #endif #ifdef DRM_IOCTL_I915_GEM_GET_CACHING IOCTL(DRM_IOCTL_I915_GEM_GET_CACHING), #endif IOCTL(DRM_IOCTL_I915_GEM_THROTTLE), IOCTL(DRM_IOCTL_I915_GEM_ENTERVT), IOCTL(DRM_IOCTL_I915_GEM_LEAVEVT), IOCTL(DRM_IOCTL_I915_GEM_CREATE), IOCTL(DRM_IOCTL_I915_GEM_PREAD), IOCTL(DRM_IOCTL_I915_GEM_PWRITE), IOCTL(DRM_IOCTL_I915_GEM_MMAP), IOCTL(DRM_IOCTL_I915_GEM_MMAP_GTT), IOCTL(DRM_IOCTL_I915_GEM_SET_DOMAIN), IOCTL(DRM_IOCTL_I915_GEM_SW_FINISH), IOCTL(DRM_IOCTL_I915_GEM_SET_TILING), IOCTL(DRM_IOCTL_I915_GEM_GET_TILING), IOCTL(DRM_IOCTL_I915_GEM_GET_APERTURE), IOCTL(DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID), IOCTL(DRM_IOCTL_I915_GEM_MADVISE), IOCTL(DRM_IOCTL_I915_OVERLAY_PUT_IMAGE), IOCTL(DRM_IOCTL_I915_OVERLAY_ATTRS), #ifdef DRM_IOCTL_I915_SET_SPRITE_COLORKEY IOCTL(DRM_IOCTL_I915_SET_SPRITE_COLORKEY), #endif #ifdef DRM_IOCTL_I915_GET_SPRITE_COLORKEY IOCTL(DRM_IOCTL_I915_GET_SPRITE_COLORKEY), #endif #ifdef DRM_IOCTL_I915_GEM_WAIT IOCTL(DRM_IOCTL_I915_GEM_WAIT), #endif #ifdef DRM_IOCTL_I915_GEM_CONTEXT_CREATE IOCTL(DRM_IOCTL_I915_GEM_CONTEXT_CREATE), #endif #ifdef DRM_IOCTL_I915_GEM_CONTEXT_DESTROY IOCTL(DRM_IOCTL_I915_GEM_CONTEXT_DESTROY), #endif #ifdef DRM_IOCTL_I915_REG_READ IOCTL(DRM_IOCTL_I915_REG_READ), #endif #ifdef USE_DRM_MGA /* mga_drm.h */ IOCTL(DRM_IOCTL_MGA_INIT), IOCTL(DRM_IOCTL_MGA_FLUSH), IOCTL(DRM_IOCTL_MGA_RESET), IOCTL(DRM_IOCTL_MGA_SWAP), IOCTL(DRM_IOCTL_MGA_CLEAR), IOCTL(DRM_IOCTL_MGA_VERTEX), IOCTL(DRM_IOCTL_MGA_INDICES), IOCTL(DRM_IOCTL_MGA_ILOAD), IOCTL(DRM_IOCTL_MGA_BLIT), IOCTL(DRM_IOCTL_MGA_GETPARAM), IOCTL(DRM_IOCTL_MGA_SET_FENCE), IOCTL(DRM_IOCTL_MGA_WAIT_FENCE), IOCTL(DRM_IOCTL_MGA_DMA_BOOTSTRAP), #endif /* nouveau_drm.h */ IOCTL(DRM_IOCTL_NOUVEAU_GETPARAM), IOCTL(DRM_IOCTL_NOUVEAU_SETPARAM), IOCTL(DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC), IOCTL(DRM_IOCTL_NOUVEAU_CHANNEL_FREE), IOCTL(DRM_IOCTL_NOUVEAU_GROBJ_ALLOC), IOCTL(DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC), IOCTL(DRM_IOCTL_NOUVEAU_GPUOBJ_FREE), #ifdef DRM_IOCTL_NOUVEAU_GEM_NEW IOCTL(DRM_IOCTL_NOUVEAU_GEM_NEW), #endif #ifdef DRM_IOCTL_NOUVEAU_GEM_PUSHBUF IOCTL(DRM_IOCTL_NOUVEAU_GEM_PUSHBUF), #endif #ifdef DRM_IOCTL_NOUVEAU_GEM_CPU_PREP IOCTL(DRM_IOCTL_NOUVEAU_GEM_CPU_PREP), #endif #ifdef DRM_IOCTL_NOUVEAU_GEM_CPU_FINI IOCTL(DRM_IOCTL_NOUVEAU_GEM_CPU_FINI), #endif #ifdef DRM_IOCTL_NOUVEAU_GEM_INFO IOCTL(DRM_IOCTL_NOUVEAU_GEM_INFO), #endif #ifdef USE_DRM_R128 /* r128_drm.h */ IOCTL(DRM_IOCTL_R128_INIT), IOCTL(DRM_IOCTL_R128_CCE_START), IOCTL(DRM_IOCTL_R128_CCE_STOP), IOCTL(DRM_IOCTL_R128_CCE_RESET), IOCTL(DRM_IOCTL_R128_CCE_IDLE), IOCTL(DRM_IOCTL_R128_RESET), IOCTL(DRM_IOCTL_R128_SWAP), IOCTL(DRM_IOCTL_R128_CLEAR), IOCTL(DRM_IOCTL_R128_VERTEX), IOCTL(DRM_IOCTL_R128_INDICES), IOCTL(DRM_IOCTL_R128_BLIT), IOCTL(DRM_IOCTL_R128_DEPTH), IOCTL(DRM_IOCTL_R128_STIPPLE), IOCTL(DRM_IOCTL_R128_INDIRECT), IOCTL(DRM_IOCTL_R128_FULLSCREEN), IOCTL(DRM_IOCTL_R128_GETPARAM), IOCTL(DRM_IOCTL_R128_FLIP), #endif /* radeon_drm.h */ IOCTL(DRM_IOCTL_RADEON_CP_INIT), IOCTL(DRM_IOCTL_RADEON_CP_START), IOCTL(DRM_IOCTL_RADEON_CP_STOP), IOCTL(DRM_IOCTL_RADEON_CP_RESET), IOCTL(DRM_IOCTL_RADEON_CP_IDLE), IOCTL(DRM_IOCTL_RADEON_RESET), IOCTL(DRM_IOCTL_RADEON_FULLSCREEN), IOCTL(DRM_IOCTL_RADEON_SWAP), IOCTL(DRM_IOCTL_RADEON_CLEAR), IOCTL(DRM_IOCTL_RADEON_VERTEX), IOCTL(DRM_IOCTL_RADEON_INDICES), IOCTL(DRM_IOCTL_RADEON_STIPPLE), IOCTL(DRM_IOCTL_RADEON_INDIRECT), IOCTL(DRM_IOCTL_RADEON_TEXTURE), IOCTL(DRM_IOCTL_RADEON_VERTEX2), IOCTL(DRM_IOCTL_RADEON_CMDBUF), IOCTL(DRM_IOCTL_RADEON_GETPARAM), IOCTL(DRM_IOCTL_RADEON_FLIP), IOCTL(DRM_IOCTL_RADEON_ALLOC), IOCTL(DRM_IOCTL_RADEON_FREE), IOCTL(DRM_IOCTL_RADEON_INIT_HEAP), IOCTL(DRM_IOCTL_RADEON_IRQ_EMIT), IOCTL(DRM_IOCTL_RADEON_IRQ_WAIT), IOCTL(DRM_IOCTL_RADEON_CP_RESUME), IOCTL(DRM_IOCTL_RADEON_SETPARAM), IOCTL(DRM_IOCTL_RADEON_SURF_ALLOC), IOCTL(DRM_IOCTL_RADEON_SURF_FREE), IOCTL(DRM_IOCTL_RADEON_GEM_INFO), IOCTL(DRM_IOCTL_RADEON_GEM_CREATE), IOCTL(DRM_IOCTL_RADEON_GEM_MMAP), IOCTL(DRM_IOCTL_RADEON_GEM_PREAD), IOCTL(DRM_IOCTL_RADEON_GEM_PWRITE), IOCTL(DRM_IOCTL_RADEON_GEM_SET_DOMAIN), IOCTL(DRM_IOCTL_RADEON_GEM_WAIT_IDLE), IOCTL(DRM_IOCTL_RADEON_CS), IOCTL(DRM_IOCTL_RADEON_INFO), #ifdef DRM_IOCTL_RADEON_GEM_SET_TILING IOCTL(DRM_IOCTL_RADEON_GEM_SET_TILING), #endif #ifdef DRM_IOCTL_RADEON_GEM_GET_TILING IOCTL(DRM_IOCTL_RADEON_GEM_GET_TILING), #endif IOCTL(DRM_IOCTL_RADEON_GEM_BUSY), #ifdef DRM_IOCTL_RADEON_GEM_VA IOCTL(DRM_IOCTL_RADEON_GEM_VA), #endif /* savage_drm.h */ #ifdef DRM_IOCTL_SAVAGE_BCI_INIT IOCTL(DRM_IOCTL_SAVAGE_BCI_INIT), #endif #ifdef DRM_IOCTL_SAVAGE_BCI_CMDBUF IOCTL(DRM_IOCTL_SAVAGE_BCI_CMDBUF), #endif #ifdef DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT IOCTL(DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT), #endif #ifdef DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT IOCTL(DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT), #endif /* sis_drm.h */ IOCTL(DRM_IOCTL_SIS_FB_ALLOC), IOCTL(DRM_IOCTL_SIS_FB_FREE), IOCTL(DRM_IOCTL_SIS_AGP_INIT), IOCTL(DRM_IOCTL_SIS_AGP_ALLOC), IOCTL(DRM_IOCTL_SIS_AGP_FREE), IOCTL(DRM_IOCTL_SIS_FB_INIT), /* via_drm.h */ /* IOCTL(DRM_IOCTL_VIA_ALLOCMEM), IOCTL(DRM_IOCTL_VIA_FREEMEM), IOCTL(DRM_IOCTL_VIA_AGP_INIT), IOCTL(DRM_IOCTL_VIA_FB_INIT), IOCTL(DRM_IOCTL_VIA_MAP_INIT), IOCTL(DRM_IOCTL_VIA_DEC_FUTEX), IOCTL(DRM_IOCTL_VIA_DMA_INIT), IOCTL(DRM_IOCTL_VIA_CMDBUFFER), IOCTL(DRM_IOCTL_VIA_FLUSH), IOCTL(DRM_IOCTL_VIA_PCICMD), IOCTL(DRM_IOCTL_VIA_CMDBUF_SIZE), IOCTL(DRM_IOCTL_VIA_WAIT_IRQ), IOCTL(DRM_IOCTL_VIA_DMA_BLIT), IOCTL(DRM_IOCTL_VIA_BLIT_SYNC), */ }; static const char *const drm_devs[] = { "drm", }; static const struct ioctl_group drm_grp = { .devtype = DEV_CHAR, .devs = drm_devs, .devs_cnt = ARRAY_SIZE(drm_devs), .sanitise = pick_random_ioctl, .ioctls = drm_ioctls, .ioctls_cnt = ARRAY_SIZE(drm_ioctls), }; REG_IOCTL_GROUP(drm_grp) #endif /* USE_DRM */ ioctls/ext.c000066400000000000000000000073061445305223700133320ustar00rootroot00000000000000#include #include #include #include #include "ioctls.h" #include "shm.h" #include "utils.h" struct ext4_new_group_input { __u32 group; /* Group number for this data */ __u64 block_bitmap; /* Absolute block number of block bitmap */ __u64 inode_bitmap; /* Absolute block number of inode bitmap */ __u64 inode_table; /* Absolute block number of inode table start */ __u32 blocks_count; /* Total number of blocks in this group */ __u16 reserved_blocks; /* Number of reserved blocks in this group */ __u16 unused; }; struct move_extent { __u32 reserved; /* should be zero */ __u32 donor_fd; /* donor file descriptor */ __u64 orig_start; /* logical start offset in block for orig */ __u64 donor_start; /* logical start offset in block for donor */ __u64 len; /* block length to be moved */ __u64 moved_len; /* moved block length */ }; #define EXT4_KEY_DESCRIPTOR_SIZE 8 struct ext4_encryption_policy { char version; char contents_encryption_mode; char filenames_encryption_mode; char flags; char master_key_descriptor[EXT4_KEY_DESCRIPTOR_SIZE]; }; #define EXT4_IOC_GETVERSION _IOR('f', 3, long) #define EXT4_IOC_SETVERSION _IOW('f', 4, long) #define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) #define EXT4_IOC_SETRSVSZ _IOW('f', 6, long) #define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) #define EXT4_IOC_GROUP_ADD _IOW('f', 8, struct ext4_new_group_input) #define EXT4_IOC_MIGRATE _IO('f', 9) #define EXT4_IOC_ALLOC_DA_BLKS _IO('f', 12) #define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent) #define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) #define EXT4_IOC_SWAP_BOOT _IO('f', 17) #define EXT4_IOC_PRECACHE_EXTENTS _IO('f', 18) #define EXT4_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct ext4_encryption_policy) #define EXT4_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) #define EXT4_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct ext4_encryption_policy) static int ext_fd_test(int fd, const struct stat *st __attribute__((unused))) { struct list_head *globallist, *node; globallist = shm->global_objects[OBJ_FD_TESTFILE].list; list_for_each(node, globallist) { struct object *obj; obj = (struct object *) node; if (obj->testfileobj.fd == fd) return 0; } return -1; } static const struct ioctl ext_ioctls[] = { { .name = "EXT4_IOC_GETVERSION", .request = EXT4_IOC_GETVERSION, }, { .name = "EXT4_IOC_SETVERSION", .request = EXT4_IOC_SETVERSION, }, { .name = "EXT4_IOC_GETRSVSZ", .request = EXT4_IOC_GETRSVSZ, }, { .name = "EXT4_IOC_SETRSVSZ", .request = EXT4_IOC_SETRSVSZ, }, { .name = "EXT4_IOC_GROUP_EXTEND", .request = EXT4_IOC_GROUP_EXTEND, }, { .name = "EXT4_IOC_GROUP_ADD", .request = EXT4_IOC_GROUP_ADD, }, { .name = "EXT4_IOC_MIGRATE", .request = EXT4_IOC_MIGRATE, }, { .name = "EXT4_IOC_ALLOC_DA_BLKS", .request = EXT4_IOC_ALLOC_DA_BLKS, }, { .name = "EXT4_IOC_MOVE_EXT", .request = EXT4_IOC_MOVE_EXT, }, { .name = "EXT4_IOC_RESIZE_FS", .request = EXT4_IOC_RESIZE_FS, }, { .name = "EXT4_IOC_SWAP_BOOT", .request = EXT4_IOC_SWAP_BOOT, }, { .name = "EXT4_IOC_PRECACHE_EXTENTS", .request = EXT4_IOC_PRECACHE_EXTENTS, }, { .name = "EXT4_IOC_SET_ENCRYPTION_POLICY", .request = EXT4_IOC_SET_ENCRYPTION_POLICY, }, { .name = "EXT4_IOC_GET_ENCRYPTION_PWSALT", .request = EXT4_IOC_GET_ENCRYPTION_PWSALT, }, { .name = "EXT4_IOC_GET_ENCRYPTION_POLICY", .request = EXT4_IOC_GET_ENCRYPTION_POLICY, }, }; static const struct ioctl_group ext_grp = { .name = "ext[234]", .fd_test = ext_fd_test, .sanitise = pick_random_ioctl, .ioctls = ext_ioctls, .ioctls_cnt = ARRAY_SIZE(ext_ioctls), }; REG_IOCTL_GROUP(ext_grp) ioctls/firewire.c000066400000000000000000000031021445305223700143340ustar00rootroot00000000000000#include #include "utils.h" #include "ioctls.h" static const struct ioctl firewire_ioctls[] = { IOCTL(FW_CDEV_IOC_GET_INFO), IOCTL(FW_CDEV_IOC_SEND_REQUEST), IOCTL(FW_CDEV_IOC_ALLOCATE), IOCTL(FW_CDEV_IOC_DEALLOCATE), IOCTL(FW_CDEV_IOC_SEND_RESPONSE), IOCTL(FW_CDEV_IOC_INITIATE_BUS_RESET), IOCTL(FW_CDEV_IOC_ADD_DESCRIPTOR), IOCTL(FW_CDEV_IOC_REMOVE_DESCRIPTOR), IOCTL(FW_CDEV_IOC_CREATE_ISO_CONTEXT), IOCTL(FW_CDEV_IOC_QUEUE_ISO), IOCTL(FW_CDEV_IOC_START_ISO), IOCTL(FW_CDEV_IOC_STOP_ISO), IOCTL(FW_CDEV_IOC_GET_CYCLE_TIMER), IOCTL(FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE), IOCTL(FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE), IOCTL(FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE), IOCTL(FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE), IOCTL(FW_CDEV_IOC_GET_SPEED), IOCTL(FW_CDEV_IOC_SEND_BROADCAST_REQUEST), IOCTL(FW_CDEV_IOC_SEND_STREAM_PACKET), #ifdef FW_CDEV_IOC_GET_CYCLE_TIMER2 IOCTL(FW_CDEV_IOC_GET_CYCLE_TIMER2), #endif #ifdef FW_CDEV_IOC_SEND_PHY_PACKET IOCTL(FW_CDEV_IOC_SEND_PHY_PACKET), #endif #ifdef FW_CDEV_IOC_RECEIVE_PHY_PACKETS IOCTL(FW_CDEV_IOC_RECEIVE_PHY_PACKETS), #endif #ifdef FW_CDEV_IOC_SET_ISO_CHANNELS IOCTL(FW_CDEV_IOC_SET_ISO_CHANNELS), #endif #ifdef FW_CDEV_IOC_FLUSH_ISO IOCTL(FW_CDEV_IOC_FLUSH_ISO), #endif }; static const char *const firewire_devs[] = { "firewire", }; static const struct ioctl_group firewire_grp = { .devtype = DEV_MISC, .devs = firewire_devs, .devs_cnt = ARRAY_SIZE(firewire_devs), .sanitise = pick_random_ioctl, .ioctls = firewire_ioctls, .ioctls_cnt = ARRAY_SIZE(firewire_ioctls), }; REG_IOCTL_GROUP(firewire_grp) ioctls/framebuffer.c000066400000000000000000000016071445305223700150140ustar00rootroot00000000000000#include #include #include "utils.h" #include "ioctls.h" static const struct ioctl fb_ioctls[] = { IOCTL(FBIOGET_VSCREENINFO), IOCTL(FBIOPUT_VSCREENINFO), IOCTL(FBIOGET_FSCREENINFO), IOCTL(FBIOGETCMAP), IOCTL(FBIOPUTCMAP), IOCTL(FBIOPAN_DISPLAY), IOCTL(FBIO_CURSOR), IOCTL(FBIOGET_CON2FBMAP), IOCTL(FBIOPUT_CON2FBMAP), IOCTL(FBIOBLANK), IOCTL(FBIOGET_VBLANK), IOCTL(FBIO_ALLOC), IOCTL(FBIO_FREE), IOCTL(FBIOGET_GLYPH), IOCTL(FBIOGET_HWCINFO), IOCTL(FBIOPUT_MODEINFO), IOCTL(FBIOGET_DISPINFO), #ifdef FBIO_WAITFORVSYNC IOCTL(FBIO_WAITFORVSYNC), #endif }; static const char *const fb_chardevs[] = { "fb", }; static const struct ioctl_group fb_grp = { .devtype = DEV_CHAR, .devs = fb_chardevs, .devs_cnt = ARRAY_SIZE(fb_chardevs), .sanitise = pick_random_ioctl, .ioctls = fb_ioctls, .ioctls_cnt = ARRAY_SIZE(fb_ioctls), }; REG_IOCTL_GROUP(fb_grp) ioctls/hpet.c000066400000000000000000000010571445305223700134670ustar00rootroot00000000000000#include #include #include "utils.h" #include "ioctls.h" static const struct ioctl hpet_ioctls[] = { IOCTL(HPET_IE_ON), IOCTL(HPET_IE_OFF), IOCTL(HPET_INFO), IOCTL(HPET_EPI), IOCTL(HPET_DPI), IOCTL(HPET_IRQFREQ), }; static const char *const hpet_devs[] = { "hpet", }; static const struct ioctl_group hpet_grp = { .devtype = DEV_MISC, .devs = hpet_devs, .devs_cnt = ARRAY_SIZE(hpet_devs), .sanitise = pick_random_ioctl, .ioctls = hpet_ioctls, .ioctls_cnt = ARRAY_SIZE(hpet_ioctls), }; REG_IOCTL_GROUP(hpet_grp) ioctls/input.c000066400000000000000000000045271445305223700136730ustar00rootroot00000000000000#include #include #include "ioctls.h" #include "random.h" #include "shm.h" #include "syscall.h" #include "utils.h" static const struct ioctl input_ioctls[] = { IOCTL(EVIOCGVERSION), IOCTL(EVIOCGID), IOCTL(EVIOCGREP), IOCTL(EVIOCSREP), IOCTL(EVIOCGKEYCODE), #ifdef EVIOCGKEYCODE_V2 IOCTL(EVIOCGKEYCODE_V2), #endif IOCTL(EVIOCSKEYCODE), #ifdef EVIOCSKEYCODE_V2 IOCTL(EVIOCSKEYCODE_V2), #endif IOCTL(EVIOCGNAME(0)), IOCTL(EVIOCGPHYS(0)), IOCTL(EVIOCGUNIQ(0)), #ifdef EVIOCGPROP IOCTL(EVIOCGPROP(0)), #endif #ifdef EVIOCGMTSLOTS IOCTL(EVIOCGMTSLOTS(0)), #endif IOCTL(EVIOCGKEY(0)), IOCTL(EVIOCGLED(0)), IOCTL(EVIOCGSND(0)), IOCTL(EVIOCGSW(0)), IOCTL(EVIOCGBIT(0,0)), IOCTL(EVIOCGABS(0)), IOCTL(EVIOCSABS(0)), IOCTL(EVIOCSFF), IOCTL(EVIOCRMFF), IOCTL(EVIOCGEFFECTS), IOCTL(EVIOCGRAB), #ifdef EVIOCSCLOCKID IOCTL(EVIOCSCLOCKID), #endif }; static const char *const input_devs[] = { "input", }; static void input_sanitise(const struct ioctl_group *grp, struct syscallrecord *rec) { unsigned int u, r; pick_random_ioctl(grp, rec); switch (rec->a2) { case EVIOCGNAME(0): u = rnd(); rec->a2 = EVIOCGNAME(u); break; case EVIOCGPHYS(0): u = rnd(); rec->a2 = EVIOCGPHYS(u); break; case EVIOCGUNIQ(0): u = rnd(); rec->a2 = EVIOCGUNIQ(u); break; #ifdef EVIOCGPROP case EVIOCGPROP(0): u = rnd(); rec->a2 = EVIOCGPROP(u); break; #endif #ifdef EVIOCGMTSLOTS case EVIOCGMTSLOTS(0): u = rnd(); rec->a2 = EVIOCGMTSLOTS(u); break; #endif case EVIOCGKEY(0): u = rnd(); rec->a2 = EVIOCGKEY(u); break; case EVIOCGLED(0): u = rnd(); rec->a2 = EVIOCGLED(u); break; case EVIOCGSND(0): u = rnd(); rec->a2 = EVIOCGSND(u); break; case EVIOCGSW(0): u = rnd(); rec->a2 = EVIOCGSW(u); break; case EVIOCGBIT(0,0): u = rnd(); r = rnd(); if (u % 10) u %= EV_CNT; if (r % 10) r /= 4; rec->a2 = EVIOCGBIT(u, r); break; case EVIOCGABS(0): u = rnd(); if (u % 10) u %= ABS_CNT; rec->a2 = EVIOCGABS(u); break; case EVIOCSABS(0): u = rnd(); if (u % 10) u %= ABS_CNT; rec->a2 = EVIOCSABS(u); break; default: break; } } static const struct ioctl_group input_grp = { .devtype = DEV_MISC, .devs = input_devs, .devs_cnt = ARRAY_SIZE(input_devs), .sanitise = input_sanitise, .ioctls = input_ioctls, .ioctls_cnt = ARRAY_SIZE(input_ioctls), }; REG_IOCTL_GROUP(input_grp) ioctls/ioctls.c000066400000000000000000000067351445305223700140340ustar00rootroot00000000000000/* trinity ioctl() support routines */ #include #include #include "files.h" #include "ioctls.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "utils.h" // ARRAY_SIZE #define IOCTL_GROUPS_MAX 48 static const struct ioctl_group *grps[IOCTL_GROUPS_MAX]; static int grps_cnt; void register_ioctl_group(const struct ioctl_group *grp) { /* group could be empty e.g. if everything is ifdeffed out */ if (grp->ioctls_cnt == 0) return; if (grps_cnt == ARRAY_SIZE(grps)) { outputerr("WARNING: please grow IOCTL_GROUPS_MAX.\n"); return; } grps[grps_cnt] = grp; ++grps_cnt; } static const struct ioctl_group * match_ioctl(int fd, struct stat *stbuf, int matchcount) { int i; retry: for (i = 0; i < grps_cnt; ++i) { if (grps[i]->fd_test) { if (grps[i]->fd_test(fd, stbuf) == 0) { /* if this is the only match, just do it. */ if (matchcount == 1) { return grps[i]; } else { if (RAND_BOOL()) return grps[i]; } } } } // If we get here we failed the RAND_BOOL too many times. goto retry; } const struct ioctl_group *find_ioctl_group(int fd) { const char *devname; struct stat stbuf; int i; size_t j; int matchcount = 0; if (fstat(fd, &stbuf) < 0) return NULL; /* Find out if >1 ioctl with an fd_test matches this fd type. */ for (i = 0; i < grps_cnt; ++i) { if (grps[i]->fd_test) { if (grps[i]->fd_test(fd, &stbuf) == 0) matchcount++; } } if (matchcount > 0) return match_ioctl(fd, &stbuf, matchcount); /* We don't have an fd_test, so try matching on type & devname */ for (i = 0; i < grps_cnt; ++i) { switch (grps[i]->devtype) { case DEV_MISC: /* fall through. misc devices are char devices. */ case DEV_CHAR: if (!S_ISCHR(stbuf.st_mode)) continue; break; case DEV_BLOCK: if (!S_ISBLK(stbuf.st_mode)) continue; break; default: break; } if (stbuf.st_rdev == 0) return NULL; devname = map_dev(stbuf.st_rdev, stbuf.st_mode); if (!devname) return NULL; for (j=0; j < grps[i]->devs_cnt; ++j) if (strcmp(devname, grps[i]->devs[j]) == 0) return grps[i]; } return NULL; } const struct ioctl_group *get_random_ioctl_group(void) { if (grps_cnt == 0) return NULL; return grps[rnd() % grps_cnt]; } static unsigned long random_ioctl_arg(void) { if (RAND_BOOL()) { return (unsigned long) rand64(); } else { void *page; page = get_writable_address(page_size); generate_random_page(page); return (unsigned long) page; } } void pick_random_ioctl(const struct ioctl_group *grp, struct syscallrecord *rec) { int ioctlnr; ioctlnr = rnd() % grp->ioctls_cnt; rec->a2 = grp->ioctls[ioctlnr].request; rec->a3 = random_ioctl_arg(); rec->a4 = random_ioctl_arg(); rec->a5 = random_ioctl_arg(); rec->a6 = random_ioctl_arg(); } void dump_ioctls(void) { int i; size_t j; for (i=0; i < grps_cnt; ++i) { if (grps[i]->name) outputerr("- %s:\n", grps[i]->name); else if (grps[i]->devtype) { if (grps[i]->devtype == DEV_MISC) outputerr("- misc devices"); else if (grps[i]->devtype == DEV_CHAR) outputerr("- char devices"); else if (grps[i]->devtype == DEV_BLOCK) outputerr("- block devices"); for (j=0; j < grps[i]->devs_cnt; ++j) outputerr("%s '%s'", j == 0 ? "" : ",", grps[i]->devs[j]); outputerr(":\n"); } else outputerr("- :\n"); for (j=0; j < grps[i]->ioctls_cnt; ++j) { outputerr(" - 0x%08x : %s\n", grps[i]->ioctls[j].request, grps[i]->ioctls[j].name ? : ""); } } } ioctls/kvm.c000066400000000000000000000064521445305223700133300ustar00rootroot00000000000000 #ifdef USE_KVM #include #include #include "compat.h" #include "ioctls.h" #include "utils.h" static const struct ioctl kvm_ioctls[] = { IOCTL(KVM_CREATE_VCPU), IOCTL(KVM_GET_DIRTY_LOG), IOCTL(KVM_SET_NR_MMU_PAGES), IOCTL(KVM_GET_NR_MMU_PAGES), IOCTL(KVM_SET_USER_MEMORY_REGION), IOCTL(KVM_SET_TSS_ADDR), IOCTL(KVM_SET_IDENTITY_MAP_ADDR), IOCTL(KVM_S390_UCAS_MAP), IOCTL(KVM_S390_UCAS_UNMAP), IOCTL(KVM_S390_VCPU_FAULT), IOCTL(KVM_CREATE_IRQCHIP), IOCTL(KVM_IRQ_LINE), IOCTL(KVM_GET_IRQCHIP), IOCTL(KVM_SET_IRQCHIP), IOCTL(KVM_CREATE_PIT), IOCTL(KVM_IRQ_LINE_STATUS), IOCTL(KVM_REGISTER_COALESCED_MMIO), IOCTL(KVM_UNREGISTER_COALESCED_MMIO), IOCTL(KVM_ASSIGN_PCI_DEVICE), IOCTL(KVM_ASSIGN_IRQ), IOCTL(KVM_ASSIGN_DEV_IRQ), IOCTL(KVM_REINJECT_CONTROL), IOCTL(KVM_DEASSIGN_PCI_DEVICE), IOCTL(KVM_ASSIGN_SET_MSIX_NR), IOCTL(KVM_ASSIGN_SET_MSIX_ENTRY), IOCTL(KVM_DEASSIGN_DEV_IRQ), IOCTL(KVM_IRQFD), IOCTL(KVM_CREATE_PIT2), IOCTL(KVM_SET_BOOT_CPU_ID), IOCTL(KVM_IOEVENTFD), IOCTL(KVM_SET_CLOCK), IOCTL(KVM_GET_CLOCK), IOCTL(KVM_PPC_GET_PVINFO), IOCTL(KVM_SET_TSC_KHZ), IOCTL(KVM_GET_TSC_KHZ), IOCTL(KVM_ASSIGN_SET_INTX_MASK), IOCTL(KVM_SIGNAL_MSI), #ifdef X86 IOCTL(KVM_SET_MEMORY_ALIAS), IOCTL(KVM_GET_PIT), IOCTL(KVM_SET_PIT), IOCTL(KVM_GET_PIT2), IOCTL(KVM_SET_PIT2), IOCTL(KVM_SET_GSI_ROUTING), IOCTL(KVM_XEN_HVM_CONFIG), IOCTL(KVM_GET_MSRS), IOCTL(KVM_SET_MSRS), IOCTL(KVM_SET_CPUID), IOCTL(KVM_GET_LAPIC), IOCTL(KVM_SET_LAPIC), IOCTL(KVM_SET_CPUID2), IOCTL(KVM_GET_CPUID2), IOCTL(KVM_X86_SET_MCE), IOCTL(KVM_GET_VCPU_EVENTS), IOCTL(KVM_SET_VCPU_EVENTS), IOCTL(KVM_GET_DEBUGREGS), IOCTL(KVM_SET_DEBUGREGS), IOCTL(KVM_GET_XSAVE), IOCTL(KVM_SET_XSAVE), IOCTL(KVM_GET_XCRS), IOCTL(KVM_SET_XCRS), #endif #if defined(__powerpc__) IOCTL(KVM_PPC_GET_SMMU_INFO), IOCTL(KVM_PPC_ALLOCATE_HTAB), #if defined(KVM_CREATE_SPAPR_TCE) IOCTL(KVM_CREATE_SPAPR_TCE), #endif #if defined(KVM_ALLOCATE_RMA) IOCTL(KVM_ALLOCATE_RMA), #endif IOCTL(KVM_PPC_GET_HTAB_FD), #endif #if defined(__arm__) || defined(__aarch64__) IOCTL(KVM_ARM_SET_DEVICE_ADDR), IOCTL(KVM_ARM_VCPU_INIT), #endif IOCTL(KVM_RUN), IOCTL(KVM_GET_REGS), IOCTL(KVM_SET_REGS), IOCTL(KVM_GET_SREGS), IOCTL(KVM_SET_SREGS), IOCTL(KVM_TRANSLATE), IOCTL(KVM_INTERRUPT), IOCTL(KVM_DEBUG_GUEST), IOCTL(KVM_SET_SIGNAL_MASK), IOCTL(KVM_GET_FPU), IOCTL(KVM_SET_FPU), IOCTL(KVM_TPR_ACCESS_REPORTING), IOCTL(KVM_SET_VAPIC_ADDR), #if defined(__s390__) IOCTL(KVM_S390_INTERRUPT), IOCTL(KVM_S390_STORE_STATUS), IOCTL(KVM_S390_SET_INITIAL_PSW), IOCTL(KVM_S390_INITIAL_RESET), #endif IOCTL(KVM_GET_MP_STATE), IOCTL(KVM_SET_MP_STATE), IOCTL(KVM_NMI), IOCTL(KVM_SET_GUEST_DEBUG), IOCTL(KVM_X86_SETUP_MCE), IOCTL(KVM_X86_GET_MCE_CAP_SUPPORTED), #if defined(KVM_IA64_VCPU_GET_STACK) IOCTL(KVM_IA64_VCPU_GET_STACK), IOCTL(KVM_IA64_VCPU_SET_STACK), #endif IOCTL(KVM_ENABLE_CAP), IOCTL(KVM_DIRTY_TLB), IOCTL(KVM_GET_ONE_REG), IOCTL(KVM_SET_ONE_REG), IOCTL(KVM_KVMCLOCK_CTRL), IOCTL(KVM_GET_REG_LIST), }; static const char *const kvm_devs[] = { "kvm", }; static const struct ioctl_group kvm_grp = { .devtype = DEV_MISC, .devs = kvm_devs, .devs_cnt = ARRAY_SIZE(kvm_devs), .sanitise = pick_random_ioctl, .ioctls = kvm_ioctls, .ioctls_cnt = ARRAY_SIZE(kvm_ioctls), }; REG_IOCTL_GROUP(kvm_grp) #endif /* USE_KVM */ ioctls/logger.c000066400000000000000000000050311445305223700140020ustar00rootroot00000000000000#include #include /* drivers/staging/android/logger.h */ /* include/linux/logger.h * * Copyright (C) 2007-2008 Google, Inc. * Author: Robert Love * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include #include /** * struct logger_entry - defines a single entry that is given to a logger * @len: The length of the payload * @__pad: Two bytes of padding that appear to be required * @pid: The generating process' process ID * @tid: The generating process' thread ID * @sec: The number of seconds that have elapsed since the Epoch * @nsec: The number of nanoseconds that have elapsed since @sec * @msg: The message that is to be logged */ struct logger_entry { __u16 len; __u16 __pad; __s32 pid; __s32 tid; __s32 sec; __s32 nsec; char msg[0]; }; #define LOGGER_LOG_RADIO "log_radio" /* radio-related messages */ #define LOGGER_LOG_EVENTS "log_events" /* system/hardware events */ #define LOGGER_LOG_SYSTEM "log_system" /* system/framework messages */ #define LOGGER_LOG_MAIN "log_main" /* everything else */ #define LOGGER_ENTRY_MAX_LEN (4*1024) #define LOGGER_ENTRY_MAX_PAYLOAD \ (LOGGER_ENTRY_MAX_LEN - sizeof(struct logger_entry)) #define __LOGGERIO 0xAE #define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */ #define LOGGER_GET_LOG_LEN _IO(__LOGGERIO, 2) /* used log len */ #define LOGGER_GET_NEXT_ENTRY_LEN _IO(__LOGGERIO, 3) /* next entry len */ #define LOGGER_FLUSH_LOG _IO(__LOGGERIO, 4) /* flush log */ #include "shm.h" #include "utils.h" #include "ioctls.h" static const struct ioctl logger_ioctls[] = { IOCTL(LOGGER_GET_LOG_BUF_SIZE), IOCTL(LOGGER_GET_LOG_LEN), IOCTL(LOGGER_GET_NEXT_ENTRY_LEN), IOCTL(LOGGER_FLUSH_LOG), }; static const char *const logger_miscdevs[] = { LOGGER_LOG_RADIO, LOGGER_LOG_EVENTS, LOGGER_LOG_SYSTEM, LOGGER_LOG_MAIN, }; static const struct ioctl_group logger_grp = { .devtype = DEV_MISC, .devs = logger_miscdevs, .devs_cnt = ARRAY_SIZE(logger_miscdevs), .sanitise = pick_random_ioctl, .ioctls = logger_ioctls, .ioctls_cnt = ARRAY_SIZE(logger_ioctls), }; REG_IOCTL_GROUP(logger_grp) ioctls/loop.c000066400000000000000000000023201445305223700134720ustar00rootroot00000000000000#include #include #include "utils.h" #include "ioctls.h" /* Intentionally mix the loop and loop-control ioctls. */ static const struct ioctl loop_ioctls[] = { IOCTL(LOOP_SET_FD), IOCTL(LOOP_CLR_FD), IOCTL(LOOP_SET_STATUS), IOCTL(LOOP_GET_STATUS), IOCTL(LOOP_SET_STATUS64), IOCTL(LOOP_GET_STATUS64), IOCTL(LOOP_CHANGE_FD), IOCTL(LOOP_SET_CAPACITY), #ifdef LOOP_CTL_ADD IOCTL(LOOP_CTL_ADD), #endif #ifdef LOOP_CTL_REMOVE IOCTL(LOOP_CTL_REMOVE), #endif #ifdef LOOP_CTL_GET_FREE IOCTL(LOOP_CTL_GET_FREE), #endif }; static const char *const loop_ctrl_devs[] = { "loop-control", //FIXME: Need to glob /dev/loop* }; static const struct ioctl_group loop_ctrl_grp = { .devtype = DEV_MISC, .devs = loop_ctrl_devs, .devs_cnt = ARRAY_SIZE(loop_ctrl_devs), .sanitise = pick_random_ioctl, .ioctls = loop_ioctls, .ioctls_cnt = ARRAY_SIZE(loop_ioctls), }; REG_IOCTL_GROUP(loop_ctrl_grp) static const char *const loop_devs[] = { "loop", }; static const struct ioctl_group loop_grp = { .devtype = DEV_BLOCK, .devs = loop_devs, .devs_cnt = ARRAY_SIZE(loop_devs), .sanitise = pick_random_ioctl, .ioctls = loop_ioctls, .ioctls_cnt = ARRAY_SIZE(loop_ioctls), }; REG_IOCTL_GROUP(loop_grp) ioctls/mce.c000066400000000000000000000011721445305223700132710ustar00rootroot00000000000000#include #include "utils.h" #include "ioctls.h" #define MCE_GET_RECORD_LEN _IOR('M', 1, int) #define MCE_GET_LOG_LEN _IOR('M', 2, int) #define MCE_GETCLEAR_FLAGS _IOR('M', 3, int) static const struct ioctl mce_ioctls[] = { IOCTL(MCE_GET_RECORD_LEN), IOCTL(MCE_GET_LOG_LEN), IOCTL(MCE_GETCLEAR_FLAGS), }; static const char *const mce_devs[] = { "mcelog", }; static const struct ioctl_group mce_grp = { .devtype = DEV_MISC, .devs = mce_devs, .devs_cnt = ARRAY_SIZE(mce_devs), .sanitise = pick_random_ioctl, .ioctls = mce_ioctls, .ioctls_cnt = ARRAY_SIZE(mce_ioctls), }; REG_IOCTL_GROUP(mce_grp) ioctls/msr.c000066400000000000000000000011561445305223700133300ustar00rootroot00000000000000#include #include #define X86_IOC_RDMSR_REGS _IOWR('c', 0xA0, __u32[8]) #define X86_IOC_WRMSR_REGS _IOWR('c', 0xA1, __u32[8]) #include "utils.h" #include "ioctls.h" static const struct ioctl msr_ioctls[] = { IOCTL(X86_IOC_RDMSR_REGS), //IOCTL(X86_IOC_WRMSR_REGS), // Too dangerous. }; static const char *const msr_devs[] = { "cpu/msr", }; static const struct ioctl_group msr_grp = { .devtype = DEV_CHAR, .devs = msr_devs, .devs_cnt = ARRAY_SIZE(msr_devs), .sanitise = pick_random_ioctl, .ioctls = msr_ioctls, .ioctls_cnt = ARRAY_SIZE(msr_ioctls), }; REG_IOCTL_GROUP(msr_grp) ioctls/mtd.c000066400000000000000000000017551445305223700133200ustar00rootroot00000000000000#include #include #include "ioctls.h" #include "utils.h" static const struct ioctl mtd_ioctls[] = { IOCTL(MEMGETINFO), IOCTL(MEMERASE), IOCTL(MEMWRITEOOB), IOCTL(MEMREADOOB), IOCTL(MEMLOCK), IOCTL(MEMUNLOCK), IOCTL(MEMGETREGIONCOUNT), IOCTL(MEMGETREGIONINFO), /* IOCTL(MEMSETOOBSEL), */ IOCTL(MEMGETOOBSEL), IOCTL(MEMGETBADBLOCK), IOCTL(MEMSETBADBLOCK), IOCTL(OTPSELECT), IOCTL(OTPGETREGIONCOUNT), IOCTL(OTPGETREGIONINFO), IOCTL(OTPLOCK), IOCTL(ECCGETLAYOUT), IOCTL(ECCGETSTATS), IOCTL(MTDFILEMODE), IOCTL(MEMERASE64), IOCTL(MEMWRITEOOB64), IOCTL(MEMREADOOB64), #ifdef MEMISLOCKED IOCTL(MEMISLOCKED), #endif #ifdef MEMWRITE IOCTL(MEMWRITE), #endif }; static const char *const mtd_devs[] = { "mtd", }; static const struct ioctl_group mtd_grp = { .devtype = DEV_MISC, .devs = mtd_devs, .devs_cnt = ARRAY_SIZE(mtd_devs), .sanitise = pick_random_ioctl, .ioctls = mtd_ioctls, .ioctls_cnt = ARRAY_SIZE(mtd_ioctls), }; REG_IOCTL_GROUP(mtd_grp) ioctls/nvme.c000066400000000000000000000016041445305223700134720ustar00rootroot00000000000000#ifdef USE_NVME #include #include #include "compat.h" #include "utils.h" #include "ioctls.h" static const struct ioctl nvme_ioctls[] = { IOCTL(NVME_IOCTL_ID), IOCTL(NVME_IOCTL_ADMIN_CMD), IOCTL(NVME_IOCTL_SUBMIT_IO), IOCTL(NVME_IOCTL_IO_CMD), IOCTL(NVME_IOCTL_RESET), }; static const char *const nvme_devs[] = { "nvme", }; static const struct ioctl_group nvme_grp_misc = { .devtype = DEV_CHAR, .devs = nvme_devs, .devs_cnt = ARRAY_SIZE(nvme_devs), .sanitise = pick_random_ioctl, .ioctls = nvme_ioctls, .ioctls_cnt = ARRAY_SIZE(nvme_ioctls), }; REG_IOCTL_GROUP(nvme_grp_misc) static const struct ioctl_group nvme_grp_block = { .devtype = DEV_BLOCK, .devs = nvme_devs, .devs_cnt = ARRAY_SIZE(nvme_devs), .sanitise = pick_random_ioctl, .ioctls = nvme_ioctls, .ioctls_cnt = ARRAY_SIZE(nvme_ioctls), }; REG_IOCTL_GROUP(nvme_grp_block); #endif ioctls/ozwpan.c000066400000000000000000000030571445305223700140470ustar00rootroot00000000000000#include #include #include "ioctls.h" #include "utils.h" /* drivers/staging/ozwpan/ozappif.h */ /* ----------------------------------------------------------------------------- * Copyright (c) 2011 Ozmo Inc * Released under the GNU General Public License Version 2 (GPLv2). * ----------------------------------------------------------------------------- */ #define OZ_IOCTL_MAGIC 0xf4 struct oz_mac_addr { __u8 a[6]; }; #define OZ_MAX_PDS 8 struct oz_pd_list { __u32 count; struct oz_mac_addr addr[OZ_MAX_PDS]; }; #define OZ_MAX_BINDING_LEN 32 struct oz_binding_info { char name[OZ_MAX_BINDING_LEN]; }; #define OZ_IOCTL_GET_PD_LIST _IOR(OZ_IOCTL_MAGIC, 0, struct oz_pd_list) #define OZ_IOCTL_SET_ACTIVE_PD _IOW(OZ_IOCTL_MAGIC, 1, struct oz_mac_addr) #define OZ_IOCTL_GET_ACTIVE_PD _IOR(OZ_IOCTL_MAGIC, 2, struct oz_mac_addr) #define OZ_IOCTL_ADD_BINDING _IOW(OZ_IOCTL_MAGIC, 3, struct oz_binding_info) #define OZ_IOCTL_REMOVE_BINDING _IOW(OZ_IOCTL_MAGIC, 4, struct oz_binding_info) #define OZ_IOCTL_MAX 5 static const struct ioctl ozwpan_ioctls[] = { IOCTL(OZ_IOCTL_GET_PD_LIST), IOCTL(OZ_IOCTL_SET_ACTIVE_PD), IOCTL(OZ_IOCTL_GET_ACTIVE_PD), IOCTL(OZ_IOCTL_ADD_BINDING), IOCTL(OZ_IOCTL_REMOVE_BINDING), }; static const char *const ozwpan_devs[] = { "ozwpan", }; static const struct ioctl_group ozwpan_grp = { .devtype = DEV_CHAR, .devs = ozwpan_devs, .devs_cnt = ARRAY_SIZE(ozwpan_devs), .sanitise = pick_random_ioctl, .ioctls = ozwpan_ioctls, .ioctls_cnt = ARRAY_SIZE(ozwpan_ioctls), }; REG_IOCTL_GROUP(ozwpan_grp) ioctls/random.c000066400000000000000000000010661445305223700140070ustar00rootroot00000000000000#include #include "utils.h" #include "ioctls.h" static const struct ioctl random_ioctls[] = { IOCTL(RNDGETENTCNT), IOCTL(RNDADDTOENTCNT), IOCTL(RNDGETPOOL), IOCTL(RNDADDENTROPY), IOCTL(RNDZAPENTCNT), IOCTL(RNDCLEARPOOL), }; static const char *const random_devs[] = { "mem", }; static const struct ioctl_group random_grp = { .devtype = DEV_CHAR, .devs = random_devs, .devs_cnt = ARRAY_SIZE(random_devs), .sanitise = pick_random_ioctl, .ioctls = random_ioctls, .ioctls_cnt = ARRAY_SIZE(random_ioctls), }; REG_IOCTL_GROUP(random_grp) ioctls/rfkill.c000066400000000000000000000007531445305223700140140ustar00rootroot00000000000000#include #include #include "ioctls.h" #include "utils.h" static const struct ioctl rfkill_ioctls[] = { IOCTL(RFKILL_IOCTL_NOINPUT), }; static const char *const rfkill_devs[] = { "rfkill", }; static const struct ioctl_group rfkill_grp = { .devtype = DEV_MISC, .devs = rfkill_devs, .devs_cnt = ARRAY_SIZE(rfkill_devs), .sanitise = pick_random_ioctl, .ioctls = rfkill_ioctls, .ioctls_cnt = ARRAY_SIZE(rfkill_ioctls), }; REG_IOCTL_GROUP(rfkill_grp) ioctls/rtc.c000066400000000000000000000016701445305223700133200ustar00rootroot00000000000000#include #include #include "ioctls.h" #include "utils.h" static const struct ioctl rtc_ioctls[] = { IOCTL(RTC_AIE_ON), IOCTL(RTC_AIE_OFF), IOCTL(RTC_UIE_ON), IOCTL(RTC_UIE_OFF), IOCTL(RTC_PIE_ON), IOCTL(RTC_PIE_OFF), IOCTL(RTC_WIE_ON), IOCTL(RTC_WIE_OFF), IOCTL(RTC_ALM_SET), IOCTL(RTC_ALM_READ), IOCTL(RTC_RD_TIME), IOCTL(RTC_SET_TIME), IOCTL(RTC_IRQP_READ), IOCTL(RTC_IRQP_SET), IOCTL(RTC_EPOCH_READ), IOCTL(RTC_EPOCH_SET), IOCTL(RTC_WKALM_SET), IOCTL(RTC_WKALM_RD), IOCTL(RTC_PLL_GET), IOCTL(RTC_PLL_SET), #ifdef RTC_VL_READ IOCTL(RTC_VL_READ), #endif #ifdef RTC_VL_CLR IOCTL(RTC_VL_CLR), #endif }; static const char *const rtc_devs[] = { "rtc", }; static const struct ioctl_group rtc_grp = { .devtype = DEV_CHAR, .devs = rtc_devs, .devs_cnt = ARRAY_SIZE(rtc_devs), .sanitise = pick_random_ioctl, .ioctls = rtc_ioctls, .ioctls_cnt = ARRAY_SIZE(rtc_ioctls), }; REG_IOCTL_GROUP(rtc_grp) ioctls/scsi.c000066400000000000000000000062301445305223700134660ustar00rootroot00000000000000#include #include #include #include #include #include #include "arch.h" // page_size #include "ioctls.h" #include "maps.h" #include "random.h" #include "sanitise.h" #include "shm.h" #include "utils.h" // ARRAY_SIZE #ifndef SCSI_IOCTL_GET_PCI #define SCSI_IOCTL_GET_PCI 0x5387 #endif #ifndef SG_GET_ACCESS_COUNT #define SG_GET_ACCESS_COUNT 0x2289 #endif static const struct ioctl scsi_ioctls[] = { IOCTL(SCSI_IOCTL_GET_IDLUN), IOCTL(SCSI_IOCTL_TAGGED_ENABLE), IOCTL(SCSI_IOCTL_TAGGED_DISABLE), IOCTL(SCSI_IOCTL_PROBE_HOST), IOCTL(SCSI_IOCTL_GET_BUS_NUMBER), IOCTL(SCSI_IOCTL_GET_PCI), IOCTL(SCSI_IOCTL_SEND_COMMAND), IOCTL(SCSI_IOCTL_TEST_UNIT_READY), IOCTL(SCSI_IOCTL_BENCHMARK_COMMAND), IOCTL(SCSI_IOCTL_SYNC), IOCTL(SCSI_IOCTL_START_UNIT), IOCTL(SCSI_IOCTL_STOP_UNIT), IOCTL(SCSI_IOCTL_DOORLOCK), IOCTL(SCSI_IOCTL_DOORUNLOCK), IOCTL(SG_EMULATED_HOST), IOCTL(SG_SET_TRANSFORM), IOCTL(SG_GET_TRANSFORM), IOCTL(SG_SET_RESERVED_SIZE), IOCTL(SG_GET_RESERVED_SIZE), IOCTL(SG_GET_SCSI_ID), IOCTL(SG_SET_FORCE_LOW_DMA), IOCTL(SG_GET_LOW_DMA), IOCTL(SG_SET_FORCE_PACK_ID), IOCTL(SG_GET_PACK_ID), IOCTL(SG_GET_NUM_WAITING), IOCTL(SG_GET_SG_TABLESIZE), IOCTL(SG_GET_VERSION_NUM), IOCTL(SG_SCSI_RESET), IOCTL(SG_IO), IOCTL(SG_GET_REQUEST_TABLE), IOCTL(SG_SET_KEEP_ORPHAN), IOCTL(SG_GET_KEEP_ORPHAN), IOCTL(SG_GET_ACCESS_COUNT), IOCTL(SG_SET_TIMEOUT), IOCTL(SG_GET_TIMEOUT), IOCTL(SG_GET_COMMAND_Q), IOCTL(SG_SET_COMMAND_Q), IOCTL(SG_SET_DEBUG), IOCTL(SG_NEXT_CMD_LEN), }; static const char *const scsi_devs[] = { "sd", "sr", }; struct sgio { sg_io_hdr_t ioh; unsigned char data[512]; unsigned char cmd[12]; unsigned char sense[252]; }; static void scsi_sg_io_sanitise(struct syscallrecord *rec) { struct sgio *sgio; sgio = (struct sgio *) get_address(); sgio->cmd[0] = 0x12; sgio->cmd[3] = 0x2; sgio->ioh.interface_id = 'S'; switch (rnd() % 4) { case 0: sgio->ioh.dxfer_direction = SG_DXFER_NONE; break; case 1: sgio->ioh.dxfer_direction = SG_DXFER_TO_DEV; break; case 2: sgio->ioh.dxfer_direction = SG_DXFER_FROM_DEV; break; case 3: sgio->ioh.dxfer_direction = SG_DXFER_TO_FROM_DEV; break; default: break; } sgio->ioh.dxferp = sgio->data; switch (rnd() % 3) { case 0: sgio->ioh.dxfer_len = rnd() % page_size; break; case 1: sgio->ioh.dxfer_len = (unsigned int) rand32(); break; case 2: sgio->ioh.dxfer_len = rnd() % 512; break; default: break; } sgio->ioh.cmdp = sgio->cmd; sgio->ioh.cmd_len = 6; sgio->ioh.mx_sb_len = sizeof(sgio->sense); sgio->ioh.sbp = sgio->sense; sgio->ioh.timeout = UINT_MAX; sgio->ioh.usr_ptr = NULL; sgio->ioh.flags |= SG_FLAG_DIRECT_IO; rec->a3 = (unsigned long) get_address(); } static void scsi_sanitise(const struct ioctl_group *grp, struct syscallrecord *rec) { pick_random_ioctl(grp, rec); switch (rec->a2) { case SG_IO: scsi_sg_io_sanitise(rec); break; default: break; } } static const struct ioctl_group scsi_grp = { .devtype = DEV_BLOCK, .devs = scsi_devs, .devs_cnt = ARRAY_SIZE(scsi_devs), .sanitise = scsi_sanitise, .ioctls = scsi_ioctls, .ioctls_cnt = ARRAY_SIZE(scsi_ioctls), }; REG_IOCTL_GROUP(scsi_grp) ioctls/sgx.c000066400000000000000000000054431445305223700133330ustar00rootroot00000000000000/* * ioctl fuzzing for Intel SGX kernel driver (isgx) * based on intel_sgx: Intel SGX Driver v0.10 * Feb 25, 2018 * Add support for SGXv2 * Feb 26, 2018 * root@davejingtian.org */ #include #include #include "ioctls.h" #include "utils.h" #define SGX_MAGIC 0xA4 #define SGX_IOC_ENCLAVE_CREATE \ _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create) #define SGX_IOC_ENCLAVE_ADD_PAGE \ _IOW(SGX_MAGIC, 0x01, struct sgx_enclave_add_page) #define SGX_IOC_ENCLAVE_INIT \ _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) /* SGXv2 */ #define SGX_IOC_ENCLAVE_EMODPR \ _IOW(SGX_MAGIC, 0x09, struct sgx_modification_param) #define SGX_IOC_ENCLAVE_MKTCS \ _IOW(SGX_MAGIC, 0x0a, struct sgx_range) #define SGX_IOC_ENCLAVE_TRIM \ _IOW(SGX_MAGIC, 0x0b, struct sgx_range) #define SGX_IOC_ENCLAVE_NOTIFY_ACCEPT \ _IOW(SGX_MAGIC, 0x0c, struct sgx_range) #define SGX_IOC_ENCLAVE_PAGE_REMOVE \ _IOW(SGX_MAGIC, 0x0d, unsigned long) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpacked" /** * struct sgx_enclave_create - parameter structure for the * %SGX_IOC_ENCLAVE_CREATE ioctl * @src: address for the SECS page data */ struct sgx_enclave_create { __u64 src; } __attribute__((__packed__)); /** * struct sgx_enclave_add_page - parameter structure for the * %SGX_IOC_ENCLAVE_ADD_PAGE ioctl * @addr: address in the ELRANGE * @src: address for the page data * @secinfo: address for the SECINFO data * @mrmask: bitmask for the 256 byte chunks that are to be measured */ struct sgx_enclave_add_page { __u64 addr; __u64 src; __u64 secinfo; __u16 mrmask; } __attribute__((__packed__)); /** * struct sgx_enclave_init - parameter structure for the * %SGX_IOC_ENCLAVE_INIT ioctl * @addr: address in the ELRANGE * @sigstruct: address for the page data * @einittoken: EINITTOKEN */ struct sgx_enclave_init { __u64 addr; __u64 sigstruct; __u64 einittoken; } __attribute__((__packed__)); /* SGXv2 */ struct sgx_range { unsigned long start_addr; unsigned int nr_pages; }; struct sgx_modification_param { struct sgx_range range; unsigned long flags; }; #pragma GCC diagnostic pop static const struct ioctl sgx_ioctls[] = { IOCTL(SGX_IOC_ENCLAVE_CREATE), IOCTL(SGX_IOC_ENCLAVE_ADD_PAGE), IOCTL(SGX_IOC_ENCLAVE_INIT), #ifdef SGXv2 IOCTL(SGX_IOC_ENCLAVE_EMODPR), IOCTL(SGX_IOC_ENCLAVE_MKTCS), IOCTL(SGX_IOC_ENCLAVE_TRIM), IOCTL(SGX_IOC_ENCLAVE_NOTIFY_ACCEPT), IOCTL(SGX_IOC_ENCLAVE_PAGE_REMOVE), #endif }; static const char *const sgx_devs[] = { "isgx", }; static const struct ioctl_group sgx_grp = { .devtype = DEV_CHAR, .devs = sgx_devs, .devs_cnt = ARRAY_SIZE(sgx_devs), .sanitise = pick_random_ioctl, .ioctls = sgx_ioctls, .ioctls_cnt = ARRAY_SIZE(sgx_ioctls), }; REG_IOCTL_GROUP(sgx_grp) ioctls/sisfb.c000066400000000000000000000015071445305223700136350ustar00rootroot00000000000000#include #include