summaryrefslogtreecommitdiff
path: root/sys/i386/linux/linux_sysvec.c
Commit message (Collapse)AuthorAgeFilesLines
* Linuxolator: Replace use of eventhandlers by sysent hooks.Konstantin Belousov2020-11-231-14/+6
| | | | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27309 Notes: svn path=/head/; revision=367960
* Fix misnomer - linux_to_bsd_errno() does the exact opposite.Edward Tomasz Napierala2020-10-271-1/+1
| | | | | | | | | | Reported by: arichardson MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26965 Notes: svn path=/head/; revision=367079
* Get rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead.Edward Tomasz Napierala2020-09-271-1/+0
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26458 Notes: svn path=/head/; revision=366205
* Get rid of sv_errtbl and SV_ABI_ERRNO().Edward Tomasz Napierala2020-09-171-5/+1
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26388 Notes: svn path=/head/; revision=365832
* Move SV_ABI_ERRNO translation into linux-specific code, to simplifyEdward Tomasz Napierala2020-09-151-2/+15
| | | | | | | | | | | | the syscall path and declutter it a bit. No functional changes intended. Reviewed by: kib (earlier version) MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26378 Notes: svn path=/head/; revision=365755
* i386: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365072
* 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
* Add compat.linux.emul_path, so it can be set to something otherEdward Tomasz Napierala2019-12-161-3/+3
| | | | | | | | | | | | | | than "/compat/linux". Useful when you have several compat directories with different Linux versions and you don't want to clash with files installed by linux-c7 packages. Reviewed by: bcr (manpages) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22574 Notes: svn path=/head/; revision=355818
* Copy out aux args after the argument and environment vectors.John Baldwin2019-12-091-8/+17
| | | | | | | | | | | | | | | | | | | | | | 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
* Use uintptr_t instead of register_t * for the stack base.John Baldwin2019-12-031-47/+57
| | | | | | | | | | | | | | | | | | | - 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
* Check for errors from copyout() and suword*() in sv_copyout_args/strings.John Baldwin2019-11-181-24/+44
| | | | | | | | | | 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
* Use a sv_copyout_auxargs hook in the Linux ELF ABIs.John Baldwin2019-11-151-19/+16
| | | | | | | | | | Reviewed by: emaste Tested on: amd64 (linux64 only), i386 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22356 Notes: svn path=/head/; revision=354754
* Make linux(4) create /dev/shm. Linux applications often expectEdward Tomasz Napierala2019-11-061-0/+2
| | | | | | | | | | | | | a tmpfs to be mounted there, and because they like to verify it's actually a mountpoint, a symlink won't do. Reviewed by: dchagin (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20333 Notes: svn path=/head/; revision=354413
* linux: futex_mtx should follow futex_listYuri Pankov2019-10-181-1/+0
| | | | | | | | | | | Move futex_mtx to linux_common.ko for amd64 and aarch64 along with respective list/mutex init/destroy. PR: 240989 Reported by: Alex S <iwtcex@gmail.com> Notes: svn path=/head/; revision=353725
* Linuxulator depends on a fundamental kernel settings such as SMP. ManyDmitry Chagin2019-05-131-49/+0
| | | | | | | | | | | | | | | | | | | | | | of them listed in opt_global.h which is not generated while building modules outside of a kernel and such modules never match real cofigured kernel. So, we should prevent our users from building obviously defective modules. Therefore, remove the root cause of the building of modules outside of a kernel - the possibility of building modules with DEBUG or KTR flags. And remove all of DEBUG printfs as it is incomplete and in threaded programms not informative, also a half of system call does not have DEBUG printf. For debuging Linux programms we have dtrace, ktr and ktrace ability. PR: 222861 Reviewed by: trasz MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20178 Notes: svn path=/head/; revision=347538
* Remove sv_pagesize, originally introduced with r100384.Edward Tomasz Napierala2019-03-011-2/+0
| | | | | | | | | | | | | | | | In all of the architectures we have today, we always use PAGE_SIZE. While in theory one could define different things, none of the current architectures do, even the ones that have transitioned from 32-bit to 64-bit like i386 and arm. Some ancient mips binaries on other systems used 8k instead of 4k, but we don't support running those and likely never will due to their age and obscurity. Reviewed by: imp (who also contributed the commit message) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D19280 Notes: svn path=/head/; revision=344705
* Remove iBCS2, part2: general kernelMateusz Guzik2018-12-191-2/+0
| | | | | | | | Reviewed by: kib (previous version) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=342243
* Fix the Linux kernel version number calculationChuck Tuffli2018-06-221-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux compatibility code was converting the version number (e.g. 2.6.32) in two different ways and then comparing the results. The linux_map_osrel() function converted MAJOR.MINOR.PATCH similar to what FreeBSD does natively. I.e. where major=v0, minor=v1, and patch=v2 v = v0 * 1000000 + v1 * 1000 + v2; The LINUX_KERNVER() macro, on the other hand, converted the value with bit shifts. I.e. where major=a, minor=b, and patch=c v = (((a) << 16) + ((b) << 8) + (c)) The Linux kernel uses the later format via the KERNEL_VERSION() macro in include/generated/uapi/linux/version.h Fix is to use the LINUX_KERNVER() macro in linux_map_osrel() as well as in the .trans_osrel functions. PR: 229209 Reviewed by: emaste, cem, imp (mentor) Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D15952 Notes: svn path=/head/; revision=335515
* Correct pointer subtraction in KASSERT().Brooks Davis2018-05-291-2/+1
| | | | | | | | | | | | The assertion would never fire without truly spectacular future programming errors. Reported by: Coverity CID: 1391370 Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=334348
* Avoid two suword() calls per auxarg entry.Brooks Davis2018-05-241-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Instead, construct an auxargs array and copy it out all at once. Use an array of Elf_Auxinfo rather than pairs of Elf_Addr * to represent the array. This is the correct type where pairs of words just happend to work. To reduce the size of the diff, AUXARGS_ENTRY is altered to act on this array rather than introducing a new macro. Return errors on copyout() and suword() failures and handle them in the caller. Incidentally fixes AT_RANDOM and AT_EXECFN in 32-bit linux on amd64 which incorrectly used AUXARG_ENTRY instead of AUXARGS_ENTRY_32 (now removed due to the use of proper types). Reviewed by: kib Comments from: emaste, jhb Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15485 Notes: svn path=/head/; revision=334165
* Simplify the code to allocate stack for auxv, argv[], and environment vectors.John Baldwin2018-04-191-19/+11
| | | | | | | | | | | | Remove auxarg_size as it was only used once right after a confusing assignment in each of the variants of exec_copyout_strings(). Reviewed by: emaste MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D15123 Notes: svn path=/head/; revision=332782
* linuxulator: deduplicate linux_exec_imgact_tryEd Maste2018-04-091-43/+0
| | | | | | | | | | | | Previously linuxulator had three identical copies of linux_exec_imgact_try. Deduplicate before adding another arch to linuxulator. Sponsored by: Turing Robotic Industries Inc Differential Revision: https://reviews.freebsd.org/D14856 Notes: svn path=/head/; revision=332333
* Remove very old and unused signal information codes.John Baldwin2018-03-271-0/+1
| | | | | | | | | | | | | These have been supplanted by the MI signal information codes in <sys/signal.h> since 7.0. The FPE_*_TRAP ones were deprecated even earlier in 1999. PR: 226579 (exp-run) Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D14637 Notes: svn path=/head/; revision=331650
* Remove redundant cast from Linuxulator SYSINITsEd Maste2018-03-231-2/+2
| | | | Notes: svn path=/head/; revision=331462
* Share Linux errno table with libsysdecodeEd Maste2018-03-221-2/+2
| | | | | | | | | Requested by: jhb Reviewed by: jhb Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=331356
* Rename linuxulator functions with linux_ prefixEd Maste2018-03-191-15/+15
| | | | | | | | | | It's preferable to have a consistent prefix. This also reduces differences between the three linux*_sysvec.c files. Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=331226
* linux*_sysvec.c: rationalize whitespace and commentsEd Maste2018-03-191-26/+26
| | | | | | | | | | | There's a fair amount of duplication between MD linuxulator files. Make indentation and comments consistent between the three versions of linux_sysvec.c to reduce diffs when comparing them. Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=331208
* Share a single bsd-linux errno table across MD consumersEd Maste2018-03-161-22/+2
| | | | | | | | | | | | | | | | | | | | Three copies of the linuxulator linux_sysvec.c contained identical BSD to Linux errno translation tables, and future work to support other architectures will also use the same table. Move the table to a common file to be used by all. Make it 'const int' to place it in .rodata. (Some existing Linux architectures use MD errno values, but x86 and Arm share the generic set.) This change should introduce no functional change; a followup will add missing errno values. MFC after: 3 weeks Sponsored by: Turing Robotic Industries Inc. Differential Revision: https://reviews.freebsd.org/D14665 Notes: svn path=/head/; revision=331056
* Remove stray ; at end of linux_vdso_deinstall()Ed Maste2018-03-141-1/+1
| | | | Notes: svn path=/head/; revision=330927
* Use C99 boolean type for translate_osrelEd Maste2018-03-131-4/+4
| | | | | | | | | | | | Migrate to modern types before creating MD Linuxolator bits for new architectures. Reviewed by: cem Sponsored by: Turing Robotic Industries Inc. Differential Revision: https://reviews.freebsd.org/D14676 Notes: svn path=/head/; revision=330866
* Apply some style(9) to Linuxulator linux_sysvec.c commentsEd Maste2018-03-131-75/+29
| | | | Notes: svn path=/head/; revision=330823
* Correct proper nouns in the LinuxulatorEd Maste2018-02-221-5/+5
| | | | | | | | | | | - Capitalize Linux - Spell FreeBSD out in full - Address some style(9) on changed lines Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=329794
* Rationalize license text on Linuxolator filesEd Maste2018-02-161-15/+13
| | | | | | | | | | | | | | | Many licenses on Linuxolator files contained small variations from the standard FreeBSD license text. To avoid license proliferation switch to the standard 2-clause FreeBSD license for those files where I have permission from each of the listed copyright holders. Additional files waiting on permission from others are listed in review D14210. Approved by: kan, marcel, sos, rdivacky MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=329370
* Linuxolator whitespace cleanupEd Maste2018-02-051-8/+6
| | | | | | | | | | | | | A version of each of the MD files by necessity exists for each CPU architecture supported by the Linuxolator. Clean these up so that new architectures do not inherit whitespace issues. Clean up shared Linuxolator files while here. Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=328890
* Remap ENOATTR to ENODATA in the linuxulator.Fedor Uporov2017-11-271-1/+1
| | | | | | | | | | | | | | In the linux ENOADATA is frequently #defined as ENOATTR. The change is required for an xattrs support implementation. MFC after: 1 week Discussed with: netchild Approved by: pfg Differential Revision: https://reviews.freebsd.org/D13221 Notes: svn path=/head/; revision=326282
* sys/i386: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326260
* Avoid using [LINUX_]SHAREDPAGE constant directly in the vdso code.Dmitry Chagin2017-07-301-1/+1
| | | | | | | | | This is needed for https://reviews.freebsd.org/D11780. Reported by: kib@ Notes: svn path=/head/; revision=321728
* Add support for musl consumers to the Linuxulator.Dmitry Chagin2017-07-031-0/+13
| | | | | | | | | | | PR: 213809 Submitted by: Yonas Yanfa Reported by: Yonas Yanfa MFC after: 1 week Relnotes: yes Notes: svn path=/head/; revision=320595
* Move struct syscall_args syscall arguments parameters container intoKonstantin Belousov2017-06-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | struct thread. For all architectures, the syscall trap handlers have to allocate the structure on the stack. The structure takes 88 bytes on 64bit arches which is not negligible. Also, it cannot be easily found by other code, which e.g. caused duplication of some members of the structure to struct thread already. The change removes td_dbg_sc_code and td_dbg_sc_nargs which were directly copied from syscall_args. The structure is put into the copied on fork part of the struct thread to make the syscall arguments information correct in the child after fork. This move will also allow several more uses shortly. Reviewed by: jhb (previous version) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks X-Differential revision: https://reviews.freebsd.org/D11080 Notes: svn path=/head/; revision=319873
* Cleanup redundant parenthesis from existing howmany()/roundup() macro uses.Pedro F. Giffuni2016-04-221-1/+1
| | | | Notes: svn path=/head/; revision=298482
* X86: use our nitems() macro when it is avaliable through param.h.Pedro F. Giffuni2016-04-191-1/+1
| | | | | | | | | No functional change, only trivial cases are done in this sweep, Discussed in: freebsd-current Notes: svn path=/head/; revision=298308
* Add kern.features flags for linux and linux64 modulesBaptiste Daroussin2016-04-051-0/+1
| | | | | | | | | | | | | | | | kern.features.linux: 1 meaning linux 32 bits binaries are supported kern.features.linux64: 1 meaning linux 64 bits binaries are supported The goal here is to help 3rd party applications (including ports) to determine if the host do support linux emulation Reviewed by: dchagin MFC after: 1 week Relnotes: yes Differential Revision: D5830 Notes: svn path=/head/; revision=297597
* Convert ss_sp in stack_t and sigstack to void *.John Baldwin2016-01-271-2/+2
| | | | | | | | | | | | | | | POSIX requires these members to be of type void * rather than the char * inherited from 4BSD. NetBSD and OpenBSD both changed their fields to void * back in 1998. No new build failures were reported via an exp-run. PR: 206503 (exp-run) Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D5092 Notes: svn path=/head/; revision=294930
* Implement AT_SECURE properly.Xin LI2016-01-271-1/+3
| | | | | | | | | | | | | | AT_SECURE auxv entry has been added to the Linux 2.5 kernel to pass a boolean flag indicating whether secure mode should be enabled. 1 means that the program has changes its credentials during the execution. Being exported AT_SECURE used by glibc issetugid() call. Submitted by: imp, dchagin Security: FreeBSD-SA-16:10.linux Security: CVE-2016-1883 Notes: svn path=/head/; revision=294900
* Implement vsyscall hack. Prior to 2.13 glibc uses vsyscallDmitry Chagin2016-01-091-0/+2
| | | | | | | | | | | | instead of vdso. An upcoming linux_base-c6 needs it. Differential Revision: https://reviews.freebsd.org/D1090 Reviewed by: kib, trasz MFC after: 1 week Notes: svn path=/head/; revision=293613
* Remove sv_prepsyscall, sv_sigsize and sv_sigtbl members of the structKonstantin Belousov2015-11-281-6/+0
| | | | | | | | | | | | | | | | | | | sysent. sv_prepsyscall is unused. sv_sigsize and sv_sigtbl translate signal number from the FreeBSD namespace into the ABI domain. It is only utilized on i386 for iBCS2 binaries. The issue with this approach is that signals for iBCS2 were delivered with the FreeBSD signal frame layout, which does not follow iBCS2. The same note is true for any other potential user if sv_sigtbl. In other words, if ABI needs signal number translation, it really needs custom sv_sendsig method instead. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=291420
* Fix missing semi-colon from r289055.Conrad Meyer2015-10-081-1/+1
| | | | | | | | Obtained from: mjg Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289058
* linux: fix handling of out-of-bounds syscall attemptsMateusz Guzik2015-10-081-1/+1
| | | | | | | | | | Due to an off by one the code would read an entry past the table, as opposed to the last entry which contains the nosys handler. Reported by: Pawel Biernacki <pawel.biernacki gmail.com> Notes: svn path=/head/; revision=289055
* Rework signal code to allow using it by other modules, like linprocfs:Dmitry Chagin2015-05-241-37/+12
| | | | | | | | | | | | | | | | | | | | 1. Linux sigset always 64 bit on all platforms. In order to move Linux sigset code to the linux_common module define it as 64 bit int. Move Linux sigset manipulation routines to the MI path. 2. Move Linux signal number definitions to the MI path. In general, they are the same on all platforms except for a few signals. 3. Map Linux RT signals to the FreeBSD RT signals and hide signal conversion tables to avoid conversion errors. 4. Emulate Linux SIGPWR signal via FreeBSD SIGRTMIN signal which is outside of allowed on Linux signal numbers. PR: 197216 Notes: svn path=/head/; revision=283474
* Call nosys in case when the incorrect syscall number is specified.Dmitry Chagin2015-05-241-1/+2
| | | | | | | Reported by: trinity Notes: svn path=/head/; revision=283467