]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 years agoDon't prune duplicate services in the expected output from /etc/services on
ngie [Sat, 1 Nov 2014 17:09:39 +0000 (17:09 +0000)]
Don't prune duplicate services in the expected output from /etc/services on
FreeBSD

Submitted by: pho

9 years agovt(4): Adjust the cursor position after changing the window size
dumbbell [Sat, 1 Nov 2014 17:05:15 +0000 (17:05 +0000)]
vt(4): Adjust the cursor position after changing the window size

A new terminal_set_cursor() is added: it wraps the existing
teken_set_cursor() function.

In vtbuf_grow(), the cursor position is adjusted at the end of the
function. In vt_change_font(), we call terminal_set_cursor() just after
terminal_set_winsize_blank(), while the terminal is mute.

This fixes a bug where, after loading a kernel video driver which
increases the terminal window size, the cursor remains at its old
position, in other words, in the middle of the display content.

PR: 194421
MFC after: 1 week

9 years agoMFV: Import atf-0.21.
jmmv [Sat, 1 Nov 2014 11:17:54 +0000 (11:17 +0000)]
MFV: Import atf-0.21.

9 years agoPut mtree test files into a subdirectory.
jmmv [Sat, 1 Nov 2014 11:07:59 +0000 (11:07 +0000)]
Put mtree test files into a subdirectory.

Kyua 0.11 points TMPDIR to the test's work directory, and atf_check creates
auxiliary files in TMPDIR.  This confuses a couple of mtree tests that were
using the work directory's root to validate the contents of the directory.

Fix the two affected tests by creating an auxiliary directory to use for
the mtree tests.  (Kyua should probably do this on its own; filed bug #133
upstream to take a look at this.)

9 years agoMove the definitions of the fdt functions from a uboot header to a new fdt
andrew [Sat, 1 Nov 2014 10:50:18 +0000 (10:50 +0000)]
Move the definitions of the fdt functions from a uboot header to a new fdt
header. There is nothing in the fdt spec that ties it to U-Boot.

While here sort and fix the signature of fdt_setup_fdtp.

MFC after: 1 week

9 years agoFix the build of non-FDT systems by moving the gpiobusvar.h header outside
loos [Sat, 1 Nov 2014 10:40:29 +0000 (10:40 +0000)]
Fix the build of non-FDT systems by moving the gpiobusvar.h header outside
the FDT #ifdef.

While here remove a few unused headers.

9 years agoDon't zero the stats before they are read out.
tuexen [Sat, 1 Nov 2014 10:35:45 +0000 (10:35 +0000)]
Don't zero the stats before they are read out.

MFC after: 3 days

9 years ago<sys/param.h> is a superset of <sys/types.h> and must always come
des [Sat, 1 Nov 2014 09:10:21 +0000 (09:10 +0000)]
<sys/param.h> is a superset of <sys/types.h> and must always come
first.  Coincidentally, today is the 11th anniversary of this man
page's (and this bug's) first appearance in FreeBSD.

MFC after: 3 days

9 years agoRewrite some of the disk setup documentation to be clearer and contain
nwhitehorn [Fri, 31 Oct 2014 23:52:02 +0000 (23:52 +0000)]
Rewrite some of the disk setup documentation to be clearer and contain
less obsolete information. Also move the entropy command down the list --
the list is ordered by likelihood of use rather than alphabetically.

MFC after: 1 week

9 years agosh: Fix corruption of CTL* bytes in positional parameters in redirection.
jilles [Fri, 31 Oct 2014 22:28:10 +0000 (22:28 +0000)]
sh: Fix corruption of CTL* bytes in positional parameters in redirection.

EXP_REDIR was not being checked for while expanding positional parameters in
redirection, so CTL* bytes were not being prefixed where they should be.

MFC after: 1 week

9 years agorc.d/geli should not depend on random, as the attach functionality
delphij [Fri, 31 Oct 2014 22:20:27 +0000 (22:20 +0000)]
rc.d/geli should not depend on random, as the attach functionality
do not require additional entropy to function.

It would create a circular dependency (not immediately obvious:
geli provides 'disks' and requires 'random' as of r273872,
'random' requires 'FILESYSTEMS', 'FILESYSTEMS' requires 'root',
'root' requires 'swap', and finally 'swap' requires 'disk').

9 years agoChange the default log level for iSCSI target from 3 to 1. It should
trasz [Fri, 31 Oct 2014 19:26:12 +0000 (19:26 +0000)]
Change the default log level for iSCSI target from 3 to 1.  It should
have been 1 from the beginning; not sure how it ended up at 3.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoFix the gpiobus locking by using a more sane model where it isn't necessary
loos [Fri, 31 Oct 2014 19:15:14 +0000 (19:15 +0000)]
Fix the gpiobus locking by using a more sane model where it isn't necessary
hold the gpiobus lock between the gpio calls.

gpiobus_acquire_lock() now accepts a third parameter which tells gpiobus
what to do when the bus is already busy.

When GPIOBUS_WAIT wait is used, the calling thread will be put to sleep
until the bus became free.

With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK right
away and then it can act upon.

This fixes the gpioiic(4) locking issues that arises when doing multiple
concurrent access on the bus.

9 years agoThe command name is a constant, use the correct type.
andrew [Fri, 31 Oct 2014 18:35:03 +0000 (18:35 +0000)]
The command name is a constant, use the correct type.

MFC after: 1 week

9 years agoClean up the types of a few strings to make them const when they are never
andrew [Fri, 31 Oct 2014 18:20:39 +0000 (18:20 +0000)]
Clean up the types of a few strings to make them const when they are never
written to.

9 years agoAdd type qualifier volatile to the base (userspace) address argument
kib [Fri, 31 Oct 2014 17:43:21 +0000 (17:43 +0000)]
Add type qualifier volatile to the base (userspace) address argument
of fuword(9) and suword(9).  This makes the functions type-compatible
with volatile objects and does not require devolatile force, e.g. in
kern_umtx.c.

Requested by: bde
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

9 years agoUse macro ERROUT() to make code more laconic and follow style of other
glebius [Fri, 31 Oct 2014 16:00:45 +0000 (16:00 +0000)]
Use macro ERROUT() to make code more laconic and follow style of other
netgraph code.

Submitted by: Dmitry Luhtionov <dmitryluhtionov gmail.com>

9 years agoRemove the check for packets with broadcast source from if_gif's encapcheck.
ae [Fri, 31 Oct 2014 15:23:24 +0000 (15:23 +0000)]
Remove the check for packets with broadcast source from if_gif's encapcheck.

The check was recommened in the draft-ietf-ngtrans-mech-05.txt. But it isn't
clear, should it compare the source with all direct broadcast addresses in the
system or not.
RFC 4213 says it is enough to verify that the source address is the address
of the encapsulator, as configured on the decapsulator. And this verification
can be extended by administrator with any other forms of IPv4 ingress filtering.

Discussed with: glebius, melifaro
Sponsored by: Yandex LLC

9 years agoFix usage of kern_getenv().
kevlo [Fri, 31 Oct 2014 15:07:51 +0000 (15:07 +0000)]
Fix usage of kern_getenv().

9 years agoAdd /etc/rc.d/initrandom, which was removed in r273872.
des [Fri, 31 Oct 2014 14:22:26 +0000 (14:22 +0000)]
Add /etc/rc.d/initrandom, which was removed in r273872.

Noticed by: ache@

9 years agoPrint human-readable error for "route not found" case.
melifaro [Fri, 31 Oct 2014 13:37:47 +0000 (13:37 +0000)]
Print human-readable error for "route not found" case.

Submitted by: vsevolod (initial version)
MFC after: 2 weeks
Sponsored by: Yandex LLC

9 years agoUse in_localip() instead of handmade implementation.
ae [Fri, 31 Oct 2014 12:19:22 +0000 (12:19 +0000)]
Use in_localip() instead of handmade implementation.

MFC after: 1 week
Sponsored by: Yandex LLC

9 years agoFix typo.
ae [Fri, 31 Oct 2014 11:40:49 +0000 (11:40 +0000)]
Fix typo.

9 years agoBuild ttm_agp_backend.c.
tijl [Fri, 31 Oct 2014 10:45:34 +0000 (10:45 +0000)]
Build ttm_agp_backend.c.

Reported by: dumbbell
MFC after: 1 month

9 years agofiledesc: drop retval argument from do_dup
mjg [Fri, 31 Oct 2014 10:35:01 +0000 (10:35 +0000)]
filedesc: drop retval argument from do_dup

It was almost always td_retval anyway.

For the one case where it is not, preserve the old value across the call.

9 years agoOnly put one CTASSERT() inside each macro to avoid compile issues.
hselasky [Fri, 31 Oct 2014 10:18:58 +0000 (10:18 +0000)]
Only put one CTASSERT() inside each macro to avoid compile issues.
The problem is that the __LINE__ macro is constant inside a macro and
results in identical assert statements when the compiler does not
support the static builtin assert function.

MFC: 3 days
Sponsored by: Mellanox Technologies

9 years agofiledesc: fix missed comments about fdsetugidsafety
mjg [Fri, 31 Oct 2014 09:56:00 +0000 (09:56 +0000)]
filedesc: fix missed comments about fdsetugidsafety

While here just note that both fdsetugidsafety and fdcheckstd take sleepable
locks.

9 years agoBuild mount_nfs(8) with WARNS=6.
trasz [Fri, 31 Oct 2014 09:51:54 +0000 (09:51 +0000)]
Build mount_nfs(8) with WARNS=6.

Reviewed by: rmacklem@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agofiledesc: make fdinit return with source filedesc locked and new one sized
mjg [Fri, 31 Oct 2014 09:25:28 +0000 (09:25 +0000)]
filedesc: make fdinit return with source filedesc locked and new one sized
appropriately

Assert FILEDESC_XLOCK_ASSERT only for already used tables in fdgrowtable.
We don't have to call it with the lock held if we are just creating new
filedesc.

As a side note, strictly speaking processes can have fdtables with
fd_lastfile = -1, but then they cannot enter fdgrowtable. Very first file
descriptor they get will be 0 and the only syscall allowing to choose fd number
requires an active file descriptor. Should this ever change, we can add an 'init'
(or similar) parameter to fdgrowtable.

9 years agofiledesc: iterate over fd table only once in fdcopy
mjg [Fri, 31 Oct 2014 09:19:46 +0000 (09:19 +0000)]
filedesc: iterate over fd table only once in fdcopy

While here add 'fdused_init' which does not perform unnecessary work.

Drop FILEDESC_LOCK_ASSERT from fdisused and rely on callers to hold
it when appropriate. This function is only used with INVARIANTS.

No functional changes intended.

9 years agofiledesc: tidy up fdfree
mjg [Fri, 31 Oct 2014 09:15:59 +0000 (09:15 +0000)]
filedesc: tidy up fdfree

Implement fdefree_last variant and get rid of 'last' parameter.

No functional changes.

9 years agofiledesc: tidy up fdcopy a little bit
mjg [Fri, 31 Oct 2014 05:41:27 +0000 (05:41 +0000)]
filedesc: tidy up fdcopy a little bit

Test for file availability by fde_file != NULL instead of fdisused, this is
consistent with similar checks later.

Drop badfileops check. badfileops don't have DFLAG_PASSABLE set, so it was never
reached in practice.

fdiused is now only used in some KASSERTS, so ifdef it under INVARIANTS.

No functional changes.

9 years agoUse search method instead of fixed offsets for finding rootfs. This unbreaks
hiren [Thu, 30 Oct 2014 23:47:28 +0000 (23:47 +0000)]
Use search method instead of fixed offsets for finding rootfs. This unbreaks
recent images for picostation by allowing to find rootfs at correct location.

Suggested by: loos
MFC after: 1 month

9 years agoBump FreeBSD_version due to syscall*_register API changes in r273707
mjg [Thu, 30 Oct 2014 22:47:32 +0000 (22:47 +0000)]
Bump FreeBSD_version due to syscall*_register API changes in r273707

9 years agoUse the right depend file for each program.
jmmv [Thu, 30 Oct 2014 22:07:29 +0000 (22:07 +0000)]
Use the right depend file for each program.

bsd.progs.mk generates a separate depend file for every program being
built, but then it does not properly tell each submake to use those
individual files.  Properly propagate the depend file to use.

Discovered while preparing the update of atf to 0.21 and noticing that
the test programs were not being relinked to the new library.

This change is "make tinderbox" clean.

9 years agoThis is the much-discussed major upgrade to the random(4) device, known to you all...
markm [Thu, 30 Oct 2014 21:21:53 +0000 (21:21 +0000)]
This is the much-discussed major upgrade to the random(4) device, known to you all as /dev/random.

This code has had an extensive rewrite and a good series of reviews, both by the author and other parties. This means a lot of code has been simplified. Pluggable structures for high-rate entropy generators are available, and it is most definitely not the case that /dev/random can be driven by only a hardware souce any more. This has been designed out of the device. Hardware sources are stirred into the CSPRNG (Yarrow, Fortuna) like any other entropy source. Pluggable modules may be written by third parties for additional sources.

The harvesting structures and consequently the locking have been simplified. Entropy harvesting is done in a more general way (the documentation for this will follow). There is some GREAT entropy to be had in the UMA allocator, but it is disabled for now as messing with that is likely to annoy many people.

The venerable (but effective) Yarrow algorithm, which is no longer supported by its authors now has an alternative, Fortuna. For now, Yarrow is retained as the default algorithm, but this may be changed using a kernel option. It is intended to make Fortuna the default algorithm for 11.0. Interested parties are encouraged to read ISBN 978-0-470-47424-2 "Cryptography Engineering" By Ferguson, Schneier and Kohno for Fortuna's gory details. Heck, read it anyway.

Many thanks to Arthur Mesh who did early grunt work, and who got caught in the crossfire rather more than he deserved to.

My thanks also to folks who helped me thresh this out on whiteboards and in the odd "Hallway track", or otherwise.

My Nomex pants are on. Let the feedback commence!

Reviewed by: trasz,des(partial),imp(partial?),rwatson(partial?)
Approved by: so(des)

9 years agoSkip the smap sysctl instead of panicing if no kernel metadata can be
jhb [Thu, 30 Oct 2014 17:58:57 +0000 (17:58 +0000)]
Skip the smap sysctl instead of panicing if no kernel metadata can be
found.

Submitted by: bde
MFC after: 3 days

9 years agoImport atf-0.21:
jmmv [Thu, 30 Oct 2014 17:14:07 +0000 (17:14 +0000)]
Import atf-0.21:

Released on October 23rd, 2014.

* Restored the atf(7) manual page to serve as a reference to all the other
  manual pages shipped by ATF.

* Added the -s flag to atf-sh to support specifying the shell interpreter
  to be used.

* Removed ATF_WORKDIR.  The only remaining consumers have been converted to
  use the standard TMPDIR environment variable.  As a benefit, and because
  Kyua forces the TMPDIR to live within the test case's work directory,
  any stale files left behind by ATF will be automatically cleaned up.

* Documented the environment variables recognized by each component in the
  relevant manual pages.  This information was lost with the atf-config(1)
  removal.

* Added a new "require.diskspace" metadata property to test cases so that
  they can specify the minimum amount of disk space required for the test
  to run.

* Renamed the atf-{c,c++,sh}-api(3) manual pages to atf-{c,c++,sh}(3) for
  discoverability purposes.  Symbolic links are provided for the time
  being to still make the old names visible.

* Issue #5: Recommend the (expected, actual) idiom for calls to the test
  macros in the manual pages.

* Issue #7: Stopped catching unhandled exceptions in atf-c++ tests.  This
  propagates the crash to the caller, which in turn allows it to obtain
  proper debugging information.  In particular, Kyua should now be able to
  extract a stacktrace pinpointing the problem.

* Issue #8: Fixed atf-c/macros_test:use test failures spotted by the clang
  that ships with FreeBSD 11.0-CURRENT.

* Issue #12: Improved documentation of atf-sh(3) and atf-check(1) by better
  explaining how they relate to each other.

* Issue #14: Stopped setting 'set -e' in atf-sh.  This setting was
  initially added as a way to enable a "strict" mode in the library and to
  make test cases fail fast when they run unprotected commands.  However,
  doing so in the library is surprising as the responsibility of enabling
  'set -e' should be on the user's code.  Also, 'set -e' introduces
  inconsistent behavior on subshells and users do not expect that.

* Issue #15: Fixed atf_utils_{fork,wait} to support nested calls.

* Issue #16: Fixed test failures (by removing a long-standing hack) on
  systems that lack \e support in printf(1).

* Issue #19: Removed stale references to atf-config and atf-run.

9 years agoFix compile warning by removing unused variable.
hselasky [Thu, 30 Oct 2014 16:57:56 +0000 (16:57 +0000)]
Fix compile warning by removing unused variable.

MFC: 3 days
Sponsored by: Mellanox Technologies

9 years agoPlug memory ordering holes in buf_ring_enqueue. For at least some
jpaetzel [Thu, 30 Oct 2014 16:26:17 +0000 (16:26 +0000)]
Plug memory ordering holes in buf_ring_enqueue. For at least some
users this patch eliminates the races previously discussed on the
mailing list.

Submitted by: oleg
Reviewed by: kmacy
MFC after: 2 weeks
Tested by: kmacy,rpaulo

9 years agoMake UEFI booting of 4Kn disks work:
ambrisko [Thu, 30 Oct 2014 15:52:01 +0000 (15:52 +0000)]
Make UEFI booting of 4Kn disks work:
      - convert boot1.efi to corrrectly calculate the lba for what the
media reports and convert the size based on what FreeBSD uses.
The existing code would use the 512 byte lba and convert the
size using 4K byte size.
      - make fsck_msdosfs read the boot block as 4K so the read doesn't
fail on a 4Kn drive since FreeBSD will error out parition reads
of a block.  Make the bpbBytesPerSec check a multiple of 512 since
it can be 512 or 4K depending on the disk.  This allows fsck to
pass checking the EFI partition on a 4Kn disk.

To create the EFI file system I used:
newfs_msdos -F 32 -S 4096 -c 1 -m 0xf8 <partition>
This works for booting 512 and 4Kn disks.

Caveat is that loader.efi cannot read the 4Kn EFI partition.  This isn't
critical right now since boot1.efi will read loader.efi from the ufs
partition.  It looks like loader.efi can be fixed via making some of the
512 bytes reads more flexible.  loader.efi doesn't have trouble reading
the ufs partition.  This is probably a simple fix.

I now have FreeBSD installed on a system with 4Kn drives and tested the
same code works on 512.

MFC after: 1 week

9 years agoAvoid possible overflow in agp_generic_alloc_memory.
tijl [Thu, 30 Oct 2014 14:36:27 +0000 (14:36 +0000)]
Avoid possible overflow in agp_generic_alloc_memory.

MFC after: 1 week

9 years agoPort the TTM AGP backend to the FreeBSD agp driver and enable AGP support
tijl [Thu, 30 Oct 2014 14:26:36 +0000 (14:26 +0000)]
Port the TTM AGP backend to the FreeBSD agp driver and enable AGP support
in the radeonkms driver.

Note: In PCI mode virtual addresses on the graphics card that map to system
RAM are translated to physical addresses by the graphics card itself.   In
AGP mode address translation is done by the AGP chipset so fictitious
addresses appear on the system bus.  For the CPU cache management to work
correctly when the CPU accesses this memory it needs to use the same
fictitious addresses (and let the chipset translate them) instead of using
the physical addresses directly.

Reviewed by: kib
MFC after: 1 month

9 years agoRemove two functions unused after r273848. Would be nice if clang
trasz [Thu, 30 Oct 2014 14:05:48 +0000 (14:05 +0000)]
Remove two functions unused after r273848.  Would be nice if clang
or at least scan-build yelled about it.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoRemove redundant code.
ae [Thu, 30 Oct 2014 12:44:46 +0000 (12:44 +0000)]
Remove redundant code.
if_detach already did these steps. Also, now we didn't keep routes to link-local
addresses.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

9 years agoMove ifq drain into in6m_purge().
ae [Thu, 30 Oct 2014 11:34:07 +0000 (11:34 +0000)]
Move ifq drain into in6m_purge().

Suggested by: bms
MFC after: 1 week
Sponsored by: Yandex LLC

9 years agoAdd two new functions to the AGP driver KPI to bind/unbind arbitrary sets
tijl [Thu, 30 Oct 2014 11:27:03 +0000 (11:27 +0000)]
Add two new functions to the AGP driver KPI to bind/unbind arbitrary sets
of pages into the GTT.

Reviewed by: kib
MFC after: 1 month

9 years agoFix mbuf leak in IPv6 multicast code.
ae [Thu, 30 Oct 2014 10:59:57 +0000 (10:59 +0000)]
Fix mbuf leak in IPv6 multicast code.
When multicast capable interface goes away, it leaves multicast groups,
this leads to generate MLD reports, but MLD code does deffered send and
MLD reports are queued in the in6_multi's in6m_scq ifq. The problem is
that in6_multi structures are freed when interface leaves multicast groups
and thread that does deffered send will not take these queued packets.

PR: 194577
MFC after: 1 week
Sponsored by: Yandex LLC

9 years agoUpdate acl(3) to expand on NFSv4 ACL support.
trasz [Thu, 30 Oct 2014 10:56:38 +0000 (10:56 +0000)]
Update acl(3) to expand on NFSv4 ACL support.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoMake it clear that ACL flags are NFSv4-only.
trasz [Thu, 30 Oct 2014 10:49:50 +0000 (10:49 +0000)]
Make it clear that ACL flags are NFSv4-only.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoFix handling of "conn" mount_nfs(8) option.
trasz [Thu, 30 Oct 2014 09:25:03 +0000 (09:25 +0000)]
Fix handling of "conn" mount_nfs(8) option.

Reviewed by: rmacklem@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoNote that the "timeout" nfs option is in tenths of a second.
trasz [Thu, 30 Oct 2014 09:06:52 +0000 (09:06 +0000)]
Note that the "timeout" nfs option is in tenths of a second.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoFix a race condition in TCP timewait between tcp_tw_2msl_reuse() and
jch [Thu, 30 Oct 2014 08:53:56 +0000 (08:53 +0000)]
Fix a race condition in TCP timewait between tcp_tw_2msl_reuse() and
tcp_tw_2msl_scan().  This race condition drives unplanned timewait
timeout cancellation.  Also simplify implementation by holding inpcb
reference and removing tcptw reference counting.

Differential Revision: https://reviews.freebsd.org/D826
Submitted by: Marc De la Gueronniere <mdelagueronniere@verisign.com>
Submitted by: jch
Reviewed By: jhb (mentor), adrian, rwatson
Sponsored by: Verisign, Inc.
MFC after: 2 weeks
X-MFC-With: r264321

9 years agoAdd support for "timeo", "actimeo", "noac", and "proto" options
trasz [Thu, 30 Oct 2014 08:50:01 +0000 (08:50 +0000)]
Add support for "timeo", "actimeo", "noac", and "proto" options
to mount_nfs(8).  They are implemented on Linux, OS X, and Solaris,
and thus can be expected to appear in automounter maps.

Reviewed by: rmacklem@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoGet rid of obsolete code in mount_nfs(8).
trasz [Thu, 30 Oct 2014 08:05:51 +0000 (08:05 +0000)]
Get rid of obsolete code in mount_nfs(8).

Reviewed by: rmacklem@
Sponsored by: The FreeBSD Foundation

9 years agofiledesc: make sure to force table reload in fget_unlocked when count == 0
mjg [Thu, 30 Oct 2014 07:21:38 +0000 (07:21 +0000)]
filedesc: make sure to force table reload in fget_unlocked when count == 0

This is a fixup to r273843.

9 years agofix spelling of offset since that is what is used in the body...
jmg [Thu, 30 Oct 2014 06:54:25 +0000 (06:54 +0000)]
fix spelling of offset since that is what is used in the body...

9 years agofiledesc: microoptimize fget_unlocked by retrying obtaining reference count
mjg [Thu, 30 Oct 2014 05:21:12 +0000 (05:21 +0000)]
filedesc: microoptimize fget_unlocked by retrying obtaining reference count
without restarting whole lookup

Restart is only needed when fp was closed by current process, which is a much
rarer event than ref/deref by some other thread.

9 years agofiledesc: get rid of atomic_load_acq_int from fget_unlocked
mjg [Thu, 30 Oct 2014 05:10:33 +0000 (05:10 +0000)]
filedesc: get rid of atomic_load_acq_int from fget_unlocked

A read barrier was necessary because fd table pointer and table size were
updated separately, opening a window where fget_unlocked could read new size
and old pointer.

This patch puts both these fields into one dedicated structure, pointer to which
is later atomically updated. As such, fget_unlocked only needs data a dependency
barrier which is a noop on all supported architectures.

Reviewed by: kib (previous version)
MFC after: 2 weeks

9 years ago.a's are installed in /usr/lib, don't delete them.
delphij [Wed, 29 Oct 2014 22:22:24 +0000 (22:22 +0000)]
.a's are installed in /usr/lib, don't delete them.

9 years agoFix a clang 3.5 warning about abs(3) being given an argument of type
dim [Wed, 29 Oct 2014 20:18:37 +0000 (20:18 +0000)]
Fix a clang 3.5 warning about abs(3) being given an argument of type
quad_t in setusercontext().  While here, sanitize the clamping of the
priority value, and use the correct type for the return value of
login_getcapnum().

Reviewed by: kib
MFC after: 3 days

9 years agoReplace a magic number with the proper definition. This change actually
jkim [Wed, 29 Oct 2014 19:21:19 +0000 (19:21 +0000)]
Replace a magic number with the proper definition.  This change actually
fixes broken state field after r273266, i.e., "CPU-1" was displayed in place
of "RUN".

9 years agoRework the EXAMPLES section to be a bit clearer.
jhb [Wed, 29 Oct 2014 18:01:09 +0000 (18:01 +0000)]
Rework the EXAMPLES section to be a bit clearer.
- Add an example of using etcupdate diff.
- Create a subsection on bootstrapping that is below the simple
  examples.  This should make it clearer that 'etcupdate extract' is
  a one-time operation and not part of the common workflow.  It also
  adds more suggestions on when bootstrapping is needed and additional
  steps to make future merges simpler.

Reviewed by: adrian
MFC after: 3 days

9 years agoFix iscsictl(8) and ctld(8) to correctly handle Windows newlines
trasz [Wed, 29 Oct 2014 12:22:32 +0000 (12:22 +0000)]
Fix iscsictl(8) and ctld(8) to correctly handle Windows newlines
(CRLF) in iscsi.conf and ctl.conf.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoKeep the token list sorted.
trasz [Wed, 29 Oct 2014 12:12:27 +0000 (12:12 +0000)]
Keep the token list sorted.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoMake it possible to optionally use semicolon to separate statements.
trasz [Wed, 29 Oct 2014 12:10:39 +0000 (12:10 +0000)]
Make it possible to optionally use semicolon to separate statements.
This makes it possible to format stuff like this:

target xxx {
lun 0 { path /foo/bar; size 4G; }
}

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoSimplify code; no functional changes.
trasz [Wed, 29 Oct 2014 09:36:02 +0000 (09:36 +0000)]
Simplify code; no functional changes.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoAdd discovery-filter. This makes it possible to restrict which targets
trasz [Wed, 29 Oct 2014 09:26:55 +0000 (09:26 +0000)]
Add discovery-filter.  This makes it possible to restrict which targets
are returned during discovery based on initiator portal, name, and CHAP
credentials.

Reviewed by: mav@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agorping: make sure that the CQ event thread can never poll a CQ after it
np [Wed, 29 Oct 2014 06:24:12 +0000 (06:24 +0000)]
rping: make sure that the CQ event thread can never poll a CQ after it
has been destroyed.

Submitted by: Hariprasad at Chelsio dot com
Sponsored by: Chelsio Communications

9 years agoFix the logic inversion in the previous commit by ensuring that the matched
ngie [Wed, 29 Oct 2014 04:32:46 +0000 (04:32 +0000)]
Fix the logic inversion in the previous commit by ensuring that the matched
expression (:M) is empty, not the not matched (:N) is empty. The former case
means we have not found the TEST_SUBDIR value in SUBDIR

Reported by: rodrigc
X-MFC with: r273803
Pointyhat to: me (did not use a clean install root)
Sponsored by: EMC / Isilon Storage Division

9 years agoImplement better handling for ENOSPC error for both CTL and CAM.
mav [Wed, 29 Oct 2014 03:14:29 +0000 (03:14 +0000)]
Implement better handling for ENOSPC error for both CTL and CAM.

This makes VMWare VAAI Thin Provisioning Stun primitive activate, pausing
the virtual machine, when backing storage (ZFS pool) is getting overflowed.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

9 years agomake this compile on arm... bus_size_t is not size_t, and it has
jmg [Wed, 29 Oct 2014 02:23:50 +0000 (02:23 +0000)]
make this compile on arm...  bus_size_t is not size_t, and it has
different sizes on different arches...

9 years agoUserspace library for Chelsio's Terminator 5 based iWARP RNICs (pretty
np [Wed, 29 Oct 2014 01:15:48 +0000 (01:15 +0000)]
Userspace library for Chelsio's Terminator 5 based iWARP RNICs (pretty
much every T5 card that does _not_ have "-SO" in its name is RDMA
capable).

This plugs into the OFED verbs framework and allows userspace RDMA
applications to work over T5 RNICs.  Tested with rping.

Obtained from: Chelsio Communications
Relnotes: Yes
Sponsored by: Chelsio Communications

9 years agoFilter out TESTS_SUBDIRS already added to SUBDIR instead of blindly
ngie [Tue, 28 Oct 2014 23:01:09 +0000 (23:01 +0000)]
Filter out TESTS_SUBDIRS already added to SUBDIR instead of blindly
appending the TESTS_SUBDIRS variable to SUBDIR

Duplicate directory entries can cause unexpected side effects, like
installing the same files multiple times. This can be easily
reproduced via the following testcase prior to this commit:

  SUBDIR= dir
  TESTS_SUBDIRS+= dir

  .include <bsd.test.mk>

Sponsored by: EMC / Isilon Storage Division

9 years agoTreat IFS separators in "$*" as quoted.
jilles [Tue, 28 Oct 2014 22:14:31 +0000 (22:14 +0000)]
Treat IFS separators in "$*" as quoted.

This makes a difference if IFS starts with *, ?, [ or a CTL* byte.

9 years agoRework virtual machine hypervisor detection.
jhb [Tue, 28 Oct 2014 19:17:44 +0000 (19:17 +0000)]
Rework virtual machine hypervisor detection.
- Move the existing code to x86/x86/identcpu.c since it is x86-specific.
- If the CPUID2_HV flag is set, assume a hypervisor is present and query
  the 0x40000000 leaf to determine the hypervisor vendor ID.  Export the
  vendor ID and the highest supported hypervisor CPUID leaf via
  hv_vendor[] and hv_high variables, respectively.  The hv_vendor[]
  array is also exported via the hw.hv_vendor sysctl.
- Merge the VMWare detection code from tsc.c into the new probe in
  identcpu.c.  Add a VM_GUEST_VMWARE to identify vmware and use that in
  the TSC code to identify VMWare.

Differential Revision: https://reviews.freebsd.org/D1010
Reviewed by: delphij, jkim, neel

9 years agoMake the GPIO children attach to the first unit available and not only to
loos [Tue, 28 Oct 2014 18:33:59 +0000 (18:33 +0000)]
Make the GPIO children attach to the first unit available and not only to
unit 0.

It seems that this 'simplification' was copied to all GPIO drivers in tree.

This fix a bug where a GPIO controller could fail to attach its children
(gpioc and gpiobus) if another GPIO driver attach first.

9 years agoAlways request a completion for every work request for iWARP. The
np [Tue, 28 Oct 2014 18:10:57 +0000 (18:10 +0000)]
Always request a completion for every work request for iWARP.  The
initial MPA exchange must be tracked this way so that t4_tom's state for
the tid is all clean at the time the tid transitions to RDMA mode.  Once
it does, t4_tom is out of the way and iw_cxgbe uses the qp endpoints
directly.

Sponsored by: Chelsio Communications

9 years agoImport in latest mtree from NetBSD to fix a bug in parsing group files
brooks [Tue, 28 Oct 2014 17:52:26 +0000 (17:52 +0000)]
Import in latest mtree from NetBSD to fix a bug in parsing group files
that jmg fixed upstream.

MFC after: 1 week
Sponsored by: DARPA, AFRL

9 years agoDocument iSNS defaults.
trasz [Tue, 28 Oct 2014 17:11:51 +0000 (17:11 +0000)]
Document iSNS defaults.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoFix renaming a group via the gr_copy function
bapt [Tue, 28 Oct 2014 16:27:29 +0000 (16:27 +0000)]
Fix renaming a group via the gr_copy function

Add a regression test to pw(8) because the bug was discovered via using:
pw groupmod

PR: 187189
Reported by: mcdouga9@egr.msu.edu
Tested by: mcdouga9@egr.msu.edu
Patch by: Marc de la Gueronniere

9 years agoActually install casuword(9) to fix build.
jkim [Tue, 28 Oct 2014 16:19:02 +0000 (16:19 +0000)]
Actually install casuword(9) to fix build.

9 years agoEnsure pw userdel -u <invalid> do not try to remove root
bapt [Tue, 28 Oct 2014 15:46:22 +0000 (15:46 +0000)]
Ensure pw userdel -u <invalid> do not try to remove root

Check the uid passed is actually a number as early as possible

MFC after: 1 week

9 years agoFix atf syntax
bapt [Tue, 28 Oct 2014 15:33:15 +0000 (15:33 +0000)]
Fix atf syntax

9 years agoConvert kern_umtx.c to use fueword() and casueword().
kib [Tue, 28 Oct 2014 15:30:33 +0000 (15:30 +0000)]
Convert kern_umtx.c to use fueword() and casueword().

Also fix some mishandling of suword(9) errors as errno, which resulted
in spurious ERESTART.

Sponsored by: The FreeBSD Foundation
Tested by: pho
MFC after: 3 weeks

9 years agoReplace some calls to fuword() by fueword() with proper error checking.
kib [Tue, 28 Oct 2014 15:28:20 +0000 (15:28 +0000)]
Replace some calls to fuword() by fueword() with proper error checking.

Sponsored by: The FreeBSD Foundation
Tested by: pho
MFC after: 3 weeks

9 years agoAdd fueword(9) and casueword(9) functions. They are like fuword(9)
kib [Tue, 28 Oct 2014 15:22:13 +0000 (15:22 +0000)]
Add fueword(9) and casueword(9) functions.  They are like fuword(9)
and casuword(9), but do not mix value read and indication of fault.

I know (or remember) enough assembly to handle x86 and powerpc.  For
arm, mips and sparc64, implement fueword() and casueword() as wrappers
around fuword() and casuword(), which means that the functions cannot
distinguish between -1 and fault.

On architectures where fueword() and casueword() are native, implement
fuword() and casuword() using fueword() and casuword(), to reduce
assembly code duplication.

Sponsored by: The FreeBSD Foundation
Tested by: pho
MFC after: 2 weeks (ia64 needs treating)

9 years agoDo not delete the group wheel when bad argument is passed to pw groupdel -g
bapt [Tue, 28 Oct 2014 14:54:04 +0000 (14:54 +0000)]
Do not delete the group wheel when bad argument is passed to pw groupdel -g

Check that the -g argument is actually a number, if not report an error.
This argument is converted without checking with atoi(3) later so without this
check it converts any alpha entries into 0 meaning it deletes the group wheel

Add a regression test about it

PR: 90114
Reported by: bkoenig@cs.tu-berlin.de
MFC after: 1 week

9 years agoAdd missing /usr/lib/debug directories
emaste [Tue, 28 Oct 2014 14:48:52 +0000 (14:48 +0000)]
Add missing /usr/lib/debug directories

Directories for /usr/lib{,32}/{i18n,private} were missing from the mtree
file, which caused installworld to install the files that should be in
the directory as the name of the directory.

9 years agoFix a regression in pw usermod -G list
bapt [Tue, 28 Oct 2014 14:19:17 +0000 (14:19 +0000)]
Fix a regression in pw usermod -G list

The user was perperly adding the to different groups from "list" but was not
removed from the other groups it could have belong to.
While here add a regression test about this bug

PR: 185666
Reported by: sub.mesa@gmail.com
MFC after: 1 week

9 years agoRemove spurious libelf dependency.
nwhitehorn [Tue, 28 Oct 2014 14:11:54 +0000 (14:11 +0000)]
Remove spurious libelf dependency.

Submitted by: pluknet

9 years agoMake some infiniband example utilities easily buildable:
hselasky [Tue, 28 Oct 2014 13:38:10 +0000 (13:38 +0000)]
Make some infiniband example utilities easily buildable:
- Add new Makefiles.
- Add more include directories when building.
- Fixed a printf() formatting string.

MFC after: 3 days
Sponsored by: Mellanox Technologies

9 years agoThe SYSCTL data pointers can come from userspace and must not be
hselasky [Tue, 28 Oct 2014 12:00:39 +0000 (12:00 +0000)]
The SYSCTL data pointers can come from userspace and must not be
directly accessed. Although this will work on some platforms, it can
throw an exception if the pointer is invalid and then panic the kernel.

Add a missing SYSCTL_IN() of "SCTP_BASE_STATS" structure.

MFC after: 3 days
Sponsored by: Mellanox Technologies

9 years agoWhen a group is renamed then the group has been invalidated for sure.
bapt [Tue, 28 Oct 2014 11:20:30 +0000 (11:20 +0000)]
When a group is renamed then the group has been invalidated for sure.
In that case get the group information using the new name.

Add a regression test about this bug

PR: 193704
Reported by: az

9 years agoAdd regression tests for the timeout(1) utility
bapt [Tue, 28 Oct 2014 10:39:41 +0000 (10:39 +0000)]
Add regression tests for the timeout(1) utility

They are modeled over the regression tests that are provided for the GNU
coreutils timeout(1) utility

9 years agoFix build after previous commit. While here, improve error messages.
trasz [Tue, 28 Oct 2014 10:39:29 +0000 (10:39 +0000)]
Fix build after previous commit.  While here, improve error messages.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoImprove compatibility with GNU timeout
bapt [Tue, 28 Oct 2014 10:33:31 +0000 (10:33 +0000)]
Improve compatibility with GNU timeout

According to the coreutils regression testsuite for timeout(1)
It is expect to exit with a status being:
125 in case an invalid duration or signal is passed in arguments
126 in case an invalid command is passed in arguments
127 in case the command passed in arguments does not exists.

While here document this behaviour in the man page

9 years agoRemove the distinction between strings and numbers from ctld(8) yacc parser.
trasz [Tue, 28 Oct 2014 10:25:59 +0000 (10:25 +0000)]
Remove the distinction between strings and numbers from ctld(8) yacc parser.
This fixes problems with passing strings that look like numbers to clauses
that expect strings; previously it caused syntax errors and had to be worked
by user, using quotes.  The workaround introduced in r267833 is no longer
neccessary.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoReported by: Coverity
araujo [Tue, 28 Oct 2014 07:19:02 +0000 (07:19 +0000)]
Reported by: Coverity
CID: 1249760
Reviewed by: neel
Approved by: neel
Sponsored by: QNAP Systems Inc.

9 years agoSimplify sys_getloginclass.
mjg [Tue, 28 Oct 2014 04:59:33 +0000 (04:59 +0000)]
Simplify sys_getloginclass.

Just use current thread credentials as they have the same accuracy as the
ones obtained from proc..