]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFhead@r322451
Enji Cooper [Sun, 13 Aug 2017 01:23:13 +0000 (01:23 +0000)]
MFhead@r322451

6 years agoTESTSDIR isn't required; remove it
Enji Cooper [Sun, 13 Aug 2017 01:08:37 +0000 (01:08 +0000)]
TESTSDIR isn't required; remove it

MFC after: 1 week
MFC with: r322450

6 years agoIntegrate the tests moved in r305626 in to the FreeBSD test suite
Enji Cooper [Sun, 13 Aug 2017 01:04:44 +0000 (01:04 +0000)]
Integrate the tests moved in r305626 in to the FreeBSD test suite

The reachover Kyuafiles were never added, and thus the tests were installed
as standalone tests, and not integrated into the full suite.

MFC after: 1 week
MFC with: r305626, 305629, r307863, r322447, r322448, r322449

6 years agoUse hardcoded IPv4/IPv6 addresses for google-public-dns-a.google.com instead
Enji Cooper [Sun, 13 Aug 2017 00:56:43 +0000 (00:56 +0000)]
Use hardcoded IPv4/IPv6 addresses for google-public-dns-a.google.com instead
of freefall.freebsd.org to unbreak the DNS tests

The address allocations for freefall.freebsd.org have changed in the past 4 years.
Use a more stable set of hardcoded addresses for now to make the tests succeed
reliably.

The hostname should be resolved dynamically instead of hardcoding the addresses in
the future. This is just a bandaid.

MFC after: 1 week

6 years agoMake root-privileges a requirement for the test
Enji Cooper [Sun, 13 Aug 2017 00:14:08 +0000 (00:14 +0000)]
Make root-privileges a requirement for the test

Some of the testcases try to manipulate sysctls that require root privileges,
e.g., "kern.sync_on_panic". Make root-privileges a hard requirement so the
tests don't raise false positives due to privilege issues when calling
sysctlbyname(3) on writable sysctls.

MFC after: 1 week

6 years agoFix result printing
Enji Cooper [Sun, 13 Aug 2017 00:04:50 +0000 (00:04 +0000)]
Fix result printing

- Flushing stdout prevents the buffer from being printed twice, fixing
  issues with stdout printing out the testplan, etc, twice.
- Don't print out raw source/line numbers; hide them behind comments.

MFC after: 1 week

6 years agoHide `sccsid` under #if 0, per example in style(9)
Enji Cooper [Sat, 12 Aug 2017 22:20:08 +0000 (22:20 +0000)]
Hide `sccsid` under #if 0, per example in style(9)

This fixes a -Wunused warning with gcc 6.3.0/7.0.0.

MFC after: 1 week

6 years agoMove NVME controller shutdown from being called as part of module unloading
Nathan Whitehorn [Sat, 12 Aug 2017 22:13:06 +0000 (22:13 +0000)]
Move NVME controller shutdown from being called as part of module unloading
to being called through the newbus DEVICE_SHUTDOWN() path. This ensures that
the NVME controller gets shut down before the device and bus disappear
and prevents data corruption on shutdown on at least Samsung EVO 960 SSDs.

PR: kern/211852
Reviewed by: imp
MFC after: 2 weeks

6 years agoDelete trailing whitespace
Enji Cooper [Sat, 12 Aug 2017 21:26:46 +0000 (21:26 +0000)]
Delete trailing whitespace

MFC after: 1 month

6 years agobthidd(8): Add support for Apple's magic mouse
Vladimir Kondratyev [Sat, 12 Aug 2017 21:23:33 +0000 (21:23 +0000)]
bthidd(8): Add support for Apple's magic mouse

Note: Mouse's bthidd.conf record should contain vendor and device IDs
to make proper device detection. If it does not contain IDs,
regenerate record with "Query" command of recent bthidcontrol(8).

Submitted by: Dirk Engling <erdgeist@erdgeist.org>
Reviewed by: emax
Approved by: bapt (mentor), gonzo (mentor)
Differential Revision: https://reviews.freebsd.org/D3702

6 years agobthidd(8): Add support for vendor_id, product_id and version.
Vladimir Kondratyev [Sat, 12 Aug 2017 21:20:51 +0000 (21:20 +0000)]
bthidd(8): Add support for vendor_id, product_id and version.

Extend bthidd.conf format to store vendor and product IDs of remote
Bluetooth HID devices to make possible implementation of device
specific quirks inside bthidd(8).
Add support for querying of this information from device's SDP records
with bthidcontrol(8) "Query" command.

Submitted by: Dirk Engling <erdgeist@erdgeist.org>
Reviewed by: emax
Approved by: bapt (mentor), gonzo (mentor)
Differential Revision: https://reviews.freebsd.org/D3702

6 years agosh: Add tests for sh -c that already pass.
Jilles Tjoelker [Sat, 12 Aug 2017 19:17:48 +0000 (19:17 +0000)]
sh: Add tests for sh -c that already pass.

PR: 220587
Submitted by: Ryan Moeller

6 years agoReliably enable debug exceptions on all CPUs.
John Baldwin [Sat, 12 Aug 2017 18:42:54 +0000 (18:42 +0000)]
Reliably enable debug exceptions on all CPUs.

Previously, debug exceptions were only enabled on the boot CPU if
DDB was enabled in the dbg_monitor_init() function.  APs also called
this function, but since mp_machdep.c doesn't include opt_ddb.h, the
APs ended up calling an empty stub defined in <machine/debug_monitor.h>
instead of the real function.  Also, if DDB was not enabled in the kernel,
the boot CPU would not enable debug exceptions.

Fix this by adding a new dbg_init() function that always clears the OS
lock to enable debug exceptions which the boot CPU and the APs call.
This function also calls dbg_monitor_init() to enable hardware breakpoints
from DDB on all CPUs if DDB is enabled.  Eventually base support for
hardware breakpoints/watchpoints will need to move out of the DDB-only
debug_monitor.c for use by userland debuggers.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D12001

6 years agoDon't panic for PT_GETFPREGS.
John Baldwin [Sat, 12 Aug 2017 18:38:18 +0000 (18:38 +0000)]
Don't panic for PT_GETFPREGS.

Only fetch the VFP state from the CPU if the thread whose registers are
being requested is the current thread.  If a stopped thread's registers
are being fetched by a debugger, the saved state in the PCB is already
valid.

Reviewed by: andrew
MFC after: 1 week

6 years agoRevert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches
Ryan Libby [Sat, 12 Aug 2017 18:28:02 +0000 (18:28 +0000)]
Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches

Either need a different way to spell HALF_LDBL_MAX, or a different way
to spell LDBL_MAX_EXP, or a different approach.

Reported by: ian

6 years agoRe-remove excess / for installing SYMLINKS
Li-Wen Hsu [Sat, 12 Aug 2017 18:11:41 +0000 (18:11 +0000)]
Re-remove excess / for installing SYMLINKS

This excess / was introduced in r280129, and fixed in r295230, but got
re-introduced while merging another branch in r298107.

Approved by: gjb
Differential Revision: https://reviews.freebsd.org/D11995

6 years agoAdd missing header.
Sevan Janiyan [Sat, 12 Aug 2017 17:46:50 +0000 (17:46 +0000)]
Add missing header.
S_IRUSR is defined in sys/stat.h

PR: 209229
Submitted by: <mt AT markoturk DOT info>
Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D12007

6 years agoBid for the device with BUS_PROBE_GENERIC, because this is very much a
Ian Lepore [Sat, 12 Aug 2017 17:39:32 +0000 (17:39 +0000)]
Bid for the device with BUS_PROBE_GENERIC, because this is very much a
generic driver with minimal feature support for a large number of chips.
More featureful per-chip drivers might exist (especially out-of-tree) and
those should win the bidding even if they use BUS_PROBE_DEFAULT.

6 years agoarm*hf is no longer a thing, remove it from the conversion now that it's easy.
Warner Losh [Sat, 12 Aug 2017 17:07:32 +0000 (17:07 +0000)]
arm*hf is no longer a thing, remove it from the conversion now that it's easy.

Submitted by: andyt@

6 years agoMake _TO_CPUARCH macro for ARCH to CPUARCH conversions
Warner Losh [Sat, 12 Aug 2017 17:07:27 +0000 (17:07 +0000)]
Make _TO_CPUARCH macro for ARCH to CPUARCH conversions

Consolidate all the regular expressions to convert from MACHINE_ARCH
to MACHINE_CPUARCH into a variable and use that variable in preference
to the almost identical copies in the tree (which should have been
identical).

Differential Revision: https://reviews.freebsd.org/D11986

6 years agoSet usage() to show -d flag
Sevan Janiyan [Sat, 12 Aug 2017 15:51:46 +0000 (15:51 +0000)]
Set usage() to show -d flag
mkesdb supports the -d flag for enabling debug mode, as documented in the manual.

PR: 209865
Submitted by: Maya Rashish <coypu AT sdf DOT org>
Reviewed by: imp
Approved by: bcr (mentor)
Obtained from: NetBSD
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D11987

6 years agoImprove standard compliance for memset_s() and abort_handler_s().
Konstantin Belousov [Sat, 12 Aug 2017 15:18:17 +0000 (15:18 +0000)]
Improve standard compliance for memset_s() and abort_handler_s().

abort_handler_s() currently simply calls abort(), though the standard
specifies more: "Writes an implementation-defined message to stderr
which must include the string pointed to by msg and calls abort()."

memset_s() is missing error condition "n > smax", and does not invoke
the constraint handler after filling the buffer: "following errors are
detected at runtime and call the currently installed constraint
handler function after storing ch in every location of the destination
range [dest, dest+destsz) if dest and destsz are themselves valid",
one of the errors is "n > smax" itself.

Submitted by: Yuri Pankov <yuripv@gmx.com>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D11991

6 years agoFix indent.
Konstantin Belousov [Sat, 12 Aug 2017 14:58:09 +0000 (14:58 +0000)]
Fix indent.

Submitted by: Yuri Pankov <yuripv@gmx.com>
MFC after: 3 days

6 years agocxgbe(4): Save the last reported link parameters and compare them with
Navdeep Parhar [Sat, 12 Aug 2017 14:02:19 +0000 (14:02 +0000)]
cxgbe(4): Save the last reported link parameters and compare them with
the current state to determine whether to generate a link-state change
notification.  This fixes a bug introduced in r321063 that caused the
driver to sometimes skip these notifications.

Reported by: Jason Eggleston @ LLNW
MFC after: 3 days
Sponsored by: Chelsio Communications

6 years agoCorrect the -H longopt equivillant
Sevan Janiyan [Sat, 12 Aug 2017 12:17:38 +0000 (12:17 +0000)]
Correct the -H longopt equivillant

PR: 209876
Submitted by: <kdrakehp AT zoho DOT com>
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D11988

6 years agoFix a typo.
John Baldwin [Fri, 11 Aug 2017 22:47:32 +0000 (22:47 +0000)]
Fix a typo.

6 years agolib/msun: avoid referring to broken LDBL_MAX
Ryan Libby [Fri, 11 Aug 2017 22:41:24 +0000 (22:41 +0000)]
lib/msun: avoid referring to broken LDBL_MAX

LDBL_MAX is broken on i386:
https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
for some time, and newer versions of gcc are now warning that the
"floating constant exceeds range of 'long double'".  Avoid this by
referring to half the value of LDBL_MAX instead.

Reviewed by: bde
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon

6 years agoadd myself to calendar.freebsd
Bjoern Heidotting [Fri, 11 Aug 2017 20:44:17 +0000 (20:44 +0000)]
add myself to calendar.freebsd

Requested by: mckusick

6 years agolldb: enable on i386
Ed Maste [Fri, 11 Aug 2017 20:11:43 +0000 (20:11 +0000)]
lldb: enable on i386

It is functional on FreeBSD/i386 as of r322326.

Sponsored by: The FreeBSD Foundation

6 years agoarm: enable ARM_MANY_BOARD in NOTES for LINT build
Ed Maste [Fri, 11 Aug 2017 19:49:29 +0000 (19:49 +0000)]
arm: enable ARM_MANY_BOARD in NOTES for LINT build

Added in r238189, ARM_MANY_BOARD adds support for multiple ARM boards in
a single kernel. Include it for LINT builds to avoid duplicate symbol
errors when linking with lld.

Sponsored by: The FreeBSD Foundation

6 years agoBump KERNELDUMP_BUFFER_SIZE to 4096.
Mark Johnston [Fri, 11 Aug 2017 19:24:08 +0000 (19:24 +0000)]
Bump KERNELDUMP_BUFFER_SIZE to 4096.

The encrypted kernel dump code writes data in blocks of this size. A buffer
size of 4096 allows encrypted dumps to work with 4Kn drives.

Reviewed by: cem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11870

6 years agoAdd SVNVERSION_CMD to bsd.own.mk, adding the capability to include
Glen Barber [Fri, 11 Aug 2017 19:21:40 +0000 (19:21 +0000)]
Add SVNVERSION_CMD to bsd.own.mk, adding the capability to include
svnversion metadata to the runtime and kernel packages.

Instead of traversing src/sys, as is done by newvers.sh for uname(1),
a full tree walk is done to prevent userland and/or modifications
from not being reflected in a modified tree (M).

MFC after: 5 days
Sponsored by: The FreeBSD Foundation

6 years agoStop calling atrtc_set() from the xen timer clock_settime() method. That
Ian Lepore [Fri, 11 Aug 2017 19:02:11 +0000 (19:02 +0000)]
Stop calling atrtc_set() from the xen timer clock_settime() method.  That
removes the only reference to atrtc_set() from outside of atrtc.c, so make
it static.

The xen timer driver registers as a realtime clock with 1us resolution.  In
the past that resulted in only the xen timer's clock_settime() getting
called, so it would call atrtc_set() to set the hardware clock as well.  As
of r32090, the clock_settime() method of all registered realtime clocks gets
called, so the xen driver no longer needs to chain-call the lower-resolution
driver.

Thanks to royger@ for talking me through the xen stuff, and for testing.

6 years agoAdd historical notes on QIC tape drives and fix a couple of issues in mt(1).
Kenneth D. Merry [Fri, 11 Aug 2017 18:43:52 +0000 (18:43 +0000)]
Add historical notes on QIC tape drives and fix a couple of issues in mt(1).

 o Density code 0x5 is also known as QIC-11, and should have a footnote
   reference.
 o Add notes on QIC tape drives from the bug report.  These may help anyone
   trying to use a QIC drive.
 o Take out a "more more" instance found by igor.
 o Bump the man page date.

The PR is 14 years old, so it's past time to retire it.

PR: doc/53596
Submitted by: tedm@toybox.placo.com
Reviewed by: bcr
Sponsored by: Spectra Logic

6 years agoRename at91_pmc's M_PMC malloc type to avoid duplicate definition
Ed Maste [Fri, 11 Aug 2017 18:09:26 +0000 (18:09 +0000)]
Rename at91_pmc's M_PMC malloc type to avoid duplicate definition

M_PMC is defined in sys/dev/hwpmc/hwpmc_mod.c, and the LINT kernel build
fails when linking with lld due to a duplicate symbol error.

Sponsored by: The FreeBSD Foundation

6 years agoPerformance enhancements to reduce CPU utililization for large number of
David C Somayajulu [Fri, 11 Aug 2017 17:43:25 +0000 (17:43 +0000)]
Performance enhancements to reduce CPU utililization for large number of
TCP connections (order of tens of thousands), with predominantly Transmits.

Choice to perform receive operations either in IThread or Taskqueue Thread.

Submitted by:Vaishali.Kulkarni@cavium.com
MFC after:5 days

6 years agox86/crc32_sse42.c: quiet unused function warning
Ryan Libby [Fri, 11 Aug 2017 17:05:31 +0000 (17:05 +0000)]
x86/crc32_sse42.c: quiet unused function warning

Reviewed by: cem
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11980

6 years agoHave sendfile_swapin() use vm_page_grab_pages().
Mark Johnston [Fri, 11 Aug 2017 16:32:24 +0000 (16:32 +0000)]
Have sendfile_swapin() use vm_page_grab_pages().

Reviewed by: alc, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D11942

6 years agoModify vm_page_grab_pages() to handle VM_ALLOC_NOWAIT.
Mark Johnston [Fri, 11 Aug 2017 16:29:22 +0000 (16:29 +0000)]
Modify vm_page_grab_pages() to handle VM_ALLOC_NOWAIT.

This will allow its use in sendfile_swapin().

Reviewed by: alc, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D11942

6 years agoAn invalid page can't be dirty.
Alan Cox [Fri, 11 Aug 2017 16:27:54 +0000 (16:27 +0000)]
An invalid page can't be dirty.

Reviewed by: kib
MFC after: 1 week

6 years agoacpi/srat: fix build without DMAP
Roger Pau Monné [Fri, 11 Aug 2017 14:19:55 +0000 (14:19 +0000)]
acpi/srat: fix build without DMAP

Use pmap_mapbios to map memory used to store the cpus array.

Reported by: lwhsu
X-MFC-with: r322348

6 years agoFix indentation from r322401.
Glen Barber [Fri, 11 Aug 2017 14:19:31 +0000 (14:19 +0000)]
Fix indentation from r322401.

MFC after: 3 days
MFC with: r322401
Sponsored by: The FreeBSD Foundation

6 years agoAvoid creating kernel-dbg.txz distribution sets and kernel-debug
Glen Barber [Fri, 11 Aug 2017 14:18:11 +0000 (14:18 +0000)]
Avoid creating kernel-dbg.txz distribution sets and kernel-debug
packages when MK_DEBUG_FILES is 'no'.

MFC after: 5 days
Sponsored by: The FreeBSD Foundation

6 years agoOnly return the current cpu if it's in the cpumask. When we restrict the
Andrew Turner [Fri, 11 Aug 2017 12:45:58 +0000 (12:45 +0000)]
Only return the current cpu if it's in the cpumask. When we restrict the
cpumask it probably means we are unable to sent interrupts to CPUs outside
the map. As such only return the current CPU when it's within the mask
otherwise return the first valid CPU.

This is needed on ThunderX as, in a dual socket configuration, we are
unable to send MSI/MSI-X interrupts between sockets.

Reviewed by: mmel
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D11957

6 years agoMake sure the "vm_flags" and "vm_page_prot" fields get set correctly
Hans Petter Selasky [Fri, 11 Aug 2017 10:44:40 +0000 (10:44 +0000)]
Make sure the "vm_flags" and "vm_page_prot" fields get set correctly
in the VM area structure in the LinuxKPI when doing mmap() and that
unsupported bits are masked away.

While at it fix some redundant use of parenthesing inside some related
macros.

Found by: KrishnamRaju ErapaRaju <Krishna2@chelsio.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd a specialized function for DRM drivers to register themselves.
Mark Johnston [Fri, 11 Aug 2017 03:59:48 +0000 (03:59 +0000)]
Add a specialized function for DRM drivers to register themselves.

Such drivers attach to a vgapci bus rather than directly to a pci bus. For
the rest of the LinuxKPI to work correctly in this case, we override the
vgapci bus' ivars with those of the grandparent.

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11932

6 years agoMicro-optimize kmem_unback().
Mark Johnston [Fri, 11 Aug 2017 03:09:11 +0000 (03:09 +0000)]
Micro-optimize kmem_unback().

We can remove some unnecessary object radix tree lookups by using the
object memq to iterate over pages in the specified range. This does not,
however, eliminate the lookup needed in vm_page_free_toq() to remove each
tree entry.

Reviewed by: alc, kib (previous revision)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11945

6 years agoUpdate from sqlite3-3.14.1 to sqlite3-3.20.0. This is a private lib.
Peter Wemm [Fri, 11 Aug 2017 00:00:01 +0000 (00:00 +0000)]
Update from sqlite3-3.14.1 to sqlite3-3.20.0.  This is a private lib.
This fixes a possible client-side crash when parsing corrupt databases.

6 years agoMake vm_page_sunbusy() assert that the page is unlocked.
Mark Johnston [Thu, 10 Aug 2017 22:43:38 +0000 (22:43 +0000)]
Make vm_page_sunbusy() assert that the page is unlocked.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11946

6 years agoImport sqlite3-3.20.0
Peter Wemm [Thu, 10 Aug 2017 22:15:42 +0000 (22:15 +0000)]
Import sqlite3-3.20.0

6 years agoUpdate subversion 1.9.5 -> 1.9.7
Peter Wemm [Thu, 10 Aug 2017 22:03:26 +0000 (22:03 +0000)]
Update subversion 1.9.5 -> 1.9.7

This includes a client-side fix for CVE-2017-9800.

6 years agoImport subversion-1.9.7
Peter Wemm [Thu, 10 Aug 2017 21:48:34 +0000 (21:48 +0000)]
Import subversion-1.9.7

6 years agobsdinstall: record DHCP config after obtaining lease
Ed Maste [Thu, 10 Aug 2017 20:26:07 +0000 (20:26 +0000)]
bsdinstall: record DHCP config after obtaining lease

Previously we added an ifconfig_$INTERFACE line to rc.conf for each
unsuccessful DCHP attempt.

PR: 219515
Reviewed by: allanjude
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11967

6 years agoEnsure the clocks driver is attached before any drivers that need to enable
Ian Lepore [Thu, 10 Aug 2017 19:42:30 +0000 (19:42 +0000)]
Ensure the clocks driver is attached before any drivers that need to enable
clocks in their attach().

6 years agomptable: fix i386 build failure
Roger Pau Monné [Thu, 10 Aug 2017 17:46:57 +0000 (17:46 +0000)]
mptable: fix i386 build failure

Reported by: emaste
X-MFC-with: r322347

6 years agofnmatch(3): Update testcase for r322368.
Pedro F. Giffuni [Thu, 10 Aug 2017 17:03:46 +0000 (17:03 +0000)]
fnmatch(3): Update testcase for r322368.

6 years agoLimit descriptors stored in the pidfh structure.
Mariusz Zaborski [Thu, 10 Aug 2017 16:50:13 +0000 (16:50 +0000)]
Limit descriptors stored in the pidfh structure.

Reviewed by: markj, cem
Differential Revision: https://reviews.freebsd.org/D11741

6 years agoStore directory descriptor in the pidfh structure and use unlinkat(2)
Mariusz Zaborski [Thu, 10 Aug 2017 16:45:05 +0000 (16:45 +0000)]
Store directory descriptor in the pidfh structure and use unlinkat(2)
function instead of unlink(2).

Now when pidfile_remove() uses unlinkat(2) to remove the pidfile
it is safe to use this function in capability mode.

Style fix: sort headers.

PR: 220524
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D11692

6 years agofnmatch(3): improve POSIX conformance.
Pedro F. Giffuni [Thu, 10 Aug 2017 15:42:25 +0000 (15:42 +0000)]
fnmatch(3): improve POSIX conformance.

In a recent interpretation[1], "\\" shall return a non-zero value
(indicating either no match or an error).

The fix involves a change over r254091 and now the behavior matches the
Sun/IBM/HP closed source implementations and also likely musl libc.

Submitted by: Joerg Schilling <joerg at schily.net>
MFC after: 1 week

[1] http://austingroupbugs.net/view.php?id=806

6 years ago Add myself.
Ruey-Cherng Yu [Thu, 10 Aug 2017 15:31:45 +0000 (15:31 +0000)]
 Add myself.

Reported by: mckusick

6 years agoChanges to make mps(4) and mpr(4) handle reinit with reallocation.
Kenneth D. Merry [Thu, 10 Aug 2017 14:59:17 +0000 (14:59 +0000)]
Changes to make mps(4) and mpr(4) handle reinit with reallocation.

When the mps(4) and mpr(4) drivers need to reinitialize the
firmware, they sometimes need to reallocate all of the memory
allocated by the driver.  The reallocation happens whenever the IOC
Facts change.  That should only happen after a firmware upgrade.

If the reinitialization happens as a result of a timed out command
sent to the card, the command that timed out and triggered the
reinit may have been freed if iocfacts_allocate() reallocated all
memory.  If the caller attempts to access the command after that,
the kernel will panic because the caller will be dereferencing
freed memory.

The solution is to set a flag in the softc when we reallocate,
and avoid dereferencing the command strucure if we've reallocated.

The changes are largely the same in both drivers, since mpr(4) is a
derivative of mps(4).

 o In iocfacts_allocate(), if the IOC Facts have changed and we
   need to reallocate, set the REALLOCATED flag in the softc.

 o Change wait_command() to take a struct mps_command ** instead of
   a struct mps_command *.  This allows us to NULL out the caller's
   command pointer if we have to reinit the controller and the data
   structures get reallocated.  (The REALLOCATED flag will be set
   in the softc if that has happened.)

 o In every place that calls wait_command(), make sure we handle
   the case where the command is NULL after the call.

 o The mpr(4) driver has mpr_request_polled() which can also
   reinitialize the card.  Also check for reallocation there.

Reviewed by: scottl, slm
MFC after: 1 week
Sponsored by: Spectra Logic

6 years agoPurge deprecated locking macros.
Sean Bruno [Thu, 10 Aug 2017 14:54:36 +0000 (14:54 +0000)]
Purge deprecated locking macros.

Submitted by: Matt Macy <matt@mattmacy.io>
Sponsored by: Limelight Networks

6 years agoIndent nested conditionals for readability.
Glen Barber [Thu, 10 Aug 2017 14:18:58 +0000 (14:18 +0000)]
Indent nested conditionals for readability.

Sponsored by: The FreeBSD Foundation

6 years agoSupport for v1.10 (latest) of RISC-V privilege specification.
Ruslan Bukin [Thu, 10 Aug 2017 14:18:09 +0000 (14:18 +0000)]
Support for v1.10 (latest) of RISC-V privilege specification.

New version is not compatible on supervisor mode with v1.9.1
(previous version).

Highlights:
    o BBL (Berkeley Boot Loader) provides no initial page tables
      anymore allowing us to choose VM, to build page tables manually
      and enable MMU in S-mode.
    o SBI interface changed.
    o GENERIC kernel.
      FDT is now chosen standard for RISC-V hardware description.
      DTB is now provided by Spike (golden model simulator). This
      allows us to introduce GENERIC kernel. However, description
      for console and timer devices is not provided in DTB, so move
      these devices temporary to nexus bus.
    o Supervisor can't access userspace by default. Solution is to
      set SUM (permit Supervisor User Memory access) bit in sstatus
      register.
    o Compressed extension is now turned on by default.
    o External GCC 7.1 compiler used.
    o _gp renamed to __global_pointer$
    o Compiler -march= string is now in use allowing us to choose
      required extensions (compressed, FPU, atomic, etc).

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D11800

6 years agolldb: Report inferior signals as signals, not exceptions, on FreeBSD
Ed Maste [Thu, 10 Aug 2017 13:51:04 +0000 (13:51 +0000)]
lldb: Report inferior signals as signals, not exceptions, on FreeBSD

This is the FreeBSD equivalent of LLVM r238549.

This serves 2 purposes:

* LLDB should handle inferior process signals SIGSEGV/SIGILL/SIGBUS/
  SIGFPE the way it is suppose to be handled. Prior to this fix these
  signals will neither create a coredump, nor exit from the debugger
  or work for signal handling scenario.
* eInvalidCrashReason need not report "unknown crash reason" if we have
  a valid si_signo

llvm.org/pr23699

Patch by Karnajit Wangkhem

Differential Revision:  https://reviews.llvm.org/D35223

Submitted by: Karnajit Wangkhem
Obtained from: LLVM r310591

6 years agoEnable OF_setprop API function to add property in FDT
Marcin Wojtas [Thu, 10 Aug 2017 13:45:56 +0000 (13:45 +0000)]
Enable OF_setprop API function to add property in FDT

This patch modifies function ofw_fdt_setprop (called by OF_setprop),
so that it can add property, when replacing is not possible.
Adding property is needed to fixup FDT's that have missing
properties.

Submitted by: Patryk Duda <pdk@semihalf.com>
Reviewed by: nwhitehorn, cognet (mentor)
Approved by: cognet (mentor)
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D11879

6 years agoFurther revise r322327 and r322352 in release/packages/kernel.ucl.
Glen Barber [Thu, 10 Aug 2017 13:32:04 +0000 (13:32 +0000)]
Further revise r322327 and r322352 in release/packages/kernel.ucl.

Use PPID and PID to kill off the pre-install and parent pkg(8)
processes unless 'Y' or 'y' are entered at the prompt if the user
wants to proceed with upgrading the kernel and userland at the same
time.

This restores some of the logic and intent of r322327, with the
caveat of printing "child process terminated unexpectedly."

MFC after: 5 days
MFC with: r322327, r322352
Sponsored by: The FreeBSD Foundation

6 years agoUse integer type to pass around jiffies and/or ticks values in the
Hans Petter Selasky [Thu, 10 Aug 2017 13:05:40 +0000 (13:05 +0000)]
Use integer type to pass around jiffies and/or ticks values in the
LinuxKPI because in FreeBSD ticks are 32-bit.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoMark PROFILE option as broken when targetting mips64
Ed Maste [Thu, 10 Aug 2017 13:01:19 +0000 (13:01 +0000)]
Mark PROFILE option as broken when targetting mips64

The assembly in sys/mips/include/profile.h will only work for o32 ABI.

Submitted by: Alexander Richardson
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11950

6 years agoFixes for wait event in the LinuxKPI. These are regression issues
Hans Petter Selasky [Thu, 10 Aug 2017 13:00:10 +0000 (13:00 +0000)]
Fixes for wait event in the LinuxKPI. These are regression issues
after r319757.

1) Correct the return value from __wait_event_common() from 1 to 0 in
case the timeout is specified as MAX_SCHEDULE_TIMEOUT. In the other
case __ret is zero and will be substituted in the last part of the
macro with the appropriate value before return.

2) Make sure the "timeout" argument is casted to "int" before
evaluating negativity. Else the signedness of a "long" might be
checked instead of the signedness of an integer.

3) The wait_event() function should not have a return value.

Found by: KrishnamRaju ErapaRaju <Krishna2@chelsio.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoMake sure the linux_wait_event_common() function in the LinuxKPI properly
Hans Petter Selasky [Thu, 10 Aug 2017 12:51:04 +0000 (12:51 +0000)]
Make sure the linux_wait_event_common() function in the LinuxKPI properly
handles a timeout value of MAX_SCHEDULE_TIMEOUT which basically means there
is no timeout. This is a regression issue after r319757.

While at it change the type of returned variable from "long" to "int" to
match the actual return type.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd myself.
Oleg Bulyzhin [Thu, 10 Aug 2017 12:31:55 +0000 (12:31 +0000)]
Add myself.

Reported by: mckusick

6 years agoRevise part of r322327 in release/packages/kernel.ucl.
Glen Barber [Thu, 10 Aug 2017 12:30:34 +0000 (12:30 +0000)]
Revise part of r322327 in release/packages/kernel.ucl.

It appears I misunderstand process forking and signal handling in
how the pre-/post-install scripts are executed internally by pkg(8).
In some cases (not all), ^C when prompted to cancel the kernel
package update will stop the pre-install script from executing, but
allow pkg(8) to continue extracting the package when it is not the
intent.

In order to keep somewhat of an anti-footshooting measure in place,
print the recommendation to install the kernel package first if
ASSUME_ALWAYS_YES is false and TERM is set, then sleep for 5 seconds
to allow the user to see the message.

MFC after: 5 days
MFC with: r322327
X-MFC-Note: Maybe not until I am happy with this..
Sponsored by: The FreeBSD Foundation

6 years agoAdd two NFIT fields missed in r321298.
Alexander Motin [Thu, 10 Aug 2017 10:59:05 +0000 (10:59 +0000)]
Add two NFIT fields missed in r321298.

MFC after: 2 weeks

6 years agocalendars: add myself to the FreeBSD calendar
Roger Pau Monné [Thu, 10 Aug 2017 09:17:16 +0000 (09:17 +0000)]
calendars: add myself to the FreeBSD calendar

Reported by: mckusick

6 years agox86: bump MAX_APIC_ID to 512
Roger Pau Monné [Thu, 10 Aug 2017 09:16:40 +0000 (09:16 +0000)]
x86: bump MAX_APIC_ID to 512

Introduce a new define to take int account the xAPIC ID limit, for
systems where x2APIC is not available/reliable.

Also change some of the usages of the APIC ID to use an unsigned int
(which is the correct storage type to deal with x2APIC IDs as found in
x2APIC MADT entries).

This allows booting FreeBSD on a box with 256 CPUs and APIC IDs up to
295:

FreeBSD/SMP: Multiprocessor System Detected: 256 CPUs
FreeBSD/SMP: 1 package(s) x 64 core(s) x 4 hardware threads
Package HW ID = 0
Core HW ID = 0
CPU0 (BSP): APIC ID: 0
CPU1 (AP/HT): APIC ID: 1
CPU2 (AP/HT): APIC ID: 2
CPU3 (AP/HT): APIC ID: 3
[...]
Core HW ID = 73
CPU252 (AP): APIC ID: 292
CPU253 (AP/HT): APIC ID: 293
CPU254 (AP/HT): APIC ID: 294
CPU255 (AP/HT): APIC ID: 295

Submitted by: kib (previous version)
Relnotes: yes
MFC after: 1 month
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D11913

6 years agox86: make the arrays that depend on MAX_APIC_ID dynamic
Roger Pau Monné [Thu, 10 Aug 2017 09:16:03 +0000 (09:16 +0000)]
x86: make the arrays that depend on MAX_APIC_ID dynamic

So that MAX_APIC_ID can be bumped without wasting memory.

Note that the usage of MAX_APIC_ID in the SRAT parsing forces the
parser to allocate memory directly from the phys_avail physical memory
array, which is not the best approach probably, but I haven't found
any other way to allocate memory so early in boot. This memory is not
returned to the system afterwards, but at least it's sized according
to the maximum APIC ID found in the MADT table.

Sponsored by: Citrix Systems R&D
MFC after: 1 month
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D11912

6 years agoapic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase
Roger Pau Monné [Thu, 10 Aug 2017 09:15:18 +0000 (09:15 +0000)]
apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase

Populate the lapics arrays and call cpu_add/lapic_create in the setup
phase instead. Also store the max APIC ID found in the newly
introduced max_apic_id global variable.

This is a requirement in order to make the static arrays currently
using MAX_LAPIC_ID dynamic.

Sponsored by: Citrix Systems R&D
MFC after: 1 month
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D11911

6 years agoDon't leak mbufs if clusers exceeds the number of segments. This would
Sean Bruno [Thu, 10 Aug 2017 03:43:23 +0000 (03:43 +0000)]
Don't leak mbufs if clusers exceeds the number of segments.  This would
leak mbufs over time causing crashes.

PR: 221202
Submitted by: Matt Macy <matt@mattmacy.io>
Reported by: gergely.czuczy@harmless.hu
Sponsored by: Limelight Networks

6 years agoExport IFCAP_HWSTATS so that we don't experience double stats counting
Sean Bruno [Thu, 10 Aug 2017 03:11:05 +0000 (03:11 +0000)]
Export IFCAP_HWSTATS so that we don't experience double stats counting
on iflib enabled devices.

PR: 220198
Submitted by: Matt Macy <matt@mattmacy.io>
Reported by: Ben Woods <woodsb02@freebsd.org>
Sponsored by: Limelight Networks

6 years agoAdd sbruno@ birthday information.
Sean Bruno [Thu, 10 Aug 2017 02:55:22 +0000 (02:55 +0000)]
Add sbruno@ birthday information.

Reported by: mckusick

6 years agoAdd myself (rlibby) to calendar.freebsd
Ryan Libby [Thu, 10 Aug 2017 02:15:40 +0000 (02:15 +0000)]
Add myself (rlibby) to calendar.freebsd

Reported by: mckusick
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D11947

6 years agoPick 'Remove external linkage for spin_adaptive' from upstream jemalloc
Ryan Libby [Wed, 9 Aug 2017 22:58:42 +0000 (22:58 +0000)]
Pick 'Remove external linkage for spin_adaptive' from upstream jemalloc

Apply the changes from upstream jemalloc 048c6679.  This is actually not
quite a cherry pick due to makefile difference and because FreeBSD does
not carry the msvc project files which were also modified in that
commit.

Approved by: jasone (maintainer), markj (mentor)
Sponsored by: Dell EMC Isilon

6 years agoProvide compile to choose receive processing in either Ithread or Taskqueue Thread.
David C Somayajulu [Wed, 9 Aug 2017 22:18:49 +0000 (22:18 +0000)]
Provide compile to choose receive processing in either Ithread or Taskqueue Thread.

6 years agoAdd myself to calendar.freebsd
Kyle Evans [Wed, 9 Aug 2017 21:44:55 +0000 (21:44 +0000)]
Add myself to calendar.freebsd

Requested by: mckusick
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D11936

6 years agoi386/boot2: -fno-asynchronous-unwind-tables for gcc
Ryan Libby [Wed, 9 Aug 2017 20:13:49 +0000 (20:13 +0000)]
i386/boot2: -fno-asynchronous-unwind-tables for gcc

The amd64 build of boot2 was failing with gcc 6.3.0 due to being more
than 1 kB too large. It was apparently generating a .eh_frame section
which was not being removed by objcopy -S. The .eh_frame section seems
to be mandatory per the amd64 ABI, but boot2 is compiled for i386 (uses
-m32), and therefore should be optional in this context. Suppress
generation of .eh_frame with the -fno-asynchronous-unwind-tables flag to
gcc. This saves 1348 bytes (the limit is 7680 bytes).

Reviewed by: dim, imp
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11928

6 years agoMake user supplied data checks a bit stricter.
Andrey V. Elsukov [Wed, 9 Aug 2017 19:58:38 +0000 (19:58 +0000)]
Make user supplied data checks a bit stricter.

key_msg2sp() is used for parsing data from setsockopt(IP[V6]_IPSEC_POLICY)
call. This socket option is usually used to configure IPsec bypass for
socket. Only privileged user can set this socket option.
The message syntax is described here
http://www.kame.net/newsletter/20021210/

and our libipsec is usually used to create the correct request.
Add additional checks:
* that sadb_x_ipsecrequest_len is not out of bounds of user supplied buffer
* that src/dst's sa_len is the same
* that 2*sa_len is not out of bounds of user supplied buffer
* that 2*sa_len fits into bounds of sadb_x_ipsecrequest

Reported by: Ilja van Sprundel
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11796

6 years agoAdd a dependency on the kernel package for the runtime package.
Glen Barber [Wed, 9 Aug 2017 19:16:54 +0000 (19:16 +0000)]
Add a dependency on the kernel package for the runtime package.

The idea here is that, provided upstream pkg(8) maintainers accept
the proposed change, the kernel.ucl will contain a post-install
script causing pkg(8) to emit a message informing to reboot the
system after the kernel is upgraded using 'pkg upgrade', so the
new userland is installed on the running new kernel.  At present,
this functionality does not exist in pkg(8), but will help ensure
the upgrade path follows that from UPDATING.  To work around this
for now, evaluate ASSUME_ALWAYS_YES, and prompt the user if they
wish to proceed if not set to true.

Since there is a kernel dependency, and a non-GENERIC kernel may
be in use, update Makefile.inc1 to replace '%KERNCONF%' in the
runtime.ucl with the first-built kernel set either via command line
or in make.conf(5).

MFC after: 5 days
Sponsored by: The FreeBSD Foundation

6 years agolldb: Make i386-*-freebsd expression work on JIT path
Ed Maste [Wed, 9 Aug 2017 19:09:23 +0000 (19:09 +0000)]
lldb: Make i386-*-freebsd expression work on JIT path

* Enable i386 ABI creation for freebsd
* Added an extra argument in ABISysV_i386::PrepareTrivialCall for mmap
  syscall
* Unlike linux, the last argument of mmap is actually 64-bit(off_t).
  This requires us to push an additional word for the higher order bits.
* Prior to this change, ktrace dump will show mmap failures due to
  invalid argument coming from the 6th mmap argument.

Submitted by: Karnajit Wangkhem
Differential Revision: https://reviews.llvm.org/D34776

6 years agocat: fix build with -DNO_UDOM_SUPPORT
Ed Maste [Wed, 9 Aug 2017 18:23:46 +0000 (18:23 +0000)]
cat: fix build with -DNO_UDOM_SUPPORT

Sponsored by: The FreeBSD Foundation

6 years agocapsicum_helpers: Add FIODTYPE to default ioctls allowed
Kyle Evans [Wed, 9 Aug 2017 18:15:07 +0000 (18:15 +0000)]
capsicum_helpers: Add FIODTYPE to default ioctls allowed

FIODTYPE will be needed by hexdump(1) to speed up the -s flag on devices
that should be able to support fseek(3); specifically, in an attempt to
correct for the fact that most tape drives don't support seeking yet don't
indicate as such when fseeko(3) is invoked. Related: D10939

Reviewed by: cem, emaste, oshogbo
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D10937

6 years agoSplit identify_cpu() into two functions for amd64 as we do for i386. This
Jung-uk Kim [Wed, 9 Aug 2017 18:09:09 +0000 (18:09 +0000)]
Split identify_cpu() into two functions for amd64 as we do for i386.  This
reduces diff between amd64 and i386.  Also, it fixes a regression introduced
in r322076, i.e., identify_hypervisor() failed to identify some hypervisors.
This function assumes cpu_feature2 is already initialized.

Reported by: dexuan
Tested by: dexuan

6 years agolibusb(3): Expose device caps as libusb_bos_descriptor::dev_capability
Kyle Evans [Wed, 9 Aug 2017 18:06:27 +0000 (18:06 +0000)]
libusb(3): Expose device caps as libusb_bos_descriptor::dev_capability

Some libusb consumers in Linux-land (in this case, libusb4java) expect a
dev_capability member that they can use to enumerate the device
capabilities.

No particular layout is expected of this, just that it can be traversed
using the bLength member until bNumDeviceCapabilities are read and that the
consumer may then use one of the libusb_get_*_descriptor methods to extract
specific (usb 2.0 vs. ss) capability information.

In collaboration with: hselasky
Reviewed by: hselasky
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D11494

6 years agoPlug uninitialized stack variable leak in sendfile(2).
Gleb Smirnoff [Wed, 9 Aug 2017 17:48:38 +0000 (17:48 +0000)]
Plug uninitialized stack variable leak in sendfile(2).

Reported by: Ilja Van Sprundel <ivansprundel ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa gmail.com>
MFC after: 1 week
Security: uninitialized stack variable leak

6 years agoUpgrade our copies of clang, llvm and libc++ to r310316 from the
Dimitry Andric [Wed, 9 Aug 2017 17:32:39 +0000 (17:32 +0000)]
Upgrade our copies of clang, llvm and libc++ to r310316 from the
upstream release_50 branch.

MFC after: 2 months
X-MFC-with: r321369

6 years agoAlso provide a warning for geom_fox.
Warner Losh [Wed, 9 Aug 2017 16:37:37 +0000 (16:37 +0000)]
Also provide a warning for geom_fox.

Differential Review: https://reviews.freebsd.org/D11935
Requested by: jhb@
MFC After: 3 days

6 years agoMark geom classes as deprecated.
Warner Losh [Wed, 9 Aug 2017 16:15:24 +0000 (16:15 +0000)]
Mark geom classes as deprecated.

geom_bsd, geom_mbr and geom_sunlabel have been obsolete since Marcel
Moolenaar's geom_part was in FreeBSD 7. They haven't been in GENERIC
since FreeBSD 8. Add warning when used.

geom_vol_ffs has been obsolete since ufs support to geom_label was
committed in FreeBSD 5. It hasn't been in GENERIC since FreeBSD 5.
Add warning when used.

geom_fox has been obsolete since gmultipath was committed in FreeBSD 7.
(no warning added, since this is a very obscure class).

These will all be removed in FreeBSD 12.

MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D11935

Note: Classes will be removed after MFC

6 years agoMissing remanant of 322309.
Alexander Motin [Wed, 9 Aug 2017 13:46:16 +0000 (13:46 +0000)]
Missing remanant of 322309.

MFC after: 1 week

6 years agoAdd birthday information for jonathan@.
Jonathan Anderson [Wed, 9 Aug 2017 13:25:27 +0000 (13:25 +0000)]
Add birthday information for jonathan@.

As requested by mckusick@...

6 years agoAdd to if_enc(4) ability to capture packets via BPF after pfil processing.
Andrey V. Elsukov [Wed, 9 Aug 2017 12:24:07 +0000 (12:24 +0000)]
Add to if_enc(4) ability to capture packets via BPF after pfil processing.

New flag 0x4 can be configured in net.enc.[in|out].ipsec_bpf_mask.
When it is set, if_enc(4) additionally captures a packet via BPF after
invoking pfil hook. This may be useful for debugging.

MFC after: 2 weeks
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D11804