Attilio Rao [Thu, 27 Dec 2012 12:36:58 +0000 (12:36 +0000)]
br_prod_tail and br_cons_tail members are used as barrier to
signal bug_ring ownership. However, instructions can be reordered
around members write leading to stale values for ie. br_prod_bufs.
Use correct memory barriers to ensure proper ordering of the
ownership tokens updates.
Mark Johnston [Wed, 26 Dec 2012 22:21:27 +0000 (22:21 +0000)]
Add the NO_SYNC_CACHE quirk for all Apple USB MSC devices, as they
typically do not handle the SYNCHRONIZE_CACHE command - they either
return an error or the firmware enters a reset loop.
Reset provider-specific fields when resending I/O request in low memory
conditions. This fixes assertion which checks those fields when kernel is
compiled with DIAGNOSTIC.
Use the correct USB interface macros instead of USB_IF_CSI.
As pointed out by hselasky@, USB_IF_CSI is the wrong macro here since we want
to declare the device's interface class, subclass and protocol, not class,
subclass and driver info.
In case of the deletion of a user those whole database has to be regenerated,
otherwise the user planned to be deleted remain in the pwd.db while removed from
the plain text password file.
Attilio Rao [Wed, 26 Dec 2012 15:20:32 +0000 (15:20 +0000)]
Fixup r244240: mp_ncpus will be 1 also in the !SMP and smp_disabled=1
case. There is no point in optimizing further the code and use a TRUE
litteral for a path that does heavyweight stuff anyway (like lock acq),
at the price of obfuscated code.
Use the appropriate check where necessary and remove a macro.
David Xu [Wed, 26 Dec 2012 13:07:17 +0000 (13:07 +0000)]
Always initialize pattern_buf pointers to NULL, otherwise AMD64 machine
panics with:
free: address xxx(yyy) has not been allocated.
it can be triggered by hald.
Sergey Kandaurov [Wed, 26 Dec 2012 05:11:48 +0000 (05:11 +0000)]
Fix libproc test case to work with clang premature optimization
observed with -O2 (used by default).
Avoid function inlining for t1_bkpt_t on which we set a breakpoint.
Otherwise the address of the function is never called thus the
breakpoint never triggers.
Rick Macklem [Tue, 25 Dec 2012 22:47:49 +0000 (22:47 +0000)]
Attempt to clarify that for ZFS, all file systems under
the NFSv4 root must be exported. This is because ZFS
checks exports itself.
This is a content change.
Rick Macklem [Tue, 25 Dec 2012 22:34:43 +0000 (22:34 +0000)]
Attempt to clarify that for ZFS, all file systems under
the NFSv4 root must be exported. This is because ZFS
checks exports itself.
This is a content change.
Jilles Tjoelker [Tue, 25 Dec 2012 14:17:09 +0000 (14:17 +0000)]
sh: Prefer strsignal() to accessing sys_siglist directly.
Accessing sys_siglist directly requires rtld to copy it from libc to the sh
executable's BSS. Also, strsignal() will put in the signal number for
unknown signals (FreeBSD-specific) so we need not do that ourselves.
Unfortunately, there is no function for sys_signame.
Gleb Smirnoff [Tue, 25 Dec 2012 13:01:58 +0000 (13:01 +0000)]
The SIOCSIFFLAGS ioctl handler runs if_up()/if_down() that notify
all interested parties in case if interface flag IFF_UP has changed.
However, not only SIOCSIFFLAGS can raise the flag, but SIOCAIFADDR
and SIOCAIFADDR_IN6 can, too. The actual |= is done not in the protocol
code, but in code of interface drivers. To fix this historical layering
violation, we will check whether ifp->if_ioctl(SIOCSIFADDR) raised the
IFF_UP flag, and if it did, run the if_up() handler.
This fixes configuring an address under CARP control on an interface
that was initially !IFF_UP.
P.S. I intentionally omitted handling the IFF_SMART flag. This flag was
never ever used in any driver since it was introduced, and since it
means another layering violation, it should be garbage collected instead
of pretended to be supported.
Devin Teske [Tue, 25 Dec 2012 09:30:25 +0000 (09:30 +0000)]
Remove unnecessary duplicate initialization of the dialog(1) API (automatically
bootstrapped on-include unless DIALOG_SELF_INITIALIZE is set to NO before-hand)
Ryan Stone [Sun, 23 Dec 2012 15:50:37 +0000 (15:50 +0000)]
Correct a series of errors in the hand-rolled locking for drace_debug.c:
- Use spinlock_enter()/spinlock_exit() to prevent a thread holding a
debug lock from being preempted to prevent other threads waiting
on that lock from starvation.
- Handle the possibility of CPU migration in between the fetch of curcpu
and the call to spinlock_enter() by saving curcpu in a local variable.
- Use memory barriers to prevent reordering of loads and stores of the
data protected by the lock outside of the critical section
- Eliminate false sharing of the locks by moving them into the structures
that they protect and aligning them to a cacheline boundary.
- Record the owning thread in the lock to make debugging future problems
easier.
Rick Macklem [Sat, 22 Dec 2012 23:21:17 +0000 (23:21 +0000)]
It was reported via email that some sshds create kerberos
credential cache files with names other than /tmp/krb5cc_<uid>.
The gssd daemon does not know how to find these credential caches.
This patch implements a new option "-s" that does a search for
credential cache files, using roughly the same algorithm as the
gssd daemon for Linux uses. The gssd behaviour is only changed
if the new "-s" option is specified. It also implements two other
new options related to the "-s" option.
Reported by: Piete.Brooks at cl.cam.ac.uk, Herbert Poeckl
Tested by: Herbert Poeckl (admin at ist.tugraz.at), Illias A. Marinos
MFC after: 2 weeks
Dimitry Andric [Sat, 22 Dec 2012 20:46:46 +0000 (20:46 +0000)]
Fix a bug in ld --gc-sections: it strips out .note sections, while it
should never do so. This can cause global constructors and destructors
to not be executed at run-time, resulting in crashes and other strange
behaviour.
Dimitry Andric [Sat, 22 Dec 2012 20:16:21 +0000 (20:16 +0000)]
Pull in r170353 from upstream llvm trunk:
Fix another SROA crasher, PR14601.
This was a silly oversight, we weren't pruning allocas which were used
by variable-length memory intrinsics from the set that could be widened
and promoted as integers. Fix that.
This should fix the following assertion failure:
Assertion failed: (CanSROA), function visitUsers, file
/usr/src/lib/clang/libllvmscalaropts/../../../contrib/llvm/lib/Transforms/Scalar/SROA.cpp,
line 2395.
Matthew Seaman [Sat, 22 Dec 2012 15:13:16 +0000 (15:13 +0000)]
Switch from 'pkg -n' to 'pkg -N' as the test for pkgn activation
status. '-n' is already used extensively elsewhere in pkgng (to mean
'dry-run') and this reduces the potential confusion
Jaakko Heinonen [Sat, 22 Dec 2012 13:43:12 +0000 (13:43 +0000)]
Mangle label names containing spaces, non-printable characters '%' or
'"'. Mangling is only done for label names read from file system
metadata. Encoding resembles URL encoding. For example, the space
character becomes %20.
Attilio Rao [Sat, 22 Dec 2012 09:37:34 +0000 (09:37 +0000)]
Fixup r240424: On entering KDB backends, the hijacked thread to run
interrupt context can still be idlethread. At that point, without the
panic condition, it can still happen that idlethread then will try to
acquire some locks to carry on some operations.
Skip the idlethread check on block/sleep lock operations when KDB is
active.
Andrew Turner [Sat, 22 Dec 2012 04:11:59 +0000 (04:11 +0000)]
Make struct fstate aligned to the same as an int as its pointer is cast to
an int pointer in args.c. This fixes an issue with ARM where the struct
will be byte aligned but an int pointer must be 4 byte aligned.
Adrian Chadd [Sat, 22 Dec 2012 01:17:49 +0000 (01:17 +0000)]
if_start() is being used here as a way of kick-starting the new queue
processing. For if_transmit() style hardware drivers (which none publicly
exist yet, for wireless) they will need to still implement if_start()
but only to re-start the TX queue.
Olivier Houchard [Sat, 22 Dec 2012 01:04:29 +0000 (01:04 +0000)]
The manpage states that bus_dmamap_create(9) returns ENOMEM if it can't
allocate a map or mapping resources. That seems to imply that any memory
allocations it does must use M_NOWAIT and check for NULL.
Submitted by: Ian Lepore <freebsd@damnhippie.dyndns.org>
Xin LI [Fri, 21 Dec 2012 22:20:59 +0000 (22:20 +0000)]
- Reduce buffer size from LINE_MAX to PATH_MAX, there is no point to store
path longer than this.
- Fix an unreached case of check against sizeof buf, which in turn leads
to an off-by-one nul byte write on the stack. The original condition
can never be satisfied because the passed boundary is the maximum value
that can be returned, so code was harmless.
Reduce stack usage in the USB audio driver by moving some large stack
elements to the USB audio softc structure. This fixes a double CPU
fault when attaching USB audio devices in 10-current for i386 at
least.
Brooks Davis [Fri, 21 Dec 2012 20:37:38 +0000 (20:37 +0000)]
Add libnetbsd, a thin compatibility layer intended to allow a limited
set of NetBSD software to compile as part of the FreeBSD build with
little or no modifiction. It is built as a static library and not
installed for general use. Likewise, its header files are not
installed.
Matthew Seaman [Fri, 21 Dec 2012 20:01:13 +0000 (20:01 +0000)]
In preparation for making 'pkg -n' the one true method of determining
whether a system has been configured to use pkgng, cause /usr/sbin/pkg
recognise a -n option and exit with a failure code when the pkg port
is not installed.
Devin Teske [Fri, 21 Dec 2012 19:26:17 +0000 (19:26 +0000)]
Improve the debugging abilities and clean up debug messages. In most cases,
all one has to do is set the environment variable DEBUGGING to get the debug
messages to appear on the console.
Regression issue:
Use a boundary of zero, hence a PAGE_SIZE boundary
is implied by all memory allocations.
Background:
Busdma has problems to allocate more than PAGE_SIZE
bytes when the boundary is PAGE_SIZE bytes too.
Initially it was thought that a boundary of PAGE_SIZE
bytes will only affect loading of DMA memory, so that
segments get split correctly, but it also affects
allocation of DMA'able memory.
Solution:
USB can detect big segments and split them as required
by the USB code.
Attilio Rao [Fri, 21 Dec 2012 13:14:12 +0000 (13:14 +0000)]
Fixup r218424: uio_yield() was scaling directly to userland priority.
When kern_yield() was introduced with the possibility to specify
a new priority, the behaviour changed by not lowering priority at all
in the consumers, making the yielding mechanism highly ineffective for
high priority kthreads like bufdaemon, syncer, vlrudaemon, etc.
There are no evidences that consumers could bear with such change in
semantic and this situation could finally lead to bugs similar to the
ones fixed in r244240.
Re-specify userland pri for kthreads involved.