]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFV r304732.
Cy Schubert [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 Turner [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 Schouten [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 Schouten [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 Schouten [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 Schouten [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.
Julio Merino [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 Schouten [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
Michael 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.
Bruce Evans [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 Schubert [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.
Sepherosa Ziehau [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.
Sepherosa Ziehau [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
Justin Hibbits [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.
Kevin Lo [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.
Sepherosa Ziehau [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.
Sepherosa Ziehau [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.
Sepherosa Ziehau [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 Schubert [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
Mike 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 Davis [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 Davis [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
Emmanuel Vadot [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
Andrey A. Chernov [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
Gleb Smirnoff [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.
Bruce Evans [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
Enji Cooper [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.
Bryan Drewery [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
Dimitry Andric [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.
Bryan Drewery [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
Enji Cooper [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
Enji Cooper [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
Landon J. Fuller [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)
Ed Maste [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 Turner [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 Turner [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 Turner [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.
Pedro F. Giffuni [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 Turner [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.
Pedro F. Giffuni [Tue, 23 Aug 2016 15:46:20 +0000 (15:46 +0000)]
indent(1): remove dead assignments.

Taken from: Piotr Sephaniak

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

7 years agoRe-enable WITH_SYSTEM_COMPILER with WITH_META_MODE.
Bryan Drewery [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.
Bryan Drewery [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
Baptiste Daroussin [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.
Marcelo Araujo [Tue, 23 Aug 2016 13:43:43 +0000 (13:43 +0000)]
Use roundup2() from sys/param.h.

7 years agoAdd tftpfs support for the EFI loader
Baptiste Daroussin [Tue, 23 Aug 2016 13:35:48 +0000 (13:35 +0000)]
Add tftpfs support for the EFI loader

Allow netbooting on efi without having to setup any NFS server by rebuilding the
loader with LOADER_TFTP_SUPPORT like for the i386 pxeloader

Sponsored by: Gandi.net

7 years agoFix calloc(3) argument order.
Marcelo Araujo [Tue, 23 Aug 2016 13:19:42 +0000 (13:19 +0000)]
Fix calloc(3) argument order.

MFC after: 4 weeks.

7 years agointpm: add support for SB800
Andriy Gapon [Tue, 23 Aug 2016 10:40:53 +0000 (10:40 +0000)]
intpm: add support for SB800

This code should be able to support later AMD chipsets as well, but that
hasn't been tested.

SB800 supports accessing several different SMBus buses using the same
set of constrol registeirs plus special PMIO registers that control which
bus is selected.  This could be exposed to consumers as several smb devices
each talking to its bus.  This feature is not implemented yet.

MFC after: 2 weeks

7 years agotlb1_init() can be called twice on BookE
Justin Hibbits [Tue, 23 Aug 2016 04:37:03 +0000 (04:37 +0000)]
tlb1_init() can be called twice on BookE

Summary:
There is no need to call tlb1_init() twice. Now it is called first time from
booke_init() and second time from powerpc_init() (where it is under BOOKE
switch). Although this does not cause immediate problems in the mainline kernel,
this can lead to undesirable side effects like two TLB entries with the same VA
in the TLB1. Presence of two TLB entries with the same VA can hang CPU.

Test Plan:
Add initial mapping for UART to the tlb1_init(), build and boot the kernel,
ensure that mapping presents only once (most convinient way - through Lauterbah
or similar hardware debugger)

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

7 years agoTake into account mas7/8 when reading/writing TLB entries on e6500
Justin Hibbits [Tue, 23 Aug 2016 04:26:30 +0000 (04:26 +0000)]
Take into account mas7/8 when reading/writing TLB entries on e6500

Summary: Current booke/pmap code ignores mas7 and mas8 on e6500 CPU.

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

7 years agonet: Split RNDIS protocol structs/macros out of dev/usb/net/if_urndisreg.h
Sepherosa Ziehau [Tue, 23 Aug 2016 02:54:06 +0000 (02:54 +0000)]
net: Split RNDIS protocol structs/macros out of dev/usb/net/if_urndisreg.h

So that Hyper-V can leverage them instead of rolling its own definition.

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

7 years agoindent(1): Fix off-by-one in control flow leading dead code.
Pedro F. Giffuni [Tue, 23 Aug 2016 02:07:08 +0000 (02:07 +0000)]
indent(1): Fix off-by-one in control flow leading dead code.

Coverity correctly reported that it's impossible for /comparison/ to be 0
here, because the only way for the for loop to end is by /comparison/
being < 0.

Fortunately the consequences of this bug weren't severe; for duplicated
entries in the typedef names file it would unnecessarily duplicate strings
with strdup(), but pointers to those would replace existing ones. So this
was a memory leak at worst.

CID:  1361477
Obtained from:  Piotr Stephaniak

7 years agoFix missing substitution of @SBINDIR@ in resolvconf scripts
Eric Badger [Tue, 23 Aug 2016 02:06:20 +0000 (02:06 +0000)]
Fix missing substitution of @SBINDIR@ in resolvconf scripts

Certain features, such as resolv_conf_passthrough=NULL, do not work
correctly due to this missing substitution.

Also remove the @PREFIX@ substitution, which is no longer needed.

Reviewed by: pfg
Approved by: vangyzen (mentor)
MFC after: 1 week
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D7572

7 years agoindent(1): add some comments to quiet down Coverity.
Pedro F. Giffuni [Tue, 23 Aug 2016 01:58:02 +0000 (01:58 +0000)]
indent(1): add some comments to quiet down Coverity.

Hopefully adding comments should help explain the code to both static
checkers and humans.

CID: 976543, 976544, 976545
Obtained from: Piotr Stephaniak

7 years agoindent(1): Fix memory leaks pointed out by clang-analyzer.
Pedro F. Giffuni [Tue, 23 Aug 2016 01:40:45 +0000 (01:40 +0000)]
indent(1): Fix memory leaks pointed out by clang-analyzer.

Shift the responsibility of allocating memory for the string duplicate
from the caller (set_option, add_typedefs_from_file) to the callee
(add_typename) as it has more knowledge about when the duplication
actually needs to occur.

Taken from: Piotr Stefaniak

7 years agoDo not include file from dt-bindings and simply use the already present defines.
Emmanuel Vadot [Tue, 23 Aug 2016 00:46:22 +0000 (00:46 +0000)]
Do not include file from dt-bindings and simply use the already present defines.

Reported by: jmcneill
MFC after: 1 week

7 years agoRename ORDERED to BOOTSTRAP since no order is respected in the list.
Bryan Drewery [Mon, 22 Aug 2016 22:51:10 +0000 (22:51 +0000)]
Rename ORDERED to BOOTSTRAP since no order is respected in the list.

The directories in SUBDIR_ORDERED are built in parallel, so the name is
misleading.

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

7 years agoFor 'make <directory>' hook into the all_subdir_<directory> targets.
Bryan Drewery [Mon, 22 Aug 2016 22:51:07 +0000 (22:51 +0000)]
For 'make <directory>' hook into the all_subdir_<directory> targets.

This fixes parallel build issues when trying to depend on ${SUBDIR}.  An
example of this in share/i18n/csmapper/Makefile where mapper.dir depends
on ${SUBDIR} having been traversed and built already.  Before this
change running make in that directory would build the subdirectories
twice.  This led to obscure build races.  While reworking that build
may be possible, the framework should not so easily allow creating such
problems.

Now depending on <directory> will properly redirect to the
all_subdir_<directory> target rather than invoking the inline shell.

This also makes 'make -jX <directory>' now respect any
SUBDIR_DEPEND_<directory> statements when SUBDIR_PARALLEL is defined.
This is not entirely intended and may be changed later.

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

7 years agoAlways define the various <target>_subdir_<directory> targets, even if not used.
Bryan Drewery [Mon, 22 Aug 2016 22:51:04 +0000 (22:51 +0000)]
Always define the various <target>_subdir_<directory> targets, even if not used.

This is part of an effort to cleanup handling of some edge cases
involving 'make <directory>'.  It also provides the targets for
other uses.

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

7 years agoStop using _SUBDIR internally for non-SUBDIR_PARALLEL builds.
Bryan Drewery [Mon, 22 Aug 2016 22:51:01 +0000 (22:51 +0000)]
Stop using _SUBDIR internally for non-SUBDIR_PARALLEL builds.

This is unifying more of the logic.  Rather than create targets such
as 'all: all_subdir_foo' when using SUBDIR_PARALLEL and using
'all: _SUBDIR' when not using SUBDIR_PARALLEL, always use the
expanded out <target>_subdir_<directory> pattern.  When not using
SUBDIR_PARALLEL, have each directory-target depend on the previously
defined targets as to respect the *order* of SUBDIR.

Using 'make -N' now prints all directory traversals individually rather
than using a loop, since a loop is no longer used to traverse.

This is part of an effort to cleanup handling of some edge cases
involving 'make <directory>' and making it simpler in the sense
that the pattern used to build is the same for all modes.

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

7 years agoFix building on read-only source trees.
Bryan Drewery [Mon, 22 Aug 2016 22:50:58 +0000 (22:50 +0000)]
Fix building on read-only source trees.

This partially reverts r296702 and reworks the original check to only
look in .CURDIR.  This avoids ever trying to rebuild a .src file that is
already in the source tree as an override.

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

7 years ago1) Back out r304607 case 2). fgetwln() as its pair fgetln() supposed to
Andrey A. Chernov [Mon, 22 Aug 2016 22:28:41 +0000 (22:28 +0000)]
1) Back out r304607 case 2). fgetwln() as its pair fgetln() supposed to
return partial line on any errors. See the comment in fgetln.c.
Add corresponding comment to fgetwln() too.
2) Rewrite r304607 case 1).
3) Remove "Fast path" from __fgetwc_mbs() since it can't detect encoding
errors and ignores them all.

PR:     212033
MFC after:      7 days

7 years agoPrefer C-style comments in assembly sources.
Jung-uk Kim [Mon, 22 Aug 2016 21:49:17 +0000 (21:49 +0000)]
Prefer C-style comments in assembly sources.

7 years agoFix white spaces in assembly sources.
Jung-uk Kim [Mon, 22 Aug 2016 21:30:59 +0000 (21:30 +0000)]
Fix white spaces in assembly sources.

7 years agoFix build for !SMP kernels after the Xen MSIX workaround.
John Baldwin [Mon, 22 Aug 2016 21:23:17 +0000 (21:23 +0000)]
Fix build for !SMP kernels after the Xen MSIX workaround.

Move msix_disable_migration under #ifdef SMP since it doesn't make sense
for !SMP kernels.

PR: 212014
Reported by: Glyn Grinstead <glyn@grinstead.org>
MFC after: 3 days

7 years agoBuild OpenSSL assembly sources for arm. Tested with Raspberry Pi 2 Model B.
Jung-uk Kim [Mon, 22 Aug 2016 20:59:34 +0000 (20:59 +0000)]
Build OpenSSL assembly sources for arm.  Tested with Raspberry Pi 2 Model B.

MFC after: 1 week

7 years agoRemove support for SSH1 as it is already disabled in our OpenSSH.
Ollivier Robert [Mon, 22 Aug 2016 20:48:46 +0000 (20:48 +0000)]
Remove support for SSH1 as it is already disabled in our OpenSSH.

Submitted by: vangyzen
MFC after: 2 weeks

7 years agoDon't separate the status stage of the XHCI USB control transfers into
Hans Petter Selasky [Mon, 22 Aug 2016 19:32:50 +0000 (19:32 +0000)]
Don't separate the status stage of the XHCI USB control transfers into
its own job because this breaks the simplified QEMU XHCI TRB parser,
which expects the complete USB control transfer as a series of back to
back TRBs. The old behaviour is kept under #ifdef in case this change
breaks enumeration of any USB devices.

PR: 212021
MFC after: 1 week

7 years agoAdd support for Ed25519 keys.
Ollivier Robert [Mon, 22 Aug 2016 19:27:20 +0000 (19:27 +0000)]
Add support for Ed25519 keys.

Reported by: mwlucas
MFH: 2 weeks

7 years agoFix the arm64 non-SMP build, active_irq is a uint64_t so cast it through
Andrew Turner [Mon, 22 Aug 2016 19:05:11 +0000 (19:05 +0000)]
Fix the arm64 non-SMP build, active_irq is a uint64_t so cast it through
a uintmax_t.

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

7 years agoRemove duplicate symbol from libhx509 version-script.map
Ed Maste [Mon, 22 Aug 2016 18:50:57 +0000 (18:50 +0000)]
Remove duplicate symbol from libhx509 version-script.map

Upstream commit r21331 (7758a5d0) added semiprivate function
_hx509_request_to_pkcs10 twice. This change has been committed upstream
as 8ef0071d.

7 years agoFix building for ARM kernel that have FLASHADDR, PHYSADDR and LOADERRAMADDR defined.
Emmanuel Vadot [Mon, 22 Aug 2016 18:33:56 +0000 (18:33 +0000)]
Fix building for ARM kernel that have FLASHADDR, PHYSADDR and LOADERRAMADDR defined.

Pointy Hat: myself

Reported by: bz

7 years agoEnsure map is valid, even before userland exists and the fault address
Andrew Turner [Mon, 22 Aug 2016 18:19:46 +0000 (18:19 +0000)]
Ensure map is valid, even before userland exists and the fault address
register points to an address in the userland range.

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

7 years agoRemove cross references to el(4) and ie(4).
John Baldwin [Mon, 22 Aug 2016 18:17:29 +0000 (18:17 +0000)]
Remove cross references to el(4) and ie(4).

7 years agoFix pmap_update_entry, pmap_invalidate_range takes the end address, not
Andrew Turner [Mon, 22 Aug 2016 18:12:44 +0000 (18:12 +0000)]
Fix pmap_update_entry, pmap_invalidate_range takes the end address, not
the size.

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

7 years agoRegenerate src.conf.5 after r304616
Ed Maste [Mon, 22 Aug 2016 17:53:18 +0000 (17:53 +0000)]
Regenerate src.conf.5 after r304616

7 years agoForcibly disable MK_TESTS if building without C++
Ed Maste [Mon, 22 Aug 2016 17:45:30 +0000 (17:45 +0000)]
Forcibly disable MK_TESTS if building without C++

Several atf components require C++, and the test suite is not usable
if building WITHOUT_CXX.

Reviewed by: bdrewery, jmmv
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7597

7 years agoMake CloudABI work on i386.
Ed Schouten [Mon, 22 Aug 2016 17:37:31 +0000 (17:37 +0000)]
Make CloudABI work on i386.

Copy over amd64's cloudabi64_sysvec.c into i386 and tailor it to work.
Again, we use a system call convention similar to FreeBSD, except that
there is no support for indirect system calls (%eax == 0).

Where i386 differs from amd64 is that we have to store thread/process
entry arguments on the stack instead of using registers. We also have to
put an extra pointer on the stack for TLS (for GSBASE). Place that
pointer in the empty slot that is normally used to hold return
addresses. That seems to keep the code simple.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D7590

7 years agoFurther fixes for translation of PrintScreen/SysRq.
Bruce Evans [Mon, 22 Aug 2016 16:39:51 +0000 (16:39 +0000)]
Further fixes for translation of PrintScreen/SysRq.

The previous fix was tested mainly on 3 AT keyboards with USB adaptors where
it works.  1 USB keyboard doesn't translate Alt-PrintScreen, so the software
has to do it.

Reorganize a little to share some code and to not translate the unusual usb
scan code0x8a unless an Alt modified is set.  Remove redundant check of Alt
modifiers.  Translation now more clearly filters out Alt-PrintScreen before
the check.

The table of errors fixed in the previous commit had many bugs.  Correct
table:

K_RAW  Ctl-PrintScreen:                                 E0-2A-E0-37 -> E0-37
K_RAW  Alt-PrintScreen (with 4 comb. of Ctl/Shift):     79 -> 54
K_RAW  Pause/Break (with 4 comb. of Alt/Shift):         E0-46 -> E1-1D-45
K_CODE PrintScreen (with 4 comb. of Ctl/Shift):         54 -> 5c
K_CODE Alt-PrintScreen (with 4 comb. of Ctl/Shift):     7e -> 54
K_CODE Pause/Break (with 8 comb. of Ctl/Alt/Shift):     6c -> 68

That is 25 of 32 shift combinations for 2 keys fixed.  All 16 combinations
were broken for K_CODE and thus also for K_XLATE.

7 years agoBump __FreeBSD_version for C++11 thread_local support in r303795.
Bryan Drewery [Mon, 22 Aug 2016 15:52:03 +0000 (15:52 +0000)]
Bump __FreeBSD_version for C++11 thread_local support in r303795.

PR: 192320

7 years agoFix error processing.
Andrey A. Chernov [Mon, 22 Aug 2016 15:44:54 +0000 (15:44 +0000)]
Fix error processing.
1) Don't forget to set __SERR on __slbexpand() error.
2) Check for __fgetwc() errors using errno. Don't check for __SERR
as PR suggested, it user-visible flag which can stick from previous
functions and stdio code don't check it for this purpose.

PR:     212033
MFC after:      3 days

7 years agoTemporarily disable the optimization from r304436
Ryan Stone [Mon, 22 Aug 2016 15:27:37 +0000 (15:27 +0000)]
Temporarily disable the optimization from r304436

r304436 attempted to optimize the handling of incoming UDP packet by only
making an expensive call to in_broadcast() if the mbuf was marked as an
broadcast packet.  Unfortunately, this cannot work in the case of point-to-
point L2 protocols like PPP, which have no notion of "broadcast".

Discussions on how to properly fix r304436 are ongoing, but in the meantime
disable the optimization to ensure that no existing network setups are broken.

Reported by: bms

7 years agoFix calloc(3) argument order.
Marcelo Araujo [Mon, 22 Aug 2016 15:01:39 +0000 (15:01 +0000)]
Fix calloc(3) argument order.

Reviewed by: trasz
MFC after: 4 weeks.
Differential Revision: https://reviews.freebsd.org/D7532

7 years agoUse switch statements in pmap_remove_pages. While only one level of
Andrew Turner [Mon, 22 Aug 2016 14:53:39 +0000 (14:53 +0000)]
Use switch statements in pmap_remove_pages. While only one level of
pagetable is supported more will be added soon to support removing
superpages.

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

7 years agoioat(4): Allow callouts to be scheduled after hw reset
Conrad Meyer [Mon, 22 Aug 2016 14:51:09 +0000 (14:51 +0000)]
ioat(4): Allow callouts to be scheduled after hw reset

is_completion_pending governs whether or not a callout will be scheduled
when new work is queued on the IOAT device.  If true, a callout is
already scheduled, so we do not need a new one.  If false, we schedule
one and set it true.  Because resetting the hardware completed all
outstanding work but failed to clear is_completion_pending, no new
callout could be scheduled after a reset with pending work.

This resulted in a driver hang for polled-only work.

7 years agoioat(4): Don't process events past queue head
Conrad Meyer [Mon, 22 Aug 2016 14:51:07 +0000 (14:51 +0000)]
ioat(4): Don't process events past queue head

Fix a race where the completion routine could overrun the active ring
area in some situations.

7 years agoIncrease the maximum RX/TX queue size. This allows for a RX/TX queue
Hans Petter Selasky [Mon, 22 Aug 2016 13:43:25 +0000 (13:43 +0000)]
Increase the maximum RX/TX queue size. This allows for a RX/TX queue
size of 16384 mbufs. Previously the limit was 8192.

Sponsored by: Mellanox Technologies
MFC after: 1 week

7 years agoUse pmap_update_entry in pmap_enter when updating an entry with a new
Andrew Turner [Mon, 22 Aug 2016 12:56:40 +0000 (12:56 +0000)]
Use pmap_update_entry in pmap_enter when updating an entry with a new
physical address. This is required when either mapping is writeable.

While here remove an unneeded call to pmap_pde, we already have the pde
from earlier in the function.

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

7 years agoAdd sysctls to report on superpages statistics. While here add extra
Andrew Turner [Mon, 22 Aug 2016 12:17:40 +0000 (12:17 +0000)]
Add sysctls to report on superpages statistics. While here add extra
logging to these paths.

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

7 years agoAdd a size argument to pmap_update_entry.
Andrew Turner [Mon, 22 Aug 2016 10:50:30 +0000 (10:50 +0000)]
Add a size argument to pmap_update_entry.
Make use of this in pmap_promote_l2.

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

7 years agoFix for invalid use of bits in input context. Basically split
Hans Petter Selasky [Mon, 22 Aug 2016 10:21:25 +0000 (10:21 +0000)]
Fix for invalid use of bits in input context. Basically split
configuring of EP0 and non-EP0 into xhci_cmd_evaluate_ctx() and
xhci_cmd_configure_ep() respectivly. This resolves some errors when
using XHCI under QEMU and gets is more in line with the XHCI
specification.

PR: 212021
MFC after: 1 week

7 years agoAdd KASSERTS in pmap_alloc_l3 to ensure we are not encountering superpages
Andrew Turner [Mon, 22 Aug 2016 10:21:09 +0000 (10:21 +0000)]
Add KASSERTS in pmap_alloc_l3 to ensure we are not encountering superpages
when we don't yet expect them;

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

7 years agohyperv/hn: Factor out function to simplify NVS request sending
Sepherosa Ziehau [Mon, 22 Aug 2016 08:00:14 +0000 (08:00 +0000)]
hyperv/hn: Factor out function to simplify NVS request sending

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

7 years agohyperv/hn: Factor out function to execute NVS transactions.
Sepherosa Ziehau [Mon, 22 Aug 2016 07:51:46 +0000 (07:51 +0000)]
hyperv/hn: Factor out function to execute NVS transactions.

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

7 years agohyperv/hn: Get rid of netvsc_dev
Sepherosa Ziehau [Mon, 22 Aug 2016 07:44:11 +0000 (07:44 +0000)]
hyperv/hn: Get rid of netvsc_dev

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

7 years agohyperv/hn: Move chimney sending buffer to hn_softc
Sepherosa Ziehau [Mon, 22 Aug 2016 07:34:39 +0000 (07:34 +0000)]
hyperv/hn: Move chimney sending buffer to hn_softc

And don't recreate chimney sending buffer for each primary channel
open, it is now created in device_attach DEVMETHOD and destroyed
in device_detach DEVMETHOD.

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

7 years agoAdd a missing change in r304575.
Pyun YongHyeon [Mon, 22 Aug 2016 03:28:06 +0000 (03:28 +0000)]
Add a missing change in r304575.

Noticed by: jhb

7 years agoImprove the locking when sending user messages.
Michael Tuexen [Mon, 22 Aug 2016 01:45:29 +0000 (01:45 +0000)]
Improve the locking when sending user messages.

First, keep a ref count on the stcb after looking it up, as
done in the other lookup cases.
Second, before looking again at sp, ensure that it is not
freed, because the assoc is about to be freed.

MFC after: 3 days

7 years agoAdd Killer E2400 to the supported hardware list.
Pyun YongHyeon [Mon, 22 Aug 2016 01:28:02 +0000 (01:28 +0000)]
Add Killer E2400 to the supported hardware list.

7 years agoAdd Killer E2400 Gigabit Ethernet support.
Pyun YongHyeon [Mon, 22 Aug 2016 01:19:05 +0000 (01:19 +0000)]
Add Killer E2400 Gigabit Ethernet support.
It seems Killer E2200/E2400 has a BIOS misconfiguration or silicon
bug which triggers DMA write errors when driver uses advertised
maximum payload size.  Force the maximum payload size to 128 bytes
in DMA configuration.
This change should fix occasional DMA write errors reported on
Killer E2200.

Tested by: <psy0nic@sys-tek.org>