aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/freebsd32
Commit message (Collapse)AuthorAgeFilesLines
...
* regen syscall files after 0bd5d81f1edfEd Maste2021-05-202-791/+791
|
* Add ptrace(PT_COREDUMP)Konstantin Belousov2021-05-102-0/+19
| | | | (cherry picked from commit 87a64872cd3166a09b58aac28cdb95380d6a38eb)
* Convert remaining cap_rights_init users to cap_rights_init_oneMateusz Guzik2021-01-122-2/+2
| | | | | | | | | | | | | semantic patch: @@ expression rights, r; @@ - cap_rights_init(&rights, r) + cap_rights_init_one(&rights, r)
* Regenerate syscall files after reallocation of aio_writev/aio_readvAlan Somers2021-01-085-61/+65
|
* Reallocate syscall numbers for aio_writev and aio_readvAlan Somers2021-01-081-4/+6
| | | | | | | | | | The originally chosen numbers interfere with downstream projects' syscalls. Move them to the end of the syscall table instead. Reported by: jrtc27 Reviewed by: brooks MFC-With: 022ca2fc7fe08d51f33a1d23a9be49e6d132914e Differential Revision: 022ca2fc7fe08d51f33a1d23a9be49e6d132914e
* Regenerate syscall files after addition of aio_writev/aio_readvAlan Somers2021-01-035-4/+60
|
* Add aio_writev and aio_readvAlan Somers2021-01-033-3/+7
| | | | | | | | | | | | | | POSIX AIO is great, but it lacks vectored I/O functions. This commit fixes that shortcoming by adding aio_writev and aio_readv. They aren't part of the standard, but they're an obvious extension. They work just like their synchronous equivalents pwritev and preadv. It isn't yet possible to use vectored aiocbs with lio_listio, but that could be added in the future. Reviewed by: jhb, kib, bcr Relnotes: yes Differential Revision: https://reviews.freebsd.org/D27743
* Regen.Konstantin Belousov2020-12-274-1/+34
|
* Expose eventfd in the native API/ABI using a new __specialfd syscallKonstantin Belousov2020-12-271-0/+2
| | | | | | | | | | | | | | | | | | | | eventfd is a Linux system call that produces special file descriptors for event notification. When porting Linux software, it is currently usually emulated by epoll-shim on top of kqueues. Unfortunately, kqueues are not passable between processes. And, as noted by the author of epoll-shim, even if they were, the library state would also have to be passed somehow. This came up when debugging strange HW video decode failures in Firefox. A native implementation would avoid these problems and help with porting Linux software. Since we now already have an eventfd implementation in the kernel (for the Linuxulator), it's pretty easy to expose it natively, which is what this patch does. Submitted by: greg@unrelenting.technology Reviewed by: markj (previous version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26668
* Add ELF flag to disable ASLR stack gap.Konstantin Belousov2020-12-181-2/+1
| | | | | | | | | | | | Also centralize and unify checks to enable ASLR stack gap in a new helper exec_stackgap(). PR: 239873 Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=368772
* RegenKonstantin Belousov2020-12-045-9/+14
| | | | Notes: svn path=/head/; revision=368344
* Fix compat32 for ntp_adjtime(2).Konstantin Belousov2020-12-043-1/+88
| | | | | | | | | | | | | struct timex is not 32-bit safe, it uses longs for members. Provide translation. Reviewed by: brooks, cy Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27471 Notes: svn path=/head/; revision=368343
* freebsd32: take the _umtx_op struct definitions backKyle Evans2020-11-231-0/+21
| | | | | | | | | Providing these in freebsd32.h facilitates local testing/measuring of the structs rather than forcing one to locally recreate them. Sanity checking offsets/sizes remains in kern_umtx.c where these are typically used. Notes: svn path=/head/; revision=367943
* _umtx_op: move compat32 definitions back inKyle Evans2020-11-222-29/+0
| | | | | | | | These are reasonably compact, and a future commit will blur the compat32 lines by supporting 32-bit operations with the native _umtx_op. Notes: svn path=/head/; revision=367928
* umtx_op: reduce redundancy required for compat32Kyle Evans2020-11-172-0/+30
| | | | | | | | | | | | | | | | | | All of the compat32 variants are substantially the same, save for copyin/copyout (mostly). Apply the same kind of technique used with kevent here by having the syscall routines supply a umtx_copyops describing the operations needed. umtx_copyops carries the bare minimum needed- size of timespec and _umtx_time are used for determining if copyout is needed in the sem2_wait case. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27222 Notes: svn path=/head/; revision=367744
* audit: correct reporting of *execve(2) successKyle Evans2020-10-241-0/+2
| | | | | | | | | | | | | | | | | | | | | r326145 corrected do_execve() to return EJUSTRETURN upon success so that important registers are not clobbered. This had the side effect of tapping out 'failures' for all *execve(2) audit records, which is less than useful for auditing purposes. Audit exec returns earlier, where we can know for sure that EJUSTRETURN translates to success. Note that this unsets TDP_AUDITREC as we commit the audit record, so the usual audit in the syscall return path will do nothing. PR: 249179 Reported by: Eirik Oeverby <ltning-freebsd anduin net> Reviewed by: csjp, kib MFC after: 1 week Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26922 Notes: svn path=/head/; revision=367002
* Regen after r366145.Edward Tomasz Napierala2020-09-252-603/+609
| | | | | | | Sponsored by: DARPA Notes: svn path=/head/; revision=366147
* Do not leak oldvmspace if image activation failedKonstantin Belousov2020-09-231-2/+2
| | | | | | | | | | | | | | | | and current address space is already destroyed, so kern_execve() terminates the process. While there, clean up some internals of post_execve() inlined in init_main. Reported by: Peter <pmc@citylink.dinoex.sub.org> Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D26525 Notes: svn path=/head/; revision=366085
* compat: clean up empty lines in .c and .h filesMateusz Guzik2020-09-013-9/+0
| | | | Notes: svn path=/head/; revision=365080
* Fix a TOCTOU vulnerability in freebsd32_copyin_control().Mark Johnston2020-08-051-59/+71
| | | | | | | | | | | | PR: 248257 Reported by: m00nbsd working with Trend Micro Zero Day Initiative Reviewed by: kib Security: SA-20:23.sendmsg Security: CVE-2020-7460 Security: ZDI-CAN-11543 Notes: svn path=/head/; revision=363917
* Regenerate.Mark Johnston2020-07-061-2/+2
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=362971
* Refactor ptrace() ABI compatibility.John Baldwin2020-06-097-8/+228
| | | | | | | | | | | | | | | | Add a freebsd32_ptrace() and move as many freebsd32 shims as possible to freebsd32_ptrace(). Aside from register sets, freebsd32 passes pointers to native structures to kern_ptrace() and converts to/from native/32-bit structure formats in freebsd32_ptrace() outside of kern_ptrace(). Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25195 Notes: svn path=/head/; revision=361975
* Update the files created from the new syscalls.master from r361599.Rick Macklem2020-05-284-1/+30
| | | | | | | | Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D24949 Notes: svn path=/head/; revision=361602
* Add a syscall for the nfs-over-tls daemons to use.Rick Macklem2020-05-281-0/+3
| | | | | | | | | | | | | | The nfs-over-tls daemons need a system call to perform operations such as associate a file descriptor with a krpc socket. The daemons will not be in head for some time, but it will make it easier for testers of nfs-over-tls to do testing if the system call is in head (basically the stub for libc which will be commited soon). Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D24949 Notes: svn path=/head/; revision=361599
* sysent: re-roll after 360236 (AUE_CLOSERANGE used)Kyle Evans2020-04-241-1/+1
| | | | Notes: svn path=/head/; revision=360237
* close_range(2): use newly assigned AUE_CLOSERANGEKyle Evans2020-04-241-1/+1
| | | | Notes: svn path=/head/; revision=360236
* Convert canary, execpathp, and pagesizes to pointers.Brooks Davis2020-04-161-6/+6
| | | | | | | | | | | | | Use AUXARGS_ENTRY_PTR to export these pointers. This is a followup to r359987 and r359988. Reviewed by: jhb Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24446 Notes: svn path=/head/; revision=360024
* Export argc, argv, envc, envv, and ps_strings in auxargs.Brooks Davis2020-04-151-0/+2
| | | | | | | | | | | | | | | | | This simplifies discovery of these values, potentially with reducing the number of syscalls we need to make at runtime. Longer term, we wish to convert the startup process to pass an auxargs pointer to _start() and use that rather than walking off the end of envv. This is cleaner, more C-friendly, and for systems with strong bounds (e.g. CHERI) necessary. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24407 Notes: svn path=/head/; revision=359988
* Make ps_strings in struct image_params into a pointer.Brooks Davis2020-04-151-0/+1
| | | | | | | | | | | This is a prepratory commit for D24407. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA Notes: svn path=/head/; revision=359987
* Remove bogus use of useracc() in (clock_)nanosleep.Brooks Davis2020-04-141-7/+2
| | | | | | | | | | | | | | | There's no point in pre-checking that we can access the user's rmtp pointer before we do it in copyout(). While here, improve style(9) compliance. Reviewed by: imp MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24409 Notes: svn path=/head/; revision=359938
* Centralize compatability translation macros.Brooks Davis2020-04-141-25/+1
| | | | | | | | | | | | | | | | Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h and replace existing definitation with includes where required. This eliminates duplicate code and allows Linux and FreeBSD compatability headers to be included in the same files. Input from: cem, jhb Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24275 Notes: svn path=/head/; revision=359937
* sysent: re-roll after r359930Kyle Evans2020-04-144-25/+3
| | | | Notes: svn path=/head/; revision=359931
* Mark closefrom(2) COMPAT12, reimplement in libc to wrap close_rangeKyle Evans2020-04-141-1/+1
| | | | | | | | | | | Include a temporarily compatibility shim as well for kernels predating close_range, since closefrom is used in some critical areas. Reviewed by: markj (previous version), kib Differential Revision: https://reviews.freebsd.org/D24399 Notes: svn path=/head/; revision=359930
* sysent: re-roll after introduction of close_range in r359836Kyle Evans2020-04-124-1/+34
| | | | Notes: svn path=/head/; revision=359837
* Implement a close_range(2) syscallKyle Evans2020-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | close_range(min, max, flags) allows for a range of descriptors to be closed. The Python folk have indicated that they would much prefer this interface to closefrom(2), as the case may be that they/someone have special fds dup'd to higher in the range and they can't necessarily closefrom(min) because they don't want to hit the upper range, but relocating them to lower isn't necessarily feasible. sys_closefrom has been rewritten to use kern_close_range() using ~0U to indicate closing to the end of the range. This was chosen rather than requiring callers of kern_close_range() to hold FILEDESC_SLOCK across the call to kern_close_range for simplicity. The flags argument of close_range(2) is currently unused, so any flags set is currently EINVAL. It was added to the interface in Linux so that future flags could be added for, e.g., "halt on first error" and things of this nature. This patch is based on a syscall of the same design that is expected to be merged into Linux. Reviewed by: kib, markj, vangyzen (all slightly earlier revisions) Differential Revision: https://reviews.freebsd.org/D21627 Notes: svn path=/head/; revision=359836
* make sysent for r358172 ("vfs: add realpathat syscall")Mateusz Guzik2020-02-204-1/+42
| | | | Notes: svn path=/head/; revision=358173
* vfs: add realpathat syscallMateusz Guzik2020-02-201-0/+2
| | | | | | | | | | | | | | | | | | realpath(3) is used a lot e.g., by clang and is a major source of getcwd and fstatat calls. This can be done more efficiently in the kernel. This works by performing a regular lookup while saving the name and found parent directory. If the terminal vnode is a directory we can resolve it using usual means. Otherwise we can use the name saved by lookup and resolve the parent. See the review for sample syscall counts. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23574 Notes: svn path=/head/; revision=358172
* regen sysent after r357831, r357838Ed Maste2020-02-121-2/+2
| | | | | | | | | Capability mode changes allowing fdatasync and getloginclass. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=357839
* Regen.Konstantin Belousov2020-02-094-1/+30
| | | | Notes: svn path=/head/; revision=357694
* Add a way to manage thread signal mask using shared word, instead of syscall.Konstantin Belousov2020-02-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new syscall sigfastblock(2) is added which registers a uint32_t variable as containing the count of blocks for signal delivery. Its content is read by kernel on each syscall entry and on AST processing, non-zero count of blocks is interpreted same as the signal mask blocking all signals. The biggest downside of the feature that I see is that memory corruption that affects the registered fast sigblock location, would cause quite strange application misbehavior. For instance, the process would be immune to ^C (but killable by SIGKILL). With consumers (rtld and libthr added), benchmarks do not show a slow-down of the syscalls in micro-measurements, and macro benchmarks like buildworld do not demonstrate a difference. Part of the reason is that buildworld time is dominated by compiler, and clang already links to libthr. On the other hand, small utilities typically used by shell scripts have the total number of syscalls cut by half. The syscall is not exported from the stable libc version namespace on purpose. It is intended to be used only by our C runtime implementation internals. Tested by: pho Disscussed with: cem, emaste, jilles Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D12773 Notes: svn path=/head/; revision=357693
* sysent targets: further cleanup and deduplicationKyle Evans2020-01-181-24/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | r355473 vastly improved the readability and cleanliness of these Makefiles. Every single one of them follows the same pattern and duplicates the exact same logic. Now that we have GENERATED/SRCS, split SRCS up into the two parameters we'll use for ${MAKESYSCALLS} rather than assuming a specific ordering of SRCS and include a common sysent.mk to handle the rest. This makes it less tedious to make sweeping changes. Some default values are provided for GENERATED/SYSENT_*; almost all of these just use a 'syscalls.master' and 'syscalls.conf' in cwd, and they all use effectively the same filenames with an arbitrary prefix. Most ABIs will be able to get away with just setting GENERATED_PREFIX and including ^/sys/conf/sysent.mk, while others only need light additions. kern/Makefile is the notable exception, as it doesn't take a SYSENT_CONF and the generated files are spread out between ^/sys/kern and ^/sys/sys, but it otherwise fits the pattern enough to use the common version. Reviewed by: brooks, imp Nice!: emaste Differential Revision: https://reviews.freebsd.org/D23197 Notes: svn path=/head/; revision=356868
* Set .ORDER for makesyscalls generated filesKyle Evans2020-01-101-0/+3
| | | | | | | | | | | | | | | | | | | | When either makesyscalls.lua or syscalls.master changes, all of the ${GENERATED} targets are now out-of-date. With make jobs > 1, this means we will run the makesyscalls script in parallel for the same ABI, generating the same set of output files. Prior to r356603 , there is a large window for interlacing output for some of the generated files that we were generating in-place rather than staging in a temp dir. After that, we still should't need to run the script more than once per-ABI as the first invocation should update all of them. Add .ORDER to do so cleanly. Reviewed by: brooks Discussed with: sjg Differential Revision: https://reviews.freebsd.org/D23099 Notes: svn path=/head/; revision=356604
* Copy out aux args after the argument and environment vectors.John Baldwin2019-12-091-3/+14
| | | | | | | | | | | | | | | | | | | | | | Partially revert r354741 and r354754 and go back to allocating a fixed-size chunk of stack space for the auxiliary vector. Keep sv_copyout_auxargs but change it to accept the address at the end of the environment vector as an input stack address and no longer allocate room on the stack. It is now called at the end of copyout_strings after the argv and environment vectors have been copied out. This should fix a regression in r354754 that broke the stack alignment for newer Linux amd64 binaries (and probably broke Linux arm64 as well). Reviewed by: kib Tested on: amd64 (native, linux64 (only linux-base-c7), and i386) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22695 Notes: svn path=/head/; revision=355567
* sysent: Reduce duplication and improve readability.Brooks Davis2019-12-061-8/+13
| | | | | | | | | | | | | Use the power of variable to avoid spelling out source and generated files too many times. The previous Makefiles were hard to read, hard to edit, and badly formatted. Reviewed by: kevans, emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22714 Notes: svn path=/head/; revision=355473
* Use uintptr_t instead of register_t * for the stack base.John Baldwin2019-12-032-15/+19
| | | | | | | | | | | | | | | | | | | - Use ustringp for the location of the argv and environment strings and allow destp to travel further down the stack for the stackgap and auxv regions. - Update the Linux copyout_strings variants to move destp down the stack as was done for the native ABIs in r263349. - Stop allocating a space for a stack gap in the Linux ABIs. This used to hold translated system call arguments, but hasn't been used since r159992. Reviewed by: kib Tested on: md64 (amd64, i386, linux64), i386 (i386, linux) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22501 Notes: svn path=/head/; revision=355373
* sysent: regenerate after r354835Kyle Evans2019-11-182-7/+7
| | | | | | | | | The lua-based makesyscalls produces slightly different output than its makesyscalls.sh predecessor, all whitespace differences more closely matching the source syscalls.master. Notes: svn path=/head/; revision=354836
* Convert in-tree sysent targets to use new makesyscalls.luaKyle Evans2019-11-181-2/+4
| | | | | | | | | | | | flua is bootstrapped as part of the build for those on older versions/revisions that don't yet have flua installed. Once upgraded past r354833, "make sysent" will again naturally work as expected. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D21894 Notes: svn path=/head/; revision=354835
* Check for errors from copyout() and suword*() in sv_copyout_args/strings.John Baldwin2019-11-182-22/+43
| | | | | | | | | | Reviewed by: brooks, kib Tested on: amd64 (amd64, i386, linux64), i386 (i386, linux) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22401 Notes: svn path=/head/; revision=354827
* Jail and capability mode for shm_rename; add audit support for shm_renameDavid Bright2019-11-182-2/+2
| | | | | | | | | | | | | | | | | | | | | | Co-mingling two things here: * Addressing some feedback from Konstantin and Kyle re: jail, capability mode, and a few other things * Adding audit support as promised. The audit support change includes a partial refresh of OpenBSM from upstream, where the change to add shm_rename has already been accepted. Matthew doesn't plan to work on refreshing anything else to support audit for those new event types. Submitted by: Matthew Bryan <matthew.bryan@isilon.com> Reviewed by: kib Relnotes: Yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22083 Notes: svn path=/head/; revision=354808
* Add a sv_copyout_auxargs() hook in sysentvec.John Baldwin2019-11-151-8/+2
| | | | | | | | | | | | | | | | | | Change the FreeBSD ELF ABIs to use this new hook to copyout ELF auxv instead of doing it in the sv_fixup hook. In particular, this new hook allows the stack space to be allocated at the same time the auxv values are copied out to userland. This allows us to avoid wasting space for unused auxv entries as well as not having to recalculate where the auxv vector is by walking back up over the argv and environment vectors. Reviewed by: brooks, emaste Tested on: amd64 (amd64 and i386 binaries), i386, mips, mips64 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22355 Notes: svn path=/head/; revision=354741