9027 Commits

Author SHA1 Message Date
alfred
4ca8b29bef In calcru, we make sure the thread's state is correct, however we
do not emit the thread or proc information making debugging this
assertion difficult.

Emit the thread/proc that caused the KASSERT to fail to ease debugging.

Note: this assert does not exist in later branches of FreeBSD.
2008-03-15 03:20:53 +00:00
rwatson
dd9a067a69 Merge uipc_sem.c:1.30 from HEAD to RELENG_6:
Free MAC label on a POSIX semaphore when the semaphore is freed.

  Submitted by:   jhb
2008-03-01 11:43:01 +00:00
obrien
1adb54c02d Back out MFC of "eradicate caddr_t".
Turn's out Kris' suspisions were right - from a suttle code compatability
point of view.  Robert Watson found that ARLA code had something like this:
	typedef int (*foo_t)(caddr_t); ... foo_t fred;
The compile gets all snarky when it finds int fred(void *) { .. }.
2008-02-26 18:19:49 +00:00
obrien
e7c1685e3e MFC: Eradicate caddr_t from the VFS API. 2008-02-25 08:55:02 +00:00
simon
926347d060 Fix sendfile(2) write-only file permission bypass.
Security:	FreeBSD-SA-08:03.sendfile
2008-02-14 11:46:08 +00:00
remko
8b13a4d96d MFC rev 1.264 init_main.c
The VERBOSE_SYSINIT stuff sees the DDB define a lot better if we include
  opt_ddb.h.

  Spotted by:	benno
  Pointy hat to:	benno

Approved by:	imp (mentor)
PR:		kern/119288
Submitted by:	"Dan Lukes" <dan at obluda dot cz>
2008-02-13 16:41:26 +00:00
jhb
f3b20660fb MFC: Move several data structure definitions out of freebsd32_misc.c and
into freebsd32.h and freebsd32_ipc.h.
2007-12-19 23:03:02 +00:00
kib
542a731b22 MFC rev. 1.181:
Check for the program headers alignment of the ELF images before
dereferencing. Unaligned access could cause panic on strict alignment
architectures.

Approved by:	re (kensmith)
2007-12-07 14:30:26 +00:00
thompsa
e99369996b MFC r1.209
Apply a workaround for the unkillable jail problem where some devices created
  within the jail are never freed.

Approved by:	re (kensmith)
2007-12-07 03:46:23 +00:00
jhb
a6256653d9 MFC: Add kern_msgsnd() and kern_msgrcv() and use them to fix msgsnd()
and msgrcv() in 32-bit ABIs on 64-bit kernels.
2007-12-06 22:00:05 +00:00
rwatson
82be387181 Call NET_LOCK_GIANT/NET_UNLOCK_GIANT around calls to protocol drain
methods in mb_reclaim().  This is not an MFC, as debug.mpsafenet is
not present in 7.x or 8.x.  In practice, this likely resulted in
instability only on kernels with INVARIANTS, as the protocol drain
paths are generally MPSAFE.

PR:		116034
Reported by:	Dan Lukes <dan@obluda.cz>
Discussed with:	kmacy, alc
Approved by:	re (kensmith)
Tested by:	Eugene Grosbein <eugen at grosbein dot pp dot ru>
2007-12-05 00:00:10 +00:00
jhb
f107dfa8f5 MFC: Sync up SYSV IPC with HEAD some:
- Add kern_semctl() and use it for Linux, IBCS2, and SVR4 ABIs.
- Don't pass a bufsz pointer to kern_shmctl() for operations that don't
  need it.
- Add module dependencies for SYSV IPC modules to IBCS2 and SVR4.
- Use kern_shmctl() in SVR4.
- Use kern_msgctl(), kern_semctl(), and kern_shmctl() in IBCS2.
- Mark linux_ipc(), svr4_sys_shmsys(), and svr4_sys_semsys() MPSAFE.
2007-12-03 21:53:23 +00:00
jhb
d50340de24 MFC 1.109: Remove call to ipcperm() in shmget_existing(). 2007-12-03 21:47:33 +00:00
jhb
26a5aec9dd MFC: Bump up the number of ttys supported by pty(4) to 512.
Approved by:	re (kensmith)
2007-11-27 18:43:09 +00:00
dumbbell
4e5890fc70 The fix for blocked select/poll/kqueue (rev 1.184.2.3) wasn't applied
correctly: one line was missing.

Approved by:	re (kensmith)
2007-11-25 17:31:42 +00:00
dumbbell
26e45320a5 MFC 1.193:
The kernel uses two ways to write data on a pipe:
      o  buffered write, for chunks smaller than PIPE_MINDIRECT bytes
      o  direct write, for everything else

  A call to writev(2) may receive struct iov of various size and the
  kernel may have to switch from one solution to the other. Before doing
  this, it must wake reader processes and any select/poll/kqueue up.

  This commit fixes a bug where select/poll/kqueue are not triggered
  when switching from buffered write to direct write. It adds calls to
  pipeselwakeup().

  I give more details on freebsd-arch@:
  http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html

  This should fix issues with Erlang (lang/erlang) and kqueue.

Reported by:	Rickard Green (Erlang)
Approved by:	re (kensmith)
2007-11-25 11:54:27 +00:00
rwatson
6b59c6623b Merge kern_proc.c:1.255 from HEAD to RELENG_6:
Test that p_textvp is non-NULL be dereferencing, as no executable vnode is
  set for kernel processes.

  Reported by:    Skip Ford <skip at menantico dot com>

Approved by:    re (kensmith)
2007-11-24 19:45:57 +00:00
jb
a1dd99d2f5 MFC Add pathname to the linker_file structure. 2007-11-18 00:15:32 +00:00
jhb
6f26eff25b MFC: Make it easier to add more ptys to the pty(4) driver.
Approved by:	re (kensmith)
2007-11-15 20:20:54 +00:00
julian
f6218756ff MFC of un-neede singl-threading code. 2007-11-06 03:01:32 +00:00
phk
9291e301e6 MFC:
bus_alloc_resources() convenience API
2007-11-05 11:49:44 +00:00
csjp
95075604ca MFC revision 1.350, move where we audit the PID to ensure that it gets
audited even if it's invalid.
2007-11-04 18:22:25 +00:00
jhb
f62ca665b2 MFC 1.55: Fix another edge case in rman_manage_region() that could result
in the the resource list getting missorted.
2007-11-02 19:00:06 +00:00
emaste
a95f700077 MFC to RELENG_6 part of kern_intr.c revision 1.142:
- Don't do the interrupt storm protection stuff for software interrupt
    handlers.
2007-10-29 21:10:03 +00:00
cognet
62c34d6b2a Oops. Remove a debug printf.
Spotted out by:	delphij
2007-10-16 21:32:19 +00:00
cognet
82ceddb921 Use 16 - 1 instead of 16 as the align argument of uma_zcreate(), as it's
what is expected.
2007-10-16 21:10:26 +00:00
jhb
9ad5f6f445 MFC: Always use an exclusive lock on the leaf vnode during an open() when
shared lookups are enabled.  This closes a few races including a race where
concurrent opens of a fifo could result in different v_fifoinfo structures
in different threads.
2007-10-03 21:06:05 +00:00
jhb
3c7672b104 Remove the *_queue() variants of various sleepq and turnstile functions
and always require the queue to be specified to reduce diffs with HEAD.
These APIs are internal APIs only used to implement higher level primitives
such as locks and condition variables.

Approved by:	alfred
2007-09-27 20:24:56 +00:00
jhb
1248dc42fa MFC some comment updates to account for multi-queue support missed earlier
as well as a few other changes (whitespace, style, etc.) to reduce diffs
with HEAD.
2007-09-27 18:44:16 +00:00
jhb
bf60b344e1 - Remove some debugging nits in the MFC of rwlocks that looked for cases
where a reader blocked on a lock with no owner and just assert that it
  never happens like HEAD.
- Actually set td->td_tsqueue to the sub-queue of a turnstile that a
  thread is actually enqueued to.  Otherwise, the kernel would always
  think that threads were on the queue for exclusive (write) waiters
  (queue 0).  Thus, if the priority of a thread waiting on a read lock
  was adjusted while it was waiting it could result in corrupting the
  queue of waiting threads.
2007-09-27 18:39:18 +00:00
jhb
f8d0499c66 MFC 1.167: Use a UMA zone to handle the turnstile objects rather than
malloc(9).
2007-09-27 18:23:44 +00:00
jhb
a4cadc0209 Make td_sqqueue a char and move it into a pre-existing "hole" from
alignment padding to restore the ABI of 'struct thread' in 6.x.
2007-09-27 18:12:25 +00:00
jhb
bcef6cfce9 - Restore the 'show sleepq' DDB command.
- Trim some extra includes.
2007-09-27 18:10:40 +00:00
jhb
5c87605e74 Use lock_init() and lock_destroy(). 2007-09-27 18:08:09 +00:00
jhb
532b026a40 A few tweaks to reduce diffs with HEAD including using lock_init() and
lock_destroy() and adding a missing #include so that NO_ADAPTIVE_RWLOCKS
is honored.
2007-09-27 18:06:49 +00:00
obrien
fb0af2dfab MFC: new kernel config option, VERBOSE_SYSINIT.
(kern/init_main.c rev. 1.263)
2007-09-14 22:44:37 +00:00
alfred
d85be45214 FreeBSD 7 has a macro that converts calls to sx_init -> sx_init_flags,
however FreeBSD 6 needs this as a function to preserve binary compat.

Pointed out by: kmacy
2007-09-10 23:43:52 +00:00
alfred
6df6b1c5ea Remove/refactor calls to turnstile_release() as it turns out that
turnstile_unpend_queue() drops the lock that turnstile_release()
does.  This was triggering a mtx_unlock() of an already unlocked
mutex panic.

Obtained from: Juniper Networks
2007-09-05 22:18:39 +00:00
alfred
7740e0f542 Unbreak "options DDB" breakage from previous commit. 2007-09-05 17:38:28 +00:00
alfred
bf462b58be Backport of optimized sx locks and rwlocks from FreeBSD 7.0.
Reviewed by: attilio, jhb
Obtained from: Juniper Networks
2007-09-04 22:40:40 +00:00
jinmei
94c889fde1 MFC:
Fix a kernel panic based on receiving an ICMPv6 Packet too Big message.
  (MFC was planned but has been missed)

PR:		99779
Submitted by:	Jinmei Tatuya
Reviewed by:	clement, rwatson
Approved by:	gnn (mentor)

src/sys/kern/uipc_socket.c:	1.280
2007-08-23 18:17:08 +00:00
njl
0e4a0c6c62 MFC 1.26 and 1.27: use proper loop variables and sched_bind() behavior 2007-08-22 04:55:05 +00:00
cvs2svn
c37f50f631 This commit was manufactured by cvs2svn to create branch 'RELENG_6'. 2007-08-18 04:08:54 +00:00
jhb
153695bbdc MFC 1.87: Avoid manipulating semu_list outside of the scope of
SEMUNDO_LOCK().  This would lead to an occasional hang with a cycle in
semu_list.
2007-08-08 16:42:47 +00:00
kib
b06a1c7235 MFC rev. 1.273, submitted by peter:
Change kn_hook value from cdev to struct tty to avoid dereferencing freed
cdev.
In ttygone(), wake up select(), sigio and kevent() users in addition
to the queue sleepers.
Return EV_EOF from kevent filters if TS_GONE is set.
2007-08-03 14:24:38 +00:00
jhb
31ca82f7fe MFC: Close race conditions between fork() and [sg]etpriority()'s
PRIO_USER case, and possibly also other places that deference p_ucred.
2007-07-19 18:46:32 +00:00
netchild
47a37c3274 MFC (3 of X):
- In preparation of further linuxulator fixes MFC kern_descrip.c rev 1.296 and
   syscallsubr.h rev 1.41 by jhb:
   Add a kern_close() so that the ABIs can close a file descriptor w/o having
   to populate a close_args struct and change some of the places that do.

Tested by:	scf (i386, as part of a mega-MFC-patch),
		Arno J. Klaassen <arno@heho.snv.jussieu.fr> (amd64)
2007-07-08 08:44:48 +00:00
jhb
27111628aa MFC 1.306: Conditionally acquire Giant when dropping a reference on the
ktrace vnode during execve().
2007-06-25 23:58:46 +00:00
emaste
149b7332ae MFC compat32 argument to do_wait() to make it use fuword32() for readling
longs from 32 bit processes.

Submitted by:	jhb
2007-06-23 19:18:50 +00:00
jhb
9d52499b7d MFC: Support for running 32-bit multithreaded binaries using libthr on
amd64 including:
- Add 32-bit wrappers for thr_new(), thr_suspend(), and the umtx system
  calls.
- Add support to amd64 for constructing thread upcalls for 32-bit
  processes.
- Leave %fs and %gs alone in the signal trampoline for 32-bit processes on
  amd64.
- Add 'casuword32()' to amd64 and ia64.

Tested by:	emaste
2007-06-18 22:44:59 +00:00