#
302962 |
|
17-Jul-2016 |
dchagin |
MFC r302515:
Implement Linux personality() system call mainly due to READ_IMPLIES_EXEC flag. In Linux if this flag is set, PROT_READ implies PROT_EXEC for mmap(). Linux/i386 set this flag automatically if the binary requires executable stack.
READ_IMPLIES_EXEC flag will be used in the next Linux mmap() commit.
|
#
302229 |
|
27-Jun-2016 |
bdrewery |
MFC r280130:
cred: add proc_set_cred helper
|
#
301054 |
|
31-May-2016 |
glebius |
Merge r301053:
Fix kernel stack disclosures in the Linux and 4.3BSD compat layers.
Security: SA-16:20 Security: SA-16:21
|
#
299705 |
|
13-May-2016 |
pfg |
MFC r298829 sys/compat/linux*: minor spelling fixes.
|
#
297780 |
|
10-Apr-2016 |
dchagin |
MFCR r297519, r297525 (by pfg@):
Move Linux specific times tests up to guarantee the values are defined.
|
#
297304 |
|
27-Mar-2016 |
dchagin |
MFC r296502, r296543, r296546, r297060:
1. Limit secs to INT32_MAX / 2 to avoid errors from kern_setitimer(). Assert that kern_setitimer() returns 0. Remove bogus cast of secs. Fix style(9) issues.
2. Increment the return value if the remaining tv_usec value more than 500000 as a Linux does.
|
#
294368 |
|
19-Jan-2016 |
jhb |
MFC 289769,289822,290143,290144: Rename remaining linux32 symbols from linux_* to linux32_*.
289769: Rename remaining linux32 symbols such as linux_sysent[] and linux_syscallnames[] from linux_* to linux32_* to avoid conflicts with linux64.ko. While here, add support for linux64 binaries to systrace. - Update NOPROTO entries in amd64/linux/syscalls.master to match the main table to fix systrace build. - Add a special case for union l_semun arguments to the systrace generation. - The systrace_linux32 module now only builds the systrace_linux32.ko. module on amd64. - Add a new systrace_linux module that builds on both i386 and amd64. For i386 it builds the existing systrace_linux.ko. For amd64 it builds a systrace_linux.ko for 64-bit binaries.
289822: Fix build for the KTR-enabled kernels.
290143: Fix build with DEBUG defined.
290144: Update for LINUX32 rename. The assembler didn't complain about undefined symbols but just used 0 after the rename.
|
#
293897 |
|
14-Jan-2016 |
glebius |
o Fix SCTP ICMPv6 error message vulnerability. [SA-16:01.sctp] o Fix Linux compatibility layer incorrect futex handling. [SA-16:03.linux] o Fix Linux compatibility layer setgroups(2) system call. [SA-16:04.linux] o Fix TCP MD5 signature denial of service. [SA-16:05.tcp] o Fix insecure default bsnmpd.conf permissions. [SA-16:06.bsnmpd]
Security: FreeBSD-SA-16:01.sctp, CVE-2016-1879 Security: FreeBSD-SA-16:03.linux, CVE-2016-1880 Security: FreeBSD-SA-16:04.linux, CVE-2016-1881 Security: FreeBSD-SA-16:05.tcp, CVE-2016-1882 Security: FreeBSD-SA-16:06.bsnmpd, CVE-2015-5677
|
#
293591 |
|
09-Jan-2016 |
dchagin |
MFC r283491:
Properly check tv_nsec value. The tv_nsec field can also be one of the special value UTIME_NOW or UTIME_OMIT.
|
#
293582 |
|
09-Jan-2016 |
dchagin |
MFC r283480:
Add utimensat() system call.
|
#
293575 |
|
09-Jan-2016 |
dchagin |
MFC r283474:
Rework signal code to allow using it by other modules, like linprocfs:
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
|
#
293565 |
|
09-Jan-2016 |
dchagin |
MFC r283463:
Do not use struct l_timespec without conversion. While here move args->timeout handling before acquiring the futex key at FUTEX_WAIT path.
|
#
293555 |
|
09-Jan-2016 |
dchagin |
MFC r283451:
Implement ppoll() system call.
|
#
293548 |
|
09-Jan-2016 |
dchagin |
MFC r283443:
Put the correct value for the abi_nfdbits parameter of kern_select() for all supported Linuxulators.
|
#
293539 |
|
09-Jan-2016 |
dchagin |
MFC r283435:
Convert Linux wait options to the FreeBSD. Check wait options as a Linux do. Linux always set WEXITED option not a WUNTRACED|WNOHANG which is a strange bug.
|
#
293538 |
|
09-Jan-2016 |
dchagin |
MFC r283434:
Set WIFCONTINUED to the wait status if needed.
|
#
293532 |
|
09-Jan-2016 |
dchagin |
MFC r283427:
Where possible we will use M_LINUX malloc(9) type. Move M_FUTEX defines to the linux_common.ko.
|
#
293528 |
|
09-Jan-2016 |
dchagin |
MFC r283422:
Refund the proc emuldata struct for future use. For now move flags from thread emuldata to proc emuldata as it was originally intended.
As we can have both 64 & 32 bit Linuxulator running any eventhandler can be called twice for us. To prevent this move eventhandlers code from linux_emul.c to the linux_common.ko module.
|
#
293527 |
|
09-Jan-2016 |
dchagin |
MFC r283421:
Introduce a new module linux_common.ko which is intended for the following primary purposes:
1. Remove the dependency of linsysfs and linprocfs modules from linux.ko, which will be architecture specific on amd64.
2. Incorporate into linux_common.ko general code for platforms on which we'll support two Linuxulator modules (for both instruction set - 32 & 64 bit).
3. Move malloc(9) declaration to linux_common.ko, to enable getting memory usage statistics properly.
Currently linux_common.ko incorporates a code from linux_mib.c and linux_util.c and linprocfs, linsysfs and linux kernel modules depend on linux_common.ko.
Temporarily remove dtrace garbage from linux_mib.c and linux_util.c
|
#
293524 |
|
09-Jan-2016 |
dchagin |
MFC r283419:
Fix compilation with -DDEBUG option.
|
#
293521 |
|
09-Jan-2016 |
dchagin |
MFC r283415:
Disable i386 call for x86-64 Linux.
|
#
293516 |
|
09-Jan-2016 |
dchagin |
MFC r283410:
Put linux_platform into the vdso to avoid copying it onto the stack at every exec.
|
#
293512 |
|
09-Jan-2016 |
dchagin |
MFC r283403:
Implement pselect6() system call.
|
#
293510 |
|
09-Jan-2016 |
dchagin |
MFC r283401:
Implement prlimit64() system call.
|
#
293507 |
|
09-Jan-2016 |
dchagin |
MFC r283398:
Sched_rr_get_interval returns EINVAL in case when the invalid pid specified. This silence the ltp tests.
|
#
293503 |
|
09-Jan-2016 |
dchagin |
MFC r283394:
Implement waitid() system call.
|
#
293500 |
|
09-Jan-2016 |
dchagin |
MFC r283391:
To reduce code duplication introduce linux_copyout_rusage() method. Use it in linux_wait4() system call and move linux_wait4() to the MI path. While here add a prototype for the static bsd_to_linux_rusage().
|
#
293499 |
|
09-Jan-2016 |
dchagin |
MFC r283390:
Add a function for converting wait options.
|
#
293493 |
|
09-Jan-2016 |
dchagin |
MFC r283383:
Switch linuxulator to use the native 1:1 threads.
The reasons: 1. Get rid of the stubs/quirks with process dethreading, process reparent when the process group leader exits and close to this problems on wait(), waitpid(), etc. 2. Reuse our kernel code instead of writing excessive thread managment routines in Linuxulator.
Implementation details:
1. The thread is created via kern_thr_new() in the clone() call with the CLONE_THREAD parameter. Thus, everything else is a process. 2. The test that the process has a threads is done via P_HADTHREADS bit p_flag of struct proc. 3. Per thread emulator state data structure is now located in the struct thread and freed in the thread_dtor() hook. Mandatory holdig of the p_mtx required when referencing emuldata from the other threads. 4. PID mangling has changed. Now Linux pid is the native tid and Linux tgid is the native pid, with the exception of the first thread in the process where tid and pid are one and the same.
Ugliness:
In case when the Linux thread is the initial thread in the thread group thread id is equal to the process id. Glibc depends on this magic (assert in pthread_getattr_np.c). So for system calls that take thread id as a parameter we should use the special method to reference struct thread.
|
#
293487 |
|
09-Jan-2016 |
dchagin |
MFC r283379:
Implement a Linux version of sched_getparam() && sched_setparam(). Temporarily use the first thread in proc.
|
#
293482 |
|
09-Jan-2016 |
dchagin |
MFC r283374:
In preparation for switching linuxulator to the use the native 1:1 threads refactor kern_sched_rr_get_interval() and sys_sched_rr_get_interval(). Add a kern_sched_rr_get_interval() counterpart which takes a targettd parameter to allow specify target thread directly by callee (new Linuxulator).
Linuxulator temporarily uses first thread in proc.
Move linux_sched_rr_get_interval() to the MI part.
|
#
293473 |
|
09-Jan-2016 |
dchagin |
To facillitate an upcoming Linuxulator merging partially MFC r275121 (by kib). Only merge the syntax changes from r275121, PROC_*LOCK() macros still lock the same proc spinlock.
The process spin lock currently has the following distinct uses:
- Threads lifetime cycle, in particular, counting of the threads in the process, and interlocking with process mutex and thread lock. The main reason of this is that turnstile locks are after thread locks, so you e.g. cannot unlock blockable mutex (think process mutex) while owning thread lock.
- Virtual and profiling itimers, since the timers activation is done from the clock interrupt context. Replace the p_slock by p_itimmtx and PROC_ITIMLOCK().
- Profiling code (profil(2)), for similar reason. Replace the p_slock by p_profmtx and PROC_PROFLOCK().
- Resource usage accounting. Need for the spinlock there is subtle, my understanding is that spinlock blocks context switching for the current thread, which prevents td_runtime and similar fields from changing (updates are done at the mi_switch()). Replace the p_slock by p_statmtx and PROC_STATLOCK().
Discussed with: kib
|
#
256281 |
|
10-Oct-2013 |
gjb |
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
255426 |
|
09-Sep-2013 |
jhb |
Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a mapping use 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)
|
#
254025 |
|
07-Aug-2013 |
jeff |
Replace kernel virtual address space allocation with vmem. This provides transparent layering and better fragmentation.
- Normalize functions that allocate memory to use kmem_* - Those that allocate address space are named kva_* - Those that operate on maps are named kmap_* - Implement recursive allocation handling for kmem_arena in vmem.
Reviewed by: alc Tested by: pho Sponsored by: EMC / Isilon Storage Division
|
#
242476 |
|
02-Nov-2012 |
kib |
The r241025 fixed the case when a binary, executed from nullfs mount, was still possible to open for write from the lower filesystem. There is a symmetric situation where the binary could already has file descriptors opened for write, but it can be executed from the nullfs overlay.
Handle the issue by passing one v_writecount reference to the lower vnode if nullfs vnode has non-zero v_writecount. Note that only one write reference can be donated, since nullfs only keeps one use reference on the lower vnode. Always use the lower vnode v_writecount for the checks.
Introduce the VOP_GET_WRITECOUNT to read v_writecount, which is currently always bypassed to the lower vnode, and VOP_ADD_WRITECOUNT to manipulate the v_writecount value, which manages a single bypass reference to the lower vnode. Caling the VOPs instead of directly accessing v_writecount provide the fix described in the previous paragraph.
Tested by: pho MFC after: 3 weeks
|
#
241896 |
|
22-Oct-2012 |
kib |
Remove the support for using non-mpsafe filesystem modules.
In particular, do not lock Giant conditionally when calling into the filesystem module, remove the VFS_LOCK_GIANT() and related macros. Stop handling buffers belonging to non-mpsafe filesystems.
The VFS_VERSION is bumped to indicate the interface change which does not result in the interface signatures changes.
Conducted and reviewed by: attilio Tested by: pho
|
#
241025 |
|
28-Sep-2012 |
kib |
Fix the mis-handling of the VV_TEXT on the nullfs vnodes.
If you have a binary on a filesystem which is also mounted over by nullfs, you could execute the binary from the lower filesystem, or from the nullfs mount. When executed from lower filesystem, the lower vnode gets VV_TEXT flag set, and the file cannot be modified while the binary is active. But, if executed as the nullfs alias, only the nullfs vnode gets VV_TEXT set, and you still can open the lower vnode for write.
Add a set of VOPs for the VV_TEXT query, set and clear operations, which are correctly bypassed to lower vnode.
Tested by: pho (previous version) MFC after: 2 weeks
|
#
235063 |
|
05-May-2012 |
netchild |
- >500 static DTrace probes for the linuxulator - 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).
|
#
231885 |
|
17-Feb-2012 |
kib |
Fix misuse of the kernel map in miscellaneous image activators. 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
|
#
230132 |
|
15-Jan-2012 |
uqs |
Convert files to UTF-8
|
#
225617 |
|
16-Sep-2011 |
kmacy |
In order to maximize the re-usability of kernel code in user space this 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)
|
#
220373 |
|
05-Apr-2011 |
trasz |
Add accounting for most of the memory-related resources.
Sponsored by: The FreeBSD Foundation Reviewed by: kib (earlier version)
|
#
220031 |
|
26-Mar-2011 |
avg |
linux compat: improve and fix sendmsg/recvmsg compatibility
- implement baseic stubs for capget, capset, prctl PR_GET_KEEPCAPS and prctl PR_SET_KEEPCAPS. - add SCM_CREDS support to sendmsg and recvmsg - modify sendmsg to ignore control messages if not using UNIX domain sockets
This should allow linux pulse audio daemon and client work on FreeBSD and interoperate with native counter-parts modulo the differences in pulseaudio versions.
PR: kern/149168 Submitted by: John Wehle <john@feith.com> Reviewed by: netchild MFC after: 2 weeks
|
#
218717 |
|
15-Feb-2011 |
dchagin |
Put the macro declaration in the relevant include file for future use.
|
#
218031 |
|
28-Jan-2011 |
dchagin |
Style(9) fixes.
MFC after: 1 Month.
|
#
218030 |
|
28-Jan-2011 |
dchagin |
Implement a variation of the linux_common_wait() which should be used by linuxolator itself.
Move linux_wait4() to MD path as it requires native struct rusage translation to struct l_rusage on linux32/amd64.
MFC after: 1 Month.
|
#
218005 |
|
28-Jan-2011 |
dchagin |
Style(9) fix.
MFC after: 1 month.
|
#
215664 |
|
22-Nov-2010 |
netchild |
By using the 32-bit Linux version of Sun's Java Development Kit 1.6 on FreeBSD (amd64), invocations of "javac" (or "java") eventually end with the output of "Killed" and exit code 137.
This is caused by: 1. After calling exec() in multithreaded linux program threads are not destroyed and continue running. They get killed after program being executed finishes.
2. linux_exit_group doesn't return correct exit code when called not from group leader. Which happens regularly using sun jvm.
The submitters fix this in a similar way to how NetBSD handles this.
I took the PRs away from dchagin, who seems to be out of touch of this since a while (no response from him).
The patches committed here are from [2], with some little modifications from me to the style.
PR: 141439 [1], 144194 [2] Submitted by: Stefan Schmidt <stefan.schmidt@stadtbuch.de>, gk Reviewed by: rdivacky (in april 2010) MFC after: 5 days
|
#
202341 |
|
15-Jan-2010 |
brooks |
Since all other comparisons involving ngroups_max use "ngroups_max + 1", use ">= ngroups_max+1" instead of the equivalent "> ngroups_max" to reduce confusion.
|
#
202143 |
|
12-Jan-2010 |
brooks |
Replace the static NGROUPS=NGROUPS_MAX+1=1024 with a dynamic kern.ngroups+1. kern.ngroups can range from NGROUPS_MAX=1023 to INT_MAX-1. Given that the Windows group limit is 1024, this range should be sufficient for most applications.
MFC after: 1 month
|
#
197049 |
|
09-Sep-2009 |
kib |
kern_select(9) copies fd_set in and out of userspace in quantities of longs. Since 32bit processes longs are 4 bytes, 64bit kernel may copy in or out 4 bytes more then the process expected.
Calculate the amount of bytes to copy taking into account size of fd_set for the current process ABI.
Diagnosed and tested by: Peter Jeremy <peterjeremy acm org> Reviewed by: jhb MFC after: 1 week
|
#
194498 |
|
19-Jun-2009 |
brooks |
Rework the credential code to support larger values of NGROUPS and NGROUPS_MAX, eliminate ABI dependencies on them, and raise the to 1024 and 1023 respectively. (Previously they were equal, but under a close reading of POSIX, NGROUPS_MAX was defined to be too large by 1 since it is the number of supplemental groups, not total number of groups.)
The bulk of the change consists of converting the struct ucred member cr_groups from a static array to a pointer. Do the equivalent in kinfo_proc.
Introduce new interfaces crcopysafe() and crsetgroups() for duplicating a process credential before modifying it and for setting group lists respectively. Both interfaces take care for the details of allocating groups array. crsetgroups() takes care of truncating the group list to the current maximum (NGROUPS) if necessary. In the future, crsetgroups() may be responsible for insuring invariants such as sorting the supplemental groups to allow groupmember() to be implemented as a binary search.
Because we can not change struct xucred without breaking application ABIs, we leave it alone and introduce a new XU_NGROUPS value which is always 16 and is to be used or NGRPS as appropriate for things such as NFS which need to use no more than 16 groups. When feasible, truncate the group list rather than generating an error.
Minor changes: - Reduce the number of hand rolled versions of groupmember(). - Do not assign to both cr_gid and cr_groups[0]. - Modify ipfw to cache ucreds instead of part of their contents since they are immutable once referenced by more than one entity.
Submitted by: Isilon Systems (initial implementation) X-MFC after: never PR: bin/113398 kern/133867
|
#
194090 |
|
12-Jun-2009 |
jamie |
Add counterparts to getcredhostname: getcreddomainname, getcredhostuuid, getcredhostid
Suggested by: rmacklem Approved by: bz
|
#
193511 |
|
05-Jun-2009 |
rwatson |
Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC and used in a large number of files, but also because an increasing number of incorrect uses of MAC calls were sneaking in due to copy-and-paste of MAC-aware code without the associated opt_mac.h include.
Discussed with: pjd
|
#
193066 |
|
29-May-2009 |
jamie |
Place hostnames and similar information fully under the prison system. The system hostname is now stored in prison0, and the global variable "hostname" has been removed, as has the hostname_mtx mutex. Jails may have their own host information, or they may inherit it from the parent/system. The proper way to read the hostname is via getcredhostname(), which will copy either the hostname associated with the passed cred, or the system hostname if you pass NULL. The system hostname can still be accessed directly (and without locking) at prison0.pr_host, but that should be avoided where possible.
The "similar information" referred to is domainname, hostid, and hostuuid, which have also become prison parameters and had their associated global variables removed.
Approved by: bz (mentor)
|
#
191973 |
|
10-May-2009 |
dchagin |
Do not export AT_CLKTCK when emulating Linux kernel prior to 2.4.0, as it has appeared in the 2.4.0-rc7 first time. Being exported, AT_CLKTCK is returned by sysconf(_SC_CLK_TCK), glibc falls back to the hard-coded CLK_TCK value when aux entry is not present.
Glibc versions prior to 2.2.1 always use hard-coded CLK_TCK value.
For older applications/libc's which depends on hard-coded CLK_TCK value user should set compat.linux.osrelease less than 2.4.0.
Approved by: kib (mentor)
|
#
191966 |
|
10-May-2009 |
dchagin |
Rework r189362, r191883. The frequency of the statistics clock is given by stathz. Use stathz if it is available, otherwise use hz.
Pointed out by: bde
Approved by: kib (mentor)
|
#
191883 |
|
07-May-2009 |
dchagin |
Linux exports HZ value to user space via AT_CLKTCK auxiliary vector entry, which is available for Glibc as sysconf(_SC_CLK_TCK). If AT_CLKTCK entry is not exported, Glibc uses 100.
linux_times() shall use the value that is exported to user space.
Pointyhat to: dchagin
PR: kern/134251 Approved by: kib (mentor) MFC after: 2 weeks
|
#
191880 |
|
07-May-2009 |
dchagin |
Change linux struct tms definition to match actual linux one.
Approved by: kib (mentor) MFC after: 2 weeks
|
#
189362 |
|
04-Mar-2009 |
dchagin |
Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries which are used by glibc. This silents the message "2.4+ kernel w/o ELF notes?" from some programs at start, among them are top and pkill.
Do the assignment of the vector entries in elf_linux_fixup() as it is done in glibc.
Fix some minor style issues.
Submitted by: Marcin Cieslak <saper at SYSTEM PL> Approved by: kib (mentor) MFC after: 1 week
|
#
186564 |
|
29-Dec-2008 |
ed |
Push down Giant inside sysctl. Also add some more assertions to the code.
In the existing code we didn't really enforce that callers hold Giant before calling userland_sysctl(), even though there is no guarantee it is safe. Fix this by just placing Giant locks around the call to the oid handler. This also means we only pick up Giant for a very short period of time. Maybe we should add MPSAFE flags to sysctl or phase it out all together.
I've also added SYSCTL_LOCK_ASSERT(). We have to make sure sysctl_root() and name2oid() are called with the sysctl lock held.
Reviewed by: Jille Timmermans <jille quis cx>
|
#
184789 |
|
09-Nov-2008 |
ed |
Mark uname(), getdomainname() and setdomainname() with COMPAT_FREEBSD4.
Looking at our source code history, it seems the uname(), getdomainname() and setdomainname() system calls got deprecated somewhere after FreeBSD 1.1, but they have never been phased out properly. Because we don't have a COMPAT_FREEBSD1, just use COMPAT_FREEBSD4.
Also fix the Linuxolator to build without the setdomainname() routine by just making it call userland_sysctl on kern.domainname. Also replace the setdomainname()'s implementation to use this approach, because we're duplicating code with sysctl_domainname().
I wasn't able to keep these three routines working in our COMPAT_FREEBSD32, because that would require yet another keyword for syscalls.master (COMPAT4+NOPROTO). Because this routine is probably unused already, this won't be a problem in practice. If it turns out to be a problem, we'll just restore this functionality.
Reviewed by: rdivacky, kib
|
#
183612 |
|
04-Oct-2008 |
kib |
Current linux_fooaffinity() emulation fails, as the FreeBSD affinity syscalls expect the bitmap size in the range from 32 to 128. Old glibc always assumed size 1024, while newer glibc searches for approriate size, starting from 1024 and going up.
For now, use FreeBSD size of cpuset_t for bitmap size parameter and return EINVAL if length of user space bitmap less than our size of cpuset_t.
Submitted by: dchagin MFC after: 1 week [This requires MFC of the actual linux affinity syscalls]
|
#
183550 |
|
02-Oct-2008 |
zec |
Step 1.5 of importing the network stack virtualization infrastructure from the vimage project, as per plan established at devsummit 08/08: http://wiki.freebsd.org/Image/Notes200808DevSummit
Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator macros, and CURVNET_SET() context setting macros, all currently resolving to NOPs.
Prepare for virtualization of selected SYSCTL objects by introducing a family of SYSCTL_V_*() macros, currently resolving to their global counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT().
Move selected #defines from sys/sys/vimage.h to newly introduced header files specific to virtualized subsystems (sys/net/vnet.h, sys/netinet/vinet.h etc.).
All the changes are verified to have zero functional impact at this point in time by doing MD5 comparision between pre- and post-change object files(*).
(*) netipsec/keysock.c did not validate depending on compile time options.
Implemented by: julian, bz, brooks, zec Reviewed by: julian, bz, brooks, kris, rwatson, ... Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
|
#
183275 |
|
22-Sep-2008 |
trasz |
Fix usage of mac_vnode_check_open() in linuxulator - last argument should be VREAD, not FREAD.
Approved by: rwatson (mentor)
|
#
182935 |
|
11-Sep-2008 |
rdivacky |
The ERESTART to EINTR conversion is already done in kern_select so there is no need to repeat it in linux_select().
Submitted by: Dmitry Chagin <dchagin@> MFC after: 1 week Approved by: kib (mentor)
|
#
182371 |
|
28-Aug-2008 |
attilio |
Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed thread was always curthread and totally unuseful.
Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
|
#
181803 |
|
17-Aug-2008 |
bz |
Commit step 1 of the vimage project, (network stack) virtualization work done by Marko Zec (zec@).
This is the first in a series of commits over the course of the next few weeks.
Mark all uses of global variables to be virtualized with a V_ prefix. Use macros to map them back to their global names for now, so this is a NOP change only.
We hope to have caught at least 85-90% of what is needed so we do not invalidate a lot of outstanding patches again.
Obtained from: //depot/projects/vimage-commit2/... Reviewed by: brooks, des, ed, mav, julian, jamie, kris, rwatson, zec, ... (various people I forgot, different versions) md5 (with a bit of help) Sponsored by: NLnet Foundation, The FreeBSD Foundation X-MFC after: never V_Commit_Message_Reviewed_By: more people than the patch
|
#
180766 |
|
23-Jul-2008 |
rdivacky |
Fix linux_alarm, the linux behaviour is to limit the secs to INT_MAX when the passed in parameter is bigger than INT_MAX.
Submitted by: Dmitry Chagin <chagin.dmitry gmail com> Approved by: kib (mentor)
|
#
180291 |
|
05-Jul-2008 |
rwatson |
Introduce a new lock, hostname_mtx, and use it to synchronize access to global hostname and domainname variables. Where necessary, copy to or from a stack-local buffer before performing copyin() or copyout(). A few uses, such as in cd9660 and daemon_saver, remain under-synchronized and will require further updates.
Correct a bug in which a failed copyin() of domainname would leave domainname potentially corrupted.
MFC after: 3 weeks
|
#
178976 |
|
13-May-2008 |
rdivacky |
Implement robust futexes. Most of the code is modelled after what Linux does. This is because robust futexes are mostly userspace thing which we cannot alter. Two syscalls maintain pointer to userspace list and when process exits a routine walks this list waking up processes sleeping on futexes from that list.
Reviewed by: kib (mentor) MFC after: 1 month
|
#
177997 |
|
08-Apr-2008 |
kib |
Implement the linux syscalls openat, mkdirat, mknodat, fchownat, futimesat, fstatat, unlinkat, renameat, linkat, symlinkat, readlinkat, fchmodat, faccessat.
Submitted by: rdivacky Sponsored by: Google Summer of Code 2007 Tested by: pho
|
#
177604 |
|
25-Mar-2008 |
ru |
Fix build.
Reported by: ache, tinderbox
|
#
177257 |
|
16-Mar-2008 |
rdivacky |
Implement sched_setaffinity and get_setaffinity using real cpu affinity setting primitives.
Reviewed by: jeff Approved by: kib (mentor)
|
#
176460 |
|
22-Feb-2008 |
kib |
Sanitize arguments to linux_mremap(). Check that only MREMAP_FIXED and MREMAP_MAYMOVE flags are specified. Check for the page alignment of the addr argument.
Submitted by: rdivacky MFC after: 1 week
|
#
175294 |
|
13-Jan-2008 |
attilio |
VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used in conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary.
KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed.
Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
|
#
172930 |
|
24-Oct-2007 |
rwatson |
Merge first in a series of TrustedBSD MAC Framework KPI changes from Mac OS X Leopard--rationalize naming for entry points to the following general forms:
mac_<object>_<method/action> mac_<object>_check_<method/action>
The previous naming scheme was inconsistent and mostly reversed from the new scheme. Also, make object types more consistent and remove spaces from object types that contain multiple parts ("posix_sem" -> "posixsem") to make mechanical parsing easier. Introduce a new "netinet" object type for certain IPv4/IPv6-related methods. Also simplify, slightly, some entry point names.
All MAC policy modules will need to be recompiled, and modules not updates as part of this commit will need to be modified to conform to the new KPI.
Sponsored by: SPARTA (original patches against Mac OS X) Obtained from: TrustedBSD Project, Apple Computer
|
#
171998 |
|
28-Aug-2007 |
kib |
Implement fake linux sched_getaffinity() syscall to enable java to work with Linux 2.6 emulation. This shall be reimplemented once FreeBSD gets native scheduler affinity syscalls.
Submitted by: rdivacky Reviewed by: jkim Sponsored by: Google Summer of Code 2007 Approved by: re (kensmith)
|
#
170587 |
|
11-Jun-2007 |
rwatson |
Eliminate now-unused SUSER_ALLOWJAIL arguments to priv_check_cred(); in some cases, move to priv_check() if it was an operation on a thread and no other flags were present.
Eliminate caller-side jail exception checking (also now-unused); jail privilege exception code now goes solely in kern_jail.c.
We can't yet eliminate suser() due to some cases in the KAME code where a privilege check is performed and then used in many different deferred paths. Do, however, move those prototypes to priv.h.
Reviewed by: csjp Obtained from: TrustedBSD Project
|
#
170472 |
|
09-Jun-2007 |
attilio |
rufetch and calcru sometimes should be called atomically together. This patch fixes places where they should be called atomically changing their locking requirements (both assume per-proc spinlock held) and introducing rufetchcalc which wrappers both calls to be performed in atomic way.
Reviewed by: jeff Approved by: jeff (mentor)
|
#
170170 |
|
31-May-2007 |
attilio |
Revert VMCNT_* operations introduction. Probabilly, a general approach is not the better solution here, so we should solve the sched_lock protection problems separately.
Requested by: alc Approved by: jeff (mentor)
|
#
170152 |
|
31-May-2007 |
kib |
Revert UF_OPENING workaround for CURRENT. Change the VOP_OPEN(), vn_open() vnode operation and d_fdopen() cdev operation argument from being file descriptor index into the pointer to struct file.
Proposed and reviewed by: jhb Reviewed by: daichi (unionfs) Approved by: re (kensmith)
|
#
169667 |
|
18-May-2007 |
jeff |
- define and use VMCNT_{GET,SET,ADD,SUB,PTR} macros for manipulating vmcnts. This can be used to abstract away pcpu details but also changes to use atomics for all counters now. This means sched lock is no longer responsible for protecting counts in the switch routines.
Contributed by: Attilio Rao <attilio@FreeBSD.org>
|
#
166944 |
|
24-Feb-2007 |
netchild |
Partial MFp4 of 114977: Whitespace commit: Fix grammar, spelling and punctuation.
Submitted by: "Scot Hetzel" <swhetzel@gmail.com>
|
#
166931 |
|
23-Feb-2007 |
netchild |
MFp4 (114193 (i386 part), 114194, 114195, 114200): - Dont "return" in linux_clone() after we forked the new process in a case of problems. - Move the copyout of p2->p_pid outside the emul_lock coverage in linux_clone(). - Cache the em->pdeath_signal in a local variable and move the copyout out of the emul_lock coverage. - Move the free() out of the emul_shared_lock coverage in a preparation to switch emul_lock to non-sleepable lock (mutex).
Submitted by: rdivacky
|
#
166397 |
|
01-Feb-2007 |
kib |
No need to lock emul_lock in exit_group() because em->shared cannot change (because its referenced by curthread). This fixes a LOR caused by acquiring emul_shared_lock while holding emul_lock.
Fix typo in comment.
Submitted by: rdivacky
|
#
165871 |
|
07-Jan-2007 |
netchild |
MFp4 (112646): Now (ok it's been a while...) that FreeBSD has RLIMIT_AS too, we can use it in the linuxolator instead of ignoring it.
This fixes a LTP test.
Submitted by: rdivacky
|
#
165869 |
|
07-Jan-2007 |
netchild |
MFp4 (112534): Dont lock em in a case of just using em->shared->group_pid because the group_pid never changes.
Submitted by: rdivacky Reviewed by: kib Glanced at by: jhb
|
#
165867 |
|
07-Jan-2007 |
netchild |
MFp4 (112498): Rename the locking flags to EMUL_DOLOCK and EMUL_DONTLOCK to prevent confusion.
Submitted by: rdivacky
|
#
165689 |
|
31-Dec-2006 |
netchild |
MFp4 (111746, 108671, 108945, 112352): - add linux utimes syscall [1] - add linux rt_sigtimedwait syscall [2]
Submitted by: "Scot Hetzel" <swhetzel@gmail.com> [1] Submitted by: Bruce Becker <hostmaster@whois.gts.net> [2] PR: 93199 [2]
|
#
165687 |
|
31-Dec-2006 |
netchild |
MFp4 (111746+): Redo the checking for 2.6 emulation. We now cache the value of use26 and replace calls to linux_get_osrelease() + parsing with a call to linux_use26(). Typical path is lockless now.
Pointed out by: kib
This allows to ship RELENG_7_0 with a default osrelease of 2.4.2 and the possibility to enable 2.6.x emulation without the possible performance impact of the previous version of the check.
Submitted by: rdivacky
|
#
165686 |
|
31-Dec-2006 |
netchild |
MFp4: - semi-automatic style fixes - spelling fixes in comments - add some comments
|
#
164893 |
|
04-Dec-2006 |
jkim |
MFP4: 109653
Linux mknod(2) can open any files, not just char/block or fifo files. This fixes Linux Test Project test cases mknod01, mknod07 and mknod09.
|
#
164826 |
|
02-Dec-2006 |
netchild |
MFP4 (108673, 110519, 110874): - Currently LINUX_MAX_COMM_LEN is smaller than MAXCOMLEN, but in case this will change we have a buffer overflow. Apply some defensive programming to DTRT when this should happen. - Use copyinstr() instead of copyin where appropriate. * Fallback to copyin() in case of ENAMETOOLONG. [1] * Use the right source and destination (it was wrong before). - Use strlcpy instead of strcpy. - Properly lock the read case (PR_GET_NAME) like the write case.
Reviewed by: rwatson (except [1]) Suggested by: rwatson [1]
|
#
164380 |
|
18-Nov-2006 |
kib |
Sync struct sysinfo with real one from linux.
Submitted by: rdivacky
|
#
164378 |
|
18-Nov-2006 |
kib |
Add debuging printfs to syscalls that do not contain it yet. In sethostname do not print the hostname because it would require to copyin the string. Sethostname is not very frequently used.
Submitted by: rdivacky
|
#
164377 |
|
18-Nov-2006 |
kib |
Remove unecessary locking of process in linux_getpid.
Suggested by: jhb Submitted by: rdivacky
|
#
164296 |
|
15-Nov-2006 |
kib |
In rev 1.188 of linux_misc.c the added check for valid options ommited __WCLONE. This fixes it thus fixing skype/teamspeak to not keep zombies after exit.
Submitted by: rdivacky Reported by: Bakul Shah (bakul at bitblocks com)
|
#
164184 |
|
11-Nov-2006 |
trhodes |
Merge posix4/* into normal kernel hierarchy.
Reviewed by: glanced at by jhb Approved by: silence on -arch@ and -standards@
|
#
164033 |
|
06-Nov-2006 |
rwatson |
Sweep kernel replacing suser(9) calls with priv(9) calls, assigning specific privilege names to a broad range of privileges. These may require some future tweaking.
Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
|
#
163740 |
|
28-Oct-2006 |
netchild |
Fix style(9).
Noticed by: rwatson
|
#
163734 |
|
28-Oct-2006 |
netchild |
MFP4: Implement prctl().
Submitted by: rdivacky Tested with: LTP
|
#
163606 |
|
22-Oct-2006 |
rwatson |
Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.h begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead.
This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd.
Obtained from: TrustedBSD Project Sponsored by: SPARTA
|
#
163131 |
|
08-Oct-2006 |
netchild |
- Replace homegrown check for FIFO with S_ISFIFO. [1] - Check the status of the options before messing with it.
Inspired by: NetBSD [1] Submitted by: rdivacky Tested with: LTP
|
#
162358 |
|
16-Sep-2006 |
netchild |
- don't reboot() when feed with wrong parameters (and enough permissions) [1] - add support to power off the system [2] - check the linux magic values [3]
Submitted by: Marcin Cieslak <saper@SYSTEM.PL> [1,2] Modelled after: linux man page of the reboot() syscall [3] Found by: LTP testcase "reboot02" [1] Tested with: LTP testcase "reboot02" [1,3] MFC after: 1 week
|
#
161610 |
|
25-Aug-2006 |
rwatson |
Don't call suser_cred() directly from linux_sethostname(), as it just wraps userland_sysctl(), which performs necessary privilege checks as part of its normal operation.
MFC after: 1 week
|
#
161474 |
|
20-Aug-2006 |
netchild |
Sync the MI parts for amd64 with i386 and remove the corresponding special handling for amd64 in the common code. The MD parts for amd64 are still outstanding, but at least this fixes some panics on amd64.
Sponsored by: Google SoC 2006 Submitted by: rdivacky Tested by: bsam
|
#
161420 |
|
17-Aug-2006 |
netchild |
- disable some more code when osrelease=2.4.2 - protect td->td_proc->p_pid with the proc lock in linux_getpid in the amd64 (= non i386) case [1]
Sponsored by: Google SoC 2006 Submitted by: rdivacky Noticed by: netchild [1]
|
#
161419 |
|
17-Aug-2006 |
netchild |
Move some stuff into headers where they belong.
Sponsored by: Google SoC 2006 Submitted by: rdivacky Noticed by: jhb, ssouhlal
|
#
161317 |
|
15-Aug-2006 |
netchild |
Disable some parts of the code on amd64 for now to prevent a panic. A better fix will come later.
Sponsored by: Google SoC 2006 Submitted by: rdivacky
|
#
161310 |
|
15-Aug-2006 |
netchild |
Add the linux 2.6.x stuff (not used by default!): - TLS - complete - pid/tid mangling - complete - thread area - complete - futexes - complete with issues - clone() extension - complete with some possible minor issues - mq*/timer*/clock* stuff - complete but untested and the mq* stuff is disabled when not build as part of the kernel with native FreeBSD mq* support (module support for this will come later)
Tested with: - linux-firefox - works, tested - linux-opera - works, tested - linux-realplay - doesnt work, issue with futexes - linux-skype - doesnt work, issue with futexes - linux-rt2-demo - works, tested - linux-acroread - doesnt work, unknown reason (coredump) and sometimes issue with futexes - various unix utilities in linux-base-gentoo3 and linux-base-fc4: everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run sysctl compat.linux.osrelease=2.6.16 to switch back use sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not happen.
Sponsored by: Google SoC 2006 Submitted by: rdivacky Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
|
#
160555 |
|
21-Jul-2006 |
jhb |
- Pass the MPSAFE flag to namei() in linux_uselib() and handle conditional Giant VFS locking in that function. - Remove bogus code to handle the case where namei() returns success but a NULL vnode pointer. - Note that this code duplicates exec_check_permissions() and annotate where it differs. - Hold the vnode lock longer to protect the write to set VV_TEXT in v_vflag. - Mark linux_uselib() MPSAFE.
Reviewed by: rwatson
|
#
159896 |
|
23-Jun-2006 |
netchild |
The linux times syscall can be called with a NULL pointer, so keep cool and don't panic.
This fix is different from the patch submitted as it not only prevents a NULL-pointer dereference, but also skips some work in this case.
Noticed by: Dmitry Ganenko <dima@apk-inform.com> Reviewed by: rdivacky (the original version as in emulation@) MFC after: 1 week Security: This is a RELENG_x_y candidate (local DoS). Go ahead by: secteam (cperciva)
|
#
158415 |
|
10-May-2006 |
netchild |
Now that we don't have a linuxolator on alpha anymore: - unifdef __alpha__ - revert rev. 1.66 of linux_socket.c
|
#
157189 |
|
27-Mar-2006 |
avatar |
Unbreaking build by removing a now unused variable.
|
#
157183 |
|
27-Mar-2006 |
jhb |
Use td_ucred rather than p_ucred to avoid panics and general unhappiness.
Pointy hat to: netchild
|
#
156874 |
|
19-Mar-2006 |
ru |
Unbreak COMPAT_LINUX32 option support on amd64.
Broken by: netchild
|
#
156850 |
|
18-Mar-2006 |
netchild |
Fixup some problems in my previous commit (COMPAT_43).
Pointyhat to: netchild
|
#
156842 |
|
18-Mar-2006 |
netchild |
Get rid of the need of COMPAT_43 in the linuxolator.
Submitted by: Divacky Roman <xdivac02@stud.fit.vutbr.cz> Obtained from: DragonFly (some parts)
|
#
153775 |
|
28-Dec-2005 |
trhodes |
Cast tv_sec to intmax_t and print with %jd in some ifdef'ed code.
|
#
151316 |
|
14-Oct-2005 |
davidxu |
1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, most changes in MD code are trivial, before this change, trapsignal and sendsig use discrete parameters, now they uses member fields of ksiginfo_t structure. For sendsig, this change allows us to pass POSIX realtime signal value to user code.
2. Remove cpu_thread_siginfo, it is no longer needed because we now always generate ksiginfo_t data and feed it to libpthread.
3. Add p_sigqueue to proc structure to hold shared signals which were blocked by all threads in the proc.
4. Add td_sigqueue to thread structure to hold all signals delivered to thread.
5. i386 and amd64 now return POSIX standard si_code, other arches will be fixed.
6. In this sigqueue implementation, pending signal set is kept as before, an extra siginfo list holds additional siginfo_t data for signals. kernel code uses psignal() still behavior as before, it won't be failed even under memory pressure, only exception is when deleting a signal, we should call sigqueue_delete to remove signal from sigqueue but not SIGDELSET. Current there is no kernel code will deliver a signal with additional data, so kernel should be as stable as before, a ksiginfo can carry more information, for example, allow signal to be delivered but throw away siginfo data if memory is not enough. SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can not be caught or masked. The sigqueue() syscall allows user code to queue a signal to target process, if resource is unavailable, EAGAIN will be returned as specification said. Just before thread exits, signal queue memory will be freed by sigqueue_flush. Current, all signals are allowed to be queued, not only realtime signals.
Earlier patch reviewed by: jhb, deischen Tested on: i386, amd64
|
#
147816 |
|
07-Jul-2005 |
jhb |
Fix the computation of uptime for linux_sysinfo(). Before it was returning the uptime in seconds mod 60 which wasn't very useful.
Approved by: re (scottl)
|
#
147141 |
|
08-Jun-2005 |
sobomax |
Properly convert FreeBSD priority values into Linux values in the getpriority(2) syscall.
PR: kern/81951 Submitted by: Andriy Gapon <avg@icyb.net.ua>
|
#
145584 |
|
27-Apr-2005 |
jeff |
- Pass the ISOPEN flag to namei so filesystems will know we're about to open them or otherwise access the data.
|
#
144501 |
|
01-Apr-2005 |
jhb |
- Change the vm_mmap() function to accept an objtype_t parameter specifying the type of object represented by the handle argument. - Allow vm_mmap() to map device memory via cdev objects in addition to vnodes and anonymous memory. Note that mmaping a cdev directly does not currently perform any MAC checks like mapping a vnode does. - Unbreak the DRM getbufs ioctl by having it call vm_mmap() directly on the cdev the ioctl is acting on rather than trying to find a suitable vnode to map from.
Reviewed by: alc, arch@
|
#
143197 |
|
06-Mar-2005 |
sobomax |
Handle unimplemented syscall by instantly returning ENOSYS instead of sending signal first and only then returning ENOSYS to match what real linux does.
PR: kern/74302 Submitted by: Travis Poppe <tlp@LiquidX.org>
|
#
141467 |
|
07-Feb-2005 |
jhb |
Use kern_setitimer() to implement linux_alarm() instead of fondling the real interval timer directly.
|
#
140832 |
|
25-Jan-2005 |
sobomax |
Split out kernel side of {get,set}itimer(2) into two parts: the first that pops data from the userland and pushes results back and the second which does actual processing. Use the latter to eliminate stackgap in the linux wrappers of those syscalls.
MFC after: 2 weeks
|
#
140214 |
|
14-Jan-2005 |
obrien |
Match the LINUX32's style with existing style Submitted by: Jung-uk Kim <jkim@niksun.com>
Use positive, not negative logic.
|
#
140213 |
|
14-Jan-2005 |
obrien |
Fix Linux compat 'uname -m' on AMD64.
Submitted by: Jung-uk Kim <jkim@niksun.com> (patch reworked by me)
|
#
136152 |
|
05-Oct-2004 |
jhb |
Rework how we store process times in the kernel such that we always store the raw values including for child process statistics and only compute the system and user timevals on demand.
- Fix the various kern_wait() syscall wrappers to only pass in a rusage pointer if they are going to use the result. - Add a kern_getrusage() function for the ABI syscalls to use so that they don't have to play stackgap games to call getrusage(). - Fix the svr4_sys_times() syscall to just call calcru() to calculate the times it needs rather than calling getrusage() twice with associated stackgap, etc. - Add a new rusage_ext structure to store raw time stats such as tick counts for user, system, and interrupt time as well as a bintime of the total runtime. A new p_rux field in struct proc replaces the same inline fields from struct proc (i.e. p_[isu]ticks, p_[isu]u, and p_runtime). A new p_crux field in struct proc contains the "raw" child time usage statistics. ruadd() has been changed to handle adding the associated rusage_ext structures as well as the values in rusage. Effectively, the values in rusage_ext replace the ru_utime and ru_stime values in struct rusage. These two fields in struct rusage are no longer used in the kernel. - calcru() has been split into a static worker function calcru1() that calculates appropriate timevals for user and system time as well as updating the rux_[isu]u fields of a passed in rusage_ext structure. calcru() uses a copy of the process' p_rux structure to compute the timevals after updating the runtime appropriately if any of the threads in that process are currently executing. It also now only locks sched_lock internally while doing the rux_runtime fixup. calcru() now only requires the caller to hold the proc lock and calcru1() only requires the proc lock internally. calcru() also no longer allows callers to ask for an interrupt timeval since none of them actually did. - calcru() now correctly handles threads executing on other CPUs. - A new calccru() function computes the child system and user timevals by calling calcru1() on p_crux. Note that this means that any code that wants child times must now call this function rather than reading from p_cru directly. This function also requires the proc lock. - This finishes the locking for rusage and friends so some of the Giant locks in exit1() and kern_wait() are now gone. - The locking in ttyinfo() has been tweaked so that a shared lock of the proctree lock is used to protect the process group rather than the process group lock. By holding this lock until the end of the function we now ensure that the process/thread that we pick to dump info about will no longer vanish while we are trying to output its info to the console.
Submitted by: bde (mostly) MFC after: 1 month
|
#
133845 |
|
16-Aug-2004 |
obrien |
Fix the 'DEBUG' argument code to unbreak the amd64 LINT build.
|
#
133840 |
|
16-Aug-2004 |
obrien |
Fix the 'DEBUG' argument code to unbreak the LINT build.
|
#
133816 |
|
16-Aug-2004 |
tjr |
Changes to MI Linux emulation code necessary to run 32-bit Linux binaries on AMD64, and the general case where the emulated platform has different size pointers than we use natively: - declare certain structure members as l_uintptr_t and use the new PTRIN and PTROUT macros to convert to and from native pointers. - declare some structures __packed on amd64 when the layout would differ from that used on i386. - include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h> if compiling with COMPAT_LINUX32. This will need to be revisited before 32-bit and 64-bit Linux emulation support can coexist in the same kernel. - other small scattered changes.
This should be a no-op on i386 and Alpha.
|
#
133749 |
|
15-Aug-2004 |
tjr |
Replace linux_getitimer() and linux_setitimer() with implementations based on those in freebsd32_misc.c, removing the assumption that Linux uses the same layout for struct itimerval as we use natively.
|
#
133747 |
|
15-Aug-2004 |
tjr |
Avoid assuming that l_timeval is the same as the native struct timeval in linux_select().
|
#
132653 |
|
26-Jul-2004 |
cperciva |
Rename suser_cred()'s PRISON_ROOT flag to SUSER_ALLOWJAIL. This is somewhat clearer, but more importantly allows for a consistent naming scheme for suser_cred flags.
The old name is still defined, but will be removed in a few days (unless I hear any complaints...)
Discussed with: rwatson, scottl Requested by: jhb
|
#
130344 |
|
11-Jun-2004 |
phk |
Deorbit COMPAT_SUNOS.
We inherited this from the sparc32 port of BSD4.4-Lite1. We have neither a sparc32 port nor a SunOS4.x compatibility desire these days.
|
#
127140 |
|
17-Mar-2004 |
jhb |
- Replace wait1() with a kern_wait() function that accepts the pid, options, status pointer and rusage pointer as arguments. It is up to the caller to copyout the status and rusage to userland if needed. This lets us axe the 'compat' argument and hide all that functionality in owait(), by the way. This also cleans up some locking in kern_wait() since it no longer has to drop locks around copyout() since all the copyout()'s are deferred. - Convert owait(), wait4(), and the various ABI compat wait() syscalls to use kern_wait() rather than wait1() or wait4(). This removes a bit more stackgap usage.
Tested on: i386 Compiled on: i386, alpha, amd64
|
#
125454 |
|
04-Feb-2004 |
jhb |
Locking for the per-process resource limits structure. - struct plimit includes a mutex to protect a reference count. The plimit structure is treated similarly to struct ucred in that is is always copy on write, so having a reference to a structure is sufficient to read from it without needing a further lock. - The proc lock protects the p_limit pointer and must be held while reading limits from a process to keep the limit structure from changing out from under you while reading from it. - Various global limits that are ints are not protected by a lock since int writes are atomic on all the archs we support and thus a lock wouldn't buy us anything. - All accesses to individual resource limits from a process are abstracted behind a simple lim_rlimit(), lim_max(), and lim_cur() API that return either an rlimit, or the current or max individual limit of the specified resource from a process. - dosetrlimit() was renamed to kern_setrlimit() to match existing style of other similar syscall helper functions. - The alpha OSF/1 compat layer no longer calls getrlimit() and setrlimit() (it didn't used the stackgap when it should have) but uses lim_rlimit() and kern_setrlimit() instead. - The svr4 compat no longer uses the stackgap for resource limits calls, but uses lim_rlimit() and kern_setrlimit() instead. - The ibcs2 compat no longer uses the stackgap for resource limits. It also no longer uses the stackgap for accessing sysctl's for the ibcs2_sysconf() syscall but uses kernel_sysctl() instead. As a result, ibcs2_sysconf() no longer needs Giant. - The p_rlimit macro no longer exists.
Submitted by: mtm (mostly, I only did a few cleanups and catchups) Tested on: i386 Compiled on: alpha, amd64
|
#
124082 |
|
02-Jan-2004 |
alc |
Lock the traversal of the vm object list. Use TAILQ_FOREACH consistently.
|
#
122802 |
|
16-Nov-2003 |
sobomax |
Pull latest changes from OpenBSD:
- improve sysinfo(2) syscall; - add dummy fadvise64(2) syscall; - add dummy *xattr(2) family of syscalls; - add protos for the syscalls 222-225, 238-249 and 253-267; - add exit_group(2) syscall, which is currently just wired to exit(2).
Obtained from: OpenBSD MFC after: 2 weeks
|
#
121302 |
|
21-Oct-2003 |
tjr |
Reject negative ngrp arguments in linux_setgroups() and linux_setgroups16(); stops users being able to cause setgroups to clobber the kernel stack by copying in data past the end of the linux_gidset array.
|
#
119839 |
|
07-Sep-2003 |
bde |
Restored a non-egregious cast so that this file compiles on i386's with 64-bit longs again. This was fixed in rev.1.42 but the fix rotted non-fatally in rev.1.105 and fatally in rev.1.137.
Many more non-egregrious casts are strictly required for conversions from semi-opaque types to pointers, but we avoid most of them by using types that are almost certain to be compatible with uintptr_t for representing pointers (e.g., vm_offset_t). Here we don't really want the u_longs, but we have them because a.out.h and its support code doesn't use typedefs (it uses unsigned in V7 and unsigned long in FreeBSD) and is too obsolete to fix now.
|
#
118149 |
|
29-Jul-2003 |
des |
Try to make 'uname -a' look more like it does on Linux:
- cut the version string at the newline, suppressing information about who built the kernel and in what directory. Most of this information was already lost to truncation.
- on i386, return the precise CPU class (if known) rather than just "i386". Linux software which uses this information to select which binary to run often does not know what to make of "i386".
|
#
118047 |
|
26-Jul-2003 |
phk |
Add a "int fd" argument to VOP_OPEN() which in the future will contain the filedescriptor number on opens from userland.
The index is used rather than a "struct file *" since it conveys a bit more information, which may be useful to in particular fdescfs and /dev/fd/*
For now pass -1 all over the place.
|
#
117723 |
|
18-Jul-2003 |
phk |
Add a new function swap_pager_status() which reports the total size of the paging space and how much of it is in use (in pages).
Use this interface from the Linuxolator instead of groping around in the internals of the swap_pager.
|
#
116173 |
|
10-Jun-2003 |
obrien |
Use __FBSDID().
|
#
114216 |
|
29-Apr-2003 |
kan |
Deprecate machine/limits.h in favor of new sys/limits.h. Change all in-tree consumers to include <sys/limits.h>
Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
|
#
113613 |
|
17-Apr-2003 |
jhb |
Use local struct proc variables to reduce repeated td->td_proc dereferences and improve readability.
|
#
113579 |
|
16-Apr-2003 |
jhb |
Explicitly cast a l_ulong to an unsigned long to make all arch's happy with the printf format.
|
#
113577 |
|
16-Apr-2003 |
jhb |
Fix printf format in a debug printf.
|
#
112206 |
|
13-Mar-2003 |
jhb |
- Change the linux_[gs]et_os{name, release, s_version}() functions to take a thread instead of a proc for their first argument. - Add a mutex to protect the system-wide Linux osname, osrelease, and oss_version variables. - Change linux_get_prison() to take a thread instead of a proc for its first argument and to use td_ucred rather than p_ucred. This is ok because a thread's prison does not change even though it's ucred might. - Also, change linux_get_prison() to return a struct prison * instead of a struct linux_prison * since it returns with the struct prison locked and this makes it easier to safely unlock the prison when we are done messing with it.
|
#
111798 |
|
03-Mar-2003 |
des |
Clean up whitespace and remove register keyword.
|
#
111797 |
|
03-Mar-2003 |
des |
More caddr_t removal, in conjunction with copy{in,out}(9) this time. Also clean up some egregious casts and incorrect use of sizeof.
|
#
111034 |
|
17-Feb-2003 |
tjr |
Use the proc lock to protect p_realtimer instead of Giant, and obtain sched_lock around accesses to p_stats->p_timer[] to avoid a potential race with hardclock. getitimer(), setitimer() and the realitexpire() callout are now Giant-free.
|
#
110848 |
|
14-Feb-2003 |
tjr |
Obtain proc lock around modification of p_siglist in linux_wait4().
|
#
105359 |
|
17-Oct-2002 |
robert |
- Use strlcpy() rather than strncpy() to copy NUL terminated strings. - Pass the correct buffer size to getcredhostname().
|
#
104306 |
|
01-Oct-2002 |
jmallett |
Back our kernel support for reliable signal queues.
Requested by: rwatson, phk, and many others
|
#
104245 |
|
30-Sep-2002 |
jmallett |
(Forced commit, to clarify previous commit of ksiginfo/signal queue code.)
I've added a structure, kernel-private, to represent a pending or in-delivery signal, called `ksiginfo'. It is roughly analogous to the basic information that is exported by the POSIX interface 'siginfo_t', but more basic. I've added functions to allocate these structures, and further to wrap all signal operations using them.
Once the operations are wrapped, I've added a TailQ (see queue(3)) of these structures to 'struct proc', and all pending signals are in that TailQ. When a signal is being delivered, it is dequeued from the list. Once I finish the spreading of ksiginfo throughout the tree, the dequeued structure will be delivered to the process in question, whereas currently and normally, the signal number is what is used.
|
#
104233 |
|
30-Sep-2002 |
jmallett |
First half of implementation of ksiginfo, signal queues, and such. This gets signals operating based on a TailQ, and is good enough to run X11, GNOME, and do job control. There are some intricate parts which could be more refined to match the sigset_t versions, but those require further evaluation of directions in which our signal system can expand and contract to fit our needs.
After this has been in the tree for a while, I will make in kernel API changes, most notably to trapsignal(9) and sendsig(9), to use ksiginfo more robustly, such that we can actually pass information with our (queued) signals to the userland. That will also result in using a struct ksiginfo pointer, rather than a signal number, in a lot of kern_sig.c, to refer to an individual pending signal queue member, but right now there is no defined behaviour for such.
CODAFS is unfinished in this regard because the logic is unclear in some places.
Sponsored by: New Gold Technology Reviewed by: bde, tjr, jake [an older version, logic similar]
|
#
103941 |
|
25-Sep-2002 |
jeff |
- Hold the vn lock over vm_mmap().
|
#
103652 |
|
19-Sep-2002 |
mdodd |
Pass flags to msync() accounting for differences in the definition of MS_SYNC on FreeBSD and Linux.
Submitted by: Christian Zander <zander@minion.de>
|
#
102963 |
|
05-Sep-2002 |
bde |
Do not cast from a pointer to an integer of a possibly different size. This fixes a warning on i386's with 64-bit longs.
|
#
102954 |
|
05-Sep-2002 |
bde |
Include <sys/malloc.h> instead of depending on namespace pollution 2 layers deep in <sys/proc.h> or <sys/vnode.h>.
Removed unused includes. Sorted includes.
|
#
102814 |
|
01-Sep-2002 |
iedowse |
Use the new kern_* functions to avoid the need to store arguments in the stack gap. This converts most VFS and signal related system calls, as well as select().
Discussed on: -arch Approved by: marcel
|
#
101308 |
|
04-Aug-2002 |
jeff |
- Replace v_flag with v_iflag and v_vflag - v_vflag is protected by the vnode lock and is used when synchronization with VOP calls is needed. - v_iflag is protected by interlock and is used for dealing with vnode management issues. These flags include X/O LOCK, FREE, DOOMED, etc. - All accesses to v_iflag and v_vflag have either been locked or marked with mp_fixme's. - Many ASSERT_VOP_LOCKED calls have been added where the locking was not clear. - Many functions in vfs_subr.c were restructured to provide for stronger locking.
Idea stolen from: BSD/OS
|
#
101189 |
|
01-Aug-2002 |
rwatson |
Introduce support for Mandatory Access Control and extensible kernel access control.
Invoke appropriate MAC entry points for a number of VFS-related operations in the Linux ABI module. In particular, handle uselib in a manner similar to open() (more work is probably needed here), as well as handle statfs(), and linux readdir()-like calls.
Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
|
#
98209 |
|
14-Jun-2002 |
rwatson |
Add a comment about how we should use vn_open() here instead of directly invoking VOP_OPEN(). This would reduce code redundancy with the rest of the kernel, and also is required for MAC to work properly.
|
#
97748 |
|
02-Jun-2002 |
schweikh |
Fix typo in the BSD copyright: s/withough/without/
Spotted and suggested by: des MFC after: 3 weeks
|
#
95837 |
|
01-May-2002 |
peter |
Zap some stale unused headers, including one machine/psl.h (which is a stub on alpha). Compile tested on alpha and x86.
|
#
95130 |
|
20-Apr-2002 |
rwatson |
Add an XXX: linux_uselib() should be using vn_open() rather than invoking VOP_OPEN() and doing lots of manual checking. This would further centralize use of the name functions, and once the MAC code is integrated, meaning few extraneous MAC checks scattered all over the place. I don't have time to fix this now, but want to make sure it doesn't get forgotten. Anyone interested in fixing this should feel free.
Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
|
#
94621 |
|
13-Apr-2002 |
jhb |
Rework logic of syscalls that modify process credentials as described in rev 1.152 of sys/kern/kern_prot.c.
|
#
94454 |
|
11-Apr-2002 |
jhb |
Use td_ucred in a few spots.
|
#
93593 |
|
01-Apr-2002 |
jhb |
Change the suser() API to take advantage of td_ucred as well as do a general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag.
Discussed on: smp@
|
#
92787 |
|
20-Mar-2002 |
jeff |
Remove references to vm_zone.h and switch over to the new uma API.
|
#
91406 |
|
27-Feb-2002 |
jhb |
Simple p_ucred -> td_ucred changes to start using the per-thread ucred reference.
|
#
91392 |
|
27-Feb-2002 |
robert |
Use the updated getcredhostname() function.
|
#
91385 |
|
27-Feb-2002 |
robert |
Use the getcredhostname function to fill the hostname into the linux_newuname_args structure. This should fix the case of jailed linux processes not using the jail's hostname.
PR: 35336 Reviewed by: phk
|
#
89717 |
|
23-Jan-2002 |
gallatin |
Linux/alpha uses the same BSDish return mechanism we do for getpid, getuid, getgid and pipe, since they bootstrapped from OSF/1 and never cleaned up. Switch to the native syscalls on alpha so that the above functions work
MFC after: 7 days
|
#
87275 |
|
03-Dec-2001 |
rwatson |
o Introduce pr_mtx into struct prison, providing protection for the mutable contents of struct prison (hostname, securelevel, refcount, pr_linux, ...) o Generally introduce mtx_lock()/mtx_unlock() calls throughout kern/ so as to enforce these protections, in particular, in kern_mib.c protection sysctl access to the hostname and securelevel, as well as kern_prot.c access to the securelevel for access control purposes. o Rewrite linux emulator abstractions for accessing per-jail linux mib entries (osname, osrelease, osversion) so that they don't return a pointer to the text in the struct linux_prison, rather, a copy to an array passed into the calls. Likewise, update linprocfs to use these primitives. o Update in_pcb.c to always use prison_getip() rather than directly accessing struct prison.
Reviewed by: jhb
|
#
86852 |
|
24-Nov-2001 |
des |
Revert incorrect KSEfication: realitexpire expects a struct proc *, not a struct thread *.
|
#
84783 |
|
10-Oct-2001 |
ps |
Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loader tunable.
Reviewed by: peter MFC after: 2 weeks
|
#
84075 |
|
27-Sep-2001 |
marcel |
Remove linux_getpgid(). We map the syscall natively now.
PR: kern/21402
|
#
83503 |
|
15-Sep-2001 |
mr |
Add a wrapper for linux_getsid -> getsid Syscall.
|
#
83366 |
|
12-Sep-2001 |
julian |
KSE Milestone 2 Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process.
Sorry john! (your next MFC will be a doosie!)
Reviewed by: peter@freebsd.org, dillon@freebsd.org
X-MFC after: ha ha ha ha
|
#
83221 |
|
08-Sep-2001 |
marcel |
Round of cleanups and enhancements. These include (in random order):
o Introduce private types for use in linux syscalls for two reasons: 1. establish type independence for ease in porting and, 2. provide a visual queue as to which syscalls have proper prototypes to further cleanup the i386/alpha split. Linuxulator types are prefixed by 'l_'. void and char have not been "virtualized".
o Provide dummy functions for all syscalls and remove dummy functions or implementations of truely obsolete syscalls.
o Sanitize the shm*, sem* and msg* syscalls.
o Make a first attempt to implement the linux_sysctl syscall. At this time it only returns one MIB (KERN_VERSION), but most importantly, it tells us when we need to add additional sysctls :-)
o Bump the kenel version up to 2.4.2 (this is not the same as the KERN_VERSION MIB, BTW).
o Implement new syscalls, of which most are specific to i386. Our syscall table is now up to date with Linux 2.4.2. Some highlights: - Implement the 32-bit uid_t and gid_t bases syscalls. - Implement a couple of 64-bit file size/offset bases syscalls.
o Fix or improve numerous syscalls and prototypes.
o Reduce style(9) violations while I'm here. Especially indentation inconsistencies within the same file are addressed. Re-indenting did not obfuscate actual changes to the extend that it could not be combined.
NOTE: I spend some time testing these changes and found that if there were regressions, they were not caused by these changes AFAICT. It was observed that installing a RH 7.1 runtime environment did make matters worse. Hangs and/or reboots have been observed with and without these changes, so when it failed to make life better in cases it doesn't look like it made it worse.
|
#
80180 |
|
23-Jul-2001 |
pirzyk |
Added the linux_sysinfo function to implement sysinfo(2).
PR: kern/27759 Reviewed by: marcel Approved by: marcel MFC after: 1 week
|
#
78257 |
|
15-Jun-2001 |
peter |
Fix warning: 413: warning: long unsigned int format, vm_offset_t arg (arg 2)
|
#
77183 |
|
25-May-2001 |
rwatson |
o Merge contents of struct pcred into struct ucred. Specifically, add the real uid, saved uid, real gid, and saved gid to ucred, as well as the pcred->pc_uidinfo, which was associated with the real uid, only rename it to cr_ruidinfo so as not to conflict with cr_uidinfo, which corresponds to the effective uid. o Remove p_cred from struct proc; add p_ucred to struct proc, replacing original macro that pointed. p->p_ucred to p->p_cred->pc_ucred. o Universally update code so that it makes use of ucred instead of pcred, p->p_ucred instead of p->p_pcred, cr_ruidinfo instead of p_uidinfo, cr_{r,sv}{u,g}id instead of p_*, etc. o Remove pcred0 and its initialization from init_main.c; initialize cr_ruidinfo there. o Restruction many credential modification chunks to always crdup while we figure out locking and optimizations; generally speaking, this means moving to a structure like this: newcred = crdup(oldcred); ... p->p_ucred = newcred; crfree(oldcred); It's not race-free, but better than nothing. There are also races in sys_process.c, all inter-process authorization, fork, exec, and exit. o Remove sigio->sio_ruid since sigio->sio_ucred now contains the ruid; remove comments indicating that the old arrangement was a problem. o Restructure exec1() a little to use newcred/oldcred arrangement, and use improved uid management primitives. o Clean up exit1() so as to do less work in credential cleanup due to pcred removal. o Clean up fork1() so as to do less work in credential cleanup and allocation. o Clean up ktrcanset() to take into account changes, and move to using suser_xxx() instead of performing a direct uid==0 comparision. o Improve commenting in various kern_prot.c credential modification calls to better document current behavior. In a couple of places, current behavior is a little questionable and we need to check POSIX.1 to make sure it's "right". More commenting work still remains to be done. o Update credential management calls, such as crfree(), to take into account new ruidinfo reference. o Modify or add the following uid and gid helper routines: change_euid() change_egid() change_ruid() change_rgid() change_svuid() change_svgid() In each case, the call now acts on a credential not a process, and as such no longer requires more complicated process locking/etc. They now assume the caller will do any necessary allocation of an exclusive credential reference. Each is commented to document its reference requirements. o CANSIGIO() is simplified to require only credentials, not processes and pcreds. o Remove lots of (p_pcred==NULL) checks. o Add an XXX to authorization code in nfs_lock.c, since it's questionable, and needs to be considered carefully. o Simplify posix4 authorization code to require only credentials, not processes and pcreds. Note that this authorization, as well as CANSIGIO(), needs to be updated to use the p_cansignal() and p_cansched() centralized authorization routines, as they currently do not take into account some desirable restrictions that are handled by the centralized routines, as well as being inconsistent with other similar authorization instances. o Update libkvm to take these changes into account.
Obtained from: TrustedBSD Project Reviewed by: green, bde, jhb, freebsd-arch, freebsd-audit
|
#
76166 |
|
01-May-2001 |
markm |
Undo part of the tangle of having sys/lock.h and sys/mutex.h included in other "system" header files.
Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files.
Sort sys/*.h includes where possible in affected files.
OK'ed by: bde (with reservations)
|
#
75916 |
|
24-Apr-2001 |
rwatson |
o Change a suser() call to a suser_xxx(..., PRISON_ROOT) call in the linuxulator so as to allow privileged processes within a jail() to invoke the Linux initgroups() system call. This allows the Linux "su" to work properly (better) when running a complete Linux environment under jail(). This problem was reported by Attila Nagy <bra@fsn.hu>.
Reviewed by: marcel
|
#
75893 |
|
23-Apr-2001 |
jhb |
Change the pfind() and zpfind() functions to lock the process that they find before releasing the allproc lock and returning.
Reviewed by: -smp, dfr, jake
|
#
75053 |
|
01-Apr-2001 |
alc |
Add linux_sched_get_priority_max() and linux_sched_get_priority_min(): The policy parameter requires translation.
|
#
74701 |
|
23-Mar-2001 |
gallatin |
fix linux_times() to take into account linux's value of CLK_TCK on the alpha. Previously, results were off by a factor of 10
Tested by: Yoriaki FUJIMORI <fujimori@grafin.fujimori.cache.waseda.ac.jp>
|
#
72543 |
|
16-Feb-2001 |
jlemon |
Allow debugging output to be controlled on a per-syscall granularity. Also clean up debugging output in a slightly more uniform fashion.
The default behavior remains the same (all debugging output is turned on)
|
#
72538 |
|
16-Feb-2001 |
jlemon |
Add mount syscall to linux emulation. Also improve emulation of reboot.
|
#
72200 |
|
09-Feb-2001 |
bmilekic |
Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:
mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)
similarily, for releasing a lock, we now have:
mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument.
The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind.
Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two:
MTX_QUIET and MTX_NOSWITCH
The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers:
mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively.
Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case.
Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled.
Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those.
Finally, caught up to the interface changes in all sys code.
Contributors: jake, jhb, jasone (in no particular order)
|
#
71699 |
|
26-Jan-2001 |
jhb |
Back out proc locking to protect p_ucred for obtaining additional references along with the actual obtaining of additional references.
|
#
71445 |
|
23-Jan-2001 |
jhb |
Protect calcru() with sched_lock.
|
#
70061 |
|
15-Dec-2000 |
jhb |
Lock access to proc members.
Glanced over by: marcel
|
#
69539 |
|
02-Dec-2000 |
marcel |
Don't auto-generate the syscalls.
|
#
69286 |
|
27-Nov-2000 |
jake |
Use callout_reset instead of timeout(9). Most callouts are statically allocated, 2 have been added to struct proc for setitimer and sleep.
Reviewed by: jhb, jlemon
|
#
68583 |
|
10-Nov-2000 |
marcel |
Revert auto-generation. The Alpha port is broken. Syncing with it is wrong.
|
#
68519 |
|
09-Nov-2000 |
marcel |
Sync with Alpha: Do not use sysent.c, proto.h and syscall.h in source tree; use auto-generated versions.
|
#
68201 |
|
01-Nov-2000 |
obrien |
The MI/MD split wasn't perfect and the MI files need hacks for the AlphaLinux compat bits. This will be better cleaned up soon.
Agreed to what ever was necessary by: marcel
|
#
65106 |
|
26-Aug-2000 |
marcel |
Fix bug in previous commit. We need to trim the limits to fit the datatype (= long). Use ULONG_MAX and LONG_MAX to avoid creating MD code.
|
#
65099 |
|
26-Aug-2000 |
marcel |
Re-implement linux_{g|s}etrlimit in terms of {g|s}etrlimit instead of the o{g|s}etrlimit so that the dependency on COMPAT_43 is removed.
|
#
64909 |
|
21-Aug-2000 |
marcel |
Update include directives.
Move linux_select to MD code (i386 compat. syscall).
Move linux_fork, linux_vfork, linux_clone, linux_mmap, linux_pipe, linux_ioperm, linux_iopl and linux_modify_ldt to MD code.
|
#
63778 |
|
23-Jul-2000 |
marcel |
Add bounds checking to stackgap_alloc. Previously it was possible to construct a path that was long enough (ie longer than SPARE_USRSPACE bytes) and trash the stack.
Note that SPARE_USRSPACE is much smaller than MAXPATHLEN so that the Linuxulator will now return ENAMETOOLONG even if the path is smaller than MAXPATHLEN.
PR: 12749
|
#
63605 |
|
20-Jul-2000 |
marcel |
Revert implementation of setfsuid and setfsgid due to security issues.
Requested by: rwatson Backed by: kris
|
#
63280 |
|
16-Jul-2000 |
marcel |
Implement setfsuid and setfsgid. Implementation derived from patch in PR.
PR: 16993 Submitted by: Bjoern Groenvall <bg@sics.se>
|
#
61702 |
|
15-Jun-2000 |
cracauer |
Linux allows to mmap annonymous with a file descriptor passed, FreeBSD doesn't. In the Linux emulation layer, ignore the fd passed when MAP_ANON is specified.
Known application to be fixed: Xanalys/Harlequin Lispworks
Also improve debug output for mmap, now showing what the emulation layer mapped to what (-DDEBUG).
Reviewed by: marcel
|
#
59794 |
|
30-Apr-2000 |
phk |
Remove unneeded #include <vm/vm_zone.h>
Generated by: src/tools/tools/kerninclude
|
#
57867 |
|
09-Mar-2000 |
marcel |
Fix bug in linux_wait4 and linux_waitpid where garbage in the status argument could panic the kernel.
Submitted by: Ian Dowse <iedowse@maths.tcd.ie> Prompted by: jkh, gallatin Approved by: prompters
|
#
54655 |
|
15-Dec-1999 |
eivind |
Introduce NDFREE (and remove VOP_ABORTOP)
|
#
52635 |
|
29-Oct-1999 |
phk |
useracc() the prequel:
Merge the contents (less some trivial bordering the silly comments) of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts the #defines for the vm_inherit_t and vm_prot_t types next to their typedefs.
This paves the road for the commit to follow shortly: change useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE} as argument.
|
#
51793 |
|
29-Sep-1999 |
marcel |
sigset_t change (part 4 of 5) -----------------------------
The compatibility code and/or emulators have been updated:
iBCS2 now mostly uses the older syscalls. SVR4 now properly handles all signals. This has been achieved by using the new sigset_t throughout the emulator. The Linuxulator has been severely updated. Internally the new Linux sigset_t is made the default. These are then mapped to and from the new FreeBSD sigset_t.
Also, rt_sigsuspend has been implemented in the Linuxulator. Implementing this syscall basicly caused all this sigset_t changing in the first place and the syscall has been used throughout the change as a means for testing. It basicly is too much work to undo the implementation so that it can later be added again.
A special note on the use of sv_sigtbl and sv_sigsize in struct sysentvec: Every signal larger than sv_sigsize is not translated and is passed on to the signal handler unmodified. Signals in the range 1 upto and including sv_sigsize are translated. The rationale is that only the system defined signals need to be translated.
The emulators also have been updated so that the translation tables are only indexed for valid (system defined) signals. This change also fixes the translation bug already in the SVR4 emulator.
|
#
51569 |
|
22-Sep-1999 |
luoqi |
Implement linux_ioperm() syscall. Fix linux_iopl() to use the level argument. SVGAlib should now work.
Reviewed by: marcel
|
#
50833 |
|
03-Sep-1999 |
marcel |
I missed the namechange of field desc in struct i386_ldt_args into descs while reviewing luoqi's changes...
Pointed out by: luoqi
|
#
50818 |
|
02-Sep-1999 |
marcel |
Implementation of the modify_ldt syscall. Use the sysarch() interface to do the actual work. When USER_LDT is not defined for a kernel, sysarch returns EOPNOTSUPP. Display a message in that case and return ENOSYS to userland.
Reviewed by: luoqi
|
#
50546 |
|
29-Aug-1999 |
marcel |
Fix a missing '-1' in the size argument of copyout in getgroups. Spotted while reviewing the MFC in -stable.
|
#
50477 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
50465 |
|
27-Aug-1999 |
marcel |
Add sysctl variables for the Linuxulator. These reside under `compat.linux' as discussed on current.
The following variables are defined (for now):
osname (defaults to "Linux") Allow users to change the name of the OS as returned by uname(2), specially added for all those Linux Netscape users and statistics maniacs :-) We now have what we all wanted!
osrelease (defaults to "2.2.5") Allow users to change the version of the OS as returned by uname(2). Since -current supports glibc2.1 now, change the default to 2.2.5 (was 2.0.36).
oss_version (defaults to 198144 [0x030600]) This one will be used by the OSS_GETVERSION ioctl (PR 12917) which I can commit now that we have the MIB. The default version number is the lowest version possible with the current 'encoding'.
A note about imprisoned processes (see jail(2)): These variables are copy-on-write (as suggested by phk). This means that imprisoned processes will use the system wide value unless it is written/set by the process. From that moment on, a copy local to the prison will be used.
A note about the implementation: I choose to add a single pointer to struct prison, because I didn't like the idea of changing struct prison every time I come up with a new variable. As a side effect, the extra storage is only needed when a variable is set from within the prison. This also minimizes kernel bloat when the Linuxulator is not used; both compiled in or as a module.
Reviewed by: bde (first version only) and phk
|
#
50350 |
|
25-Aug-1999 |
marcel |
Fix {g|s}etgroups semantics. We use cr_groups[0] to hold egid. This means that egid will be twice in the set and that setting cr_groups[0] will change egid. This is simply solved by ignoring cr_groups[0]. That is; linux_getgroups does not return cr_groups[0] and linux_setgroups does not touch it.
Noticed by: bde Brought to my attention by: sheldonh
|
#
50345 |
|
25-Aug-1999 |
marcel |
Change all UNIMPL syscalls to STD and add them to linux_dummy. Now we always know if and when an unimplemented or obsoleted syscall is being used. Make the message more end-user friendly.
And as long as we're here, rename some unimplemeted syscalls (linux_phys -> linux_umount2, linux_vm86 -> linux_vm86old, linux_new_vm86 -> linux_vm86).
Change prototype for linux_newuname from `struct linux_newuname_t *' into `struct linux_new_utsname *'. This change is reflected in linux.h and linux_misc.c.
|
#
49959 |
|
17-Aug-1999 |
marcel |
Fix bug in the debug-printf of the vfork syscall, where the format specifier didn't match the argument (p->p_pid).
While I'm at it, also fix the dupo in the format string and fix the annoying inconsistency in all the debug-printfs wrt p_pid arguments. Change all of them to use the %ld format specifier and cast the p_pid arguments to long.
Submitted by: billf
|
#
49890 |
|
16-Aug-1999 |
marcel |
Implement linux_vfork() syscall by calling vfork(). Analogous to the linux_fork() implementation.
|
#
49849 |
|
15-Aug-1999 |
marcel |
Provide wrappers for sched_{s|g}etscheduler. We need to convert the policy argument.
PR: 12006 Originator: Jean-Claude MICHOT <jcmichot@teaser.fr>
|
#
49842 |
|
15-Aug-1999 |
marcel |
Include opt_compat.h so that COMPAT_43 is defined. This gives us the proper prototypes of o{s|g}etrlimit (from sys/sysproto.h). Update linux_{s|g}etrlimit so that the arguments to o{s|g}etrlimit are corresponding the prototypes.
Pointed out by: bde
|
#
49626 |
|
11-Aug-1999 |
marcel |
Do not map {s|g}etrlimit onto FreeBSD syscalls. The arguments don't match. The linux syscalls translate the arguments first before invoking the FreeBSD native syscalls.
PR: kern/9591 Originator: John Plevyak <jplevyak@inktomi.com>
|
#
49523 |
|
08-Aug-1999 |
marcel |
Fix page fault in linux_uselib syscall.
PR: 12910 Submitted by: Peter Holm <peter@holm.cc>
|
#
48595 |
|
05-Jul-1999 |
marcel |
Let newuname return "Linux" as the OS name and not "FreeBSD". Also, return a more sensible (for Linux applications) release number. Hardcoding a release number has its drawbacks, but it will do for now.
|
#
46571 |
|
06-May-1999 |
peter |
Fix up a few easy 'assignment used as truth value' and 'suggest parens around && within ||' type warnings. I'm pretty sure I have not masked any problems here, I've committed real problem fixes seperately.
|
#
46129 |
|
27-Apr-1999 |
luoqi |
Enable vmspace sharing on SMP. Major changes are, - %fs register is added to trapframe and saved/restored upon kernel entry/exit. - Per-cpu pages are no longer mapped at the same virtual address. - Each cpu now has a separate gdt selector table. A new segment selector is added to point to per-cpu pages, per-cpu global variables are now accessed through this new selector (%fs). The selectors in gdt table are rearranged for cache line optimization. - fask_vfork is now on as default for both UP and SMP. - Some aio code cleanup.
Reviewed by: Alan Cox <alc@cs.rice.edu> John Dyson <dyson@iquest.net> Julian Elischer <julian@whistel.com> Bruce Evans <bde@zeta.org.au> David Greenman <dg@root.com>
|
#
46116 |
|
27-Apr-1999 |
phk |
Change suser_xxx() to suser() where it applies.
|
#
46112 |
|
27-Apr-1999 |
phk |
Suser() simplification:
1: s/suser/suser_xxx/
2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>.
3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/
The remaining suser_xxx() calls will be scrutinized and dealt with later.
There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce.
More changes to the suser() API will come along with the "jail" code.
|
#
45821 |
|
19-Apr-1999 |
peter |
unifdef -DVM_STACK - it's been on for a while for x86 and was checked and appeared to be working for the Alpha some time ago.
|
#
44384 |
|
01-Mar-1999 |
julian |
Fix thread/process tracking and differentiation for Linux threads emulation.
Submitted by: Richard Seaman, Jr." <dick@tar.com>
Also clean some compiler warnings in surrounding code.
|
#
43208 |
|
26-Jan-1999 |
julian |
Enable Linux threads support by default. This takes the conditionals out of the code that has been tested by various people for a while. ps and friends (libkvm) will need a recompile as some proc structure changes are made.
Submitted by: "Richard Seaman, Jr." <dick@tar.com>
|
#
42360 |
|
06-Jan-1999 |
julian |
Add (but don't activate) code for a special VM option to make downward growing stacks more general. Add (but don't activate) code to use the new stack facility when running threads, (specifically the linux threads support). This allows people to use both linux compiled linuxthreads, and also the native FreeBSD linux-threads port.
The code is conditional on VM_STACK. Not using this will produce the old heavily tested system.
Submitted by: Richard Seaman <dick@tar.com>
|
#
42185 |
|
30-Dec-1998 |
sos |
Commit #2 of
PR: 9235 Submitted by: marcel@scc.nl <Marcel Moolenaar>
|
#
42054 |
|
24-Dec-1998 |
julian |
According to the author..
"I've been having a problem running the patches [committed to current] installed with the COMPAT_LINUX_THREADS option along with the VM_STACK patches I did. I'm not sure what the problem is, since it seemed to work before.
In any event, the attached patch fixes the problem for me. While I've had no report of problems from anyone else, possibly it would be wise to commit the patch until the problem is found.
Also, there was some left-over junk in the linux_misc.c file from some earlier work I did. The attached patch cleans that up too."
Submitted by: "Richard Seaman, Jr." <dick@tar.com>
|
#
41931 |
|
19-Dec-1998 |
julian |
Reviewed by: Luoqi Chen, Jordan Hubbard Submitted by: "Richard Seaman, Jr." <lists@tar.com> Obtained from: linux :-)
Code to allow Linux Threads to run under FreeBSD.
By default not enabled This code is dependent on the conditional COMPAT_LINUX_THREADS (suggested by Garret) This is not yet a 'real' option but will be within some number of hours.
|
#
41650 |
|
10-Dec-1998 |
jkh |
linux_pipe does not preserve the edx register. Linux and programs using glibc expect edx to be preserved accross syscalls. As a result, linux programs running in emulation mode can have whatever value may be represented by edx clobbered.
PR: 9038 Submitted-By: Richard Seaman, Jr. <dick@tar.com>
|
#
41514 |
|
04-Dec-1998 |
archie |
Examine all occurrences of sprintf(), strcat(), and str[n]cpy() for possible buffer overflow problems. Replaced most sprintf()'s with snprintf(); for others cases, added terminating NUL bytes where appropriate, replaced constants like "16" with sizeof(), etc.
These changes include several bug fixes, but most changes are for maintainability's sake. Any instance where it wasn't "immediately obvious" that a buffer overflow could not occur was made safer.
Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Mike Spengler <mks@networkcs.com>
|
#
39977 |
|
05-Oct-1998 |
sos |
In linux_newuname bzero the right type of struct (linux_newuname_t).
|
#
39620 |
|
24-Sep-1998 |
jkh |
MF22: revert time bogon.
|
#
39598 |
|
23-Sep-1998 |
jkh |
return time in proper format for linux.
|
#
38354 |
|
15-Aug-1998 |
bde |
Use [u]intptr_t instead of [u_]long for casts between pointers and integers. Don't forget to cast to (void *) as well.
|
#
38127 |
|
05-Aug-1998 |
bde |
Converted the second last instance of hzto() to tvtohz().
Fixed nearby bugs (in linux_alarm()): - the itimer for the alarm was relative to the epoch instead of relative to the boot time. This was harmless because the itimer's interval is 0. - the seconds arg was not checked for validity before converting it to a possibly different value. - printf format errors.
Improvements: Don't use splclock(). splsoftclock() suffices. Don't complicate things by micro-optimizing interrupt latency.
Minor improvements: Various micro-optimizations to exploit the specialness of the alarm itimer and the value 0.
|
#
37950 |
|
29-Jul-1998 |
bde |
Fixed print format errors.
|
#
37548 |
|
10-Jul-1998 |
jkh |
Quick and dirty support for Linux's mremap. Not used by anything but quake2 AFAIK.
Submitted by: Luoqi Chen <luoqi@watermarkgroup.com>
|
#
36119 |
|
17-May-1998 |
phk |
s/nanoruntime/nanouptime/g s/microruntime/microuptime/g
Reviewed by: bde
|
#
35058 |
|
06-Apr-1998 |
phk |
Make a kernel version of the timer* functions called timerval* to be more consistent.
OK'ed by: bde
|
#
35034 |
|
04-Apr-1998 |
phk |
Use microruntime() rather than doing it by hand.
|
#
34961 |
|
30-Mar-1998 |
phk |
Eradicate the variable "time" from the kernel, using various measures. "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part.
Most uses of time.tv_sec now uses the new variable time_second instead.
gettime() changed to getmicrotime(0.
Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it).
A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random.
Add a new nfs_curusec() function.
Mark a couple of bogosities involving the now disappeard time variable.
Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args.
Change profiling in ncr.c to use ticks instead of time. Resolution is the same.
Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences.
Reviewed by: bde
|
#
33821 |
|
25-Feb-1998 |
bde |
Removed redundant test against MAXDSIZ (the rlimit test is stronger).
|
#
30994 |
|
06-Nov-1997 |
phk |
Move the "retval" (3rd) parameter from all syscall functions and put it in struct proc instead.
This fixes a boatload of compiler warning, and removes a lot of cruft from the sources.
I have not removed the /*ARGSUSED*/, they will require some looking at.
libkvm, ps and other userland struct proc frobbing programs will need recompiled.
|
#
30855 |
|
30-Oct-1997 |
kato |
Securelevel and formatting fixes, and trapframe simplification.
Reviewed by: sos Submitted by: bde
|
#
30837 |
|
29-Oct-1997 |
kato |
Implement linux_iopl and linux_nice.
|
#
29679 |
|
21-Sep-1997 |
gibbs |
Update for changes in the callout interface.
|
#
27557 |
|
20-Jul-1997 |
bde |
Removed unused #includes.
|
#
25219 |
|
28-Apr-1997 |
msmith |
Always include PROT_READ for Linux mmap operations. Submitted by: Hannu Savolainen <hannu@voxware.pp.fi> via jkh
|
#
24478 |
|
01-Apr-1997 |
bde |
Removed potentially harmful garbage <vm/lock.h> and fixed bogus use of it. It was actually harmless because the use was null due to fortuitous include orders and identical (wrong) idempotency macros.
|
#
24203 |
|
24-Mar-1997 |
bde |
Don't include <sys/ioctl.h> in the kernel. Stage 1: don't include it when it is not used. In most cases, the reasons for including it went away when the special ioctl headers became self-sufficient.
|
#
24131 |
|
23-Mar-1997 |
bde |
Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined. Fixed everything that depended on getting fcntl.h stuff from the wrong place. Most things don't depend on file.h stuff at all.
|
#
22975 |
|
22-Feb-1997 |
peter |
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not ready for it yet.
|
#
22543 |
|
10-Feb-1997 |
mpp |
Make this compile again after the Lite2 merge.
VOP_UNLOCK was being called with the wrong mumber of arguments.
Also silenced a -Wall warning.
|
#
22521 |
|
10-Feb-1997 |
dyson |
This is the kernel Lite/2 commit. There are some requisite userland changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes.
The system boots and can mount UFS filesystems.
Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed.
Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
|
#
21673 |
|
14-Jan-1997 |
jkh |
Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
|
#
16322 |
|
12-Jun-1996 |
gpalmer |
Clean up -Wunused warnings.
Reviewed by: bde
|
#
15538 |
|
02-May-1996 |
phk |
First pass at cleaning up macros relating to pages, clusters and all that.
|
#
15117 |
|
07-Apr-1996 |
bde |
Removed never-used #includes of <machine/cpu.h>. Many were apparently copied from bad examples.
|
#
14703 |
|
19-Mar-1996 |
bde |
Fixed unsigned longs that should have been vm_offset_t.
vm_offset_t is currently unsigned long but should probably be plain unsigned for i386's to match the choice of minimal types to represent for fixed-width types in Lite2. Anyway, it shouldn't be assumed to be unsigned long.
I only fixed the type mismatches that were detected when I changed vm_offset_t to unsigned. Only pointer type mismatches were detected.
|
#
14584 |
|
12-Mar-1996 |
peter |
Remove references to MAP_FILE.. That is now "default" and is only a "#define MAP_FILE 0" that is still there for net-2 source compatability.
|
#
14471 |
|
10-Mar-1996 |
peter |
Fix the vm_map_remove and vm_map_protect calls.. Somewhere along the line, these had got (start, length) arguments instead of (start, end) args. This could be the cause of Robert Sanders lockups with ZMAGIC binaries.
|
#
14381 |
|
04-Mar-1996 |
peter |
update linux_times() and linux_utime() emulation, fix sigsuspend() (actually back out my recent change there) and regen the syscall tables..
|
#
14331 |
|
02-Mar-1996 |
peter |
Mega-commit for Linux emulator update.. This has been stress tested under netscape-2.0 for Linux running all the Java stuff. The scrollbars are now working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386 machine dependent section into the linux emulator itself. The int 0x80 syscall code was almost identical to the lcall 7,0 code and a minor tweak allows them to both be used with the same C code. All kernels can now just modload the lkm and it'll DTRT without having to rebuild the kernel first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(), readv(), writev(), msync(), personality(). The Linux-ELF libraries want to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in syscalls.. eg: mixups between passing the sigset as an int, vs passing it as a pointer and doing a copyin(), missing return values, unhandled cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately below the top of the stack (below PS_STRINGS). This allows the different binary emulations to have their own signal trampoline code (which gets rid of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so that the emulator can provide the exact "struct sigcontext *" argument to the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which have the same values as the re-used SA_DISABLE and SA_ONSTACK which are intended for sigaction only. This enables the support of a SA_RESETHAND flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the generated init_sysent.c code. It's a lot saner to have it in a seperate file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied to the top of the user's stack, rather than obtaining the trampoline code the old way by getting a clone of the parent's user area. This allows Linux and native binaries to freely exec each other without getting trampolines mixed up.
|
#
14114 |
|
16-Feb-1996 |
peter |
This is an extract of changes from what I am currently running... - Optimise the linux a.out loading and uselib system calls so they take advantage of some of John's recent interface improvements. Basically, this means they make far less map changes than before. - Attempt to plug some potentially nasty kernel_map memory leaks.. - Improve support for QMAGIC libs (I only use QMAGIC (ie: a.out libraries from the slackware 3.0 dist) but this depends on other changes to enhance the /compat/linux support) - uselib goes out through a single exit as part of the resource tracking that I did when closing the resource leaks on errors. This could be cleaner than what I did, but making a 30-deep nested if/else was not my idea of fun, neither did I want to repeat the same code 30 times over for each failure possibility. I guess this function needs to be split into smaller functions to solve this.
I've been running the Linux Netscape-2.0 (with Java) to test this, and apart from the long-standing problem with the missing scrollbars, it appears to still work as before with ZMAGIC libs (and the leaks).. However, I've been using it with mods for the signal trampoline code for native linux stack frames on signals and exterminated the blasted sigreturn printf() problem, so I can't be certain that there is not a dependency on something else.
|
#
13503 |
|
19-Jan-1996 |
dyson |
Fixed vm_map_find for new vm updates.
|
#
13420 |
|
14-Jan-1996 |
sos |
Add linux_mknod so that it will do mkfifo if needed...
|
#
12860 |
|
15-Dec-1995 |
peter |
Initial attempt at getting Linux QMAGIC shared lib support. I have successfully run linux netscape 2.0b3 with a QMAGIC ld.so and libc/libm that I found on some linux machine that I _think_ is running slackware 3.0.
There are still problems.. ld.so claims the libraries are the wrong format, but it still runs anyway.. :-/ The QMAGIC ld.so also screams about needing ld.so.cache, and running a linux ldconfig is quite educational. You soon learn to run "chroot /compat/linux /bin/ldconfig" where ldconfig is living in /compat/linux/bin. :-]
(Lets just say that it puts loads of symlinks in /usr/lib otherwise :-)
|
#
12858 |
|
15-Dec-1995 |
peter |
Clean up some warnings by using the generated structures in <sys/sysproto.h> for passing to the bsd system calls, rather than inveninting our own equivalent structures.
|
#
12842 |
|
14-Dec-1995 |
bde |
Restored a vm #include.
|
#
12689 |
|
09-Dec-1995 |
peter |
Attempt to make the Linux LKM compile again after the recent VM include de-nesting changes... (I figured this might be usefulif it actually built, since I've told everybody to rebuild it or die.. :-)
|
#
12652 |
|
06-Dec-1995 |
bde |
Include <vm/vm.h> explicitly to avoid breaking when vnode_if.h doesn't include vm stuff.
|
#
12458 |
|
22-Nov-1995 |
bde |
Completed function declarations and added prototypes.
Removed some unnecessary #includes.
Fixed warnings about nested externs.
|
#
12130 |
|
06-Nov-1995 |
dg |
All: Changed vnodep -> vp for consistency with the rest of the kernel, and changed iparams -> imgp for brevity.
kern_exec.c: Explicitly initialized some additional parts of the image_params struct to avoid bzeroing it. Rewrote the set-id code to reduce the number of logical tests. The rewrite exposed a mostly benign bug in the algorithm: traced set-id images would get ktracing disabled even if the set-id didn't happen for other reasons.
|
#
11163 |
|
04-Oct-1995 |
julian |
Submitted by: Juergen Lock <nox@jelal.hb.north.de> Obtained from: other people on the net ?
1. stepping over syscalls (gdb ni) sends you to DDB, and returned to the wrong address afterwards, with or without DDB. patch in i386/i386/trap.c below.
2. the linux emulator (modload'ed) still causes panics with DIAGNOSTIC, re-applied a patch posted to one of the lists...
|
#
9313 |
|
25-Jun-1995 |
sos |
First incarnation of our Linux emulator or rather compatibility code. This first shot only incorporaties so much functionality that DOOM can run (the X version), signal handling is VERY weak, so is many other things. But it meets my milestone number one (you guessed it - running DOOM).
Uses /compat/linux as prefix for loading shared libs, so it won't conflict with our own libs.
Kernel must be compiled with "options COMPAT_LINUX" for this to work.
|