]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoWITH_META_MODE: Don't let subdir traversals for 'make install' re-enable meta mode.
bdrewery [Thu, 25 Aug 2016 23:55:56 +0000 (23:55 +0000)]
WITH_META_MODE: Don't let subdir traversals for 'make install' re-enable meta mode.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

7 years agoUnlike Solaris, in FreeBSD p_args can be 0 so check for that
gnn [Thu, 25 Aug 2016 23:24:57 +0000 (23:24 +0000)]
Unlike Solaris, in FreeBSD p_args can be 0 so check for that
instead of walking down to ar_args blindly.

Reported by: Amanda Strnad
Reviewed by: markj, jhb
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agocxgbe/cxgbei: Convert the driver-private PDU flags to enums and replace
np [Thu, 25 Aug 2016 23:06:12 +0000 (23:06 +0000)]
cxgbe/cxgbei: Convert the driver-private PDU flags to enums and replace
pdu_ prefix with icp_ in struct icl_cxgbei_pdu.

Sponsored by: Chelsio Communications

7 years ago[mips] flip from =v to =r - let the compiler choose a temp register.
adrian [Thu, 25 Aug 2016 22:32:10 +0000 (22:32 +0000)]
[mips] flip from =v to =r - let the compiler choose a temp register.

=v is some ye olde gcc "use this specific register as the temp register"
thing that they've deprecated and clang/llvm doesn't implement.

Poked again and again by: sbruno

7 years agocxgbe/cxgbei: Read the chip's configuration to determine the actual
np [Thu, 25 Aug 2016 21:55:17 +0000 (21:55 +0000)]
cxgbe/cxgbei: Read the chip's configuration to determine the actual
hardware send and receive PDU limits.  Report these limits to ICL and
take them into account when setting the socket's send and receive buffer
sizes.  The driver used a single hardcoded limit everywhere prior to
this change.

Sponsored by: Chelsio Communications

7 years agobspatch: remove output file in the case of error
emaste [Thu, 25 Aug 2016 21:33:39 +0000 (21:33 +0000)]
bspatch: remove output file in the case of error

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7644

7 years agoOriginal fgetln() from 44lite return sucess for line tail errors,
ache [Thu, 25 Aug 2016 21:14:26 +0000 (21:14 +0000)]
Original fgetln() from 44lite return sucess for line tail errors,
i.e. partial line, but set __SERR and errno in the same time, which
is inconsistent.
Now both OpenBSD and NetBSD return failure, i.e. no line and set error
indicators for such case, so make our fgetln() and fgetwln()
(as its wide version) compatible with the rest of *BSD.

PR:     212033
MFC after:      7 days

7 years agoAdd libifc, a library implementing core functionality that exists in ifconfig(8)...
kp [Thu, 25 Aug 2016 19:40:25 +0000 (19:40 +0000)]
Add libifc, a library implementing core functionality that exists in ifconfig(8) today.

libifc (pronounced lib-ifconfig) aims to be a light abstraction layer between
programs and the kernel APIs for managing the network configuration.
This should hopefully make programs easier to maintain, and reduce code
duplication.

Work will begin on making ifconfig(8) use this library in the near future.

This code is still evolving. The interface should not be considered stable until
it is announced as such.

Submitted By: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D7529

7 years agoRemove last remnants of acd(4), mcd(4), and scd(4) drivers.
ak [Thu, 25 Aug 2016 19:36:58 +0000 (19:36 +0000)]
Remove last remnants of acd(4), mcd(4), and scd(4) drivers.

Approved by: jhb

7 years agoIn both do_rw_wrlock() and do_rw_rdlock() after r304808, do not
kib [Thu, 25 Aug 2016 19:15:02 +0000 (19:15 +0000)]
In both do_rw_wrlock() and do_rw_rdlock() after r304808, do not
obliterate possible error from sleep with errors from
umtxq_check_susp(), when looping to clear URWLOCK_{READ,WRITE}_WAITERS.

Noted and reviewed by: vangyzen
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRemove "Fast path", it bypass __wcrtomb() and all its error checking.
ache [Thu, 25 Aug 2016 17:30:00 +0000 (17:30 +0000)]
Remove "Fast path", it bypass __wcrtomb() and all its error checking.
One of affected encoding example: US-ASCII

MFC after:      7 days

7 years agoDon't check for __SERR which may stick from one of any previous stdio
ache [Thu, 25 Aug 2016 17:13:04 +0000 (17:13 +0000)]
Don't check for __SERR which may stick from one of any previous stdio
functions.
__SERR is for user and the rest of stdio code do not check it
for error sensing internally, only set it.
In vf(w)printf.c here it is more easy to save __SERR, clear and restore it.

7 years agoAdd non-TRUSTEDBSD prefixed knobs for the _PC_ACL* and {CAP,INF,MAC}_PRESENT knobs
ngie [Thu, 25 Aug 2016 17:07:43 +0000 (17:07 +0000)]
Add non-TRUSTEDBSD prefixed knobs for the _PC_ACL* and {CAP,INF,MAC}_PRESENT knobs

It's not necessarily intuitive that the variables to query contain TRUSTEDBSD
in the prefix. Add non-TRUSTEDBSD prefixed knobs for querying things like
"_PC_ACL_NFS4".

MFC after: 1 week
Relnotes: yes
Reviewed by: wollman
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7618

7 years agoPrevent leak of URWLOCK_READ_WAITERS flag for urwlocks.
kib [Thu, 25 Aug 2016 16:35:42 +0000 (16:35 +0000)]
Prevent leak of URWLOCK_READ_WAITERS flag for urwlocks.

If there was some error, e.g. the sleep was interrupted, as in the
referenced PR, do_rw_rdlock() did not cleared URWLOCK_READ_WAITERS.
Since unlock only wakes up write waiters when there is no read
waiters, for URWLOCK_PREFER_READER kind of locks, the result was
missed wakeups for writers.

In particular, the most visible victims are ld-elf.so locks in
processes which loaded libthr, because rtld locks are urwlocks in
prefer-reader mode.  Normal rwlocks fall into prefer-reader mode only
if thread already owns rw lock in read mode, which is not typical and
correspondingly less visible.  In the PR, unowned rtld bind lock was
waited for in the process where only one thread was left alive.

Note that do_rw_wrlock() correctly clears URWLOCK_WRITE_WAITERS in
case of errors.

Reported and tested by: longwitz@incore.de
PR: 211947
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoCapsicumize bspatch
allanjude [Thu, 25 Aug 2016 15:08:33 +0000 (15:08 +0000)]
Capsicumize bspatch

Move all of the fopen() and open() calls to the top of main()

Restrict each FD to least privilege (read/seek only, write only, etc)

cap_enter(), and make all except the output FD read/seek only.

Reviewed by: emaste, ed, oshogbo, delphij
Approved by: so
MFC after: 3 days
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D7358

7 years agoFix an assert, it should check if, when moving from 1 l1 to 512 l2 blocks,
andrew [Thu, 25 Aug 2016 14:42:29 +0000 (14:42 +0000)]
Fix an assert, it should check if, when moving from 1 l1 to 512 l2 blocks,
the l2 entry is a block type and not an l3 page.

While here fix the string to correct the level name and add a missing ')'.

Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoAdd support for Allwinner A64.
jmcneill [Thu, 25 Aug 2016 13:59:19 +0000 (13:59 +0000)]
Add support for Allwinner A64.

Reviewed by: andrew, manu
Relnotes: yes

7 years agoLess-quick fix for locking fixes in r172250. r172250 added a second
bde [Thu, 25 Aug 2016 13:46:52 +0000 (13:46 +0000)]
Less-quick fix for locking fixes in r172250.  r172250 added a second
syscons spinlock for the output routine alone.  It is better to extend
the coverage of the first syscons spinlock added in r162285.  2 locks
might work with complicated juggling, but no juggling was done.  What
the 2 locks actually did was to cover some of the missing locking in
each other and deadlock less often against each other than a single
lock with larger coverage would against itself.  Races are preferable
to deadlocks here, but 2 locks are still worse since they are harder
to understand and fix.

Prefer deadlocks to races and merge the second lock into the first one.

Extend the scope of the spinlocking to all of sc_cnputc() instead of
just the sc_puts() part.  This further prefers deadlocks to races.

Extend the kdb_active hack from sc_puts() internals for the second lock
to all spinlocking.  This reduces deadlocks much more than the other
changes increases them.  The s/p,10* test in ddb gets much further now.
Hide this detail in the SC_VIDEO_LOCK() macro.  Add namespace pollution
in 1 nested #include and reduce namespace pollution in other nested
#includes to pay for this.

Move the first lock higher in the witness order.  The second lock was
unnaturally low and the first lock was unnaturally high.  The second
lock had to be above "sleepq chain" and/or "callout" to avoid spurious
LORs for visual bells in sc_puts().  Other console driver locks are
already even higher (but not adjacent like they should be) except when
they are missing from the table.  Audio bells also benefit from the
syscons lock being high so that audio mutexes have chance of being
lower.  Otherwise, console drviver locks should be as low as possible.
Non-spurious LORs now occur if the bell code calls printf() or is
interrupted (perhaps by an NMI) and the interrupt handler calls
printf().  Previous commits turned off many bells in console i/o but
missed ones done by the teken layer.

7 years agoPass the number of segments coalesced by LRO up the stack by repurposing the
lstewart [Thu, 25 Aug 2016 13:33:32 +0000 (13:33 +0000)]
Pass the number of segments coalesced by LRO up the stack by repurposing the
tso_segsz pkthdr field during RX processing, and use the information in TCP for
more correct accounting and as a congestion control input. This is only a start,
and an audit of other uses for the data is left as future work.

Reviewed by: gallatin, rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D7564

7 years agoRemove the gratuitous check for $FreeBSD$ and rename the function
cy [Thu, 25 Aug 2016 13:24:11 +0000 (13:24 +0000)]
Remove the gratuitous check for $FreeBSD$ and rename the function
to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy
isn't already there.

Reported by: ache@
MFC after: 1 day

7 years agoDon't set *dev in the zfs root case, it may be NULL and will correctly be
andrew [Thu, 25 Aug 2016 12:42:41 +0000 (12:42 +0000)]
Don't set *dev in the zfs root case, it may be NULL and will correctly be
set later in the function. This fixes a potential NULL pointer dereference
found on arm64.

Obtained from: ABT Systems Ltd
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 years agoFix logic errors in bounds checks in previous commit. The 2-entry stack
bde [Thu, 25 Aug 2016 12:04:57 +0000 (12:04 +0000)]
Fix logic errors in bounds checks in previous commit.  The 2-entry stack
was overrun for grab levels larger than 2.

Reported by: pluknet

7 years agoMap coherent memory in a non-coherent dma tag as uncached. This is similar
andrew [Thu, 25 Aug 2016 10:53:03 +0000 (10:53 +0000)]
Map coherent memory in a non-coherent dma tag as uncached. This is similar
to what the 32-bit arm code does, with the exception that it always assumes
the tag is non-coherent.

Tested by: jmcneill
Obtained from: ABT Systems Ltd
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 years agoAdd support for Allwinner A64 PLL_PERIPH0/PLL_PERIPH1 and PLL_HSIC clocks.
jmcneill [Thu, 25 Aug 2016 10:29:41 +0000 (10:29 +0000)]
Add support for Allwinner A64 PLL_PERIPH0/PLL_PERIPH1 and PLL_HSIC clocks.

Reviewed by: andrew, manu

7 years agoMake use of Kyua's work directories.
jmmv [Thu, 25 Aug 2016 10:28:47 +0000 (10:28 +0000)]
Make use of Kyua's work directories.

Change the vnode tests to use the current directory when creating temporary
files, which we can assume is a volatile work directory, and then make the
kqueue_test.sh driver _not_ abandon the directory created by Kyua.

This makes the various kqueue tests independent of each other, and ensures
the temporary file is cleaned up on failure.

Problem spotted by asomers@ when reviewing D4254.

7 years agoSwitch parent clock when setting frequency if a new parent is a better
jmcneill [Thu, 25 Aug 2016 10:27:22 +0000 (10:27 +0000)]
Switch parent clock when setting frequency if a new parent is a better
candidate for the target rate.

Reviewed by: andrew, manu

7 years agoAdd support for Allwinner multi-parent bus gates.
jmcneill [Thu, 25 Aug 2016 10:24:14 +0000 (10:24 +0000)]
Add support for Allwinner multi-parent bus gates.

Reviewed by: andrew, manu

7 years agoExpose DC1SW as a regulator switch. On Pine64 this is used to control EMAC
jmcneill [Thu, 25 Aug 2016 10:20:27 +0000 (10:20 +0000)]
Expose DC1SW as a regulator switch. On Pine64 this is used to control EMAC
PHY power.

Reviewed by: andrew, manu

7 years agoRemove dependency on allwinner_soc_family() as it is not available on arm64.
jmcneill [Thu, 25 Aug 2016 10:14:56 +0000 (10:14 +0000)]
Remove dependency on allwinner_soc_family() as it is not available on arm64.

Reviewed by: andrew, manu

7 years agohyperv/storvsc: Increase queue depth and rework channel selection.
sephe [Thu, 25 Aug 2016 05:50:19 +0000 (05:50 +0000)]
hyperv/storvsc: Increase queue depth and rework channel selection.

- Increasing queue depth gives ~100% performance improvement for
  randwrite fio test in Azure.
- New channel selection, which takes LUN id and the current cpuid
  into consideration, gives additional ~20% performance improvement
  for ranwrite fio test in Azure.

Submitted by:   Hongzhang Jiang <honzhan microsoft com>
Modified by:    sephe
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7622

7 years agohyperv/vmbus: Add function to calculate max # of elements in a bufring.
sephe [Thu, 25 Aug 2016 05:35:51 +0000 (05:35 +0000)]
hyperv/vmbus: Add function to calculate max # of elements in a bufring.

MFC after: 1 week
Sponsored by: Microsoft

7 years agoBump __FreeBSD_version for r304787 and add a note about it to UPDATING.
np [Thu, 25 Aug 2016 05:28:02 +0000 (05:28 +0000)]
Bump __FreeBSD_version for r304787 and add a note about it to UPDATING.

7 years agohyperv/ic: Update total message size if negotiate message size grows.
sephe [Thu, 25 Aug 2016 05:24:57 +0000 (05:24 +0000)]
hyperv/ic: Update total message size if negotiate message size grows.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7627

7 years agoMake the iSCSI parameter negotiation more flexible.
np [Thu, 25 Aug 2016 05:22:53 +0000 (05:22 +0000)]
Make the iSCSI parameter negotiation more flexible.

Decouple the send and receive limits on the amount of data in a single
iSCSI PDU.  MaxRecvDataSegmentLength is declarative, not negotiated, and
is direction-specific so there is no reason for both ends to limit
themselves to the same min(initiator, target) value in both directions.

Allow iSCSI drivers to report their send, receive, first burst, and max
burst limits explicitly instead of using hardcoded values or trying to
derive all of them from the receive limit (which was the only limit
reported by the drivers prior to this change).

Display the send and receive limits separately in the userspace iSCSI
utilities.

Reviewed by: jpaetzel@ (earlier version), trasz@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D7279

7 years agohyperv/ic: Cleanup heartbeat channel callback.
sephe [Thu, 25 Aug 2016 05:11:04 +0000 (05:11 +0000)]
hyperv/ic: Cleanup heartbeat channel callback.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7626

7 years agohyperv/hn: Use vmbus xact for RNDIS initialize.
sephe [Thu, 25 Aug 2016 05:00:41 +0000 (05:00 +0000)]
hyperv/hn: Use vmbus xact for RNDIS initialize.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7624

7 years agohyperv/hn: Add compat code for RNDIS reorganization phase.
sephe [Thu, 25 Aug 2016 04:52:50 +0000 (04:52 +0000)]
hyperv/hn: Add compat code for RNDIS reorganization phase.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7621

7 years agohyperv/hn: Use definition in net/rndis.h for message type and status code.
sephe [Thu, 25 Aug 2016 04:40:51 +0000 (04:40 +0000)]
hyperv/hn: Use definition in net/rndis.h for message type and status code.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7620

7 years agoMake validation of the leap-seconds file unconditional.
cy [Thu, 25 Aug 2016 03:09:23 +0000 (03:09 +0000)]
Make validation of the leap-seconds file unconditional.

MFC after: 1 day

7 years agoAdd logic to replace the working ntp leap-seconds file in /var/db
cy [Thu, 25 Aug 2016 02:58:41 +0000 (02:58 +0000)]
Add logic to replace the working ntp leap-seconds file in /var/db
if it contains a $FreeBSD$ header. The header will cause the file
to fail checksum of the hash causing ntpd to ignore the file.

MFC after: 1 day

7 years agoChange the algorithm by which /var/db/leap-seconds is updated.
cy [Thu, 25 Aug 2016 02:45:52 +0000 (02:45 +0000)]
Change the algorithm by which /var/db/leap-seconds is updated.

1. Use the leap-seconds version number (update time) to determine
   whether to update the file or not.

2. If the version numbers of the files is the same, use the later
   expiry date to determine which file to use.

Suggested by: ian@
MFC after: 1 day

7 years agoRevert r298887 (spelling fix) and remove $FreeBSD$ because text changes
cy [Thu, 25 Aug 2016 02:40:14 +0000 (02:40 +0000)]
Revert r298887 (spelling fix) and remove $FreeBSD$ because text changes
to leap-seconds invaldidates validation hash at the end of the file.

Remove svn:keywords and replace with fbsd:nokeywords=yes to
support this change.

MFC after: 1 day

7 years agoIncrease the default rotation threshold of log files from 100kb to 1000kb
allanjude [Wed, 24 Aug 2016 23:02:20 +0000 (23:02 +0000)]
Increase the default rotation threshold of log files from 100kb to 1000kb

Submitted by: Sean Kelly <smkelly@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D6792

7 years agoFlesh out the state and flags args to sccnopen(). Set state flags to
bde [Wed, 24 Aug 2016 18:59:24 +0000 (18:59 +0000)]
Flesh out the state and flags args to sccnopen().  Set state flags to
indicate (potentially partial) success of the open.  Use these to
decide what to close in sccnclose().  Only grab/ungrab use open/close
so far.

Add a per-sc variable to count successful keyboard opens and use
this instead of the grab count to decide if the keyboad state has
been switched.

Start fixing the locking by using atomic ops for the most important
counter -- the grab level one.  Other racy counting will eventually
be fixed by normal mutex or kdb locking in most cases.

Use a 2-entry per-sc stack of states for grabbing.  2 is just enough
to debug grabbing, e.g., for gets().  gets() grabs once and might not
be able to do a full (or any) state switch.  ddb grabs again and has
a better chance of doing a full state switch and needs a place to
stack the previous state.  For more than 3 levels, grabbing just
changes the count.  Console drivers should try to switch on every i/o
in case lower levels of nesting failed to switch but the current level
succeeds, but then the switch (back) must be completed on every i/o
and this flaps the state unless the switch is null.  The main point
of grabbing is to make it null quite often.  Syscons grabbing also
does a carefully chosen screen focus that is not done on every i/o.

Add a large comment about grabbing.

Restore some small lost comments.

7 years agoReorganise a little to prepare for locking fixes:
bde [Wed, 24 Aug 2016 17:26:11 +0000 (17:26 +0000)]
Reorganise a little to prepare for locking fixes:
- in sccnopen(), open the keyboard before the screen.  The keyboard
  currently requires Giant (although it must be spinlocked to work
  correctly as a console), so the previous order would be a LOR if
  it has any semblance of locking.
- add a (currently dummy) state arg to scgetc().

7 years agoDon't build libdevdctl if MK_CXX is no
emaste [Wed, 24 Aug 2016 17:15:32 +0000 (17:15 +0000)]
Don't build libdevdctl if MK_CXX is no

7 years agoClose a race when making the CPU idle under pHyp. If an interrupt occurs
nwhitehorn [Wed, 24 Aug 2016 16:49:14 +0000 (16:49 +0000)]
Close a race when making the CPU idle under pHyp. If an interrupt occurs
between the beginning of the idle function and actually going idle, the
CPU could go to sleep with pending work.

MFC after: 1 month

7 years agoUse current locale (f.e. set by thread). It was global locale always
ache [Wed, 24 Aug 2016 16:44:27 +0000 (16:44 +0000)]
Use current locale (f.e. set by thread). It was global locale always
previously.

MFC after:      7 days

7 years agoBug 212038 - svn commit: r304321 broken bhyve zvol VM bhyveload hang 100% WCPU
tsoome [Wed, 24 Aug 2016 16:40:29 +0000 (16:40 +0000)]
Bug 212038 - svn commit: r304321 broken bhyve zvol VM bhyveload hang 100% WCPU

As the support for large blocks was enabled in loader zfs code, the
heap in userboot was left not changed, resulting with failure of detecting
and accessing zfs pools for bhyve virtual machines.

This fix does set the heap to use same amount of memory as the zfsloader
is using. To make it possible to test and verify loader functions, bhyve
is providing very useful option, but it also means, we like to keep feature
parity with [zfs]loader as close as possible.

PR: 212038
Reported by: dfh0522@gmail.com
Reviewed by: allanjude, grehan
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D7635

7 years agoBug 212114 - loader: zio_checksum_verify() must test spa for NULL pointer
tsoome [Wed, 24 Aug 2016 16:30:15 +0000 (16:30 +0000)]
Bug 212114 - loader: zio_checksum_verify() must test spa for NULL pointer

The issue was introduced with adding support for salted checksums, and
was revealed by bhyve userboot.so.

During pool discovery the loader is reading pool label from disks, and
at that time the spa structure is not yet set up, so the NULL pointer
is passed for spa. This condition must be checked to avoid the corruption
of the memory and NULL pointer dereference.

PR: 212114
Reported by: tsoome@freebsd.com
Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D7634

7 years agoBump __FreeBSD_version for LC_*_MASK fix for newlocale(3) and querylocale(3)
ache [Wed, 24 Aug 2016 15:36:48 +0000 (15:36 +0000)]
Bump __FreeBSD_version for LC_*_MASK fix for newlocale(3) and querylocale(3)

7 years agoFix minor copy/paste bug.
mav [Wed, 24 Aug 2016 15:13:42 +0000 (15:13 +0000)]
Fix minor copy/paste bug.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week

7 years agoAllow superpages on arm64 to be enabled. It is disabled for now to allow
andrew [Wed, 24 Aug 2016 13:00:50 +0000 (13:00 +0000)]
Allow superpages on arm64 to be enabled. It is disabled for now to allow
for more testing across more hardware.

Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoAdd support to promote and demote managed superpages. This is the last part
andrew [Wed, 24 Aug 2016 12:57:40 +0000 (12:57 +0000)]
Add support to promote and demote managed superpages. This is the last part
needed before enabling superpages on arm64. This code is based on the amd64
pmap with changes as needed to handle the differences between the two
architectures.

Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoDocument the existence of the cloudabi32 kernel module.
ed [Wed, 24 Aug 2016 12:53:54 +0000 (12:53 +0000)]
Document the existence of the cloudabi32 kernel module.

7 years agoMFV r304732.
cy [Wed, 24 Aug 2016 12:32:24 +0000 (12:32 +0000)]
MFV r304732.

Update from sqlite3-3.12.1 (3120100) to sqlite3-3.14.1 (3140100).

This commit addresses the tmpdir selection vulnerability fixed in
sqlite3-1.13.0.  See VuXML entry 546deeea-3fc6-11e6-a671-60a44ce6887b.

Security: VuXML 546deeea-3fc6-11e6-a671-60a44ce6887b
Security: CVE-2016-6153

7 years agoTeach the parts of the arm64 pmap that need to iterate over pages to also
andrew [Wed, 24 Aug 2016 12:32:18 +0000 (12:32 +0000)]
Teach the parts of the arm64 pmap that need to iterate over pages to also
iterate over superpages. We don't yet create these, but soon will.

Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoAdd a Makefile for building the cloudabi32 kernel module.
ed [Wed, 24 Aug 2016 11:35:49 +0000 (11:35 +0000)]
Add a Makefile for building the cloudabi32 kernel module.

Where the cloudabi64 kernel can be used to execute 64-bit CloudABI
binaries, this one should be used for 32-bit binaries. Right now it
works on i386 and amd64.

7 years agoMake execution of 32-bit CloudABI executables work on amd64.
ed [Wed, 24 Aug 2016 10:51:33 +0000 (10:51 +0000)]
Make execution of 32-bit CloudABI executables work on amd64.

A nice thing about requiring a vDSO is that it makes it incredibly easy
to provide full support for running 32-bit processes on 64-bit systems.
Instead of letting the kernel be responsible for composing/decomposing
64-bit arguments across multiple registers/stack slots, all of this can
now be done in the vDSO. This means that there is no need to provide
duplicate copies of certain system calls, like the sys_lseek() and
freebsd32_lseek() we have for COMPAT_FREEBSD32.

This change imports a new vDSO from the CloudABI repository that has
automatically generated code in it that copies system call arguments
into a buffer, padding them to eight bytes and zero-extending any
pointers/size_t arguments. After returning from the kernel, it does the
inverse: extracting return values, in the process truncating
pointers/size_t values to 32 bits.

Obtained from: https://github.com/NuxiNL/cloudabi

7 years agoRemove an unused header file.
ed [Wed, 24 Aug 2016 10:36:52 +0000 (10:36 +0000)]
Remove an unused header file.

The native CloudABI data types header file used to be pulled in by the
vDSOs when they were still written in C. Since they are now all
rewritten in assembly, this can go away.

7 years agoConvert pointers obtained from the threadattr_t structure with TO_PTR().
ed [Wed, 24 Aug 2016 10:13:18 +0000 (10:13 +0000)]
Convert pointers obtained from the threadattr_t structure with TO_PTR().

In all of these source files, the userspace pointer size corresponds
with the kernelspace pointer size, meaning that casting directly works.
As I'm planning on making 32-bit execution on 64-bit systems work as
well, use TO_PTR() here as well, so that the changes between source
files remain minimal.

7 years agoSkip ls tests that use sparse files if these are not supported.
jmmv [Wed, 24 Aug 2016 10:10:26 +0000 (10:10 +0000)]
Skip ls tests that use sparse files if these are not supported.

Some of the ls(1) tests create really large sparse files to validate
the number formatting features of ls(1).  Unfortunately, those tests fail
if the underlying test file system does not support sparse files, as is the
case when /tmp is mounted on tmpfs.

Before running these tests, check if the test file system supports sparse
files by using getconf(1) and skip them if not.  Note that the support for
this query was just added to getconf(1) in r304694.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D7609

7 years agoAdd missing header dependency.
ed [Wed, 24 Aug 2016 09:57:19 +0000 (09:57 +0000)]
Add missing header dependency.

This header depends on sigaltstack32 being declared.

7 years agoWhen aborting an association, send the ABORT before notifying the upper
tuexen [Wed, 24 Aug 2016 06:22:53 +0000 (06:22 +0000)]
When aborting an association, send the ABORT before notifying the upper
layer. For the kernel this doesn't matter, for the userland stack, it does.
While there, silence a clang warning when compiling it in userland.

7 years agoFix key delay and repeat, part 2.
bde [Wed, 24 Aug 2016 05:54:11 +0000 (05:54 +0000)]
Fix key delay and repeat, part 2.

Use sbintime_t timeouts with precision control to get very accurate
timing.  It costs little to always ask for about 1% accuracy, and the
not so new event timer implementation usual delivers that, and when
it can't it gets much closer than our previous coarse timeouts and
buggy simple countdown.

The 2 fastest atkbd repeat rates have periods 34 and 38 msec, and ukbd
pretended to support rates in between these.  This requires
sub-microsecond precision and accuracy even to handle the 4 msec
difference very well, but ukbd asked the timeout subsystem for timeouts
of 25 msec and the buggy simple countdown of this gave a a wide range
of precisions and accuracies depending on HZ and other timer
configuration (sometimes better than 25 msec but usually more like 50
msec).  We now ask for and usually get precision and accuracy of about
1% for each repeat and much better on average.

The 1% accuracy is overkill.  Rounding of 30 cps to 34 msec instead of
33 already gives an error of +2% instead of -1%, and ut AT keyboards on
PS/2 interfaces have similar errors.

A timeout is now scheduled for every keypress and release.  This allows
some simplifications that are not done.  It allows removing the timeout
scheduling for exiting polled mode where it was unsafe in ddb mode.  This
is done.  Exiting polled mode had some problems with extra repeats.  Now
exiting polled mode lets an extra timeout fire and the state is fudged
so that the timeout handler does very little.

The sc->time_ms variable is unsigned to avoid overflow.  Differences of
it need to be signed.  Signed comparisons were emulated by testing an
emulated sign bits.  This only works easily for '<' comparisonss, but
we now need a '<=' comparison.  Change the difference variable to
signed and use a signed comparison.  Using unsigned types here didn't
prevent overflow bugs but just reduced them.  Overflow occurs with
n repeats at the silly repeat period of [U]INT_MAX / n.  The old countdown
had an off by 1 error, and the simplifications would simply count down
1 to 0 and not need to accumulate possibly-large repeat repeats.

7 years agoImport sqlite3-3.14.1 (3140100)
cy [Wed, 24 Aug 2016 04:57:29 +0000 (04:57 +0000)]
Import sqlite3-3.14.1 (3140100)

7 years agohyperv/ic: Redefine IC version negotiate message.
sephe [Wed, 24 Aug 2016 04:36:04 +0000 (04:36 +0000)]
hyperv/ic: Redefine IC version negotiate message.

And stringent input IC version negotiate message checks.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7614

7 years agohyperv/hn: Log a warning for RESET_CMPLT.
sephe [Wed, 24 Aug 2016 04:21:15 +0000 (04:21 +0000)]
hyperv/hn: Log a warning for RESET_CMPLT.

RESET is not used by the hn(4) at all, and RESET_CMPLT does not even
have a rid to match with the pending requests.  So, let's put it
onto an independent switch branch and log a warning about it.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7602

7 years agoFix system hang when large FDT is in use
jhibbits [Wed, 24 Aug 2016 03:51:40 +0000 (03:51 +0000)]
Fix system hang when large FDT is in use

Summary:
Kernel maps only one page of FDT. When FDT is more than one page in size, data
TLB miss occurs on memmove() when FDT is moved to kernel storage
(sys/powerpc/booke/booke_machdep.c, booke_init())

This introduces a pmap_early_io_unmap() to complement pmap_early_io_map(), which
can be used for any early I/O mapping, but currently is only used when mapping
the fdt.

Submitted by: Ivan Krivonos <int0dster_gmail.com>
Differential Revision: https://reviews.freebsd.org/D7605

7 years agoBring datasheet URL up to date.
kevlo [Wed, 24 Aug 2016 03:44:16 +0000 (03:44 +0000)]
Bring datasheet URL up to date.

7 years agohyperv/hn: Remove the redundant rid setting for RNDIS HALT.
sephe [Wed, 24 Aug 2016 03:28:58 +0000 (03:28 +0000)]
hyperv/hn: Remove the redundant rid setting for RNDIS HALT.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7595

7 years agonet/rndis: Fix RNDIS_STATUS_PENDING definition.
sephe [Wed, 24 Aug 2016 03:16:25 +0000 (03:16 +0000)]
net/rndis: Fix RNDIS_STATUS_PENDING definition.

While I'm here, sort the RNDIS status in ascending order.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7594

7 years agonet/rndis: Add canonical RNDIS major/minor version as of today.
sephe [Wed, 24 Aug 2016 03:08:13 +0000 (03:08 +0000)]
net/rndis: Add canonical RNDIS major/minor version as of today.

Reviewed by: hps
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7593

7 years agoFixup man page formatting.
cy [Wed, 24 Aug 2016 02:41:24 +0000 (02:41 +0000)]
Fixup man page formatting.

Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
Discussed with: bjk@
MFC after: 3 days

7 years agoFix L2 caching for UDP over IPv6
karels [Wed, 24 Aug 2016 00:52:30 +0000 (00:52 +0000)]
Fix L2 caching for UDP over IPv6

ip6_output() was missing cache invalidation code analougous to
ip_output.c. r304545 disabled L2 caching for UDP/IPv6 as a workaround.
This change adds the missing cache invalidation code and reverts
r304545.

Reviewed by: gnn
Approved by: gnn (mentor)
Tested by: peter@, Mike Andrews
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D7591

7 years agoAvoid a redecleartion of __getosreldate().
brooks [Wed, 24 Aug 2016 00:02:20 +0000 (00:02 +0000)]
Avoid a redecleartion of __getosreldate().

Sponsored by: DARPA, AFRL

7 years agoSpell MIPS more traditionally in "bfd_elf32_ntradbigmips_vec".
brooks [Wed, 24 Aug 2016 00:00:54 +0000 (00:00 +0000)]
Spell MIPS more traditionally in "bfd_elf32_ntradbigmips_vec".

Sponsored by: DAPRA, AFRL

7 years agoAllwinner: Add thermal sensor driver for A10/A20
manu [Tue, 23 Aug 2016 22:26:50 +0000 (22:26 +0000)]
Allwinner: Add thermal sensor driver for A10/A20
The thermal sensor lives in the touch screen controller. Touch screen part
isn't done for now.
Temperature is read every ~2 seconds and exposed via sysctl.

7 years agoLC_*_MASK bit shifting order was partially broken from the initial commit
ache [Tue, 23 Aug 2016 20:33:56 +0000 (20:33 +0000)]
LC_*_MASK bit shifting order was partially broken from the initial commit
time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the
right order.

The order here should match XLC_* from "xlocale_private.h" which, in turn,
match LC_* publicly visible order from <locale.h> which determines how
locale components are stored in the structure.
LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale()
and equivalent shift loop in the newlocale(), so mapped to some wrong
components (excluding two mentioned above).

Formally the fix is ABI breakage, but old code using those masks
never works properly in any case.
Only newlocale() and querylocale() are affected.

MFC after:      7 days

7 years agoThe -f check here is used to determine whether we have a single kernel
glebius [Tue, 23 Aug 2016 20:04:23 +0000 (20:04 +0000)]
The -f check here is used to determine whether we have a single kernel
config or a list of them.  Put the variable into quotes, to avoid syntax
error from [ in case of list.  Without this change list is still working,
but an error is reported in the build log file.

Reviewed by: imp

7 years agoFix key delay and repeat, part 1.
bde [Tue, 23 Aug 2016 19:50:16 +0000 (19:50 +0000)]
Fix key delay and repeat, part 1.

kbdcontrol -r fast is documented to give a non-emulated atkbd's fastest
rate of 250.34, but is misimplemented to request this as 0.0.  ukbd
supports many nonstandard rates, although it is currently too inaccurate
by a factor of several hundred for non-huge nonstandard rates to be
useful.  It mapped 0.0 to 200.0.  A repeat delay of 0 means a rate of
infinity which is quite fast, but physical constraints limit this to
a few MHz and the inaccuracies made it almost usable.

Convert 0.0 to the documented 250.34.

Also convert negative args and small args to the 250.34 minimal ones,
like atkbd does.  This is for KDSETREPEAT -- the 2 versions of the
deprecated KDSETRAD have bounds checking.  Keep not doing any bounds
checking or conversions for upper limits since nonstandard large
delays are useful for testing.

The inaccuracies are dependent on HZ and the timeout implementation.
With the old timeout implementation and HZ = 1000, 200.0 probably
worked better to emulate 250.34 than 250.34 itself.  HZ = 100 gives
roundoff errors that accidentally reduce the inaaccuracies, and
event timers reduce the inaccuracies even more, so 200.0 was giving
more like itself (perhaps 215.15 on average but sometimes close to
10 msec repeat which is noticebly too fast).  This commit makes 0.0
noticeably too slow, like 250.34 always was.

7 years agoAdd support for _PC_ACL_NFS4 as TRUSTEDBSD_ACL_NFS4
ngie [Tue, 23 Aug 2016 19:41:49 +0000 (19:41 +0000)]
Add support for _PC_ACL_NFS4 as TRUSTEDBSD_ACL_NFS4

The TRUSTEDBSD prefix was chosen for consistency with the other
related `_PC_ACL*` prefixed variables.

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

7 years agoFAST_DEPEND: Fix 'make all install' not properly rebuilding based on .depend.* files.
bdrewery [Tue, 23 Aug 2016 19:37:18 +0000 (19:37 +0000)]
FAST_DEPEND: Fix 'make all install' not properly rebuilding based on .depend.* files.

An optimization is in place to skip reading the .depend.* files with
'make install'.  This was too strong and broke 'make all install' and
'make foo.o foo install'.  Now only skip reading the dependency files
if all make targets ran are install targets.

The problem comes about because headers are only added in as a guessed
dependency if .depend.* files do not yet exist.  If they do exist, even
if being skipped from being read, then the header dependencies are not
applied.  This applies to all #included files, and not just headers.

Reported by: kib
MFC after: 1 day
Sponsored by: EMC / Isilon Storage Division

7 years agoIn addition to creating subdirectories under .OBJDIR for SRCS with
dim [Tue, 23 Aug 2016 19:31:43 +0000 (19:31 +0000)]
In addition to creating subdirectories under .OBJDIR for SRCS with
relative paths, also create them for DPSRCS.  This is needed for builds
that generate files during the depend stage, which cannot be compiled by
themselves, since those have to be put in DPSRCS.

7 years agoFix in-tree GCC builds after r304681.
bdrewery [Tue, 23 Aug 2016 19:29:37 +0000 (19:29 +0000)]
Fix in-tree GCC builds after r304681.

There were a few issues.
- In-tree GCC won't have X_COMPILER_TYPE defined but will have
  WANT_COMPILER_TYPE==gcc set from the SYSTEM_COMPILER logic that can
  be used.  Make the clang check specific to clang as well to ensure
  -target doesn't leak into a GCC build.
- When using a cross-compiler GCC (with a default sysroot or arch) and also
  passing --sysroot, it basically forgets all internal paths for
  libraries.  We've already worked around this quite a bit for
  the external toolchains.  Now for the in-tree bootstrap cross-compiler
  GCC, also pass in the needed -B${WORLDTMP}/usr/lib to find the crt
  object files, but also -isystem and -L to fix the paths.  This creates
  quite a spammy build log, but it is clear and still achieves the goals
  and stays consistent between internal and external build flags.
  Reducing the spam by using the '=' prefix feature will help and be
  done later.

MFC after: 3 days
X-MFC-With: r304681
Reported by: bz
Pointyhat to: bdrewery
Sponsored by: EMC / Isilon Storage Division

7 years agoAdd `MIN_HOLE_SIZE` pathconf(2) support to getconf
ngie [Tue, 23 Aug 2016 19:28:01 +0000 (19:28 +0000)]
Add `MIN_HOLE_SIZE` pathconf(2) support to getconf

This allows shell programs to programmatically determine whether
or not a filesystem supports sparse files

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

7 years agoClean up trailing whitespace
ngie [Tue, 23 Aug 2016 19:15:01 +0000 (19:15 +0000)]
Clean up trailing whitespace

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

7 years agobhndb(4): Fix unsigned integer underflow in dynamic register window
landonf [Tue, 23 Aug 2016 19:03:11 +0000 (19:03 +0000)]
bhndb(4): Fix unsigned integer underflow in dynamic register window
handling. This resulted in the window target being left uninitialized
when an underflow occured.

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D7617

7 years agobspatch: apply style(9)
emaste [Tue, 23 Aug 2016 17:42:03 +0000 (17:42 +0000)]
bspatch: apply style(9)

Make style changes (and trivial refactoring of open calls) now in order
to reduce noise in diffs for future capsicum changes.

Reviewed by: oshogbo
No objection: cperciva
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7610

7 years agoAlso adjust the virtual address passed to vm_page_pa_tryrelock.
andrew [Tue, 23 Aug 2016 16:37:34 +0000 (16:37 +0000)]
Also adjust the virtual address passed to vm_page_pa_tryrelock.

Reported by: alc
Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoMap memory as read-only in pmap_enter_quick_locked as is done in other
andrew [Tue, 23 Aug 2016 16:20:56 +0000 (16:20 +0000)]
Map memory as read-only in pmap_enter_quick_locked as is done in other
pmap implementations.

Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoIf we find we have a superpage in pmap_enter_quick_locked return without
andrew [Tue, 23 Aug 2016 16:12:25 +0000 (16:12 +0000)]
If we find we have a superpage in pmap_enter_quick_locked return without
trying to add a new level 3 page.

Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoindent(1): have the memset invocation somewhat more canonical.
pfg [Tue, 23 Aug 2016 15:49:31 +0000 (15:49 +0000)]
indent(1): have the memset invocation somewhat more canonical.

While correct, the previous invocation was somewhat more error prone.

Pointed out by: delphij, bde

7 years agoInclude the offset the virtual address is within an L1 or L2 block when
andrew [Tue, 23 Aug 2016 15:48:27 +0000 (15:48 +0000)]
Include the offset the virtual address is within an L1 or L2 block when
finding the vm_page_t in pmap_extract_and_hold. Previously it would return
the vm_page_t of the first page in a block. This would cause issues when,
for example, fsck reads from a device into the middle of a superpage. In
this case the read call would write to the start of the block, and not to
the buffer passed in.

Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoindent(1): remove dead assignments.
pfg [Tue, 23 Aug 2016 15:46:20 +0000 (15:46 +0000)]
indent(1): remove dead assignments.

Taken from: Piotr Sephaniak

7 years agoRegenerate
bdrewery [Tue, 23 Aug 2016 15:31:53 +0000 (15:31 +0000)]
Regenerate

7 years agoRe-enable WITH_SYSTEM_COMPILER with WITH_META_MODE.
bdrewery [Tue, 23 Aug 2016 15:22:17 +0000 (15:22 +0000)]
Re-enable WITH_SYSTEM_COMPILER with WITH_META_MODE.

This was disabled in r301468 due to -target/--sysroot sometimes being used in
the build and other times not being used.  Now that it is always used since
r304681, it is safe to combine the features.

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

7 years agoAlways pass in -target and --sysroot flags for the build.
bdrewery [Tue, 23 Aug 2016 15:20:32 +0000 (15:20 +0000)]
Always pass in -target and --sysroot flags for the build.

The internal bootstrap compiler has a default sysroot set by TOOLS_PREFIX
and target set by TARGET/TARGET_ARCH.  However, there are several needs to
always pass an explicit --sysroot and -target.
- External compiler needs sysroot and target flags.
- External ld needs sysroot.
- To be clear about the use of a sysroot when using the internal compiler.
- Easier debugging.
- Allowing WITH_SYSTEM_COMPILER+WITH_META_MODE to work together due to
  the flip-flopping build command when sometimes using external and
  sometimes using internal.
- Allow using no lld which has support for default paths.

The default sysroot in the bootstrap compiler is not changed.  The
buildenv compiler will still work with its default and will also
include -target/--sysroot from CC in the environment.

MFC after: 3 days
Discussed with: emaste, brooks (BSDCam)
Reviewed by: emaste
Sponsored by: EMC / Isilon Storage Division

7 years agoEFI loader: only open/close on the net device with tftpfs
bapt [Tue, 23 Aug 2016 13:53:38 +0000 (13:53 +0000)]
EFI loader: only open/close on the net device with tftpfs

It prevents issuing a dhcp request before each file open
As a consequence netbooting over tftpfs is significantly faster

Sponsored by: Gandi.net

7 years agoUse roundup2() from sys/param.h.
araujo [Tue, 23 Aug 2016 13:43:43 +0000 (13:43 +0000)]
Use roundup2() from sys/param.h.