summaryrefslogtreecommitdiffstats
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
* MFC r283924vangyzen2015-10-021-8/+4
| | | | | | | | | | | | | | | Provide vnode in memory map info for files on tmpfs When providing memory map information to userland, populate the vnode pointer for tmpfs files. Set the memory mapping to appear as a vnode type, to match FreeBSD 9 behavior. This fixes the use of tmpfs files with the dtrace pid provider, procstat -v, procfs, linprocfs, pmc (pmcstat), and ptrace (PT_VM_ENTRY). Submitted by: Eric Badger <eric@badgerio.us> (initial revision) Obtained from: Dell Inc. PR: 198431
* MFC 281266:jhb2015-06-021-26/+0
| | | | | | | | | | | | Move the 32-bit compatible procfs types from freebsd32.h to <sys/procfs.h> and export them to userland. - Define __HAVE_REG32 on platforms that define a reg32 structure and check for this in <sys/procfs.h> to control when to export prstatus32, etc. - Add prstatus32_t and prpsinfo32_t typedefs for the 32-bit structures. libbfd looks for these types, and having them fixes 'gcore' in gdb of a 32-bit process on a 64-bit platform. - Use the structure definitions from <sys/procfs.h> in gcore's elf32 core dump code instead of duplicating the definitions.
* Fix COMPAT_FREEBSD32 build on ia64. This is a direct commit tojhb2015-05-281-0/+2
| | | | stable/10 since ia64 is not present in head.
* MFC r282708:kib2015-05-242-0/+24
| | | | | On exec, single-threading must be enforced before arguments space is allocated from exec_map.
* Merge r263233 from HEAD to stable/10:rwatson2015-03-1911-11/+11
| | | | | | | | | Update kernel inclusions of capability.h to use capsicum.h instead; some further refinement is required as some device drivers intended to be portable over FreeBSD versions rely on __FreeBSD_version to decide whether to include capability.h. Sponsored by: Google, Inc.
* MFC 274817,274878,276801,276840,278976:jhb2015-02-231-2/+18
| | | | | | | | | | | | | | | | Improve support for XSAVE with debuggers. - Dump an NT_X86_XSTATE note if XSAVE is in use. This note is designed to match what Linux does in that 1) it dumps the entire XSAVE area including the fxsave state, and 2) it stashes a copy of the current xsave mask in the unused padding between the fxsave state and the xstate header at the same location used by Linux. - Teach readelf() to recognize NT_X86_XSTATE notes. - Change PT_GET/SETXSTATE to take the entire XSAVE state instead of only the extra portion. This avoids having to always make two ptrace() calls to get or set the full XSAVE state. - Add a PT_GET_XSTATE_INFO which returns the length of the current XSTATE save area (so the size of the buffer needed for PT_GETXSTATE) and the current XSAVE mask (%xcr0).
* MFC r277322:kib2015-01-251-0/+8
| | | | | Add procctl(2) PROC_TRACE_CTL command to enable or disable debugger attachment to the process.
* MFC r277211:kib2015-01-221-0/+3
| | | | | fcntl F_O{GET,SET}LK take pointer as the arg, handle them properly for compat32.
* Regen for r276955 (__getcwd path bug).dchagin2015-01-115-6/+6
|
* MFC r276564, r276654:dchagin2015-01-112-4/+4
| | | | | | | | | | | | | | | | Cast *path to silence clang -Wpointer-sign warning. Indeed, instead of hiding the kern___getcwd() bug by bogus cast in r276564, change path type to char * (pathnames are always char *). And remove bogus casts of malloc(). kern___getcwd() internally doesn't actually use or support u_char * paths, except to copy them to a normal char * path. These changes are not visible to libc as libc/gen/getcwd.c misdeclares __getcwd() as taking a plain char * path. While here remove _SYS_SYSPROTO_H_ for __getcwd() syscall as we always have sysproto.h.
* MFC r276550:dchagin2015-01-091-3/+0
| | | | Remove Giant from linux_getcwd() due to VFS is MPSAFE now.
* MFC r276512:dchagin2015-01-081-2/+3
| | | | Fix Clang -Wpointer-sign warnings.
* MFC r276511:dchagin2015-01-081-4/+5
| | | | | Fix Clang warning: passing 'unsigned int *' to parameter of type 'int *' converts between pointers to integer types with different sign.
* Merge reaper facility.kib2015-01-052-4/+53
| | | | | | | | | | | | | | | | | | | | | MFC r270443 (by mjg): Properly reparent traced processes when the tracer dies. MFC r273452 (by mjg): Plug unnecessary PRS_NEW check in kern_procctl. MFC 275800: Add a facility for non-init process to declare itself the reaper of the orphaned descendants. MFC r275821: Add missed break. MFC r275846 (by mckusick): Add some additional clarification and fix a few gammer nits. MFC r275847 (by bdrewery): Bump Dd for r275846.
* Regen for r275986 (ppoll).dchagin2014-12-215-5/+50
|
* MFC r274462: Add the ppoll() system call.dchagin2014-12-212-0/+31
|
* MFC r271982 and r271990 to support CentOS 6 ports.sbruno2014-12-151-2/+2
|
* Merge the fueword(9) and casueword(9). In particular,kib2014-11-181-3/+8
| | | | | | | | | | | | | | | | | | | | | | | MFC r273783: Add fueword(9) and casueword(9) functions. MFC note: ia64 is handled like arm, with NO_FUEWORD define. MFC r273784: Replace some calls to fuword() by fueword() with proper error checking. MFC r273785: Convert kern_umtx.c to use fueword() and casueword(). MFC note: the sys__umtx_lock and sys__umtx_unlock syscalls are not converted, they are removed from HEAD, and not used. The do_sem2*() family is not yet merged to stable/10, corresponding chunk will be merged after do_sem2* are committed. MFC r273788 (by jkim): Actually install casuword(9) to fix build. MFC r273911: Add type qualifier volatile to the base (userspace) address argument of fuword(9) and suword(9).
* MFC r263710, r273377, r273378, r273423 and r273455:hselasky2014-10-271-17/+26
| | | | | | | - De-vnet hash sizes and hash masks. - Fix multiple issues related to arguments passed to SYSCTL macros. Sponsored by: Mellanox Technologies
* MFC r272132:kib2014-09-281-2/+2
| | | | | | Fix fcntl(2) compat32 after r270691. Approved by: re (glebius)
* MFC r272059:mav2014-09-271-13/+2
| | | | | | | | Remake Linux' SOUND_MIXER_INFO IOCTL as a wrapper around new FreeBSD's one. Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> Approved by: re (kib)
* MFC r271743:bz2014-09-232-0/+279
| | | | | | | | | | | | | | | Implement most of timer_{create,settime,gettime,getoverrun,delete} for amd64/linux32. Fix the entirely bogus (untested) version from r161310 for i386/linux using the same shared code in compat/linux. It is unclear to me if we could support more clock mappings but the current set allows me to successfully run commercial 32bit linux software under linuxolator on amd64. Reviewed by: jhb Differential Revision: D784 Sponsored by: DARPA, AFRL Approved by: re (gjb)
* Regen.kib2014-09-035-13/+20
|
* MFC r270691:kib2014-09-032-1/+27
| | | | | Fix handling of the third argument for fcntl(2). The native syscall uses long for arg, which needs translation.
* MFC 264164: Convert while copying in control messages.marcel2014-08-031-32/+75
| | | | Obtained from: Juniper Networks, Inc.
* MFC r267051:mav2014-07-041-0/+3
| | | | | | - Add support for SG_GET_SG_TABLESIZE IOCTL to report that we don't support scatter/gather lists. - Return error for still unsupported SG 3.x API read/write calls.
* MFC r266981:mav2014-07-023-5/+196
| | | | | | | | | | | | | | | | Overhaul CAM SG driver IOCTL interfaces. Make it really work for native FreeBSD programs. Before this it was broken for years due to different number of pointer dereferences in Linux and FreeBSD IOCTL paths, permanently returning errors to FreeBSD programs. This change breaks the driver FreeBSD IOCTL ABI, making it more strict, but since it was not working any way -- who bother. Add shims for 32-bit programs on 64-bit host, translating the argument of the SG_IO IOCTL for both FreeBSD and Linux ABIs. With this change I was able to run 32-bit Linux sg3_utils tools and simple 32 and 64-bit FreeBSD test tools on both 32 and 64-bit FreeBSD systems.
* MFC r266924:dchagin2014-06-031-31/+40
| | | | | | | | | | | | | | | | | Glibc was switched to the FUTEX_WAIT_BITSET op and CLOCK_REALTIME flag has been added instead of FUTEX_WAIT to replace the FUTEX_WAIT logic which needs to do gettimeofday() calls before the futex syscall to convert the absolute timeout to a relative timeout. Before this the CLOCK_MONOTONIC used by the FUTEX_WAIT_BITSET op. When the FUTEX_CLOCK_REALTIME is specified the timeout is an absolute time, not a relative time. Rework futex_wait to handle this. On the side fix the futex leak in error case and remove useless parentheses. Properly calculate the timeout for the CLOCK_MONOTONIC case. Tested by: Hans Petter Selasky
* MFC r266782:dchagin2014-05-311-13/+16
| | | | | | | | | | | In r218101 I have not changed properly the futex syscall definition. Some Linux futex ops atomically verifies that the futex address uaddr (uval) contains the value val. Comparing signed uval and unsigned val may lead to an unexpected result, mostly to a deadlock. So copyin uaddr to an unsigned int to compare the parameters correctly. While here change ktr records to print parameters in more readable format.
* MFC r263349:kib2014-03-261-22/+27
| | | | Make the array pointed to by AT_PAGESIZES auxv properly aligned.
* MFC r263289: Update NetBSD Foundation copyrights to 2-clause BSDemaste2014-03-244-28/+0
| | | | | | | | | | | The NetBSD Foundation states "Third parties are encouraged to change the license on any files which have a 4-clause license contributed to the NetBSD Foundation to a 2-clause license." This change removes clauses 3 and 4 from copyright / license blocks that list The NetBSD Foundation as the only copyright holder. Sponsored by: The FreeBSD Foundation
* MFC r262539:eadler2014-03-131-0/+22
| | | | | | linprocfs: add support for /sys/kernel/random/uuid PR: kern/186187
* MFC r261080:kib2014-02-061-4/+7
| | | | | | | | | The posix_fallocate(2) syscall should return error number on error, without modifying errno. MFC r261290: The posix_madvise(3) and posix_fadvise(2) should return error on failure, same as posix_fallocate(2).
* MFC r258622: dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINEavg2014-01-171-6/+6
|
* MFC: r258718: fix emulated jail_v0 byte orderpeter2013-12-041-1/+1
| | | | Approved by: re (gjb)
* MFC r258661:kib2013-12-031-0/+6
| | | | | | | Add sysctl KERN_PROC_SIGTRAMP to retrieve signal trampoline location for the given process. Approved by: re (gjb)
* Add padding to match the compat32 struct stat32 definition to the realkib2013-10-041-0/+1
| | | | | | | | | struct stat on 32bit architectures. Debugged and tested by: bsam Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (marius)
* Fix some typos that were causing probe argument types to show up as unknown.markj2013-10-012-2/+2
| | | | | | Reviewed by: rwatson (mac provider) Approved by: re (glebius) MFC after: 1 week
* Regenerate syscall argument strings after r255777.markj2013-09-211-4/+4
| | | | | Approved by: re (gjb) MFC after: 1 week
* Regen.jhb2013-09-195-5/+143
| | | | Approved by: re (delphij)
* Extend the support for exempting processes from being killed when swap isjhb2013-09-193-0/+31
| | | | | | | | | | | | | | | | | | | | | | exhausted. - Add a new protect(1) command that can be used to set or revoke protection from arbitrary processes. Similar to ktrace it can apply a change to all existing descendants of a process as well as future descendants. - Add a new procctl(2) system call that provides a generic interface for control operations on processes (as opposed to the debugger-specific operations provided by ptrace(2)). procctl(2) uses a combination of idtype_t and an id to identify the set of processes on which to operate similar to wait6(). - Add a PROC_SPROTECT control operation to manage the protection status of a set of processes. MADV_PROTECT still works for backwards compatability. - Add a p_flag2 to struct proc (and a corresponding ki_flag2 to kinfo_proc) the first bit of which is used to track if P_PROTECT should be inherited by new child processes. Reviewed by: kib, jilles (earlier version) Approved by: re (delphij) MFC after: 1 month
* Revert r255672, it has some serious flaws, leaking file references etc.rdivacky2013-09-182-622/+0
| | | | Approved by: re (delphij)
* Implement epoll support in Linuxulator. This is a tiny wrapper around kqueuerdivacky2013-09-182-0/+622
| | | | | | | | | | | | | | to implement epoll subset of functionality. The kqueue user data are 32bit on i386 which is not enough for epoll user data so this patch overrides kqueue fileops to maintain enough space in struct file. Initial patch developed by me in 2007 and then extended and finished by Yuri Victorovich. Approved by: re (delphij) Sponsored by: Google Summer of Code Submitted by: Yuri Victorovich <yuri at rawbw dot com> Tested by: Yuri Victorovich <yuri at rawbw dot com>
* Regenerate for freebsd32_cap_enter().jilles2013-09-175-10/+16
| | | | Approved by: re (hrs)
* Disallow cap_enter() in freebsd32 compatibility mode.jilles2013-09-172-1/+21
| | | | | | | | | | | | | | | | | | | | | | The freebsd32 compatibility mode (for running 32-bit binaries on 64-bit kernels) does not currently allow any system calls in capability mode, but still permits cap_enter(). As a result, 32-bit binaries on 64-bit kernels that use capability mode do not work (they crash after being disallowed to call sys_exit()). Affected binaries include dhclient and uniq. The latter's crashes cause obscure build failures. This commit makes freebsd32 cap_enter() fail with [ENOSYS], as if capability mode was not compiled in. Applications deal with this by doing their work without capability mode. This commit does not fix the uncommon situation where a 64-bit process enters capability mode and then executes a 32-bit binary using fexecve(). This commit should be reverted when allowing the necessary freebsd32 system calls in capability mode. Reviewed by: pjd Approved by: re (hrs)
* Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a mapping usejhb2013-09-093-12/+11
| | | | | | | | | | | | | an address in the first 2GB of the process's address space. This flag should have the same semantics as the same flag on Linux. To facilitate this, add a new parameter to vm_map_find() that specifies an optional maximum virtual address. While here, fix several callers of vm_map_find() to use a VMFS_* constant for the findspace argument instead of TRUE and FALSE. Reviewed by: alc Approved by: re (kib)
* Regenerate after r255219.pjd2013-09-055-112/+34
| | | | Sponsored by: The FreeBSD Foundation
* Change the cap_rights_t type from uint64_t to a structure that we can extendpjd2013-09-0512-70/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the future in a backward compatible (API and ABI) way. The cap_rights_t represents capability rights. We used to use one bit to represent one right, but we are running out of spare bits. Currently the new structure provides place for 114 rights (so 50 more than the previous cap_rights_t), but it is possible to grow the structure to hold at least 285 rights, although we can make it even larger if 285 rights won't be enough. The structure definition looks like this: struct cap_rights { uint64_t cr_rights[CAP_RIGHTS_VERSION + 2]; }; The initial CAP_RIGHTS_VERSION is 0. The top two bits in the first element of the cr_rights[] array contain total number of elements in the array - 2. This means if those two bits are equal to 0, we have 2 array elements. The top two bits in all remaining array elements should be 0. The next five bits in all array elements contain array index. Only one bit is used and bit position in this five-bits range defines array index. This means there can be at most five array elements in the future. To define new right the CAPRIGHT() macro must be used. The macro takes two arguments - an array index and a bit to set, eg. #define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL) We still support aliases that combine few rights, but the rights have to belong to the same array element, eg: #define CAP_LOOKUP CAPRIGHT(0, 0x0000000000000400ULL) #define CAP_FCHMOD CAPRIGHT(0, 0x0000000000002000ULL) #define CAP_FCHMODAT (CAP_FCHMOD | CAP_LOOKUP) There is new API to manage the new cap_rights_t structure: cap_rights_t *cap_rights_init(cap_rights_t *rights, ...); void cap_rights_set(cap_rights_t *rights, ...); void cap_rights_clear(cap_rights_t *rights, ...); bool cap_rights_is_set(const cap_rights_t *rights, ...); bool cap_rights_is_valid(const cap_rights_t *rights); void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src); void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src); bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little); Capability rights to the cap_rights_init(), cap_rights_set(), cap_rights_clear() and cap_rights_is_set() functions are provided by separating them with commas, eg: cap_rights_t rights; cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT); There is no need to terminate the list of rights, as those functions are actually macros that take care of the termination, eg: #define cap_rights_set(rights, ...) \ __cap_rights_set((rights), __VA_ARGS__, 0ULL) void __cap_rights_set(cap_rights_t *rights, ...); Thanks to using one bit as an array index we can assert in those functions that there are no two rights belonging to different array elements provided together. For example this is illegal and will be detected, because CAP_LOOKUP belongs to element 0 and CAP_PDKILL to element 1: cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL); Providing several rights that belongs to the same array's element this way is correct, but is not advised. It should only be used for aliases definition. This commit also breaks compatibility with some existing Capsicum system calls, but I see no other way to do that. This should be fine as Capsicum is still experimental and this change is not going to 9.x. Sponsored by: The FreeBSD Foundation
* Add the ability to display the default FIB number for a process to thewill2013-08-261-0/+1
| | | | | | | | | | | | | | | | | | ps(1) utility, e.g. "ps -O fib". bin/ps/keyword.c: Add the "fib" keyword and default its column name to "FIB". bin/ps/ps.1: Add "fib" as a supported keyword. sys/compat/freebsd32/freebsd32.h: sys/kern/kern_proc.c: sys/sys/user.h: Add the default fib number for a process (p->p_fibnum) to the user land accessible process data of struct kinfo_proc. Submitted by: Oliver Fromme <olli@fromme.com>, gibbs
* Give (*ext_free) an int return value allowing for very sophisticatedandre2013-08-252-7/+7
| | | | | | | | external mbuf buffer management capabilities in the future. For now only EXT_FREE_OK is defined with current legacy behavior. Sponsored by: The FreeBSD Foundation
OpenPOWER on IntegriCloud