]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFV r302423:
pfg [Tue, 30 Aug 2016 21:51:53 +0000 (21:51 +0000)]
MFV r302423:
Bring older verbatim version of cpuid.h

This file is used regularly in FreeBSD builds but we usually use the
similar file provided by clang.

By providing the older file introduced in GCC 4.3, we hope to mimic
better what is provided by an external toolchain.

Obtained from: GCC-4_3-branch (SVN rev. 129548, pre GPLv3)

7 years agofd: simplify fd testing in fget_locked by casting to u_int
mjg [Tue, 30 Aug 2016 21:48:10 +0000 (21:48 +0000)]
fd: simplify fd testing in fget_locked by casting to u_int

7 years agogetvfsbyname(3): Remove [EFAULT] error.
jilles [Tue, 30 Aug 2016 21:43:57 +0000 (21:43 +0000)]
getvfsbyname(3): Remove [EFAULT] error.

Since r101651 in 2002, getvfsbyname() has written *vfc using userland
memcpy(), so the [EFAULT] error no longer occurs.

MFC after: 1 week

7 years agoFix warnings in telnet about invalid constant conversions, e.g.:
dim [Tue, 30 Aug 2016 20:27:22 +0000 (20:27 +0000)]
Fix warnings in telnet about invalid constant conversions, e.g.:

contrib/telnet/telnet/commands.c:2914:13: error: implicit conversion
from 'int' to 'char' changes value from 137 to -119
[-Werror,-Wconstant-conversion]
                *lsrp++ = IPOPT_SSRR;
                        ~ ^~~~~~~~~~
/usr/include/netinet/ip.h:152:21: note: expanded from macro 'IPOPT_SSRR'
#define IPOPT_SSRR              137             /* strict source route */
                                ^~~
contrib/telnet/telnet/commands.c:2916:13: error: implicit conversion
from 'int' to 'char' changes value from 131 to -125
[-Werror,-Wconstant-conversion]
                *lsrp++ = IPOPT_LSRR;
                        ~ ^~~~~~~~~~
/usr/include/netinet/ip.h:148:21: note: expanded from macro 'IPOPT_LSRR'
#define IPOPT_LSRR              131             /* loose source route */
                                ^~~

Use unsigned char buffers instead.

MFC after: 1 week

7 years agoFix warnings in tnftp about invalid constant conversions, e.g.:
dim [Tue, 30 Aug 2016 20:24:50 +0000 (20:24 +0000)]
Fix warnings in tnftp about invalid constant conversions, e.g.:

contrib/tnftp/src/ftp.c:2067:11: error: implicit conversion from 'int'
to 'char' changes value from 255 to -1 [-Werror,-Wconstant-conversion]
        buf[0] = IAC;
               ~ ^~~
/usr/include/arpa/telnet.h:39:13: note: expanded from macro 'IAC'
#define IAC     255             /* interpret as command: */
                ^~~
contrib/tnftp/src/ftp.c:2068:11: error: implicit conversion from 'int'
to 'char' changes value from 244 to -12 [-Werror,-Wconstant-conversion]
        buf[1] = IP;
               ~ ^~
/usr/include/arpa/telnet.h:50:12: note: expanded from macro 'IP'
#define IP      244             /* interrupt process--permanently */
                ^~~

Use an unsigned char buffer instead.

MFC after: 1 week

7 years agoFix Capsicum syscalls test suite.
oshogbo [Tue, 30 Aug 2016 19:58:41 +0000 (19:58 +0000)]
Fix Capsicum syscalls test suite.

7 years agolibcpp: Complete the __COUNTER__ support with upstream implementation.
pfg [Tue, 30 Aug 2016 19:39:33 +0000 (19:39 +0000)]
libcpp: Complete the __COUNTER__ support with upstream implementation.

We brought an original __COUNTER__ implementation in r228474, however, it
was missing documentation and it had a different behaviour for precompiled
headers with respect to the upstream version. Since the upstream version
is under the same license as GCC4.2, bring the missing pieces to reduce
differences against upstream.

Optained from: GCC pre-4.3 (rev. 125041 ; GPLv2)

7 years agoReduce duplicated logic for !SMP
bdrewery [Tue, 30 Aug 2016 19:26:07 +0000 (19:26 +0000)]
Reduce duplicated logic for !SMP

Sponsored by: EMC / Isilon Storage Division

7 years agoiscsi_initiator: make logout_req::reason unsigned char
emaste [Tue, 30 Aug 2016 19:20:26 +0000 (19:20 +0000)]
iscsi_initiator: make logout_req::reason unsigned char

Previously this reported an error from Clang 3.9.0: implict conversion
from 'int' to 'char' changes value from 128 to -128.

Discussed with: dim, trasz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7699

7 years agoSquelch clang 3.9.0 warnings about BASE (which is 32768) being converted
dim [Tue, 30 Aug 2016 19:02:15 +0000 (19:02 +0000)]
Squelch clang 3.9.0 warnings about BASE (which is 32768) being converted
to -32768 when it is used as an argument to mp_itom(), in both libtelnet
and newkey.  This code has been wrong since r26238 (!), so after almost
20 years it is rather useless to try to correct it.

MFC after: 1 week

7 years agoThe code only converts from bpbHugeSectors to bpbSectors if the sum of
imp [Tue, 30 Aug 2016 18:01:26 +0000 (18:01 +0000)]
The code only converts from bpbHugeSectors to bpbSectors if the sum of
the hidden and huge sectors is less than or equal MAXU16. When
formatting in Windows bpbSectors is still used for 63488 sectors and
2048 hidden (sum > MAXU16). The hidden sectors count is the number of
sectors before the FAT16 Boot Record so it shouldn't affect the sector
count. Attached patch (huge_sec_conversion.patch) to only check for
bpb.bpbHugeSectors <= MAXU16 when converting to bpbSectors.

Submitted by: Guy Yur
PR: 183234

7 years agoRemove CHS alignment. It's not needed and causes problems for the BBB
imp [Tue, 30 Aug 2016 18:01:19 +0000 (18:01 +0000)]
Remove CHS alignment. It's not needed and causes problems for the BBB
boot partition. NetBSD removed it in 1.10 in their repo some time ago.

Submitted by: Guy Yur
PR: 183234

7 years agoBecause we need to use a break-before-make sequence when promoting pages
andrew [Tue, 30 Aug 2016 16:45:15 +0000 (16:45 +0000)]
Because we need to use a break-before-make sequence when promoting pages
there is a short period where functions that walk the kernel page table
without locking them may see an invalid entry. One solution would be to add
locking to these functions, however some may be called from locations where
we are unable to sleep.

Until a better solution can be found stop promoting pages in the kernel
pmap so these functions work as expected.

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

7 years agoUpdate cryptotest for modern algorithms
gnn [Tue, 30 Aug 2016 14:28:35 +0000 (14:28 +0000)]
Update cryptotest for modern algorithms

Reviewed by: cem
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D7598

7 years agoAdd refactored blacklist support to sshd
lidl [Tue, 30 Aug 2016 14:09:24 +0000 (14:09 +0000)]
Add refactored blacklist support to sshd

Change the calls to of blacklist_init() and blacklist_notify to be
macros defined in the blacklist_client.h file.  This avoids
the need for #ifdef USE_BLACKLIST / #endif except in the
blacklist.c file.

Remove redundent initialization attempts from within
blacklist_notify - everything always goes through
blacklistd_init().

Added UseBlacklist option to sshd, which defaults to off.
To enable the functionality, use '-o UseBlacklist=yes' on
the command line, or uncomment in the sshd_config file.

Reviewed by: des
Approved by: des
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7051

7 years agoInvert calloc(3) argument order.
araujo [Tue, 30 Aug 2016 12:40:12 +0000 (12:40 +0000)]
Invert calloc(3) argument order.

Reviewed by: grehan, mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D7613

7 years agoFix keyboard polling "on/off" to support recursion. vt depends on
bde [Tue, 30 Aug 2016 12:36:14 +0000 (12:36 +0000)]
Fix keyboard polling "on/off" to support recursion.  vt depends on
this, and sc will soon depend on it again.

The on/off request is passed without modification to lower layers,
so the bug was smaller in this layer than in in lower layers (the
sequence on;on;off left polling off when it should be on, but the
sequence on;on;off;on;off...  doesn't allow the interrupt handler
to eat the input after an "off" that should't turn off polled mode,
provided lower layers don't have the bug, since this layer is virtual.

The bug was small in lower layers too.  Normally everything is Giant
locked for keyboards, and this locks out the interrupt handler in
on;on;off;on;off... sequences.  However, PR 211884 says that fixing
this bug in ukbd in r303765 apparently causes the eating-by-interrupt
behaviour that the fix is to prevent.

Discussed with: emax

7 years agoStart adding locking to sc_cngetc().
bde [Tue, 30 Aug 2016 10:57:19 +0000 (10:57 +0000)]
Start adding locking to sc_cngetc().

Restore an splx() lost in r228644.  We aren't nearly ready to remove
spl's.  They give hints about missing locking.  This lost one was
misplaced.  Dropping it early for convenience gave race windows for
accesses to the fkey buffer.  Giant locking accidentally fixed this
for non-console cases.

Put the spl's around the whole function.  Since there are many returns
that would need splx() just before them for a direct fix, split the
function into a wrapper that does the spl's and a "locked" function
that does the work.

Return earlier when no keyboard is attached to match the ordering in a
planned version.  This breaks the dubious feature of returning keys
from the fkey buffer after the keyboard has gone away.  Losing the keys
wouldn't matter, but we keep them too long now.

7 years agoAdd support for Allwinner A64 watchdog timer.
jmcneill [Tue, 30 Aug 2016 10:21:32 +0000 (10:21 +0000)]
Add support for Allwinner A64 watchdog timer.

7 years agoUpdate a comment to reflect r305051.
kevlo [Tue, 30 Aug 2016 08:34:49 +0000 (08:34 +0000)]
Update a comment to reflect r305051.

7 years agoRestore swap pager readahead after r292373.
markj [Tue, 30 Aug 2016 05:56:21 +0000 (05:56 +0000)]
Restore swap pager readahead after r292373.

The removal of vm_fault_additional_pages() meant that a hard fault on
a swap-backed page would result in only that page being read in. This
change implements readahead and readbehind for the swap pager in
swap_pager_getpages(). swap_pager_haspage() is modified to return the
largest contiguous non-resident range of pages containing the requested
range.

Reviewed by: alc, kib
Tested by: pho
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D7677

7 years agoRecursively enumerate anonymous structs and unions in ctf_member_info().
markj [Tue, 30 Aug 2016 05:50:42 +0000 (05:50 +0000)]
Recursively enumerate anonymous structs and unions in ctf_member_info().

Previously, ctf_member_info() would ignore members belonging to an
anonymous struct or union. This made it impossible to, for example, trace
the m_next field of an mbuf using DTrace.

Reported and tested by: gallatin
MFC after: 2 weeks

7 years agohyperv/hn: Remove unnecessary NULL check.
sephe [Tue, 30 Aug 2016 05:47:58 +0000 (05:47 +0000)]
hyperv/hn: Remove unnecessary NULL check.

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

7 years agohyperv/hn: Log packet message alignment.
sephe [Tue, 30 Aug 2016 05:35:19 +0000 (05:35 +0000)]
hyperv/hn: Log packet message alignment.

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

7 years agohyperv/hn: Remove the useless rndis_device and related bits
sephe [Tue, 30 Aug 2016 05:21:34 +0000 (05:21 +0000)]
hyperv/hn: Remove the useless rndis_device and related bits

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

7 years agoZap M_IOVEC.
kevlo [Tue, 30 Aug 2016 05:15:42 +0000 (05:15 +0000)]
Zap M_IOVEC.

Reviewed by: Matthew Macy

7 years agohyperv/hn: Switch to new RNDIS transaction execution for halt.
sephe [Tue, 30 Aug 2016 05:09:26 +0000 (05:09 +0000)]
hyperv/hn: Switch to new RNDIS transaction execution for halt.

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

7 years agohyperv/hn: Factor out func to exec RNDIS transaction w/o checking result
sephe [Tue, 30 Aug 2016 04:04:29 +0000 (04:04 +0000)]
hyperv/hn: Factor out func to exec RNDIS transaction w/o checking result

It will be used by RNDIS HALT and RESET.

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

7 years agohyperv/hn: Remove unused function
sephe [Tue, 30 Aug 2016 03:55:43 +0000 (03:55 +0000)]
hyperv/hn: Remove unused function

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

7 years agohyperv/hn: Switch to new RNDIS set for RX filters.
sephe [Tue, 30 Aug 2016 03:40:22 +0000 (03:40 +0000)]
hyperv/hn: Switch to new RNDIS set for RX filters.

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

7 years agonet/rndis: Packet types are defined by NDIS; not RNDIS specific.
sephe [Tue, 30 Aug 2016 03:11:07 +0000 (03:11 +0000)]
net/rndis: Packet types are defined by NDIS; not RNDIS specific.

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

7 years agohyperv/hn: Indentation and field comment fixup for ndis.h.
sephe [Tue, 30 Aug 2016 03:03:19 +0000 (03:03 +0000)]
hyperv/hn: Indentation and field comment fixup for ndis.h.

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

7 years agohyperv/hn: Move OIDs to net/rndis.h; they are standard NDIS OIDs.
sephe [Tue, 30 Aug 2016 02:55:07 +0000 (02:55 +0000)]
hyperv/hn: Move OIDs to net/rndis.h; they are standard NDIS OIDs.

Actually all OIDs defined in net/rndis.h are standard NDIS OIDs.
While I'm here, use the verbose macro name as in NDIS spec.

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

7 years agoAttach and LAW problems to fix
jhibbits [Tue, 30 Aug 2016 02:09:40 +0000 (02:09 +0000)]
Attach and LAW problems to fix

Summary:
1) Attach problem - mpc85xx_probe() relies on fact that 0xfff0 mask matches all
QorIQ CPUs what is not true since e6500. This shall be reworked to match against
all supported CPUs.

2) There is no any reason for operating system to re-program or anyhow else
touch the LAWs programmed by firmware (u-boot). Right now mpc85xx_attach()
removes all LaW entries except for DRAM. This causes MCE to be generated when
later any of driver maps DTB-provided hardware addresses which do not exist
anymore because corresponding LaWs were removed.

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

7 years agoFilter certain compile-time options into -DATF_BUILD_*
ngie [Tue, 30 Aug 2016 02:04:55 +0000 (02:04 +0000)]
Filter certain compile-time options into -DATF_BUILD_*

Items filtered through are:

- Constant defines (-D)
- Include flags (-I)
- Linker flags (-L)
- Optimization level (-O)
- Warnings / linker flags (-W)
- Preprocessor options (-f)

This fixes the scenario hit by the Jenkins job where it's infecting
the build with --sysroot, etc options from the Jenkins build in the
tests.

Prefix all intermediate variables (_CFLAGS, etc) with "ATF_BUILD" [*].

MFC after: 2 weeks
Reported by: Jenkins
Requested by: jmmv
Reviewed by: jmmv
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7702

7 years agoAdd support for NXP/Freescale etsec2 ethernet controller
jhibbits [Tue, 30 Aug 2016 01:58:49 +0000 (01:58 +0000)]
Add support for NXP/Freescale etsec2 ethernet controller

Adding the compatible property check isn't enough.  Device trees for eTSEC2
devices are missing a 'reg' property on the eTSEC node itself, relegating it to
the queue group child nodes.

Still left to do: add Multigroup mode support (see QorIQ reference manuals s for
SoCs with eTSEC2).

MFC after: 2 weeks
Relnotes: Yes

7 years agoFix TI PRUSS driver panic with INVARIANTS enabled
gonzo [Tue, 30 Aug 2016 01:31:03 +0000 (01:31 +0000)]
Fix TI PRUSS driver panic with INVARIANTS enabled

Value passed as islocked argument to knlist_add should
be consistent with actual lock state so add lock/unlock
calls around knlist_add

PR: 212120
Submitted by: Manuel Stuhn

7 years agoSome versions of SLOF do not append the partition number to the boot
nwhitehorn [Tue, 30 Aug 2016 00:47:21 +0000 (00:47 +0000)]
Some versions of SLOF do not append the partition number to the boot
device argument to the stage-1 bootloader. In such cases, boot1 would
only try to read the entire device rather than checking for partitions.
Instead of panic'ing, fall back to reading the partitions as normal in
such situations. This was preventing boot of installed systems on some
versions of PowerKVM.

PR: kern/211599
MFC after: 2 days

7 years agoImplement 'devctl clear driver' to undo a previous 'devctl set driver'.
jhb [Mon, 29 Aug 2016 22:48:36 +0000 (22:48 +0000)]
Implement 'devctl clear driver' to undo a previous 'devctl set driver'.

Add a new 'clear driver' command for devctl along with the accompanying
ioctl and devctl_clear_driver() library routine to reset a device to
use a wildcard devclass instead of a fixed devclass.  This can be used
to undo a previous 'set driver' command.  After the device's name has
been reset to permit wildcard names, it is reprobed so that it can
attach to newly-available (to it) device drivers.

MFC after: 1 month
Sponsored by: Chelsio Communications

7 years agoMinor Makefile simplifications for lib/atf/...
ngie [Mon, 29 Aug 2016 22:47:53 +0000 (22:47 +0000)]
Minor Makefile simplifications for lib/atf/...

- Replace uses of `${.CURDIR:H:H:H}` with ${SRCTOP}
- Use built-in :H operator instead of ".." when enumerating paths.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

7 years agoUse device_verbose() to undo device_quiet() when detaching from t[45]iovX.
jhb [Mon, 29 Aug 2016 22:47:14 +0000 (22:47 +0000)]
Use device_verbose() to undo device_quiet() when detaching from t[45]iovX.

The device quiet flag is not automatically reset on detach, so it is
inherited by other device drivers (e.g. when switching a device driver
over to ppt for PCI pass through).  Cope with this behavior by explicitly
marking the device verbose during detach so that the next driver can make
its own decision.

Sponsored by: Chelsio Communications

7 years agoFix typo
ngie [Mon, 29 Aug 2016 22:38:18 +0000 (22:38 +0000)]
Fix typo

atf_tc_expect_fail should have been atf_expect_fail per atf-sh-api(3)

PR: 212193
Pointyhat to: ngie
Sponsored by: EMC / Isilon Storage Division

7 years agoioat(4): Add additional CTR tracing during reset
cem [Mon, 29 Aug 2016 20:51:34 +0000 (20:51 +0000)]
ioat(4): Add additional CTR tracing during reset

7 years agoioat(4): Don't "complete" DMA descriptors prematurely
cem [Mon, 29 Aug 2016 20:46:33 +0000 (20:46 +0000)]
ioat(4): Don't "complete" DMA descriptors prematurely

In r304602, I mistakenly removed the ioat_process_events check that we weren't
processing events before the hardware had completed the descriptor
("last_seen").  Reinstate that logic.

Keep the defensive loop condition and additionally make sure we've actually
completed a descriptor before blindly chasing the ring around.

In reset, queue and finish the startup command before allowing any event
processing or submission to occur.  Avoid potential missed callouts by
requeueing the poll later.

7 years agoWhen the EFI implementation (like U-Boot) does not support WaitForKey, we
jmcneill [Mon, 29 Aug 2016 20:01:53 +0000 (20:01 +0000)]
When the EFI implementation (like U-Boot) does not support WaitForKey, we
can emulate efi_cons_poll(0 with a flag and caching the last key read with
ReadKeyStroke. This fixes the loader.efi countdown timer on Pine64 (and
other U-Boot + EFI using platforms).

Reviewed by: imp, manu
Differential Revision: https://reviews.freebsd.org/D7670

7 years agoTypesetting fixes.
kib [Mon, 29 Aug 2016 19:53:13 +0000 (19:53 +0000)]
Typesetting fixes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agoAvoid undefined behavior when calling va_start() in bnep_send_control(),
dim [Mon, 29 Aug 2016 19:40:46 +0000 (19:40 +0000)]
Avoid undefined behavior when calling va_start() in bnep_send_control(),
by making the 'type' parameter a plain unsigned.

MFC after: 3 days

7 years agoRestore the requirement of setting errno to zero before calling
kib [Mon, 29 Aug 2016 19:33:07 +0000 (19:33 +0000)]
Restore the requirement of setting errno to zero before calling
ptrace(2).  Describe the behaviour of automatically zeroing errno as
historical feature.

Requested by: ache, jhb
Reviewed by: ache, bjk
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRemove redundant declarations and simplify ../ in pathing
ngie [Mon, 29 Aug 2016 19:10:58 +0000 (19:10 +0000)]
Remove redundant declarations and simplify ../ in pathing

- TESTSBASE and LOCALBASE are already defined in bsd.tests.mk
- TESTSDIR is automatically divined as ${TESTSBASE}${RELDIR:H} after
  r289158.
- Replace SRCDIR with SRCTOP

MFC after: 1 week
X-MFC with: r305019
Sponsored by: EMC / Isilon Storage Division

7 years agoRemove unnecessary variable (SRCDIR) replaced by SRCTOP in Makefile.common
ngie [Mon, 29 Aug 2016 19:07:48 +0000 (19:07 +0000)]
Remove unnecessary variable (SRCDIR) replaced by SRCTOP in Makefile.common

MFC after: 1 week
X-MFC with: r305018
Sponsored by: EMC / Isilon Storage Division

7 years agoUse SRCTOP instead of a homegrown definition for it (SRCDIR)
ngie [Mon, 29 Aug 2016 19:06:40 +0000 (19:06 +0000)]
Use SRCTOP instead of a homegrown definition for it (SRCDIR)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

7 years agoFix the zfsd unittest:
dim [Mon, 29 Aug 2016 18:55:06 +0000 (18:55 +0000)]
Fix the zfsd unittest:
* TESTSDIR is supposed to be under cddl/usr.sbin, not cddl/sbin
* DevdCtl::EventBuffer no longer exists, so remove its forward
  declaration

MFC after: 3 days
X-MFC-With: r305013

7 years agoRemove commented out mention of ptrace.S.
kib [Mon, 29 Aug 2016 18:53:51 +0000 (18:53 +0000)]
Remove commented out mention of ptrace.S.
After r305012 the asm wrapper is not needed.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoAdd an empty virtual destructor to zfsd's Vdev class. This is needed
dim [Mon, 29 Aug 2016 18:51:49 +0000 (18:51 +0000)]
Add an empty virtual destructor to zfsd's Vdev class.  This is needed
because the class has virtual functions, and the compiler-generated
default destructor is non-virtual.

Reviewed by: asomers
MFC after: 3 days

7 years agoRewrite ptrace(2) wrappers in C.
kib [Mon, 29 Aug 2016 18:47:51 +0000 (18:47 +0000)]
Rewrite ptrace(2) wrappers in C.
Besides removing hand-translation to assembler, this also adds missing
wrappers for arm64 and risc-v.

Reviewed by: emaste, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D7694

7 years agoExpect sub testcases 2-4 in :tests_time_rotate to fail today due to changes
ngie [Mon, 29 Aug 2016 18:46:04 +0000 (18:46 +0000)]
Expect sub testcases 2-4 in :tests_time_rotate to fail today due to changes
to newsyslog, etc made in the past month.

The issue is being root-caused as part of the bug noted below. This commit
will need to be partially reverted once the issue has been found/fixed

PR: 212160
Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division

7 years agoAdd screen locking calls to sc cn grab and ungrab. The locking functions
bde [Mon, 29 Aug 2016 18:41:06 +0000 (18:41 +0000)]
Add screen locking calls to sc cn grab and ungrab.  The locking functions
just use the same mutex locking as sc cn putc so they have the same
defects.

The locking calls to acquire the lock are actually in sc cn open and close.
Ungrab has to unlock, although this opens a race window.

Change the direct mutex lock calls in sc cn putc to the new locking
functions via the open and close functions.  Putc also has to unlock, but
doesn't keep the screen open like grab.  Screen open and close reduce to
locking, except screen open for grab also attempts to switch the screen.

Keyboard locking is more difficult and still null, even when keyboard
input calls screen functions, except some of the functions have locks
too deep to work right.

This organization gives a single place to fix some of the locking.

7 years agoAllow parallelizing clean/cleandepend/depend with all.
bdrewery [Mon, 29 Aug 2016 18:31:34 +0000 (18:31 +0000)]
Allow parallelizing clean/cleandepend/depend with all.

This now makes 'make -jX clean all install' safe.

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

7 years agoExpect :basic to fail due to recent output changes in dirname(3)
ngie [Mon, 29 Aug 2016 17:50:36 +0000 (17:50 +0000)]
Expect :basic to fail due to recent output changes in dirname(3)

The dirname output change bug is actively being worked on, and this
commit will need to be reverted once it's fixed.

MFC after: never
PR: 212193
Sponsored by: EMC / Isilon Storage Division

7 years agoNull out the release notes for 12-CURRENT
skreuzer [Mon, 29 Aug 2016 17:23:04 +0000 (17:23 +0000)]
Null out the release notes for 12-CURRENT

Approved by: gjb
Differential Revision:     D7669

7 years agoShorten banal comments about zeroing and copying pages. Don't give
bde [Mon, 29 Aug 2016 14:38:31 +0000 (14:38 +0000)]
Shorten banal comments about zeroing and copying pages.  Don't give
implementation details that last echoed the code 15-20 years ago.
But add a detail about pagezero() on i386.  Switch from Mach style
to BSD style.

7 years agoOn amd64, declare sse2_pagezero() and start using it again, but only
bde [Mon, 29 Aug 2016 13:07:21 +0000 (13:07 +0000)]
On amd64, declare sse2_pagezero() and start using it again, but only
for zeroing pages in idle where nontemporal writes are clearly best.
This is almost a no-op since zeroing in idle works does nothing good
and is off by default.  Fix END() statement forgotten in previous
commit.

Align the loop in sse2_pagezero().  Since it writes to main memory,
the loop doesn't have to be very carefully written to keep up.
Unrolling it was considered useless or harmful and was not done on
i386, but that was too careless.

Timing for i386: the loop was not unrolled at all, and moved only 4
bytes/iteration.  So on a 2GHz CPU, it needed to run at 2 cycles/
iteration to keep up with a memory speed of just 4GB/sec.  But when
it crossed a 16-byte boundary, on old CPUs it ran at 3 cycles/
iteration so it gave a maximum speed of 2.67GB/sec and couldn't even
keep up with PC3200 memory.  Fix the alignment so that it keep up with
4GB/sec memory, and unroll once to get nearer to 8GB/sec.  Further
unrolling might be useless or harmful since it would prevent the loop
fitting in 16-bytes.  My test system with an old CPU and old DDR1 only
needed 5+ GB/sec.  My test system with a new CPU and DDR3 doesn't need
any changes to keep up ~16GB/sec.

Timing for amd64: with 8-byte accesses and newer faster CPUs it is
easy to reach 16GB/sec but not so easy to go much faster.  The
alignment doesn't matter much if the CPU is not very old.  The loop
was already unrolled 4 times, but needs 32 bytes and uses a fancy
method that doesn't work for 2-way unrolling in 16 bytes.  Just
align it to 32-bytes.

7 years agoUse both the MACHINE and MACHINE_CPUARCH directories for finding sources.
ed [Mon, 29 Aug 2016 07:48:35 +0000 (07:48 +0000)]
Use both the MACHINE and MACHINE_CPUARCH directories for finding sources.

When fixing this module to build on PC98, I actually broke the build on
ARM64. On PC98 we need to pull in the sources from the MACHINE_CPUARCH
(i386), but on ARM64 we need to use the MACHINE, as MACHINE_CPUARCH is
set to aarch64 instead of just arm64.

7 years agoRedo MFV r304866:
mm [Mon, 29 Aug 2016 06:54:38 +0000 (06:54 +0000)]
Redo MFV r304866:
Sync libarchive with vendor including security fixes

Vendor issues fixed:
Issue #731: Reject tar entries >= INT64_MAX
Issue #744 (part of Issue #743): Enforce sandbox with very long pathnames
Issue #748: Zip decompression failure with highly-compressed data
Issue #767: Buffer overflow printing a filename
Issue #770: Zip read: be more careful about extra_length

MFC after: 3 days

7 years agoRevert r304869
mm [Mon, 29 Aug 2016 06:50:45 +0000 (06:50 +0000)]
Revert r304869

This commit was incorrect and will be re-committed asap.

7 years agoRestore the nontemporal pagezero() under the name sse2_pagezero() (the
bde [Mon, 29 Aug 2016 06:07:43 +0000 (06:07 +0000)]
Restore the nontemporal pagezero() under the name sse2_pagezero() (the
same name as for i386).  It is not reconnected yet.

Which method is better is too machine-dependent and system-dependent
to replace the old method unconditionally.

7 years agohyperv/hn: Switch to new RNDIS set for RSS parameters.
sephe [Mon, 29 Aug 2016 05:35:35 +0000 (05:35 +0000)]
hyperv/hn: Switch to new RNDIS set for RSS parameters.

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

7 years agohyperv/hn: Fix # of channels setting, if RSS is not available.
sephe [Mon, 29 Aug 2016 05:08:53 +0000 (05:08 +0000)]
hyperv/hn: Fix # of channels setting, if RSS is not available.

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

7 years agohyperv/hn: Switch to new RNDIS query for RSS capabilities extraction.
sephe [Mon, 29 Aug 2016 04:54:13 +0000 (04:54 +0000)]
hyperv/hn: Switch to new RNDIS query for RSS capabilities extraction.

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

7 years agohyperv/hn: Switch to new RNDIS query for link status extraction.
sephe [Mon, 29 Aug 2016 04:44:24 +0000 (04:44 +0000)]
hyperv/hn: Switch to new RNDIS query for link status extraction.

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

7 years agohyperv/hn: Add definition for NDIS media state.
sephe [Mon, 29 Aug 2016 03:22:56 +0000 (03:22 +0000)]
hyperv/hn: Add definition for NDIS media state.

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

7 years agoAdd missing array subscript.
jhb [Mon, 29 Aug 2016 01:59:18 +0000 (01:59 +0000)]
Add missing array subscript.

This fixes a tautological pointer comparison warning, but would also a
real bug for a platform where bus_dmamap_unload of a static allocation
is not a no-op.

7 years agoCheck all compatible strings on uart devices in powerpc
jhibbits [Sun, 28 Aug 2016 21:31:21 +0000 (21:31 +0000)]
Check all compatible strings on uart devices in powerpc

Summary:
Some device trees put "fsl,ns16650" first in the compatible list.  This causes
the probe code to choke, even though the device is compatible with ns16650, and
has it listed later in the tree.

Reviewed by: nwhitehorn
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D7676

7 years agoDefine hastd's STRICT_ALIGN macro in a defined and portable way.
dim [Sun, 28 Aug 2016 21:26:11 +0000 (21:26 +0000)]
Define hastd's STRICT_ALIGN macro in a defined and portable way.

MFC after: 3 days

7 years agobhnd(4): Apply the siba chipid ncore fixup in bhnd_read_chipid(), ensuring
landonf [Sun, 28 Aug 2016 20:39:53 +0000 (20:39 +0000)]
bhnd(4): Apply the siba chipid ncore fixup in bhnd_read_chipid(), ensuring
that bhndb et al are always operating on a valid core count.

Approved by: adrian (mentor, implicit)

7 years agoThe read-ahead code from r298230 made it likely the boot code would read
peter [Sun, 28 Aug 2016 20:39:33 +0000 (20:39 +0000)]
The read-ahead code from r298230 made it likely the boot code would read
beyond the end of disk. r298900 added code to prevent this.  Some BIOSes
cause significant delays if asked to read past end-of-disk.

We never trusted the BIOS to accurately report the sectorsize of disks
before and this set of changes.  Unfortuately they interact badly with
the infamous >2TB wraparound bugs.  We have a number of relatively-recent
machines in the FreeBSD.org cluster where the BIOS reports 3TB disks as 1TB.

With pre-r298900 they work just fine.  After r298900 they stop working if
the boot environment attempts to access anything outside the first 1TB on
the disk.  'ZFS: I/O error, all block copies unavailable' etc.  It affects
both UFS and ZFS if they try to boot from large volumes.

This change replaces the blind trust of the BIOS end-of-disk reporting
with a read-ahead clip to prevent reads crossing the of end-of-disk
boundary.  Since 2^32 (2TB) size reporting truncation is not uncommon,
the clipping is done on 2TB aliases of the reported end-of-disk.
ie: a 3TB disk reported as 1TB has readahead clipped at 1TB, 3TB, 5TB, ...
as one of them is likely to be the real end-of-disk.

This should make the loader on these broken machines behave the same as
traditional pre-r298900 loader behavior, without disabling read-ahead.

PR: 212139
Discussed with: tsoome, allanjude

7 years agoFollow-up to r304953, in which I broke the build: apparently the SOLARIS
dim [Sun, 28 Aug 2016 19:35:29 +0000 (19:35 +0000)]
Follow-up to r304953, in which I broke the build: apparently the SOLARIS
macro is defined in lots of different places in ipfilter, so replace all
of the nonportable definitions with portable ones.

Pointy hat to: dim
X-MFC-With: r304959, r304953
MFC after: 3 days

7 years agobhnd(4): Add a bhnd bus method for fetching the device's core table.
landonf [Sun, 28 Aug 2016 19:34:22 +0000 (19:34 +0000)]
bhnd(4): Add a bhnd bus method for fetching the device's core table.

This will allow us to perform bhndb(4) bridge configuration based on
the identified hardware, prior to performing full enumeration of the
child bhnd bus.

Approved by: adrian (mentor, implicit)

7 years agoExpand error messages: print symbol names, parentheses and shift tokens,
bde [Sun, 28 Aug 2016 19:33:09 +0000 (19:33 +0000)]
Expand error messages: print symbol names, parentheses and shift tokens,
and negative shift counts.

Fix error messages: print "Division" instead of "Divide"; print
multiplier-like, addition-like and logical operator tokens instead of
garbage (usually the command name).

ddb has a primitive lexer with excessive information hiding that makes
it hard to find even the point in the line where a syntax error is
detected.  Old ddb just printed "Syntax error" and this was unimproved
in most places by printing a garbage token.

7 years agoComplete r304953.
kib [Sun, 28 Aug 2016 18:10:29 +0000 (18:10 +0000)]
Complete r304953.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agoFix vm86 initialization, part 1 of 2 and a half.
bde [Sun, 28 Aug 2016 15:23:44 +0000 (15:23 +0000)]
Fix vm86 initialization, part 1 of 2 and a half.

Early use of vm86 depends on the PIC being reset to mask interrupts,
but r286667 moved PIC initialization to after where vm86 may be first
used.

Move the PIC initialization up to immdiately before vm86 initialization.
All invocations of diff that I tried display this move poorly so that it
looks like PIC and vm86 initialization was moved later.

r286667 was to move console initialization later.  The diffs are again
unreadable -- they show a large move that doesn't seem to involve the
console.  The PIC initialization stayed just below the console
initialization where it could still be debugged but no longer works.

Later console initialization breaks mainly debugging vm86 initialization
and memory sizing using ddb and printf().  There are several printf()s
in the memory sizing that now go nowhere since message buffer
initialization has always been too late.  Memory sizing is done by loader
for most users, but the lost messages for this case are even more
interesting than for an auto-probe since they tell you what the loader
found.

7 years agoFix vm86 initialization, part 1 of 2 and a half.
bde [Sun, 28 Aug 2016 14:03:25 +0000 (14:03 +0000)]
Fix vm86 initialization, part 1 of 2 and a half.

vm86 uses the tss, but r273995 moved tss initialization to after where
it may be first used, just because tss_esp0 now depends on later
initializations and/or amd64 does it later.

vm86 is first used for memory sizing in cases where the loader can't
figure out the size or is not used.  Its initialization is placed
immediately before memory sizing to support this, and the tss was
initialized a little earlier.

Move everything in the tss initialization except for tss_esp0 back to
almost where it was, immediately before vm86 initialization (the
combined move is from before dblflt_tss initialization to after).  Add
only early initialization of tss_esp0, later reloading of the tss, and
comments.  The initial tss_esp0 no longer has space for the pcb since
initially the size of the pcb is not known and no pcb is needed.
(Later changes broke debugging at this point, so the nonexistent pcb
cannot be used by debuggers, and at the time of 273995 when ddb was
almost able to debug this problem it didn't need the pcb.)  The
iniitial tss_esp0 still has a magic 16 bytes reserved for vm86
although I think this is unused too.

7 years agoBack out r304907, Ed had fixed it apparently earlier in the cloudabi*
bz [Sun, 28 Aug 2016 12:05:34 +0000 (12:05 +0000)]
Back out r304907, Ed had fixed it apparently earlier in the cloudabi*
subdirectories.

Reported by: np

7 years agoDefine ipfilter's SOLARIS macro in a defined and portable way.
dim [Sun, 28 Aug 2016 11:51:46 +0000 (11:51 +0000)]
Define ipfilter's SOLARIS macro in a defined and portable way.

Reviewed by: cy
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D7671

7 years agoRemove duplicated declaration.
oshogbo [Sun, 28 Aug 2016 07:40:11 +0000 (07:40 +0000)]
Remove duplicated declaration.

Reported by: adrian@

7 years ago[ath_hal] add USB PHY control registers for hornet/AR9330.
adrian [Sun, 28 Aug 2016 05:42:03 +0000 (05:42 +0000)]
[ath_hal] add USB PHY control registers for hornet/AR9330.

Obtained from: linux ath9k

7 years ago[net80211] fix up wlanwds to compile without warnings on clang.
adrian [Sun, 28 Aug 2016 04:54:02 +0000 (04:54 +0000)]
[net80211] fix up wlanwds to compile without warnings on clang.

7 years agoFix UART PPS capture mode printing
jhibbits [Sun, 28 Aug 2016 04:40:27 +0000 (04:40 +0000)]
Fix UART PPS capture mode printing

* Add breaks to prevent fallthrough and printing of multiple modes.
* Only check the mode, mask out all other bits.

7 years ago[mips] move AR91XX_BASE to std.AR91XX.
adrian [Sun, 28 Aug 2016 04:10:23 +0000 (04:10 +0000)]
[mips] move AR91XX_BASE to std.AR91XX.

7 years ago[mips] migrate the QCA955X_BASE file to std.QCA955X, to bring this in line with
adrian [Sun, 28 Aug 2016 04:08:26 +0000 (04:08 +0000)]
[mips] migrate the QCA955X_BASE file to std.QCA955X, to bring this in line with
other board defaults.

7 years agoUse ALT_BREAK_TO_DEBUGGER as well.
adrian [Sun, 28 Aug 2016 04:08:04 +0000 (04:08 +0000)]
Use ALT_BREAK_TO_DEBUGGER as well.

7 years ago.. and since others are using wdr3600/wdr4300 right now and are having
adrian [Sun, 28 Aug 2016 04:07:34 +0000 (04:07 +0000)]
.. and since others are using wdr3600/wdr4300 right now and are having
arge issues with spammed interrupts / link issues, flip on ARGE_DEBUG too.

7 years agoSince i'm using carambola 2 for more debugging, enable ARGE_DEBUG by default.
adrian [Sun, 28 Aug 2016 04:06:57 +0000 (04:06 +0000)]
Since i'm using carambola 2 for more debugging, enable ARGE_DEBUG by default.

7 years ago[mips] make AR933X boards use ALT_BREAK_TO_DEBUGGER like the rest of the Atheros...
adrian [Sun, 28 Aug 2016 04:06:36 +0000 (04:06 +0000)]
[mips] make AR933X boards use ALT_BREAK_TO_DEBUGGER like the rest of the Atheros boards.

7 years ago[mips] QCA955x config file changes to bring things into alignment with the other...
adrian [Sun, 28 Aug 2016 04:03:52 +0000 (04:03 +0000)]
[mips] QCA955x config file changes to bring things into alignment with the other atheros config files.

* ALT_BREAK_TO_DEBUGGER, because we get random breaks when unplugging USB
  to serial adapters
* Build more modules!

7 years agoFollow ABI when calling __error from the ptrace(2) wrapper.
kib [Sun, 28 Aug 2016 00:26:06 +0000 (00:26 +0000)]
Follow ABI when calling __error from the ptrace(2) wrapper.

In particular, preserve syscall arguments on stack, since callee is
not required to preserve arg-passing registers.  Align stack.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoDo not obliterate errno value in the main thread during ptrace(2) call on x86.
kib [Sat, 27 Aug 2016 23:03:23 +0000 (23:03 +0000)]
Do not obliterate errno value in the main thread during ptrace(2) call on x86.

Since ptrace(2) syscall can return -1 for non-error situations, libc
wrappers set errno to 0 before performing the syscall, as the service
to the caller.  On both i386 and amd64, the errno symbol was directly
referenced, which only works correctly in single-threaded process.

Change assembler wrappers for ptrace(2) to get current thread errno
location by calling __error().  Allow __error interposing, as
currently allowed in cerror().

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agovfs: provide a common exit point in namei for error cases
mjg [Sat, 27 Aug 2016 22:43:41 +0000 (22:43 +0000)]
vfs: provide a common exit point in namei for error cases

This shortens the function, adds the SDT_PROBE use for error cases and
consistenly unrefs rootdir last.

Reviewed by: kib
MFC after: 2 weeks

7 years agoIn ncurses baudrate definitions, avoid warnings about implicit
dim [Sat, 27 Aug 2016 20:33:19 +0000 (20:33 +0000)]
In ncurses baudrate definitions, avoid warnings about implicit
conversions from int to short changing the values.  This applies to
B38400 and higher, since their values do not fit into a short.

However, since the wrapped values are still unique, and they only serve
as keys, there is no problem in adding a cast to silence the warnings.
This also avoids changing the ABI, which would happen if we changed
NCURSES_OSPEED to int.

Discussed with: Thomas Dickey
MFC after: 1 week

7 years agoDecode some new ATA commands found in ACS-3.
mav [Sat, 27 Aug 2016 19:51:37 +0000 (19:51 +0000)]
Decode some new ATA commands found in ACS-3.

MFC after: 1 week