]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoAvoid holding the process in uread() and uwrite().
Mark Johnston [Thu, 16 Nov 2017 07:25:12 +0000 (07:25 +0000)]
Avoid holding the process in uread() and uwrite().

In general, higher-level code will atomically verify that the process
is not exiting and hold the process. In one case, we were using uwrite()
to copy a probed instruction to a per-thread scratch space block, but
copyout() can be used for this purpose instead; this change effectively
reverts r227291.

MFC after: 1 week

6 years agoTake r313504 into account when recomputing the string table length.
Mark Johnston [Thu, 16 Nov 2017 07:14:29 +0000 (07:14 +0000)]
Take r313504 into account when recomputing the string table length.

When we encounter a USDT probe in a weak symbol, we emit an alias for
the probe function symbol. Such aliases are named differently from the
aliases we emit for probes in local functions, so make sure to take that
difference into account when resizing the output object file's string
table. Otherwise, we underrun the string table buffer.

PR: 223680

6 years agocxgbe(4): Remove rsrv_noflowq from intrs_and_queues structure as it does
Navdeep Parhar [Thu, 16 Nov 2017 02:42:37 +0000 (02:42 +0000)]
cxgbe(4): Remove rsrv_noflowq from intrs_and_queues structure as it does
not influence or get affected by the number of interrupts or queues.

Sponsored by: Chelsio Communications

6 years agocxgbe(4): Sanitize t4_num_vis during MOD_LOAD like all other t4_*
Navdeep Parhar [Thu, 16 Nov 2017 01:33:53 +0000 (01:33 +0000)]
cxgbe(4): Sanitize t4_num_vis during MOD_LOAD like all other t4_*
tunables.  Add num_vis to the intrs_and_queues structure as it affects
the number of interrupts requested and queues created.  In future
cfg_itype_and_nqueues might lower it incrementally instead of going
straight to 1 when enough interrupts aren't available.

Sponsored by: Chelsio Communications

6 years agoUse better wording: change there to the and define to defines.
Warner Losh [Thu, 16 Nov 2017 00:19:44 +0000 (00:19 +0000)]
Use better wording: change there to the and define to defines.
Also fix a run-a-way macro invocation of Dv.

Noticed by: matteo@

6 years agoFix some formatting issues, bump .Dd to today's date, don't use
Warner Losh [Wed, 15 Nov 2017 23:51:17 +0000 (23:51 +0000)]
Fix some formatting issues, bump .Dd to today's date, don't use
contractions, and make igor almost happy with this (two issues are
false positives, and I'm not sure a synopsis makes sense).

Sponsored by: Netflix

6 years agocxgbe(4): Combine all _10g and _1g tunables and drop the suffix from
Navdeep Parhar [Wed, 15 Nov 2017 23:48:02 +0000 (23:48 +0000)]
cxgbe(4):  Combine all _10g and _1g tunables and drop the suffix from
their names.  The finer-grained knobs weren't practically useful.

Sponsored by: Chelsio Communications

6 years agoipsec: Use the same keysize values for HMAC as prior to r324017
Conrad Meyer [Wed, 15 Nov 2017 22:42:20 +0000 (22:42 +0000)]
ipsec: Use the same keysize values for HMAC as prior to r324017

The HMAC construction natively permits any key size between 0 and the input
block length. Before r324017, the auth_hash 'keysize' member was the hash
output length, which was used by ipsec for key sizes. (Non-ipsec consumers
need the ability to use other keysizes, hence, r324017.)

The ipsec SADB code blindly uses the auth_hash 'keysize' member for both
minimum and maximum key size, which is wrong (from an HMAC perspective).
For now, just switch it to 'hashsize', which matches the existing
expectations.

Instead it should probably use the range [0, keysize]. But there may be
other broken code in ipsec that rejects hashes with too small a minimum
key size.

Reported by: olivier@
Reviewed by: olivier, no objection from ae
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12770

6 years agoProperly bzero kldstat structure to prevent kernel information leak.
Gordon Tetlow [Wed, 15 Nov 2017 22:30:21 +0000 (22:30 +0000)]
Properly bzero kldstat structure to prevent kernel information leak.

Submitted by: kib
Reported by: TJ Corley
Security: CVE-2017-1088

6 years agoFix the handling of ERROR chunks which a lot of error causes.
Michael Tuexen [Wed, 15 Nov 2017 22:13:10 +0000 (22:13 +0000)]
Fix the handling of ERROR chunks which a lot of error causes.
While there, clean up the code.
Thanks to Felix Weinrank who found the bug by using fuzz-testing
the SCTP userland stack.

MFC after: 1 week

6 years agoOnly copy /etc/resolv.conf to ${CHROOTDIR} if /etc/resolv.conf does
Glen Barber [Wed, 15 Nov 2017 19:14:44 +0000 (19:14 +0000)]
Only copy /etc/resolv.conf to ${CHROOTDIR} if /etc/resolv.conf does
not already exist within ${CHROOTDIR}.  This allows re-using a build
chroot with CHROOTBUILD_SKIP set to a non-empty value and CHROOTDIR
set to '/' in release.conf.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agorelease: Update u-boot and firmware file for RPI2 target
Emmanuel Vadot [Wed, 15 Nov 2017 19:04:23 +0000 (19:04 +0000)]
release: Update u-boot and firmware file for RPI2 target

The u-boot port for RPI-2 was updated to use u-boot-master, this cause
an update in u-boot version to v2017.09 and changing the filename.
The various firmware files for the RPI* are now in a common ports
sysutils/rpi-firmware as they are shared on all the RPI version.

Update the release files to copy the right files from the right location.

Reviewed by: gjb
MFC after: 3 days

6 years agorelease: Update u-boot and firmware file for RPI-B target
Emmanuel Vadot [Wed, 15 Nov 2017 19:03:06 +0000 (19:03 +0000)]
release: Update u-boot and firmware file for RPI-B target

THe u-boot port for RPI-B was updated to use u-boot-master, this cause
an update in u-boot version to v2017.09 and changing the filename.
The various firmware files for the RPI* are now in a common ports
sysutils/rpi-firmware as they are shared on all the RPI version.

Update the release files to copy the right files from the right location.

Reviewed by: gjb
MFC after: 3 days

6 years agonewfs: warn if newer than kernel
Ed Maste [Wed, 15 Nov 2017 18:40:40 +0000 (18:40 +0000)]
newfs: warn if newer than kernel

Creating a UFS filesystem with a newfs newer than the running kernel,
and then mounting that filesystem, can lead to interesting failures.

Add a safety belt to explicitly warn when newfs is newer than the
running kernel.

Reviewed by: gjb, jhb, mckusick
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12765

6 years agoSort pkgbase mtree metadata, for reproducible builds
Ed Maste [Wed, 15 Nov 2017 18:03:31 +0000 (18:03 +0000)]
Sort pkgbase mtree metadata, for reproducible builds

Packaged base packages are created by running the stageworld and
stagekernel targets with -DNO_ROOT, and converting the resulting mtree
file into a set of pkg plists.  If stage* is run with multiple processes
the order of entries in the mtree file may be nondeterministic, and the
resulting package tbz also had nondeterministic file ordering.

The mtree file generated by -DNO_ROOT builds consists of one line per
file, with the filename starting in the first column, so is easily
sorted.  There's one exception: the first line of the mtree file is a
comment, but the # character sorts before the filenames anyhow and needs
no special treatment.

PR: 223673
Reviewed by: bapt, gjb
Sponsored by: The Linux Foundation, Core Infrastructure Initiative
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13103

6 years agoRemove a double free(9) in xpt_bus_register
Alan Somers [Wed, 15 Nov 2017 15:52:06 +0000 (15:52 +0000)]
Remove a double free(9) in xpt_bus_register

In xpt_bus_register(), remove superfluous call to free().  This was mostly
benign since free(9) checks for NULL before doing anything, and
xpt_create_path() is nice enough to NULL out the pointer on failure.
However, it could've segfaulted if malloc(9) failed during
xpt_create_path().

Submitted by: gibbs
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoReplace Fx's with 'the' since expanding FreeBSD here didn't seem quite
Warner Losh [Wed, 15 Nov 2017 15:02:45 +0000 (15:02 +0000)]
Replace Fx's with 'the' since expanding FreeBSD here didn't seem quite
right.

Sponsored by: Netflix

6 years agoReword a bit for clarity.
Warner Losh [Wed, 15 Nov 2017 15:00:02 +0000 (15:00 +0000)]
Reword a bit for clarity.

Sponsored by: Netflix

6 years agovmtotal: extend memory counters to accomodate for current and future
Konstantin Belousov [Wed, 15 Nov 2017 13:41:03 +0000 (13:41 +0000)]
vmtotal: extend memory counters to accomodate for current and future
hardware sizes.

32bit counters already overflow on approachable virtual memory page
counts, and soon would overflow on the physical pages counts as well.
Bump sizes to 64bit types.  Bump __FreeBSD_version.

It is impossible to provide perfect backward ABI compat for this
change.  If a program requests an old structure, it can be detected by
size.  But if it queries the size first by passing NULL old req
pointer, there is almost nothing we can do to detect the desired ABI.
As a partial solution, check p_osrel of the quering process when
selecting the size to report.

Submitted by: Pawel Biernacki <pawel.biernacki@gmail.com>
Differential revision: https://reviews.freebsd.org/D13018

6 years agoremove the poor emulation of the IllumOS needfree global variable to prevent
Baptiste Daroussin [Wed, 15 Nov 2017 12:48:36 +0000 (12:48 +0000)]
remove the poor emulation of the IllumOS needfree global variable to prevent
the ARC reclaim thread running longer than needed.

Update the arc::needfree dtrace probe triggered in arc_lowmem() to also report
the value we may want to free.

Submitted by: Nikita Kozlov <nikita.kozlov at blade-group.com>
Reviewed by: avg
Approved by: avg
MFC after: 3 weeks
Sponsored by: blade
Differential Revision: https://reviews.freebsd.org/D12163

6 years agopfctl: teach route-to to deal with interfaces with multiple addresses
Kristof Provost [Wed, 15 Nov 2017 12:27:02 +0000 (12:27 +0000)]
pfctl: teach route-to to deal with interfaces with multiple addresses

The route_host parsing code set the interface name, but only for the first
node_host in the list. If that one happened to be the inet6 address and the
rule wanted an inet address it'd get removed by remove_invalid_hosts() later
on, and we'd have no interface name.

We must set the interface name for all node_host entries in the list, not just
the first one.

PR: 223208
MFC after: 2 weeks

6 years agoUpdate the mlx4 core and mlx4en(4) modules towards Linux v4.9.
Hans Petter Selasky [Wed, 15 Nov 2017 11:14:39 +0000 (11:14 +0000)]
Update the mlx4 core and mlx4en(4) modules towards Linux v4.9.

Background:
The coming ibcore update forces an update of mlx4ib(4) which in turn requires
an updated mlx4 core module. This also affects the mlx4en(4) module because
commonly used APIs are updated. This commit is a middle step updating the
mlx4 modules towards the new ibcore.

This change contains no major new features.

Changes in mlx4:
  a) Improved error handling when mlx4 PCI devices are
  detached inside VMs.
  b) Major update of codebase towards Linux 4.9.

Changes in mlx4ib(4):
  a) Minimal changes needed in order to compile using the
  updated mlx4 core APIs.

Changes in mlx4en(4):
  a) Update flow steering code in mlx4en to use new APIs for
  registering MAC addresses and IP addresses.
  b) Update all statistics counters to be 64-bit.
  c) Minimal changes needed in order to compile using the
  updated mlx4 core APIs.

Sponsored by: Mellanox Technologies
MFC after: 1 week

6 years agoCXGBE: fix big-endian behaviour
Wojciech Macek [Wed, 15 Nov 2017 06:45:33 +0000 (06:45 +0000)]
CXGBE: fix big-endian behaviour

The setbit/clearbit pair casts the bitfield pointer
to uint8_t* which effectively treats its contents as
little-endian variable. The ffs() function accepts int as
the parameter, which is big-endian. Use uint8_t here to
avoid mismatch, as we have only 4 doorbells.

Submitted by:          Wojciech Macek <wma@freebsd.org>
Reviewed by:           np
Obtained from:         Semihalf
Sponsored by:          QCM Technologies
Differential revision: https://reviews.freebsd.org/D13084

6 years agoFix SYSDIR path. After the move, we need to chop off a couple ../ from
Warner Losh [Wed, 15 Nov 2017 03:46:59 +0000 (03:46 +0000)]
Fix SYSDIR path. After the move, we need to chop off a couple ../ from
the prior definition. But a safer definition is SRCTOP/sys, so use
that.

Sponsored by: Netflix

6 years agoInline pcie_link_{status,caps} where needed. Remove them as they
Warner Losh [Wed, 15 Nov 2017 02:24:47 +0000 (02:24 +0000)]
Inline pcie_link_{status,caps} where needed. Remove them as they
aren't really needed and I don't want to document them.

Suggested by: jhb@
Sponsored by: Netflix

6 years agoAdd note about where to use MACHINE (just src/stand and src/sys and a
Warner Losh [Wed, 15 Nov 2017 00:06:18 +0000 (00:06 +0000)]
Add note about where to use MACHINE (just src/stand and src/sys and a
few others). Add note aboute MACHINE_CPUARCH.

Sponsored by: Netflix

6 years agoUse #if instead of #ifdef for __BSD_VISIBLE tests.
John Baldwin [Tue, 14 Nov 2017 23:50:30 +0000 (23:50 +0000)]
Use #if instead of #ifdef for __BSD_VISIBLE tests.

__BSD_VISIBLE is always defined and it's value instead needs to be
tested via #if to determine if FreeBSD-specific APIs should be
exposed.

PR: 196226, 223481 (exp-run)
Submitted by: pluknet
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12977

6 years agoMove sys/boot to stand. Fix all references to new location
Warner Losh [Tue, 14 Nov 2017 23:02:19 +0000 (23:02 +0000)]
Move sys/boot to stand. Fix all references to new location

Sponsored by: Netflix

6 years agoAdd fortune datfiles that are no longer distributed.
Benno Rice [Tue, 14 Nov 2017 21:31:30 +0000 (21:31 +0000)]
Add fortune datfiles that are no longer distributed.

MFC after: 2 days

6 years agoRemove all fortune datfiles except freebsd-tips.
Benno Rice [Tue, 14 Nov 2017 21:18:30 +0000 (21:18 +0000)]
Remove all fortune datfiles except freebsd-tips.

Humour is a funny thing. What is funny to one person is not funny to all
people. What is insightful to one person is similarly not universal. The
fortune datfiles have been around a long time and have undoubtedly amused
people but it's time to acknowledge their subjective, and in some cases
at least potentially offensive, nature and stop distributing them with the
imprimatur of the FreeBSD project.

If anyone wishes to distribute these via other mechanisms they are welcome to
check them out of history and do so.

MFC after: 2 days

6 years agoFix build on arm after r325817
Alan Somers [Tue, 14 Nov 2017 21:11:55 +0000 (21:11 +0000)]
Fix build on arm after r325817

Reported by: rpokala
MFC after: 3 weeks
X-MFC-With: 325817
Sponsored by: Spectra Logic Corp

6 years agoMove sys/boot/fdt/dts to sys/dts and adjust scripts.
Warner Losh [Tue, 14 Nov 2017 21:03:57 +0000 (21:03 +0000)]
Move sys/boot/fdt/dts to sys/dts and adjust scripts.

Sponsored by: Netflix

6 years agodisallow clock_settime too far in the future to avoid panic
Ed Maste [Tue, 14 Nov 2017 18:18:18 +0000 (18:18 +0000)]
disallow clock_settime too far in the future to avoid panic

clock_ts_to_ct has a KASSERT that the converted year fits into four
digits.  By default (sysctl debug.allow_insane_settime is 0) the kernel
disallows a time too far in the future, using a value of 9999 366-day
years.  However, clock_settime is epoch-relative and the assertion will
fail with a tv_sec corresponding to some 8030 years.

Avoid trying to be too clever, and just use a limit of 8000 365-day
years past the epoch.

Submitted by: Heqing Yan <scottieyan@gmail.com>
Reported by: Syzkaller (https://github.com/google/syzkaller)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoAIO tests: increase limits
Alan Somers [Tue, 14 Nov 2017 17:46:37 +0000 (17:46 +0000)]
AIO tests: increase limits

tests/sys/aio/aio_kqueue_test.c
Instead of using a hard-coded queue depth, use
vfs.aio.max_aio_queue_per_proc

tests/sys/aio/lio_kqueue_test.c
The old, small limit on lio_listio's operation count was lifted by
change 324941.  Raise the operation count as high as possible without
exceeding the process's operation limit.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoAppease old GCC by disabling .cfi_sections for GCC 4.x.
John Baldwin [Tue, 14 Nov 2017 17:16:03 +0000 (17:16 +0000)]
Appease old GCC by disabling .cfi_sections for GCC 4.x.

6 years agoUnbreak IPv6.
Bjoern A. Zeeb [Tue, 14 Nov 2017 16:47:05 +0000 (16:47 +0000)]
Unbreak IPv6.

No longer return ENXIO when trying to send an IPv6 packet in
nicvf_sq_add_hdr_subdesc().
Restructure the code so that the upper layer protocol parts are
agnostic of the L3 protocol (and no longer specific to IPv4).
With this basic IPv6 packets go through.  We are still seeing
weird behaviour which needs further diagnosis.

PR: 223669
In collaboration with: emaste
MFC after: 3 days

6 years agodevd.conf: add mps and mpr to the scsi controllers regex
Alan Somers [Tue, 14 Nov 2017 16:32:40 +0000 (16:32 +0000)]
devd.conf: add mps and mpr to the scsi controllers regex

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12744

6 years agovnic: report that the driver supports multicast
Ed Maste [Tue, 14 Nov 2017 16:31:11 +0000 (16:31 +0000)]
vnic: report that the driver supports multicast

The driver is currently hardcoded to force promiscuous mode, so all of
the MAC filtering code is presently unused and multicast should "just
work."  Report to the higher layers that multicast is supported.

PR: 223573
Reported by: bz
Sponsored by: The FreeBSD Foundation, Packet.net (hardware)

6 years agoMake sure the ib_wr_opcode enum is signed by adding a negative dummy element.
Hans Petter Selasky [Tue, 14 Nov 2017 14:51:37 +0000 (14:51 +0000)]
Make sure the ib_wr_opcode enum is signed by adding a negative dummy element.
Different compilers may optimise the enum type in different ways. This ensures
coherency when range checking the value of enums in ibcore.

Sponsored by: Mellanox Technologies
MFC after: 1 week

6 years agoMake sure a valid VNET is set before trying to access the V_ip6_v6only
Hans Petter Selasky [Tue, 14 Nov 2017 14:43:35 +0000 (14:43 +0000)]
Make sure a valid VNET is set before trying to access the V_ip6_v6only
variable. Access the variable directly instead of going through the sysctl()
interface in the kernel.

Sponsored by: Mellanox Technologies
MFC after: 1 week

6 years agoSet the default VNET in krping before calling ifunit_ref(). Else using IPv6
Hans Petter Selasky [Tue, 14 Nov 2017 14:39:37 +0000 (14:39 +0000)]
Set the default VNET in krping before calling ifunit_ref(). Else using IPv6
link-local addresses when VIMAGE is enabled will cause a so-called NULL
pointer dereferencing issue.

Sponsored by: Mellanox Technologies
MFC after: 1 week

6 years agoCorrect the path to the md(4)-backed UFS filesystem for pine64
Glen Barber [Tue, 14 Nov 2017 14:31:02 +0000 (14:31 +0000)]
Correct the path to the md(4)-backed UFS filesystem for pine64
images.

Boot-tested by: lidl
Sponsored by: The FreeBSD Foundation

6 years agoAdd a -r option to print the running kernel version.
Dag-Erling Smørgrav [Tue, 14 Nov 2017 10:15:17 +0000 (10:15 +0000)]
Add a -r option to print the running kernel version.

MFC after: 1 week

6 years agoProperly decode NVMe state of the drive and print out the information
Warner Losh [Tue, 14 Nov 2017 05:05:26 +0000 (05:05 +0000)]
Properly decode NVMe state of the drive and print out the information
in the attach to more closely match what SCSI and ATA attached
storage provides.

Sponsored by: Netflix

6 years agoBelatedly add opt_nvme.h to fix building nvme.ko outside of a kernel
Warner Losh [Tue, 14 Nov 2017 05:05:21 +0000 (05:05 +0000)]
Belatedly add opt_nvme.h to fix building nvme.ko outside of a kernel
build.

Sponsored by: Netflix

6 years agoProvide link speed data in XPT_GET_TRAN_SETTINGS. Provide full version
Warner Losh [Tue, 14 Nov 2017 05:05:16 +0000 (05:05 +0000)]
Provide link speed data in XPT_GET_TRAN_SETTINGS. Provide full version
information for that and XPT_PATH_INQ. Provide macros to encode/decode
major/minor versions.  Read the link speed and lane count to compute
the base_transfer_speed for XPT_PATH_INQ.

Sponsored by: Netflix

6 years agoProvide pcie_link_status and pcie_link_cap convenience functions.
Warner Losh [Tue, 14 Nov 2017 05:05:05 +0000 (05:05 +0000)]
Provide pcie_link_status and pcie_link_cap convenience functions.

Sponsored by: Netflix

6 years agoMove zstd from contrib to sys/contrib so it can be used in the
Warner Losh [Tue, 14 Nov 2017 05:03:38 +0000 (05:03 +0000)]
Move zstd from contrib to sys/contrib so it can be used in the
kernel. Adjust the Makefiles that referenced it to the new path.

Sponsored by: Netflix
OK'd by: cem@ and AllanJude@

6 years agoExpand the Freescale PCIe root complex driver with the ofw_pcib_pci
Justin Hibbits [Tue, 14 Nov 2017 03:53:15 +0000 (03:53 +0000)]
Expand the Freescale PCIe root complex driver with the ofw_pcib_pci

The interrupt map wasn't being allocated properly, preventing IRQs from being
allocated to children of the PCIe bus.  Fix this by cloning the ofw_pcib_pci
code, which handles all cases -- device tree and probed.

In the future this may become a subclass of the ofw_pcib_pci driver, but as
that's not an exported class, it's cloned for now.

MFC after: 3 weeks

6 years agoConvert BERI to use ofw_parse_bootargs()
Justin Hibbits [Tue, 14 Nov 2017 03:23:46 +0000 (03:23 +0000)]
Convert BERI to use ofw_parse_bootargs()

Summary:
ofw_parse_bootargs() was added in r306065 as an attempt to unify the
various copies of the same code.  This simply migrates BERI to use it.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D12962

6 years agoUse the correct board name for the Ubiquiti Unifi Security Gateway
Justin Hibbits [Tue, 14 Nov 2017 03:21:39 +0000 (03:21 +0000)]
Use the correct board name for the Ubiquiti Unifi Security Gateway

6 years agoSimply the code and use the full buffer for contigous chunk representation.
Michael Tuexen [Tue, 14 Nov 2017 02:30:21 +0000 (02:30 +0000)]
Simply the code and use the full buffer for contigous chunk representation.

MFC after: 1 week

6 years agoAdd TP-LINK UE300.
Kevin Lo [Tue, 14 Nov 2017 01:57:54 +0000 (01:57 +0000)]
Add TP-LINK UE300.

Submitted by: Kris G <netsick@gmail.com>

6 years agoRemove an unused variable.
Brad Davis [Tue, 14 Nov 2017 01:48:24 +0000 (01:48 +0000)]
Remove an unused variable.

Approved by: bdrewery

6 years agoAdd two new tunables / sysctls to controll reboot after panic:
Warner Losh [Tue, 14 Nov 2017 00:29:14 +0000 (00:29 +0000)]
Add two new tunables / sysctls to controll reboot after panic:

kern.poweroff_on_panic which, when enabled, instructs a system to
power off on a panic instead of a reboot.

kern.powercyle_on_panic which, when enabled, instructs a system to
power cycle, if possible, on a panic instead of a reboot.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13042

6 years agoStyle r320614: don't initialize at declaration, new line after declarations,
Gleb Smirnoff [Mon, 13 Nov 2017 22:16:47 +0000 (22:16 +0000)]
Style r320614: don't initialize at declaration, new line after declarations,
shorten variable name to avoid extra long lines.
No functional changes.

6 years agoRemove fortune quotes attributed to or providing admiration of Adolf Hitler
Mark Felder [Mon, 13 Nov 2017 21:55:34 +0000 (21:55 +0000)]
Remove fortune quotes attributed to or providing admiration of Adolf Hitler

MFC after: 1 week

6 years agoDon't add /boot/dt*s* but /boot/dt*b*. Stupid think-o. /boot/dtb was
Warner Losh [Mon, 13 Nov 2017 21:25:57 +0000 (21:25 +0000)]
Don't add /boot/dt*s* but /boot/dt*b*. Stupid think-o. /boot/dtb was
what was tested...

6 years agoAdd /boot/dts to the list of default modules. The minimal arm and mips
Warner Losh [Mon, 13 Nov 2017 21:23:26 +0000 (21:23 +0000)]
Add /boot/dts to the list of default modules. The minimal arm and mips
loader.conf for uboot have this in the list, but the default one
didn't. Since there's no harm and it's a failsafe, add it to the list.

Sponsored by: Netflix

6 years agoMove loop to clear TDB_SUSPEND into PT_DETACH case.
John Baldwin [Mon, 13 Nov 2017 21:22:33 +0000 (21:22 +0000)]
Move loop to clear TDB_SUSPEND into PT_DETACH case.

The PT_DETACH case above the sendsig: label already looped over all
threads clearing flags in td_dbgflags.  Reuse this loop to clear
TDB_SUSPEND and move the logic out of the sendsig: block.

6 years agoPull the PT_ATTACH case out of the 'sendsig:' block.
John Baldwin [Mon, 13 Nov 2017 21:09:08 +0000 (21:09 +0000)]
Pull the PT_ATTACH case out of the 'sendsig:' block.

Most of the conditionals in the 'sendsig:' block are now only different
for PT_ATTACH vs other continue requests.  Pull the PT_ATTACH-specific
logic up into the PT_ATTACH case and simplify the 'sendsig:' block.  This
also permits moving the unlock of proctree_lock above the sendsig: label
since PT_KILL doesn't hold the lock and and the other cases all fall
through to the label.

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

6 years agoRework r325568 so all 'make LINT' targets work.
Bryan Drewery [Mon, 13 Nov 2017 20:49:08 +0000 (20:49 +0000)]
Rework r325568 so all 'make LINT' targets work.

Reported by: ngie
Sponsored by: Dell EMC Isilon

6 years agoAdd loader.conf to the list of files that are MD.
Warner Losh [Mon, 13 Nov 2017 20:39:43 +0000 (20:39 +0000)]
Add loader.conf to the list of files that are MD.

loader.conf is also different between machines. On arm it's a minimal
one that's not quite compatible with the default one. On arm it's
minimal for speed, which is good, but there's also extra things in it
relative to the default on which break loading FDT which is bad. This
doesn't address that issue, but instead ensures the minimal one for
arm is used.

A similar issue for mips exists, but since we can have a beri variant
of /boot/loader and a uboot variant, I'm leaving that mess alone for
the moment.

Sponsored by: Netflix

6 years agoOnly build the libmagic build-tools if MK_FILE != no
Alex Richardson [Mon, 13 Nov 2017 20:07:08 +0000 (20:07 +0000)]
Only build the libmagic build-tools if MK_FILE != no

Before this patch libmagic was always built in the build-tools phase
even if -DWITHOUT_FILE was specified.

Reviewed by: emaste, jhb
Approved by: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D12925

6 years agoOnly clear a pending thread event if one is pending.
John Baldwin [Mon, 13 Nov 2017 19:58:58 +0000 (19:58 +0000)]
Only clear a pending thread event if one is pending.

This fixes a panic when attaching to an already-stopped process after
r325028.  While here, clean up a few other things in the control flow
of the 'sendsig' section:
- Only check for P_STOPPED_TRACE rather than either of P_STOPPED_SIG
  or P_STOPPED_TRACE for most ptrace requests.  The signal handling
  code in kern_sig.c never sets just P_STOPPED_SIG for a traced
  process, so if P_STOPPED_SIG is stopped, P_STOPPED_TRACE should be
  set anyway.  Remove a related debug printf.  Assuming P_STOPPED_TRACE
  permits simplifications in the 'sendsig:' block.
- Move the block to clear the pending thread state up into a new
  block conditional on P_STOPPED_TRACE and handle delivering pending
  signals to the reporting thread and clearing the reporting thread's
  state in this block.
- Consolidate case to send a signal to the process in a single case
  for PT_ATTACH.  The only case that could have been in the else before
  was a PT_ATTACH where P_STOPPED_SIG was not set, so both instances
  of kern_psignal() collapse down to just PT_ATTACH.

Reported by: pho, mmel
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D12837

6 years agoRemove -fuse-ld= when creating _LDFLAGS from LDFLAGS
Alex Richardson [Mon, 13 Nov 2017 19:44:33 +0000 (19:44 +0000)]
Remove -fuse-ld= when creating _LDFLAGS from LDFLAGS

The -fuse-ld flag is only meant to be passed to the compiler driver so
direct linker invocations should not include it.

Reviewed by: emaste, jhb
Approved by: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D12910

6 years agoUpdate the GUMSTIX image build to use arm/arm TARGET/TARGET_ARCH.
Glen Barber [Mon, 13 Nov 2017 19:31:51 +0000 (19:31 +0000)]
Update the GUMSTIX image build to use arm/arm TARGET/TARGET_ARCH.
Update the TARGET/TARGET_ARCH matching in release/release.sh and
release/Makefile.mirrors for simplification.

Discussed with: mmel
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoarm: rpi2: Fix cpufreq(4)
Emmanuel Vadot [Mon, 13 Nov 2017 18:53:41 +0000 (18:53 +0000)]
arm: rpi2: Fix cpufreq(4)

Since r324184 the root node compatible for rpi2 is "brcm,bcm2836", add
it to the compatible list of bcm2835_cpufreq.

Tested On: RPI2 v1.1 RPI2 v1.2

Reported by: many on freebsd-arm@

6 years agoProperly handle the case where the linux_cdev_handle_insert() function
Hans Petter Selasky [Mon, 13 Nov 2017 18:16:26 +0000 (18:16 +0000)]
Properly handle the case where the linux_cdev_handle_insert() function
in the LinuxKPI returns NULL. This happens when the VM area's private
data handle already exists and could cause a so-called NULL pointer
dereferencing issue prior to this fix.

Found by: greg@unrelenting.technology
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoFix formatting of _umtx_op(2)
Eric van Gyzen [Mon, 13 Nov 2017 17:46:38 +0000 (17:46 +0000)]
Fix formatting of _umtx_op(2)

Do not use macros in the -width of a .Bl, since mandoc does not support them.

Fix issues reported by igor and mandoc -Tlint.

Use a .Bl for list of clock IDs instead of a comma list.

MFC after: 3 days
Sponsored by: Dell EMC

6 years agoAdd notes about overlapping copies.
Warner Losh [Mon, 13 Nov 2017 17:04:44 +0000 (17:04 +0000)]
Add notes about overlapping copies.

Add notes to each of these that specifically state that results are
undefined if the strings overlap. In the case of memcpy, we document
the overlapping behavior on FreeBSD (pre-existing). For str*, it is
left unspecified, however, since the default (and x86) implementations
do not handle overlapping strings properly.

PR: 223653
Sponsored by: Netflix

6 years agoAdd __BEGIN_DECLS and __END_DECLS to <sys/umtx.h>
Eric van Gyzen [Mon, 13 Nov 2017 16:53:36 +0000 (16:53 +0000)]
Add __BEGIN_DECLS and __END_DECLS to <sys/umtx.h>

This allows C++ programs to call _umtx_op().

MFC after: 3 days
Sponsored by: Dell EMC

6 years agoDo not leak PMC_PO_OWNS_LOGFILE on error.
Konstantin Belousov [Mon, 13 Nov 2017 10:45:31 +0000 (10:45 +0000)]
Do not leak PMC_PO_OWNS_LOGFILE on error.

Note that PMCLOG_RESERVE_WITH_ERROR() macro contains goto error;
statement and executed after the flag is set.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoStyle bug.
Konstantin Belousov [Mon, 13 Nov 2017 10:43:31 +0000 (10:43 +0000)]
Style bug.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoBe more careful when doing calculation with request from userland.
Xin LI [Mon, 13 Nov 2017 07:47:43 +0000 (07:47 +0000)]
Be more careful when doing calculation with request from userland.

MFC after: 2 weeks

6 years agoDocument MACHINE, MACHINE_ARCH, CPUTYPE, TARGET and TARGET_ARCH
Warner Losh [Mon, 13 Nov 2017 00:32:44 +0000 (00:32 +0000)]
Document MACHINE, MACHINE_ARCH, CPUTYPE, TARGET and TARGET_ARCH
historical use and general philosphy.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12981

6 years agoUse proper include file. While <boot/userboot/userboot.h> works, it
Warner Losh [Mon, 13 Nov 2017 00:30:38 +0000 (00:30 +0000)]
Use proper include file. While <boot/userboot/userboot.h> works, it
only works because we have -Isys on the command line. We also have
-Isys/boot/userboot on the command line, so bring it in directly with
<userboot.h>. No functional change, but it removes one hard to see
dependency on the boot loader's location in sys/boot.

Sponsored by: Netflix

6 years agoAdd Intel Processor Trace (PT) MSRs.
Ruslan Bukin [Sun, 12 Nov 2017 23:13:04 +0000 (23:13 +0000)]
Add Intel Processor Trace (PT) MSRs.

Sponsored by: DARPA, AFRL

6 years agoCleanup the handling of control chunks. While there fix some minor
Michael Tuexen [Sun, 12 Nov 2017 21:43:33 +0000 (21:43 +0000)]
Cleanup the handling of control chunks. While there fix some minor
bug related to clearing the assoc retransmit counter and the dup TSN
handling of NR-SACK chunks.

MFC after: 3 days

6 years agoboot1: also check for NULL device
Ed Maste [Sun, 12 Nov 2017 17:15:54 +0000 (17:15 +0000)]
boot1: also check for NULL device

r325681 fixed a NULL pointer dereference on RPi3 caused by a lack of
functionality in uboot's EFI implementation.  That rev checked the boot1
load path for NULL but not the load device.  In practice if the former
works the latter will as well, but improve correctness by checking each
separately.

Submitted by: Keith White <kwhite@eecs.uottawa.ca>
Reported by: jhb
MFC after: 5 days
MFC with: r325681
Sponsored by: The FreeBSD Foundation

6 years agoMake sure the proper loader.rc gets installed.
Warner Losh [Sun, 12 Nov 2017 17:10:57 +0000 (17:10 +0000)]
Make sure the proper loader.rc gets installed.

There were two things wrong. First, the wrong path was listed in .PATH
statement. Second, BOOTSRC wasn't yet defined for the .PATH, so it
didn't properly add it. Third, even if these were right, . was in the
path before, so it wouldn't have worked. Replace this with a simple
loop so the proper loader.rc gets selected.

Noticed by: dhw@ (menus stopped working on boot)
Sponsored by: Netflix

6 years agoStop installing eqnchar which has been removed
Baptiste Daroussin [Sun, 12 Nov 2017 09:42:42 +0000 (09:42 +0000)]
Stop installing eqnchar which has been removed

Pointyhat to: bapt

6 years agodhclient(8) should not close stdio using daemon(3) function.
Mariusz Zaborski [Sun, 12 Nov 2017 08:54:23 +0000 (08:54 +0000)]
dhclient(8) should not close stdio using daemon(3) function.

dhclient(8) is chrooted so opening /dev/null always will fail.
In capability world this is also annoying because we getting error that
open(2) is not permitted in Capsicum. dhclient(8) is closing stdio by
precaching fd to /dev/null before chroot.
This is done few lines below daemon(3) function so let's not try to do that
in daemon(3) function.

Reviewed by: cem@
Differential Revision: https://reviews.freebsd.org/D12826

6 years agoUse syslog service in dhclient(8).
Mariusz Zaborski [Sun, 12 Nov 2017 08:42:43 +0000 (08:42 +0000)]
Use syslog service in dhclient(8).

dhclient(8) is failing during boot to connect to the syslog service, because
syslog daemon is started after dhclient(8). This can be reproduced by stooping
syslog daemon and ktrace the dhclient or use kern.trap_enotcap sysctl and boot
the machine. Using the Casper syslog service fix the problem.

Reviewed by: bapt@
Differential Revision: https://reviews.freebsd.org/D12825

6 years agoIntroduce syslog service for Casper.
Mariusz Zaborski [Sun, 12 Nov 2017 08:34:25 +0000 (08:34 +0000)]
Introduce syslog service for Casper.

syslog in libc secretly reconnects to the daemon.
Another issue is that we don't have any information from openlog(3) if we
succeeded to open log or not so we don't know if we are ready
to enter cabability mode.
Because all of that we decided we need a syslog service for Caspser.

Reviewed by: bapt@
Differential Revision: https://reviews.freebsd.org/D12824

6 years agoRemove the special character definitions files for eqn(1)
Baptiste Daroussin [Sun, 12 Nov 2017 08:31:17 +0000 (08:31 +0000)]
Remove the special character definitions files for eqn(1)

This files hasn't been used since groff(1) was introduced in base 23 years ago.

6 years agoUpdate to 2017.10.21
Baptiste Daroussin [Sun, 12 Nov 2017 08:00:57 +0000 (08:00 +0000)]
Update to 2017.10.21

MFC after: 3 days

6 years agoWe return a pointer when we are using cap_init() or cap_service_open()
Mariusz Zaborski [Sun, 12 Nov 2017 07:18:10 +0000 (07:18 +0000)]
We return a pointer when we are using cap_init() or cap_service_open()
function, so check if cap_chanel_t is NULL is not enough.
Casper with a normal libc will still fail in capability mote so let's not
enter capability mode without casper support when we need to resolve DNS.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D12823

6 years agolibkvm: fix lib32 build.
Will Andrews [Sun, 12 Nov 2017 03:28:47 +0000 (03:28 +0000)]
libkvm: fix lib32 build.

6 years agoamd64: stop nesting preemption counter in spinlock_enter
Mateusz Guzik [Sun, 12 Nov 2017 03:13:01 +0000 (03:13 +0000)]
amd64: stop nesting preemption counter in spinlock_enter

Discussed with: jhb

6 years agoUse passed thread pointer instead of curthread in sys_sched_yield
Mateusz Guzik [Sun, 12 Nov 2017 02:34:33 +0000 (02:34 +0000)]
Use passed thread pointer instead of curthread in sys_sched_yield

No functional changes.

6 years agolibkvm: fix build failures
Will Andrews [Sun, 12 Nov 2017 01:36:48 +0000 (01:36 +0000)]
libkvm: fix build failures

6 years agolibkvm: fix 'index' shadowing.
Will Andrews [Sun, 12 Nov 2017 00:00:38 +0000 (00:00 +0000)]
libkvm: fix 'index' shadowing.

6 years agolibkvm: add kvm_walk_pages API.
Will Andrews [Sat, 11 Nov 2017 23:30:58 +0000 (23:30 +0000)]
libkvm: add kvm_walk_pages API.

This API allows callers to enumerate all known pages, including any
direct map & kernel map virtual addresses, physical addresses, size,
offset into the core, & protection configured.

For architectures that support direct map addresses, also generate pages
for any direct map only addresses that are not associated with kernel
map addresses.

Fix page size portability issue left behind from previous kvm page table
lookup interface.

Reviewed by: jhb
Sponsored by: Backtrace I/O
Differential Revision: https://reviews.freebsd.org/D12279

6 years agobhyve: avoid applying capsicum capabilities to file that was not opened
Bartek Rutkowski [Sat, 11 Nov 2017 22:50:14 +0000 (22:50 +0000)]
bhyve: avoid applying capsicum capabilities to file that was not opened

When using -l option targeting file that can't be opened (ie. nmdm module
is not loaded and /dev/nmdm* is specified) bhyve tries to apply capsicum
capabilities to a file that was not opened.

Enclose that code in an if statement and only run it on correctly opened
descriptor also providing meaningful message in case of an error.

Submitted by: Pawel Biernacki <pawel.biernacki@gmail.com>
Reviewed by: grehan, emaste
Sponsoied by: Mysterious Code Ltd.
Differential Revision: D12985

6 years agoAvoid locking and refing in sysctl_kern_proc_args if possible.
Mateusz Guzik [Sat, 11 Nov 2017 22:39:33 +0000 (22:39 +0000)]
Avoid locking and refing in sysctl_kern_proc_args if possible.

Turns out the sysctl is called a lot e.g. by pkg-static.

6 years agosysctl: try to avoid malloc in name2oid
Mateusz Guzik [Sat, 11 Nov 2017 21:50:36 +0000 (21:50 +0000)]
sysctl: try to avoid malloc in name2oid

name2oid is called all the time and passed names are almost always very short
(< 16 characters).

6 years agoImplement missing KDGETMODE IOCTL in VT.
Hans Petter Selasky [Sat, 11 Nov 2017 20:12:48 +0000 (20:12 +0000)]
Implement missing KDGETMODE IOCTL in VT.

Obtained from: Johannes Lundberg <yohanesu75@gmail.com>
Sponsored by: Mellanox Technologies
MFC after: 1 week

6 years agofind(1): Don't treat statfs() error as fatal in f_fstype, which can happen
Xin LI [Sat, 11 Nov 2017 19:18:47 +0000 (19:18 +0000)]
find(1): Don't treat statfs() error as fatal in f_fstype, which can happen
when a directory is removed in the middle of find.

Instead of a full err(), allow find to continue, plus print a warning with
exitstatus set when appropriate.

Reported by: 100.chksetuid via gordon
Reviewed by: jilles
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D13024

6 years agoUse pfind_any in linux_rt_sigqueueinfo and kern_sigqueue
Mateusz Guzik [Sat, 11 Nov 2017 18:10:09 +0000 (18:10 +0000)]
Use pfind_any in linux_rt_sigqueueinfo and kern_sigqueue