jhb [Wed, 21 Mar 2012 20:50:15 +0000 (20:50 +0000)]
MFC 230394,230441,230489,230552,232420:
Close a race in NFS lookup processing that could result in stale name cache
entries on one client when a directory was renamed on another client. The
root cause for the stale entry being trusted is that each per-vnode nfsnode
structure has a single 'n_ctime' timestamp used to validate positive name
cache entries. However, if there are multiple entries for a single vnode,
they all share a single timestamp. To fix this, extend the name cache
to allow filesystems to optionally store a timestamp value in each name
cache entry. The NFS clients now fetch the timestamp associated with
each name cache entry and use that to validate cache hits instead of the
timestamps previously stored in the nfsnode. Another part of the fix is
that the NFS clients now use timestamps from the post-op attributes of
RPCs when adding name cache entries rather than pulling the timestamps out
of the file's attribute cache. The latter is subject to races with other
lookups updating the attribute cache concurrently.
glebius [Wed, 21 Mar 2012 09:19:23 +0000 (09:19 +0000)]
Merge 232685 from head:
Merge from OpenBSD:
revision 1.146
date: 2010/05/12 08:11:11; author: claudio; state: Exp; lines: +2 -3
bzero() the full compressed update struct before setting the values.
This is needed because pf_state_peer_hton() skips some fields in certain
situations which could result in garbage beeing sent to the other peer.
This seems to fix the pfsync storms seen by stephan@ and so dlg owes me
a whiskey.
I didn't see any storms, but this definitely fixes a useless memory
allocation on the receiving side, due to non zero scrub_flags field
in a pfsync_state_peer structure.
glebius [Wed, 21 Mar 2012 07:22:27 +0000 (07:22 +0000)]
Merge from head:
r227785:
- Reduce severity for all ARP events, that can be triggered from remote
machine to LOG_NOTICE. Exception left to "using my IP address".
- Fix multicast ARP warning: add newline and also log the bad MAC address.
Tested by: Alexander Wittig <wittigal msu.edu>
r227790:
Be more informative for "unknown hardware address format" message.
tuexen [Tue, 20 Mar 2012 19:22:44 +0000 (19:22 +0000)]
MFC r232866:
This fixes PR 165210. Basically we just
add in the netgraph interface to the list of
acceptable interfaces. A todo at the next
IETF code blitz, though is we need to review
why we screen interfaces, there was a reason ;-).
From rrs@.
jpaetzel [Mon, 19 Mar 2012 23:17:26 +0000 (23:17 +0000)]
MFC: 232898
Improve ZFS exporting functionality, only export pools which are on a
specific device we happen to be writing to. This fixes an issue when
running pc-sysinstall on a running system which needs ZFS and the main
disk gets exported.
jpaetzel [Mon, 19 Mar 2012 22:52:19 +0000 (22:52 +0000)]
MFC: 232681
Work around broken BIOS memory reporting
Andrzej has a machine with 32GB of RAM, but only 16GB is reported by the
smbios.memory.enabled. Thus, use the greater of hw.realmem and the smbios
value.
Reported by: Andrzej Tobola <ato of iem pw edu pl>
jpaetzel [Mon, 19 Mar 2012 22:41:53 +0000 (22:41 +0000)]
MFC 227470:
Report the amount of memory from smbios data if provided.
This should get the correct memory size even if a 32-bit image is running
on a machine with > 4GB of memory. This can be useful is using a 32-bit
installer on a machine which will eventually run a 64-bit image.
dim [Mon, 19 Mar 2012 08:10:23 +0000 (08:10 +0000)]
MFC r232894:
Pull in r145194 from upstream clang trunk:
Make our handling of MMX x SSE closer to what gcc does:
* Enabling sse enables mmx.
* Disabling (-mno-mmx) mmx, doesn't disable sse (we got this right already).
* The order in not important. -msse -mno-mmx is the same as -mno-mmx -msse.
Some configure scripts depend on this.
PR: i386/165968
MFC r232933:
Update comments and CFLAGS in sys/conf/kern.mk, introduced in r221879,
to match reality: clang does _not_ disable SSE automatically when
-mno-mmx is used, you have to specify -mno-sse explicitly.
Note this was the case even before r232894, which only makes a change in
the 'positive' flag case; e.g. when you specify -msse, MMX gets enabled
too.
mav [Mon, 19 Mar 2012 07:24:26 +0000 (07:24 +0000)]
MFC r230845:
Make sound(4) more flexible in setting soft buffer and block sizes when
hardware imposes strict limitations on hard buffer and block sizes.
Previous code set soft buffer to be no smaller then hard buffer. On some
cards with fixed 64K physical buffer that caused up to 800ms play latency.
New code allows to set soft buffer size down to just two blocks of the hard
buffer and to not write more then that size ahead to the hardware buffer.
As result of that change I was able to reduce full practically measured
record-playback loop delay in those conditions down to only about 115ms
with theoretical playback latency of only about 50ms.
New code works fine for both vchans and direct cases. In both cases sound(4)
tries to follow hw.snd.latency_profile and hw.snd.latency values and
application-requested buffer and block sizes as much as limitation of two
hardware blocks allows.
mav [Mon, 19 Mar 2012 07:15:42 +0000 (07:15 +0000)]
MFC r232783:
Idle ticks optimization:
- Pass number of events to the statclock() and profclock() functions
same as to hardclock() before to not call them many times in a loop.
- Rename them into statclock_cnt() and profclock_cnt().
- Turn statclock() and profclock() into compatibility wrappers,
still needed for arm.
- Rename hardclock_anycpu() into hardclock_cnt() for unification.
mav [Mon, 19 Mar 2012 07:13:30 +0000 (07:13 +0000)]
MFC r232797:
ServerWorks HT1000 HPET reported to have problems with IRQs >= 16.
Lower (ISA) IRQs are working, but allowed mask is not set correctly.
Block both by default to allow HP BL465c G6 blade system to boot.
eadler [Mon, 19 Mar 2012 01:51:08 +0000 (01:51 +0000)]
MFC r231306:
Fix NULL ptr dereference in setusercontext if pwd is null,
LOGIN_SETPRIORITY is set, and setting the priority (rtprio or
setpriority) fails.
- Add an __alignof() for non-GCC and GCC < 2.95.
- Attempt to implement the following C11 keywords: _Alignas(),
_Alignof(), _Noreturn, _Static_assert() and _Thread_local.
- Add __generic(), which allows us to do _Generic() in a portable
fashion.
- Improve __offsetof(), __DECONST(), __DEVOLATILE() and __DEQUALIFY()
to use __uintptr_t and __size_t to make them work with less
header prerequisites.
- Add __has_feature(), __has_include() and __has_builtin() to make it
easier to test against Clang features.
dim [Sat, 17 Mar 2012 22:29:05 +0000 (22:29 +0000)]
MFC 232322:
Add a WITH_CLANG_IS_CC option for src.conf(5), disabled by default, that
installs clang as /usr/bin/cc, /usr/bin/c++ and /usr/bin/cpp.
Note this does *not* disable building and installing gcc, which will
still be available as /usr/bin/gcc, /usr/bin/g++ and /usr/bin/gcpp. If
you want to disable gcc completely, you must use WITHOUT_GCC.
MFC 232323:
Regenerate src.conf(5) after r232322.
MFC 232477:
In r232322, I forgot one case where a check for MK_CLANG_IS_CC was
needed, in sys/conf/kern.pre.mk. Add it now.
MFC 232522:
Fix a thinko in r232322, where gcc (and its tools) are not built during
the cross-tools stage, if CC=clang and WITH_CLANG_IS_CC is not set.
This causes no 'cc' to be installed in the temporary cross-tools tree,
making lint fall over later in the build, because it ignores ${CC} and
attempts to run 'cc' anyway.
To fix this, only skip building gcc during cross-tools, if WITHOUT_GCC
is set, or if WITH_CLANG_IS_CC is set.
marcel [Sat, 17 Mar 2012 05:45:21 +0000 (05:45 +0000)]
MFC r227430:
On i386, fbt probes are implemented by writing an invalid opcode over
certain instructions in a function prologue or epilogue. DTrace has a
hook into the invalid opcode fault handler that checks whether the fault
was due to an probe and if so, runs the DTrace magic.
Upon returning from an invalid opcode fault caused by a probe, DTrace must
emulate the instruction that was replaced with the invalid opcode and then
return control to the instruction following the invalid opcode.
There were a pair of related bugs in the emulation for the leave
instruction. The leave instruction is used to pop off a stack frame prior
to returning from a function. The emulation for this instruction must
move the trap frame for the invalid opcode fault down the stack to the
bottom of the stack frame that is being removed, and then execute an iret.
At two points in this process, the emulation code was storing values above
the current value of the stack pointer. This opened up a window in which
if we were two take an interrupt, the trap frame for the interrupt would
overwrite the values stored on the stack, causing the system to panic
later.
The first bug was that at one point the emulation code saves the new value
for $esp above the current stack pointer value. The fix is to save this
value instead inside of the original trap frame. At this point we do
not need the original trap frame so this is safe.
The second bug is that when the emulate code loads $esp from the stack, it
points part-way through the new trap frame instead of at its beginning.
The emulation code adjusts the stack pointer to the correct value
immediately afterwards, but this still leaves a one instruction window in
which an interrupt would corrupt this trap frame. Fix this by adjusting
the stack frame value before loading it into $esp.
This fixes panics in invop_leave on i386 when using fbt return probes.
jhb [Fri, 16 Mar 2012 21:28:05 +0000 (21:28 +0000)]
MFC 226340,226340:
Use queue(3) macros instead of home-rolled versions in several places in
the INET6 code. This includes retiring the 'ndpr_next' and 'pfr_next'
macros.
kib [Thu, 15 Mar 2012 11:06:37 +0000 (11:06 +0000)]
MFC r232071:
Account the writeable shared mappings backed by file in the vnode
v_writecount.
MFC r232103:
Place the if() at the right location.
MFC note: the added struct vm_object un_pager.vnp.writemappings member
is located after the fields of struct vm_object that could be accessed
from the modules.
marius [Wed, 14 Mar 2012 10:02:35 +0000 (10:02 +0000)]
MFC: r232822
Fix a bug introduced in r223938; on big-endian machines coping a 32-bit
quantum bytewise to the address of a 64-bit variable results in writing
to the "wrong" 32-bit half so adjust the address accordingly. This fix
is implemented in a hackish way for two reasons:
o in order to be able to get it into 8.3 with zero impact on the little-
endian architectures where this bug has no effect and
o to avoid blowing the x86 boot2 out of the water again when compiling
it with clang, which all sane versions of this fix tested do.
This change fixes booting from UFS1 file systems on big-endian machines.
glebius [Tue, 13 Mar 2012 20:37:57 +0000 (20:37 +0000)]
Merge 231025 from head:
Add new socket options: TCP_KEEPINIT, TCP_KEEPIDLE, TCP_KEEPINTVL and
TCP_KEEPCNT, that allow to control initial timeout, idle time, idle
re-send interval and idle send count on a per-socket basis.
mav [Tue, 13 Mar 2012 20:36:03 +0000 (20:36 +0000)]
MFc r229288:
Remove unneeded checks for CAM_DEV_QFRZN after cam_periph_runccb() call.
cam_periph_runccb() since the beginning checks it and releases device queue.
After r203108 it even clears CAM_DEV_QFRZN flag after that to avoid double
release, so removed code is unreachable now.
mav [Tue, 13 Mar 2012 20:33:15 +0000 (20:33 +0000)]
MFC r228846:
Use READ CAPACITY(16) to get information about device physical sectors.
As soon as not all devices support READ CAPACITY(16), automatically fall
back to READ CAPACITY(10) if CAM_REQ_INVALID or SSD_KEY_ILLEGAL_REQUEST
status returned.
It also provides first bits of information about Logical Block Provisioning
(aka UNMAP/TRIM) support by the device.
dim [Tue, 13 Mar 2012 18:39:57 +0000 (18:39 +0000)]
MFC r232263:
Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
individual Makefiles.
Instead, use the following extra macros, for use with clang:
- NO_WERROR.clang (disables -Werror)
- NO_WCAST_ALIGN.clang (disables -Wcast-align)
- NO_WFORMAT.clang (disables -Wformat and friends)
- CLANG_NO_IAS (disables integrated assembler)
- CLANG_OPT_SMALL (adds flags for extra small size optimizations)
As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
make.conf! For clang, use the following:
bz [Mon, 12 Mar 2012 22:08:03 +0000 (22:08 +0000)]
MFC r232515:
Rather than printing the output from route add for all FIBs just print them
for the default FIB followed by a statement with a list of FIB numbers for
all the other FIBs we install the routes for.
Request by: kib (to make it less noisy)
Tested by: kib
kib [Mon, 12 Mar 2012 12:53:27 +0000 (12:53 +0000)]
MFC r232240:
Currently, the debugger attached to the process executing vfork() does
not get syscall exit notification until the child performed exec of
exit. Swap the order of doing ptracestop() and waiting for P_PPWAIT
clearing, by postponing the wait into syscallret after ptracestop()
notification is done.
This includes major code refactoring, HDMI support, new volume control,
automatic recording source selection, runtime reconfigureation, support
for more then 4 PCM devices on controller, multichannel recording,
additional playback/record streams, higher bandwidths support, more
informative device names and many other things.
rstone [Sat, 10 Mar 2012 02:26:12 +0000 (02:26 +0000)]
MFC r230984:
Whenever a new kernel thread is spawned, explicitly clear any CPU affinity
set on the new thread. This prevents the thread from inadvertently
inheriting affinity from a random sibling.
MFC r231265:
Introduce the "ruleset=number" option for devfs(5) mounts.
Add support for updating the devfs mount (currently only changing the
ruleset number is supported).
Check mnt_optnew with vfs_filteropt(9).
This new option sets the specified ruleset number as the active ruleset
of the new devfs mount and applies all its rules at mount time. If the
specified ruleset doesn't exist, a new empty ruleset is created.
MFC r231267 [1]:
Add support for mounting devfs inside jails.
A new jail(8) option "devfs_ruleset" defines the ruleset enforcement for
mounting devfs inside jails. A value of -1 disables mounting devfs in
jails, a value of zero means no restrictions. Nested jails can only
have mounting devfs disabled or inherit parent's enforcement as jails are
not allowed to view or manipulate devfs(8) rules.
MFC r232059 [1]:
To improve control over the use of mount(8) inside a jail(8), introduce
a new jail parameter node with the following parameters:
allow.mount.devfs:
allow mounting the devfs filesystem inside a jail
allow.mount.nullfs:
allow mounting the nullfs filesystem inside a jail
Both parameters are disabled by default (equals the behavior before
devfs and nullfs in jails). Administrators have to explicitly allow
mounting devfs and nullfs for each jail. The value "-1" of the
devfs_ruleset parameter is removed in favor of the new allow setting.
MFC r232186:
Analogous to r232059, add a parameter for the ZFS file system:
allow.mount.zfs:
allow mounting the zfs filesystem inside a jail
This way the permssions for mounting all current VFCF_JAIL filesystems
inside a jail are controlled wia allow.mount.* jail parameters.
Update sysctl descriptions.
Update jail(8) and zfs(8) manpages.
MFC r232247:
mdoc(7) stype - start new sentences on new line
MFC r232278 [1]:
Add procfs to jail-mountable filesystems.
MFC r232291:
Bump .Dd to reflect latest update
MFC r232307:
Add "export" to devfs_opts[] and return EOPNOTSUPP if called with it.
Fixes mountd warnings.
MFC r232342 (jamie) [2]:
Handle the case where a boolean parameter is also a node.
mav [Fri, 9 Mar 2012 05:43:08 +0000 (05:43 +0000)]
MFC r232380:
Fix names of some Marvell SATA chips. It looks like chips with proprietary
interface supported by mvs(4) are 88SX, while AHCI-like chips are 88SE.