aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/linux
Commit message (Collapse)AuthorAgeFilesLines
* Regen.Roman Divacky2013-09-185-94/+16
| | | | | | | Approved by: re (delphij) Notes: svn path=/head/; revision=255676
* Revert r255672, it has some serious flaws, leaking file references etc.Roman Divacky2013-09-182-6/+8
| | | | | | | Approved by: re (delphij) Notes: svn path=/head/; revision=255675
* Regen.Roman Divacky2013-09-185-16/+95
| | | | | | | Approved by: re (delphij) Notes: svn path=/head/; revision=255673
* Implement epoll support in Linuxulator. This is a tiny wrapper around kqueueRoman Divacky2013-09-182-8/+6
| | | | | | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=255672
* Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a mapping useJohn Baldwin2013-09-091-3/+3
| | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=255426
* Change the cap_rights_t type from uint64_t to a structure that we can extendPawel Jakub Dawidek2013-09-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=255219
* Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.hJohn Baldwin2013-01-293-160/+2
| | | | | | | | | | by moving bits that are MI out into headers in compat/linux. Reviewed by: Chagin Dmitry dmitry | gmail MFC after: 2 weeks Notes: svn path=/head/; revision=246085
* Don't assume that all Linux TCP-level socket options are identical toJohn Baldwin2013-01-231-0/+7
| | | | | | | | | | | FreeBSD TCP-level socket options (only the first two are). Instead, using a mapping function and fail unsupported options as we do for other socket option levels. MFC after: 2 weeks Notes: svn path=/head/; revision=245849
* Revert previous commit...Kevin Lo2012-10-101-1/+1
| | | | | | | Pointyhat to: kevlo (myself) Notes: svn path=/head/; revision=241394
* Prefer NULL over 0 for pointersKevin Lo2012-10-091-1/+1
| | | | Notes: svn path=/head/; revision=241370
* Regen.John Baldwin2012-07-305-7/+7
| | | | Notes: svn path=/head/; revision=238918
* The linux_lstat() system call accepts a pointer to a 'struct l_stat', not aJohn Baldwin2012-07-301-1/+1
| | | | | | | 'struct ostat'. Notes: svn path=/head/; revision=238917
* - >500 static DTrace probes for the linuxulatorAlexander Leidinger2012-05-052-0/+10
| | | | | | | | | | | | | | | | | | | | | - DTrace scripts to check for errors, performance, ... they serve mostly as examples of what you can do with the static probe;s with moderate load the scripts may be overwhelmed, excessive lock-tracing may influence program behavior (see the last design decission) Design decissions: - use "linuxulator" as the provider for the native bitsize; add the bitsize for the non-native emulation (e.g. "linuxuator32" on amd64) - Add probes only for locks which are acquired in one function and released in another function. Locks which are aquired and released in the same function should be easy to pair in the code, inter-function locking is more easy to verify in DTrace. - Probes for locks should be fired after locking and before releasing to prevent races (to provide data/function stability in DTrace, see the man-page of "dtrace -v ..." and the corresponding DTrace docs). Notes: svn path=/head/; revision=235063
* Regen for r234359.Jung-uk Kim2012-04-165-7/+7
| | | | Notes: svn path=/head/; revision=234360
* Correct an argument type of iopl syscall for Linuxulator. This also fixesJung-uk Kim2012-04-161-1/+1
| | | | | | | a warning from Clang, i. e., "args->level < 0 is always false". Notes: svn path=/head/; revision=234359
* Regen for r234357.Jung-uk Kim2012-04-165-31/+16
| | | | Notes: svn path=/head/; revision=234358
* Correct arguments of stat64, fstat64 and lstat64 syscalls for Linuxulator.Jung-uk Kim2012-04-161-6/+6
| | | | Notes: svn path=/head/; revision=234357
* Regen for r234352.Jung-uk Kim2012-04-165-10/+27
| | | | Notes: svn path=/head/; revision=234354
* - Implement pipe2 syscall for Linuxulator. This syscall appeared in 2.6.27Jung-uk Kim2012-04-163-22/+2
| | | | | | | | | | | | | but GNU libc used it without checking its kernel version, e. g., Fedora 10. - Move pipe(2) implementation for Linuxulator from MD files to MI file, sys/compat/linux/linux_file.c. There is no MD code for this syscall at all. - Correct an argument type for pipe() from l_ulong * to l_int *. Probably this was the source of MI/MD confusion. Reviewed by: emulation Notes: svn path=/head/; revision=234352
* regenAlexander Leidinger2012-03-105-7/+583
| | | | Notes: svn path=/head/; revision=232800
* - add comments to syscalls.master and linux(32)_dummy about which linuxAlexander Leidinger2012-03-102-1/+102
| | | | | | | | | | | | | kernel version introduced the sysctl (based upon a linux man-page) - add comments to sscalls.master regarding some names of sysctls which are different than the linux-names (based upon the linux unistd.h) - add some dummy sysctls - name an unimplemented sysctl MFC after: 1 month Notes: svn path=/head/; revision=232799
* Do not write to the user address directly, use suword().Konstantin Belousov2012-02-251-4/+4
| | | | | | | | Reported by: Bengt Ahlgren <bengta sics se> MFC after: 1 week Notes: svn path=/head/; revision=232143
* Fix misuse of the kernel map in miscellaneous image activators.Konstantin Belousov2012-02-171-16/+10
| | | | | | | | | | | | | | | | | | | | | | Vnode-backed mappings cannot be put into the kernel map, since it is a system map. Use exec_map for transient mappings, and remove the mappings with kmem_free_wakeup() to notify the waiters on available map space. Do not map the whole executable into KVA at all to copy it out into usermode. Directly use vn_rdwr() for the case of not page aligned binary. There is one place left where the potentially unbounded amount of data is mapped into exec_map, namely, in the COFF image activator enumeration of the needed shared libraries. Reviewed by: alc MFC after: 2 weeks Notes: svn path=/head/; revision=231885
* Convert files to UTF-8Ulrich Spörlein2012-01-154-4/+4
| | | | Notes: svn path=/head/; revision=230132
* Regen.John Baldwin2011-12-295-10/+64
| | | | Notes: svn path=/head/; revision=228958
* Implement linux_fadvise64() and linux_fadvise64_64() usingJohn Baldwin2011-12-293-4/+15
| | | | | | | | | | kern_posix_fadvise(). Reviewed by: silence on emulation@ MFC after: 2 weeks Notes: svn path=/head/; revision=228957
* - Add the ffclock_getcounter(), ffclock_getestimate() and ffclock_setestimate()Lawrence Stewart2011-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | system calls to provide feed-forward clock management capabilities to userspace processes. ffclock_getcounter() returns the current value of the kernel's feed-forward clock counter. ffclock_getestimate() returns the current feed-forward clock parameter estimates and ffclock_setestimate() updates the feed-forward clock parameter estimates. - Document the syscalls in the ffclock.2 man page. - Regenerate the script-derived syscall related files. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au) Notes: svn path=/head/; revision=227776
* Regenerate system call tables.Ed Schouten2011-11-195-7/+12
| | | | Notes: svn path=/head/; revision=227694
* Make the Linux *at() calls a bit more complete.Ed Schouten2011-11-191-2/+2
| | | | | | | | | | Properly support: - AT_EACCESS for faccessat(), - AT_SYMLINK_FOLLOW for linkat(). Notes: svn path=/head/; revision=227693
* Regenerate system call tables.Ed Schouten2011-11-195-8/+8
| | | | Notes: svn path=/head/; revision=227692
* Improve *access*() parameter name consistency.Ed Schouten2011-11-191-2/+2
| | | | | | | | | | | | The current code mixes the use of `flags' and `mode'. This is a bit confusing, since the faccessat() function as a `flag' parameter to store the AT_ flag. Make this less confusing by using the same name as used in the POSIX specification -- `amode'. Notes: svn path=/head/; revision=227691
* Correct the types of the arguments to return probes of the syscallRyan Stone2011-11-111-1/+1228
| | | | | | | | | | | provider. Previously we were erroneously supplying the argument types of the corresponding entry probe. Reviewed by: rpaulo MFC after: 1 week Notes: svn path=/head/; revision=227441
* Auto-generated code from sys_ prefixing makesyscalls.sh changeKip Macy2011-09-161-48/+48
| | | | | | | Approved by: re(bz) Notes: svn path=/head/; revision=225618
* In order to maximize the re-usability of kernel code in user space thisKip Macy2011-09-161-14/+14
| | | | | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz) Notes: svn path=/head/; revision=225617
* Second-to-last commit implementing Capsicum capabilities in the FreeBSDRobert Watson2011-08-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kernel for FreeBSD 9.0: Add a new capability mask argument to fget(9) and friends, allowing system call code to declare what capabilities are required when an integer file descriptor is converted into an in-kernel struct file *. With options CAPABILITIES compiled into the kernel, this enforces capability protection; without, this change is effectively a no-op. Some cases require special handling, such as mmap(2), which must preserve information about the maximum rights at the time of mapping in the memory map so that they can later be enforced in mprotect(2) -- this is done by narrowing the rights in the existing max_protection field used for similar purposes with file permissions. In namei(9), we assert that the code is not reached from within capability mode, as we're not yet ready to enforce namespace capabilities there. This will follow in a later commit. Update two capability names: CAP_EVENT and CAP_KEVENT become CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they represent. Approved by: re (bz) Submitted by: jonathan Sponsored by: Google Inc Notes: svn path=/head/; revision=224778
* Add accounting for most of the memory-related resources.Edward Tomasz Napierala2011-04-051-1/+3
| | | | | | | | Sponsored by: The FreeBSD Foundation Reviewed by: kib (earlier version) Notes: svn path=/head/; revision=220373
* Revert r220032:linux compat: add SO_PASSCRED option with basic handlingAndriy Gapon2011-03-311-1/+0
| | | | | | | | | | | | | I have not properly thought through the commit. After r220031 (linux compat: improve and fix sendmsg/recvmsg compatibility) the basic handling for SO_PASSCRED is not sufficient as it breaks recvmsg functionality for SCM_CREDS messages because now we would need to handle sockcred data in addition to cmsgcred. And that is not implemented yet. Pointyhat to: avg Notes: svn path=/head/; revision=220186
* linux compat: add SO_PASSCRED option with basic handlingAndriy Gapon2011-03-261-0/+1
| | | | | | | | | | | This seems to have been a part of a bigger patch by dchagin that either haven't been committed or committed partially. Submitted by: dchagin, nox MFC after: 2 weeks Notes: svn path=/head/; revision=220032
* linux compat: add non-dummy capget and capset system calls, regenerateAndriy Gapon2011-03-266-12/+38
| | | | | | | | | | | | | And drop dummy definitions for those system calls. This may transiently break the build. PR: kern/149168 Submitted by: John Wehle <john@feith.com> Reviewed by: netchild MFC after: 2 weeks Notes: svn path=/head/; revision=220030
* linux compat: add non-dummy capget and capset system callsAndriy Gapon2011-03-261-2/+4
| | | | | | | | | | PR: kern/149168 Submitted by: John Wehle <john@feith.com> Reviewed by: netchild MFC after: 2 weeks Notes: svn path=/head/; revision=220028
* Export the correct AT_PLATFORM value.Dmitry Chagin2011-03-261-2/+1
| | | | | | | | | | Since signal trampolines are copied to the shared page do not need to leave place on the stack for it. Forgotten in the previous commit. MFC after: 1 Week Notes: svn path=/head/; revision=220026
* Enable shared page use for amd64/linux32 and i386/linux binaries.Dmitry Chagin2011-03-132-18/+21
| | | | | | | | | Move signal trampoline code from the top of the stack to the shared page. MFC after: 2 Weeks Notes: svn path=/head/; revision=219609
* add DTrace systrace support for linux32 and freebsd32 on amd64 syscallsAndriy Gapon2011-03-125-4/+5728
| | | | | | | | | | | | Regenerate system call and systrace support files. PR: kern/152822 Submitted by: Artem Belevich <fbsdlist@src.cx> Reviewed by: jhb (earlier version) MFC after: 3 weeks Notes: svn path=/head/; revision=219560
* add DTrace systrace support for linux32 and freebsd32 on amd64 syscallsAndriy Gapon2011-03-123-8/+10
| | | | | | | | | | | | | This commits makes necessary changes in syscall/sysent generation infrastructure. PR: kern/152822 Submitted by: Artem Belevich <fbsdlist@src.cx> Reviewed by: jhb (ealier version) MFC after: 3 weeks Notes: svn path=/head/; revision=219559
* Extend struct sysvec with new method sv_schedtail, which is used for anDmitry Chagin2011-03-081-4/+2
| | | | | | | | | | | | | | | | | | explicit process at fork trampoline path instead of eventhadler(schedtail) invocation for each child process. Remove eventhandler(schedtail) code and change linux ABI to use newly added sysvec method. While here replace explicit comparing of module sysentvec structure with the newly created process sysentvec to detect the linux ABI. Discussed with: kib MFC after: 2 Week Notes: svn path=/head/; revision=219405
* For realtime signals fill the sigval value.Dmitry Chagin2011-02-151-0/+1
| | | | Notes: svn path=/head/; revision=218720
* Sort include files in the alphabetical order.Dmitry Chagin2011-02-131-1/+1
| | | | Notes: svn path=/head/; revision=218658
* Move linux_clone(), linux_fork(), linux_vfork() to a MI path.Dmitry Chagin2011-02-122-242/+1
| | | | Notes: svn path=/head/; revision=218616
* In preparation for moving linux_clone() to a MI pathDmitry Chagin2011-02-122-1/+12
| | | | | | | introduce linux_set_upcall_kse(). Notes: svn path=/head/; revision=218613
* In preparation for moving linux_clone () to a MI pathDmitry Chagin2011-02-121-54/+58
| | | | | | | | | move the TLS code in a separate function. Use function parameter instead of direct using register. Notes: svn path=/head/; revision=218612