nwhitehorn [Sat, 31 Dec 2011 15:08:33 +0000 (15:08 +0000)]
MFC r228646:
Additional icache paranoia: non-PLT relocations can modify the text segment.
It is then important to make sure the icache is synchronized again to
prevent (rare) random seg faults and illegal instructions.
dim [Sat, 31 Dec 2011 15:03:29 +0000 (15:03 +0000)]
MFC r228558, r228585, r228588, r228652, r228707:
Unfortunately, clang gives warnings about sendmail code that cannot be
turned off yet. Since this is contrib code, and we don't really care
about the warnings, just make them non-fatal for now.
MFC r228590:
Fix typos in the comments about clang warnings in several
sendmail-related Makefiles.
Spotted by: arundel
MFC r228708:
In usr.bin/vacation/Makefile, fix a typo in the comment about clang
warnings.
hselasky [Sat, 31 Dec 2011 14:45:43 +0000 (14:45 +0000)]
MFC r226709:
Allow USB ethernet drivers to define a driver specific
attach handler so that a USB ethernet driver can
announce interface capabilities and do its own MII attach.
hselasky [Sat, 31 Dec 2011 14:33:15 +0000 (14:33 +0000)]
MFC r228709, r228711 and r228723:
- Add missing unlock of USB controller's lock, when
doing shutdown, suspend and resume.
- Add code to wait for USB shutdown to be executed at system shutdown.
- Add sysctl which can be used to skip this waiting.
dim [Sat, 31 Dec 2011 14:21:41 +0000 (14:21 +0000)]
MFC r228553:
In contrib/file/softmagic.c, fix a potential format string security
problem. (This fix has already been applied upstream, but we do not
have the latest version of file in the tree at the moment.)
hselasky [Sat, 31 Dec 2011 14:12:12 +0000 (14:12 +0000)]
MFC r226173, r227843, r227848 and r227908:
Use DEVMETHOD_END to mark end of device methods.
Remove superfluous device methods.
Add some missing __FBSBID() macros.
dim [Sat, 31 Dec 2011 14:04:54 +0000 (14:04 +0000)]
MFC r228550:
In cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c, the
dt_popc() function assumes that either _ILP32 or _LP64 is defined,
otherwise it has no suitable implementation.
However, the _ILP32 and _LP64 macros come from isa_defs.h, which is not
included in this file. Add the include now, to get the macros defined.
dim [Sat, 31 Dec 2011 13:43:51 +0000 (13:43 +0000)]
MFC r228547:
Cast away a clang alignment warning in drti.c's fixsymbol() function.
This code only runs on i386 and amd64, so there should be no problems if
buf + sec->dofs_offset is not aligned (which is unlikely anyway).
dim [Sat, 31 Dec 2011 13:37:25 +0000 (13:37 +0000)]
MFC r228546:
Clang has more warnings enabled by default, and when using -Wall, so if WARNS
is set to low values, some of them have to be disabled explicitly.
MFC r228551:
Disable one more clang warning when WARNS <= 3.
MFC r228606:
Add a NO_WARRAY_BOUNDS setting to bsd.sys.mk, only applicable to clang,
to selectively work around warnings in programs that don't use flexible
array members, but instead define arrays of length 1 at the end of the
struct, and then access those beyond their declared bounds.
MFC r228617:
Disable yet another clang warning when WARNS <= 3.
MFC r228675:
Disable yet another clang warning (-Wconversion) when WARNS <= 3.
MFC r228677:
Disable another clang warning (-Wempty-body) when WARNS <= 2.
hselasky [Sat, 31 Dec 2011 13:23:04 +0000 (13:23 +0000)]
MFC r227396, r227401, r227541, r227654 and r228493:
Relax XHCI timeouts which should fix enumeration issues.
Fix definition of XHCI port power bit.
Correct size of some USB 3.0 descriptor fields.
gabor [Sat, 31 Dec 2011 13:12:10 +0000 (13:12 +0000)]
MFC r228099:
- Create links to the xz and lzma versions even if BSD grep is not the
default. Nor GNU nor liblzma in base provides such functionality so
it may be useful.
MFC r228319:
- Match GNU behavior of exit code
- Rename variable that has a different meaning now
dim [Sat, 31 Dec 2011 12:58:21 +0000 (12:58 +0000)]
MFC r228540:
Since clang does not support the tls_model attribute used in malloc.c
yet (see LLVM PR 9788), and warns about it, rub it out for now. When
clang grows support for this attribute, I will revert this again.
dim [Sat, 31 Dec 2011 12:52:18 +0000 (12:52 +0000)]
MFC r228538:
In lib/libc/rpc/crypt_client.c, fix a clang warning about an implicit
conversion between enum desdir/desmode from include/rpc/des.h, and enum
desdir/desmode from include/rpcsvc/crypt.x. These are actually
different enums, with different value names, but by accident the integer
representation of the enum values happened to be the same.
dim [Sat, 31 Dec 2011 12:45:43 +0000 (12:45 +0000)]
MFC r228537:
Remove meaningless self-assignment in res_send.c, otherwise clang will
warn about it. I guess this was originally done to silence a bogus
warning by an older version of gcc, but I could not reproduce it with
any version of gcc that I have access to.
yongari [Sat, 31 Dec 2011 01:22:16 +0000 (01:22 +0000)]
MFC r226479:
Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.
Because driver is accessing a common MII structure in
mii_pollstat(), updating user supplied structure should be done
before dropping a driver lock.
yongari [Sat, 31 Dec 2011 01:07:01 +0000 (01:07 +0000)]
MFC r226478:
Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.
Because driver is accessing a common MII structure in
mii_pollstat(), updating user supplied structure should be done
before dropping a driver lock.
yongari [Sat, 31 Dec 2011 00:44:11 +0000 (00:44 +0000)]
MFC r226123:
BCE_MISC_ID register of BCM5716 returns the same id of BCM5709 so
remove explicit checks for BCM5716.
The BCM5709 and BCM5716 chips are virtually indistinguishable by
software except for the PCI device ID. The two chips differ in
that BCM5709 supports TCP/IP and iSCSI offload in Windows while
the BCM5716 doesn't.
While I'm here remove now unused definition of BCE_CHIP_NUM_5716
and BCE_CHIP_ID_5716_C0.
dim [Fri, 30 Dec 2011 23:41:24 +0000 (23:41 +0000)]
MFC r228536:
The TCB_GET32() and TCB_GET64() macros in the i386 and amd64-specific
versions of pthread_md.h have a special case of dereferencing a null
pointer. Clang warns about this with:
In file included from lib/libthr/arch/i386/i386/pthread_md.c:36:
lib/libthr/arch/i386/include/pthread_md.h:96:10: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
return (TCB_GET32(tcb_self));
^~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:73:13: note: expanded from:
: "m" (*(u_int *)(__tcb_offset(name)))); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:96:10: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
Since this indirection is done relative to the fs or gs segment, to
retrieve thread-specific data, it is an exception to the rule.
Therefore, add a volatile qualifier to tell the compiler we really want
to dereference a zero address.
dim [Fri, 30 Dec 2011 22:59:00 +0000 (22:59 +0000)]
MFC r228328:
Make it possible to use the debug versions of std::map and std::multimap
with clang, by removing two unneeded using declarations. Otherwise, you
would get errors similar to:
/usr/include/c++/4.2/debug/map.h:77:20: error: dependent using declaration resolved to type without 'typename'
using _Base::value_compare;
^
N.B.: Take care when you actually use the debug versions of any
libstdc++ header. They are more likely to contain problems, because
they are exercised far less often, and since the standard library
complexity guarantees don't always apply anymore, compile times can
drastically increase.
dim [Fri, 30 Dec 2011 22:17:10 +0000 (22:17 +0000)]
MFC r227735:
Pull in r144110 from upstream clang trunk:
Mark the overloaded atomic builtins as having custom type checking,
which they do. This avoids all of the default argument promotions that
we (1) don't want, and (2) undo during that custom type checking, and
makes sure that we don't run into trouble during template
instantiation. Fixes llvm/clang PR11320.
dim [Fri, 30 Dec 2011 22:07:04 +0000 (22:07 +0000)]
MFC r227215:
When one attempts to compile the tree with -march=i386, which also used
to be gcc's default before r198344, calls to atomic builtins will not be
expanded inline. Instead, they will be generated as calls to external
functions (e.g. __sync_fetch_and_add_N), leading to linking errors later
on.
Put in a seatbelt that disables use of atomic builtins in libstdc++ and
llvm, when tuning specifically for the real i386 CPU. This does not
protect against all possible issues, but it is better than nothing.
MFC r227538:
LLVM uses atomic operations, which are not supported on i386 and GCC
emits calls for them, rather than expanding them inline. Older FreeBSD
versions compile for i386 by default and as such we end up with
unresolved symbols when we build LLVM's TableGen utility as a build
tool on them. Add the functions that GCC emits here, but don't bother
to make them atomic. Such is not needed.
Submitted by: marcel
MFC r227636:
Revert r227538, since it doesn't compile with clang at all (it doesn't
allow the built-in operations to be redefined, at least not without
excessive force).
Instead, just disable LLVM's support for atomic operations for now.
Nothing in either clang or the tablegen tools currently depends on it.
This still allows users of head built before r198344 to upgrade to
top-of-head seamlessly.
kib [Fri, 30 Dec 2011 21:01:14 +0000 (21:01 +0000)]
MFC r227816:
Remove the wrong comment about ufs not being loadable.
Note that only root filesystem module needs to be available
before root is mounted.
dim [Fri, 30 Dec 2011 21:00:02 +0000 (21:00 +0000)]
MFC r227120:
Make it possible to set CC and CXX (and optionally, AS and LD) in
make.conf(5), while allowing the build32 stage on 64-bit architectures
to still override them, so that stage can successfully build 32-bit
compatibility libraries.
Explanation:
1) The build32 stage sets environment variables CC, CXX, AS and LD for
its sub-make, to add 32-bit specific flags (-m32 and such).
2) The sub-make reads sys.mk, encounters CC?= and CXX?= assignments, so
does not alter them.
3) After some other stuff, sys.mk reads /etc/make.conf. When you have
"CC=xxx" and "CXX=yyy" statements in there, they will *override* the
build32-supplied CC/CXX values, nullifying the 32-bit specific flags.
4) Thus all objects get built as 64-bit anyway, and since LD is usually
not set in make.conf, it still has the 32-bit flags!
5) Now, whenever something is linked, you will get a "ld: Relocatable
linking with relocations from format elf64-x86-64-freebsd (foo.o) to
format elf32-i386-freebsd (bar.o) is not supported" error.
Fix this by adding "-ECC -ECXX -EAS -ELD" to the build32 sub-make
invocation, which forces those environment variables to always override
any assignment in makefiles. Thus making it possible to simply set:
kib [Fri, 30 Dec 2011 20:21:53 +0000 (20:21 +0000)]
MFC r227393:
Lock the thread lock around block that retrieves td_wmesg. Otherwise,
procfs could see a thread with assigned td_wchan but still NULL td_wmesg.
kib [Fri, 30 Dec 2011 19:58:06 +0000 (19:58 +0000)]
MFC r228178:
If alloc_unr() call in the pipe_create() failed, then pipe->pipe_ino is
-1. But, because ino_t is unsigned, this case was not covered by the
test ino > 0 in pipeclose(), leading to the free_unr(-1). Fix it by
explicitely comparing with 0 and -1.
Do no access freed memory, the inode number was cached to prevent access
to cpipe after it possibly was freed, but I failed to commit the right
patch.
kib [Fri, 30 Dec 2011 18:20:44 +0000 (18:20 +0000)]
MFC r227024:
Despite official i386 ABI does not mandate any stack alignment besides
the word alignment, some versions of gcc do require 16-byte alignment.
Make sure the stack is 16-byte aligned before calling a subroutine.
kib [Fri, 30 Dec 2011 18:18:06 +0000 (18:18 +0000)]
MFC r227023:
Make sure that stack is 16-byte aligned before calling a function,
as it is required by amd64 ABI. Add a comment for the places were
the stack is accidentally properly aligned already.
glebius [Mon, 19 Dec 2011 13:12:37 +0000 (13:12 +0000)]
Merge r228472. For the sake of POLA for the whole 9.x timeline add
compatibility support for specifing IPv4 aliases in rc.conf without
the "inet" keyword.
des [Tue, 13 Dec 2011 12:59:39 +0000 (12:59 +0000)]
MFH r228384: validate the service name
Approved by: re (kib)
Security: some poorly thought out programs allow the user to specify
the service name; this patch makes it harder to trick these
programs into loading and executing arbitrary code.
des [Sun, 11 Dec 2011 16:57:27 +0000 (16:57 +0000)]
MFH r227757: check for null passphrases, since openssl doesn't
Approved by: re (kib)
Security: prevents users with unencrypted ssh keys (prohibited
unless the nullok option is specified) from logging in
by providing a bogus non-null passphrase.
hrs [Sat, 3 Dec 2011 22:14:15 +0000 (22:14 +0000)]
MFC r226649, 226651, 226652, 226653:
- Fix an issue that 127/8 is not configured when $ifconfig_DEFAULT is not empty.
- Add description that IPv6 configuration will be ignored if $ifconfig_IF_ipv6
is empty.
- Move a configuration example "inet6 accept_rtadv" to just after the manual
GUA configuration.
- Add an example of $ipv6_prefix_IF.
- Add support for removing addresses added by ipv6_prefix_hostid_addr_up()
upon rc.d/netif stop.
hrs [Sat, 3 Dec 2011 22:12:57 +0000 (22:12 +0000)]
MFC r226446:
Fix a problem that an interface unexpectedly becomes IFF_UP by
just doing "ifconfing inet6 -ifdisabled" when the interface has
ND6_IFF_AUTO_LINKLOCAL flag and no link-local address.
nwhitehorn [Sat, 3 Dec 2011 17:15:16 +0000 (17:15 +0000)]
MFC r228194:
Prevent user astonishment by providing the shell option at the end, after
any installer-provided configuration files have been copied. This allows
users to edit their fstab, if desired, and to see what the installer has
placed in rc.conf.
kensmith [Sat, 3 Dec 2011 16:58:55 +0000 (16:58 +0000)]
MFC r228192:
> Add a screen that asks if the user would like to enable crash dumps,
> giving them a very brief description of the trade-offs. Whether the
> user opts in or out add an entry to what will become /etc/rc.conf
> explaining what dumpdev is and how to turn on/off crash dumps. The folks
> who handle interacting with users submitting PRs have asked for this.
>
> Reviewed by: nwhitehorn
dougb [Thu, 1 Dec 2011 21:13:41 +0000 (21:13 +0000)]
Upgrade to BIND 9.8.1-P1 to address the following DDOS bug:
Recursive name servers are failing with an assertion:
INSIST(! dns_rdataset_isassociated(sigrdataset))
At this time it is not thought that authoritative-only servers
are affected, but information about this bug is evolving rapidly.
Because it may be possible to trigger this bug even on networks
that do not allow untrusted users to access the recursive name
servers (perhaps via specially crafted e-mail messages, and/or
malicious web sites) it is recommended that ALL operators of
recursive name servers upgrade immediately.
For more information see:
https://www.isc.org/software/bind/advisories/cve-2011-4313
which will be updated as more information becomes available.
dougb [Thu, 1 Dec 2011 05:46:25 +0000 (05:46 +0000)]
MFC r227482:
The default setting, daily_accounting_compress="NO", was causing
only 1 old file to be saved, so fix this.
While I'm here, fix a very old off-by-one error causing 1 more
file than specified in daily_accounting_save to be saved because
acct.0 was not taken into account (pun intended). Change that, and
use a more thorough method of finding old files to delete. Partly
just because this is the right thing to do, but also to silently
fix the extra log that would have been left behind forever with the
previous method.
marius [Tue, 29 Nov 2011 14:18:05 +0000 (14:18 +0000)]
MFC: r228028
- Based on a report on sparc64@ move V245 to the list of known working
machines.
- Mention that V480 with broken centerplanes have a chance of working with
the WAR in the upcoming 8.3-RELEASE and 9.0-RELEASE.
pluknet [Tue, 29 Nov 2011 12:38:13 +0000 (12:38 +0000)]
MFC r225757,r225764:
Update the default cvs tag for RELENG_9 by merging the following revisions:
r225757 (by kensmith, partial):
Shift head from 9.0-CURRENT to 10.0-CURRENT in preparation for releasing
it from the 9.0-RELEASE release cycle code freeze.
r225764 (by kensmith):
Forgot to add "RELENG_8" to list of CVS tags.
Reported by: Milan Obuch <freebsd-current at dino sk> (cvs tag)
Approved by: re (kib)
marius [Tue, 29 Nov 2011 09:59:51 +0000 (09:59 +0000)]
MFC: r227960
Increase the CDMA sync timeout for Schizo bridges to 15 seconds as used by
OpenSolaris. One second turned out to be not enough for certain loads while
10 seconds were sufficient.
Reported by: Peter Jeremy
Add the sfxge(4) driver providing support for 10Gb Ethernet adapters
based on Solarflare SFC9000 family controllers. The driver supports jumbo
frames, transmit/receive checksum offload, TCP Segmentation Offload (TSO),
Large Receive Offload (LRO), VLAN checksum offload, VLAN TSO, and Receive Side
Scaling (RSS) using MSI-X interrupts.
This work was sponsored by Solarflare Communications, Inc.
My sincere thanks to Ben Hutchings for doing a lot of the hard work!
Sponsored by: Solarflare Communications, Inc.
Approved by: re (bz)
rwatson [Mon, 28 Nov 2011 15:09:31 +0000 (15:09 +0000)]
Merge r228057 from head to stable/9:
Change the Makefile in cddl/lib/drti to use bsd.lib.mk instead of
bsd.prog.mk -- we need to compile PIC, which requires a library build.
With this change, USDT (userspace DTrace probes) work from within
shared libraries.
PR: kern/159046
Submitted by: Alex Samorukov <samm at os2.kiev.ua>
Comments by: Scott Lystig Fritchie <slfritchie at snookles.com>
rwatson [Mon, 28 Nov 2011 14:36:06 +0000 (14:36 +0000)]
Merge r228039 from head to stable/9:
Add an introductory Capsicum man page providing a high-level description of
its mechanisms, pointing at other pertinent man pages, and cautioning about
the experimental status of Capsicum in FreeBSD.
lstewart [Mon, 28 Nov 2011 11:10:12 +0000 (11:10 +0000)]
Fast track MFC r228016:
Plug a TCP reassembly UMA zone leak introduced in r226228 by only using the
backup stack queue entry when the zone is exhausted, otherwise we leak a zone
allocation each time we plug a hole in the reassembly queue.
Reported by: many on freebsd-stable@ (thread: "TCP Reassembly Issues")
Tested by: many on freebsd-stable@ (thread: "TCP Reassembly Issues")
Reviewed by: bz (very brief sanity check)
Approved by: re (kib)
marcel [Sun, 27 Nov 2011 20:07:30 +0000 (20:07 +0000)]
MFC rev. 227629:
Wire the kernel text RWX, rather than RX. We're not quite ready
for having kernel text non-writable, because we still need to
apply relocations. On top of that, the PBVM page table has all
pages marked as RWX, so it's an inconsistency to begin with.
tuexen [Sun, 27 Nov 2011 19:09:31 +0000 (19:09 +0000)]
MFC r228031:
Fix a warning reported by arundel@.
Fix a bug where the parameter length of a supported address types
parameter is set to a wrong value if the kernel is built with
with either INET or INET6, but not both.
kib [Sun, 27 Nov 2011 18:49:16 +0000 (18:49 +0000)]
MFC r227485:
To limit amount of the kernel memory allocated, and to optimize the
iteration over the fdsets, kern_select() limits the length of the
fdsets copied in by the last valid file descriptor index. If any bit
is set in a mask above the limit, current implementation ignores the
filedescriptor, instead of returning EBADF.
Fix the issue by scanning the tails of fdset before entering the
select loop and returning EBADF if any bit above last valid
filedescriptor index is set. The performance impact of the additional
check is only imposed on the (somewhat) buggy applications that pass
bad file descriptors to select(2) or pselect(2).
marius [Fri, 25 Nov 2011 17:06:32 +0000 (17:06 +0000)]
MFC: r227829, r227844
- Add a DEVMETHOD_END alias for KOBJMETHOD_END so that along with 'driver_t'
and DEVMETHOD() we can fully hide the explicit mention of kobj(9) from
device drivers.
- Update the device driver examples to use DEVMETHOD_END.
rstone [Fri, 25 Nov 2011 13:34:27 +0000 (13:34 +0000)]
MFC r227342. Note that the original commit message, reproduced below, has
error. The final sentence should read "*without* CTF data".
The in-kernel CTF parser caches the result of its first attempt to parse
CTF data from a module. On subsequent attempts to retrieve CTF data for
a module, return an error if there no CTF data.
This fixes a panic if you try to enable fbt probes on a module with CTF
data twice.
bschmidt [Fri, 25 Nov 2011 12:19:13 +0000 (12:19 +0000)]
MFC r227805:
The DC calibration result obtained during initialization can't be
passed over to the runtime firmware on 6050 devices. Instead let
the runtime firmware do the calibration itself. This fixes support
for the 6050 series devices.