Commit Graph

11437 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
fddc12138a MFC r200723:
Interpret VAPPEND correctly in vaccess_acl_nfs4(9).
2010-03-27 18:12:00 +00:00
Edward Tomasz Napierala
bf876fcd34 MFC r200273:
Don't add VAPPEND if the file is not being opened for writing.  Note that this
only affects cases where open(2) is being used improperly - i.e. when the user
specifies O_APPEND without O_WRONLY or O_RDWR.

Reviewed by:	rwatson
2010-03-27 18:09:40 +00:00
Edward Tomasz Napierala
89a2dbabba MFC r200058:
Add change that was somehow missed in r192586.  It could manifest by
incorrectly returning EINVAL from acl_valid(3) for applications linked
against pre-8.0 libc.
2010-03-27 18:08:14 +00:00
Bjoern A. Zeeb
2287aa049c MFC r205626:
Print the pointer to the lock with the panic message. The previous
        panic: rw lock not unlocked
  was not really helpful for debugging. Now one can at least call
        show lock <ptr>
  form ddb to learn more about the lock.
2010-03-27 17:54:44 +00:00
Bjoern A. Zeeb
67208dfa16 MFC r204147:
Set curvnet earlier so that it also covers calls to sodisconnect(), which
  before were possibly panicing the system in ULP code in the VIMAGE case.

  Submitted by: Igor (igor ispsystem.com)
2010-03-27 17:42:04 +00:00
Edward Tomasz Napierala
bd7ae20991 MFC r197680:
Provide default implementation for VOP_ACCESS(9), so that filesystems which
want to provide VOP_ACCESSX(9) don't have to implement both.  Note that
this commit makes implementation of either of these two mandatory.

Reviewed by:	kib
2010-03-27 17:22:11 +00:00
Bjoern A. Zeeb
cbd7567e6b MFC r202123:
Change DDB show prison:
  - name some columns more closely to the user space variables,
    as we do for host.* or allow.* (in the listing) already.
  - print pr_childmax (children.max).
  - prefix hex values with 0x.
2010-03-27 17:11:06 +00:00
Edward Tomasz Napierala
78e32164b0 MFC r197405:
Add pieces of infrastructure required for NFSv4 ACL support in UFS.

Reviewed by:	rwatson
2010-03-27 16:31:49 +00:00
Bruno Ducrot
2173958d3e MFC r204519:
Deliver siginfo when signal is generated by thr_kill(2) (SI_USER with properly
filled si_uid and si_pid).

PR:		141956
2010-03-15 15:33:32 +00:00
Jilles Tjoelker
873d27446a MFC r204410: Include terminated threads in ps's process cpu time field.
When a kinfo_proc is filled, first fill_kinfo_proc_only() fills in
ki_runtime using p->p_rux.rux_runtime (all cpu time used by the process
including terminated threads). If information for a specific thread is
requested, fill_kinfo_thread() then overwrites this with the thread's
td->td_runtime (good). If not, fill_kinfo_aggregate() overwrote it with
the sum of all threads' td->td_runtime which does not include terminated
threads.

This affects ps(1)'s TIME field, not its %CPU field nor anything in
top(1).
2010-03-14 13:07:40 +00:00
John Baldwin
7a547c991a MFC 204638:
Allow lseek(SEEK_END) to work on disk devices by using the DIOCGMEDIASIZE
to determine the media size.
2010-03-10 19:47:05 +00:00
Luigi Rizzo
f078d8617f MFC r197137 and r200510, which fixes a problem in 8.0
with callouts firing one tick too late. See the logs for
the original patch for details.
RELENG_7 is not affected by the problem.
2010-03-07 14:29:12 +00:00
Ivan Voras
90cb9e50f4 MFC r204611, r204633: Comment and better sysctl documentation string for
VM guest detection variable and sysctl.
2010-03-07 12:29:50 +00:00
Marcel Moolenaar
d5f57f7e08 MFC revs 203696, 203708, 203783 and 203788:
Add PT_VM_TIMESTAMP and PT_VM_ENTRY so that the tracing process can
obtain the memory map of the traced process.

Requested by: kib@
2010-03-07 00:05:44 +00:00
Konstantin Belousov
d3fe3690fb MFC r204413:
For kinfo_proc in kp->ki_siglist, return the set of the signals pending
in the process queue when gathering information for the process, and set
of signals pending for the thread, when gathering information for the
thread.
2010-03-06 12:35:33 +00:00
Alan Cox
c288186fe8 MFC r204420
When running as a guest operating system, the FreeBSD kernel must assume
  that the virtual machine monitor has enabled machine check exceptions.
  Unfortunately, on AMD Family 10h processors the machine check hardware
  has a bug (Erratum 383) that can result in a false machine check exception
  when a superpage promotion occurs.  Thus, I am disabling superpage
  promotion when the FreeBSD kernel is running as a guest operating system
  on an AMD Family 10h processor.
2010-03-02 16:29:08 +00:00
Konstantin Belousov
bfc9904424 MFC r204412:
Fix several style issues.
Define make_dev_credv() as static to match declaration.
2010-03-02 10:32:34 +00:00
Andriy Gapon
932a288f19 MFC r203061: KASSERT contract of return value of interrupt filter
X-MFCto7 after:	1 week
2010-02-28 21:28:24 +00:00
Xin LI
a5a931b33f MFC 203052:
Add interface description capability as inspired by OpenBSD.  Thanks for
rwatson@, jhb@, brooks@ and others for feedback to the old implementation!

Sponsored by:	iXsystems, Inc.
2010-02-26 00:54:47 +00:00
Brooks Davis
3c48c0897f MFC r202143,202163,202341,202342,204278
Replace the static NGROUPS=NGROUPS_MAX+1=1024 with a dynamic
  kern.ngroups+1.  kern.ngroups can range from NGROUPS_MAX=1023 to
  somewhere in the neighborhood of INT_MAX/4 one a system with sufficent
  RAM and memory bandwidth.  Given that the Windows group limit is
  1024, this range should be sufficient for most applications

r202342:
  Only allocate the space we need before calling kern_getgroups instead
  of allocating what ever the user asks for up to "ngroups_max + 1".  On
  systems with large values of kern.ngroups this will be more efficient.

  The now redundant check that the array is large enough in
  kern_getgroups() is deliberate to allow this change to be merged to
  stable/8 without breaking potential third party consumers of the API.
2010-02-24 22:16:16 +00:00
Konstantin Belousov
f723d876b5 MFC r203875:
Do not leak process lock when current thread is not allowed to see target.
2010-02-17 09:03:38 +00:00
Matt Jacob
7733cf8fff MFC a number of changes from head for ISP (203478,203463,203444,202418,201758,
201408,201325,200089,198822,197373,197372,197214,196162). Since one of those
changes was a semicolon cleanup from somebody else, this touches a lot more.
2010-02-11 18:34:06 +00:00
Attilio Rao
95e1c1fa00 MC r202889, r202940:
- Fix a race in sched_switch() of sched_4bsd.
  Block the td_lock when acquiring explicitly sched_lock in order to prevent
  races with other td_lock contenders.
- Merge the ULE's internal function thread_block_switch() into the global
  thread_lock_block() and make the former semantic as the default for
  thread_lock_block().
- Split out an invariant in order to have better checks.
2010-02-08 14:08:52 +00:00
David Xu
d430c009c7 MFC r203414:
After busied the lock, re-read state word before checking waiters flag,
otherwise, the waiters bit may not be set and a wakeup is lost.
2010-02-08 03:11:55 +00:00
Konstantin Belousov
c329abd0d3 MFC r202882:
For i386, amd64 and ia32 on amd64 MD syscall(), reread syscall number
and arguments after ptracestop(), if debugger modified anything in the
process environment.
2010-02-07 11:37:38 +00:00
Konstantin Belousov
e9560b4089 MFC r202528:
Add vunref(9).
2010-02-07 10:44:44 +00:00
Konstantin Belousov
661f092a6d MFC r202881:
Staticise sigqueue manipulation functions used only in kern_sig.c.
2010-01-31 18:25:57 +00:00
Antoine Brodin
e2b36efde5 MFC r201145 to stable/8:
(S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
  Fix some wrong usages.
  Note: this does not affect generated binaries as this argument is not used.

  PR:		137213
  Submitted by:	Eygene Ryabinkin (initial version)
2010-01-30 12:11:21 +00:00
Konstantin Belousov
c9dc5d496d MFC r202692:
Remove the signal from sigqueue before notifying the debugger for traced
process, fixing the race between resuming from stopped state and other
thread noting the old signal on the queue and acting.
2010-01-29 20:02:28 +00:00
Attilio Rao
93a45f0f56 MFC r201879:
Introduce the new kernel thread called "deadlock resolver".
It is used in order to seek within the threads state and heuristically
understand if there is any deadlock happening.

In order to implement it, the sq_type in sleepqueues is mandatory and not
only compiled along with INVARIANTS option. Additively, a new sleepqueue
function, sleepq_type() is added, returning the type of the sleepqueue
linked to a wchan.
Three new sysctls are added in order to configure the thread:
debug.deadlkres.slptime_threshold
debug.deadlkres.blktime_threshold
debug.deadlkres.sleepfreq

rappresenting the thresholds for sleep and block time that will lead to
a deadlock matching (when exceeded), while the sleepfreq rappresents the
number of seconds between 2 consecutive thread runnings.
In order to enable the deadlock resolver thread recompile your kernel
with the option DEADLKRES.

Sponsored by:	Sandvine Incorporated
2010-01-25 12:05:51 +00:00
Attilio Rao
aa16019d66 MFC r201790:
- Set td_slptick to 0 when moving threads out of sleepqueues.
- Move td_slptick from u_int to int in order to follow 'ticks' signedness
  and wrap up accordingly.

Sponsored by:	Sandvine Incorporated
2010-01-25 11:56:53 +00:00
Bjoern A. Zeeb
3bcceea40e MFC r202468:
Add ip4.saddrsel/ip4.nosaddrsel (and equivalent for ip6) to control
  whether to use source address selection (default) or the primary
  jail address for unbound outgoing connections.

  This is intended to be used by people upgrading from single-IP
  jails to multi-IP jails but not having to change firewall rules,
  application ACLs, ... but to force their connections (unless
  otherwise changed) to the primry jail IP they had been used for
  years, as well as for people prefering to implement similar policies.

  Note that for IPv6, if configured incorrectly, this might lead to
  scope violations, which single-IPv6 jails could as well, as by the
  design of jails. [1]

  Reviewed by:		jamie, hrs (ipv6 part)
  Pointed out by:	hrs [1]
2010-01-23 16:40:35 +00:00
Brooks Davis
52c240aaf4 MFC r201350:
The devices that supported EVFILT_NETDEV kqueue filters were removed in
  r195175.  Remove all definitions, documentation, and usage.

The change of function signature for vlan_link_state() was not merged to
maintain the ABI.
2010-01-22 19:51:34 +00:00
Christian Brueffer
7468bbeaea MFC: r201848
Free allocated sbufs before returning ENOMEM.
2010-01-22 17:03:49 +00:00
John Baldwin
49cc13441b MFC 198411:
- Fix several off-by-one errors when using MAXCOMLEN.  The p_comm[] and
  td_name[] arrays are actually MAXCOMLEN + 1 in size and a few places that
  created shadow copies of these arrays were just using MAXCOMLEN.
- Prefer using sizeof() of an array type to explicit constants for the
  array length in a few places.
- Ensure that all of p_comm[] and td_name[] is always zero'd during
  execve() to guard against any possible information leaks.  Previously
  trailing garbage in p_comm[] could be leaked to userland in ktrace
  record headers via td_name[].
2010-01-21 19:11:18 +00:00
John Baldwin
7b10638c5b MFC 198134,198149,198170,198171,198391,200948:
Add a facility for associating optional descriptions with active interrupt
handlers.  This is primarily intended as a way to allow devices that use
multiple interrupts (e.g. MSI) to meaningfully distinguish the various
interrupt handlers.
- Add a new BUS_DESCRIBE_INTR() method to the bus interface to associate
  a description with an active interrupt handler setup by BUS_SETUP_INTR.
  It has a default method (bus_generic_describe_intr()) which simply passes
  the request up to the parent device.
- Add a bus_describe_intr() wrapper around BUS_DESCRIBE_INTR() that supports
  printf(9) style formatting using var args.
- Reserve MAXCOMLEN bytes in the intr_handler structure to hold the name of
  an interrupt handler and copy the name passed to intr_event_add_handler()
  into that buffer instead of just saving the pointer to the name.
- Add a new intr_event_describe_handler() which appends a description string
  to an interrupt handler's name.
- Implement support for interrupt descriptions on amd64, i386, and sparc64 by
  having the nexus(4) driver supply a custom bus_describe_intr method that
  invokes a new intr_describe() MD routine which in turn looks up the
  associated interrupt event and invokes intr_event_describe_handler().
2010-01-21 17:54:29 +00:00
Attilio Rao
702748e988 MFC r200447,201703,201709-201710:
In current code, threads performing an interruptible sleep
will leave the waiters flag on forcing the owner to do a wakeup even
when the waiter queue is empty.
That operation may lead to a deadlock in the case of doing a fake wakeup
on the "preferred" queue while the other queue has real waiters on it,
because nobody is going to wakeup the 2nd queue waiters and they will
sleep indefinitively.
A similar bug, is present, for lockmgr in the case the waiters are
sleeping with LK_SLEEPFAIL on.

Add a sleepqueue interface which does report the actual number of waiters
on a specified queue of a waitchannel and track if at least one sleepfail
waiter is present or not. In presence of this or empty "preferred" queue,
wakeup both waiters queues.

Discussed with:	kib
Tested by:	Pete French <petefrench at ticketswitch dot com>,
		Justin Head <justin at encarnate dot com>
2010-01-18 14:43:44 +00:00
Ed Schouten
2c9e180f34 MFC r201532:
Make TIOCSTI work again.

  It looks like I didn't implement this when I imported MPSAFE TTY.
  Applications like mail(1) still use this. I think it's conceptually bad.

  Tested by:    Pete French <petefrench ticketswitch com>
2010-01-18 09:04:53 +00:00
Bjoern A. Zeeb
66cbfdf290 MFC r202116:
Adjust a comment to reflect reality, as we have proper source
  address selection, even for IPv4, since r183571.

  Pointed out by:	Jase Thew (bazerka beardz.net)
2010-01-17 13:42:07 +00:00
Brooks Davis
0e003a57ce MFC r201953:
Correct the explination text for the kern.ngroups.  It reflects the
  number of supplemental groups, not the total number of groups.
2010-01-12 06:09:56 +00:00
Konstantin Belousov
2d63cbda24 MFC r200770:
Remove VI_OBJDIRTY and make sure that OBJ_MIGHTBEDIRTY is set only for
vnode-backed vm objects.
2010-01-11 12:35:16 +00:00
Brooks Davis
97a0b2e16c MFC r201352
If a filter has already been added, actually return EEXIST when trying
  at add it again.
2010-01-08 21:58:12 +00:00
Konstantin Belousov
e1c0f1246f MFC r201347:
Allow swap out of the kernel stack for the thread with priority greater
or equial then PSOCK, not less or equial.
2010-01-07 11:41:47 +00:00
Konstantin Belousov
e6b37c3a7f MFC r201134:
Add a knob to allow reclaim of the directory vnodes that are source of
the namecache records.
2009-12-31 11:49:13 +00:00
Ed Schouten
35e0c29fdf MFC r198185:
Print backspaces after echoing an EOF.

  Applications like shells expect EOF to give no graphical output, while
  our implementation prints ^D by default (tunable with stty echoctl).
  Make the new implementation behave like the old TTY code. Print two
  backspaces afterwards.

I totally forgot to MFC this, because the 8.0 freeze took a little
longer than I expected.

Reminded by:	koitsu
2009-12-31 10:53:04 +00:00
Andrew Thompson
2478604ee7 MFC r200652
If the runcount is non-zero in eventhandler_deregister() then one or more
 threads are executing the eventhandler, sleep in this case to make it safe for
 module unload. If the runcount was up then an entry would have been marked
 EHE_DEAD_PRIORITY so use this as a trigger to do the wakeup in
 eventhandler_prune_list().
2009-12-31 00:09:47 +00:00
Bjoern A. Zeeb
58caa1cc76 MFC r201000:
Remove extra spaces (no functional change).
2009-12-28 14:47:25 +00:00
Bjoern A. Zeeb
8aeffdc3b9 MFC r200995:
Remove an unused global.
2009-12-28 14:44:22 +00:00
Bjoern A. Zeeb
950cde5085 MFC r200473:
Throughout the network stack we have a few places of
        if (jailed(cred))
  left.  If you are running with a vnet (virtual network stack) those will
  return true and defer you to classic IP-jails handling and thus things
  will be "denied" or returned with an error.

  Work around this problem by introducing another "jailed()" function,
  jailed_without_vnet(), that also takes vnets into account, and permits
  the calls, should the jail from the given cred have its own virtual
  network stack.

  We cannot change the classic jailed() call to do that,  as it is used
  outside the network stack as well.

  Discussed with:       julian, zec, jamie, rwatson (back in Sept)
2009-12-28 14:40:58 +00:00
Matt Jacob
fc946fd026 MFC 200620,200621: fix argument order to mtx_init call. 2009-12-27 22:49:34 +00:00