| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Pre-rfork code assumed inherent locking of a process's file descriptor
array. However, with the advent of rfork() the file descriptor table
could be shared between processes. This patch closes over a dozen
serious race conditions related to one thread manipulating the table
(e.g. closing or dup()ing a descriptor) while another is blocked in
an open(), close(), fcntl(), read(), write(), etc...
PR: kern/11629
Discussed with: Alexander Viro <viro@math.psu.edu>
|
| |
|
| |
|
|
|
|
| |
trailing options.
|
| |
|
|
|
|
|
|
| |
gcc's internal exit() prototypes and the (futile) hackery that we did to
try and avoid warnings. main() was renamed for similar reasons.
Remove an exit related hack from makesyscalls.sh.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the gating of system calls that cause modifications to the underlying
filesystem. The gating can be enabled by any filesystem that needs
to consistently suspend operations by adding the vop_stdgetwritemount
to their set of vnops. Once gating is enabled, the function
vfs_write_suspend stops all new write operations to a filesystem,
allows any filesystem modifying system calls already in progress
to complete, then sync's the filesystem to disk and returns. The
function vfs_write_resume allows the suspended write operations to
begin again. Gating is not added by default for all filesystems as
for SMP systems it adds two extra locks to such critical kernel
paths as the write system call. Thus, gating should only be added
as needed.
Details on the use and current status of snapshots in FFS can be
found in /sys/ufs/ffs/README.snapshot so for brevity and timelyness
is not included here. Unless and until you create a snapshot file,
these changes should have no effect on your system (famous last words).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
instead of a struct iovec * array and int len. Get rid of stupidly trying
to allocate all of the memory and copyin()ing the entire iovec[], and
instead just do the proper VOP_WRITE() in ktrwrite() using a copy of
the struct uio that the syscall originally used.
This solves the DoS which could easily be performed; to work around the
DoS, one could also remove "options KTRACE" from the kernel. This is
a very strong MFC candidate for 4.1.
Found by: art@OpenBSD.org
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1) while allocating a uidinfo struct malloc is called with M_WAITOK,
it's possible that while asleep another process by the same user
could have woken up earlier and inserted an entry into the uid
hash table. Having redundant entries causes inconsistancies that
we can't handle.
fix: do a non-waiting malloc, and if that fails then do a blocking
malloc, after waking up check that no one else has inserted an entry
for us already.
2) Because many checks for sbsize were done as "test then set" in a non
atomic manner it was possible to exceed the limits put up via races.
fix: instead of querying the count then setting, we just attempt to
set the count and leave it up to the function to return success or
failure.
3) The uidinfo code was inlining and repeating, lookups and insertions
and deletions needed to be in their own functions for clarity.
Reviewed by: green
|
|
|
|
|
|
| |
It was not discussed and should probably not happen.
Requested by: msmith and others
|
|
|
|
|
|
|
|
| |
the type argument to *_HEAD and *_ENTRY is a struct.
Suggested by: phk
Reviewed by: phk
Approved by: mdodd
|
|
|
|
|
| |
regeneration which somehow used the wrong syscalls.master file,
resulting in unbuildable svr4_sysent.c).
|
|
|
|
|
|
| |
expects the active id to be on the first line of the specification file.
Fixed some nearby gratuitous differences with kern/syscalls.master.
|
| |
|
|
|
|
| |
to generate it.
|
|
|
|
|
| |
all emulators. These entries were unused, so the bug had no effect, but
the the args struct tag will be used to calculate sy_nargs correctly.
|
|
|
|
|
| |
"svr4elf" module. This unbreaks the SVR4 KLD (which had an undefined
function because of thenewly-committed KLD enhancements).
|
|
|
|
| |
Generated by: src/tools/tools/kerninclude
|
| |
|
|
|
|
| |
Remove ~60 unneeded #include <sys/malloc.h>
|
|
|
|
|
| |
Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
maintainers.
After we established our branding method of writing upto 8 characters of
the OS name into the ELF header in the padding; the Binutils maintainers
and/or SCO (as USL) decided that instead the ELF header should grow two new
fields -- EI_OSABI and EI_ABIVERSION. Each of these are an 8-bit unsigned
integer. SCO has assigned official values for the EI_OSABI field. In
addition to this, the Binutils maintainers and NetBSD decided that a better
ELF branding method was to include ABI information in a ".note" ELF
section.
With this set of changes, we will now create ELF binaries branded using
both "official" methods. Due to the complexity of adding a section to a
binary, binaries branded with ``brandelf'' will only brand using the
EI_OSABI method. Also due to the complexity of pulling a section out of an
ELF file vs. poking around in the ELF header, our image activator only
looks at the EI_OSABI header field.
Note that a new kernel can still properly load old binaries except for
Linux static binaries branded in our old method.
*
* For a short period of time, ``ld'' will also brand ELF binaries
* using our old method. This is so people can still use kernel.old
* with a new world. This support will be removed before 5.0-RELEASE,
* and may not last anywhere upto the actual release. My expiration
* time for this is about 6mo.
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
of 4 longs used as a bitmask. sv4r4_sigfillset has been broken for a
while, probably since rev 1.5.
This patch fixes SVR4_NSIG (i.e.: sets it to the actual number of signals,
instead of the number of bits in the mask) because some SysVR4 clients
honestly seem to care about whether bits in the signal mask are set for
non-existant signals.
Additionally, the svr4_sigfillset macro has been replaced by a
fully fledged function, because the macro didn't actually work
(it returned an all-ones mask, but we don't want that: we want 0's
set where FreeBSD doesn't actually have a signal which is the same
as an SysVR4 signal, for example).
SysVR4 clients can now successfully ignore signals, although catching
them remains problematic (see commit log message for rev1.13 of
sys/i386/svr4/svr4_machdep.c for more info).
|
| |
|
|
|
|
|
|
| |
included in all C files if it makes sense (i.e., for compiling kernels
but not for compiling modules), so including it explicitly just
complicates module makefiles.
|
|
|
|
| |
NDFREE() macro from namei.h will be happy.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
differences between the VFS interface between FreeBSD and NetBSD make
it easier to pick up the Linux one than to continue development with the
NetBSD port.
This patch fixes a bug which caused duplicate filenames to be seen by
callers to svr4_sys_getdents64(), leading to malformed directory listings
from Solaris client programs.
Obtained from: The Linuxulator, with a pointer from marcel
|
|
|
|
|
|
| |
Only look up the provided descriptor in fd_ofiles[] once.
Submitted by: Ville-Pertti Keinone <will@iki.fi>
|
|
|
|
|
|
| |
socket. Return EINVAL instead.
Submitted by: Ville-Pertti Keinone <will@iki.fi>
|
|
|
|
| |
Prodded by: phk
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
opt_global.h and opt_svr4.h, instead of from the command line. This
brings them in-line with most of the rest of the kernel.
svr4_ioctl.c has also failed to compile with debugging for a while
now; fixed by adding systm.h and socketvar.
Some svr4 source files are automatically generated from syscalls.master;
these have been committed as consequential changes, otherwise everyone
will have to "make svr4_sysent.c".
Changes:
sys/svr4/svr4.h include opt_global.h and opt_svr4.h
sys/svr4/svr4_ioctl.c include svr4.h, sys/systm.h and sys/socketvar.h
sys/svr4/svr4_ipc.c include svr4.h
sys/svr4/svr4_resource.c include svr4.h
sys/svr4/svr4_socket.c include svr4.h
sys/svr4/svr4_ttold.c include svr4.h
sys/svr4/syscalls.master include svr4.h
sys/svr4/svr4_syscallnames.c dependent on syscalls.master
sys/svr4/svr4_sysent.c dependent on syscalls.master
sys/svr4/svr4_syscall.h dependent on syscalls.master
sys/svr4/svr4_proto.h dependent on syscalls.master
sys/modules/svr4/Makefile create opt_global.h and opt_svr4.h
|
|
|
|
|
|
|
|
|
|
|
|
| |
with NetBSD and the Single Unix Specification v2.
This updates some structures with other, almost equivalent types and
effort is under way to get the whole more consistent.
Also removes a double definition of INET6 and some other clean-ups.
Reviewed by: green, bde, phk
Some part obtained from: NetBSD, SUSv2 specification
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
phk's script walked through .c and .h files, but some of the ones on
the list are actually derived from sys/svr4/syscalls.master. Make
the necessary changes here and the others will implicitly follow...
Submitted by: phk
|
|
|
|
| |
Submitted by: phk
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
can provide the correct context to each signal handler.
Fix broken sigsuspend(): don't use p_oldsigmask as a flag, use SAS_OLDMASK
as we did before the linuxthreads support merge (submitted by bde).
Move ps_sigstk from to p_sigacts to the main proc structure since signal
stack should not be shared among threads.
Move SAS_OLDMASK and SAS_ALTSTACK flags from sigacts::ps_flags to proc::p_flag.
Move PS_NOCLDSTOP and PS_NOCLDWAIT flags from proc::p_flag to procsig::ps_flag.
Reviewed by: marcel, jdp, bde
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Move intrhook stuff into kernel.h
- Remove all occurrences of #device <device.h>
- Add kernel.h were necessary (nowhere)
- delete device.h
This file contained the structures for cfdata (old style config) and is no
longer used. It was included by most drivers.
It confuses the remote debugger as the definition of 'struct device' in
device.h is found before the one in bus_private.h.
|
|
|
|
|
| |
one trigraph with another, or completely missed the point. Kill it for
real this time.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-----------------------------
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make the alias list a SLIST.
Drop the "fast recycling" optimization of vnodes (including
the returning of a prexisting but stale vnode from checkalias).
It doesn't buy us anything now that we don't hardlimit
vnodes anymore.
Rename checkalias2() and checkalias() to addalias() and
addaliasu() - which takes dev_t and udev_t arg respectively.
Make the revoke syscalls use vcount() instead of VALIASED.
Remove VALIASED flag, we don't need it now and it is faster
to traverse the much shorter lists than to maintain the
flag.
vfs_mountedon() can check the dev_t directly, all the vnodes
point to the same one.
Print the devicename in specfs/vprint().
Remove a couple of stale LFS vnode flags.
Remove unimplemented/unused LK_DRAINED;
|
|
|
|
|
|
| |
pathname translation.
Submitted by: green
|
|
|
|
| |
svr4_sys_sendto() which probably shouldn't have been 'const'.
|
|
|
|
|
|
| |
related to the commit for rev 1.3 of svr4_stat.c.
svr4_sysvec.c also received a copyright message (which is why it grew by
28 lines).
|
|
|
|
|
| |
BSD sockets don't. Guess at a correct emulation for those values (it seems
to work for telnet, ftp and friends)
|