]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoInclude files containing metadata specific to the branch in the
gjb [Tue, 25 Jun 2019 14:56:13 +0000 (14:56 +0000)]
Include files containing metadata specific to the branch in the
directory where the individual distribution sets exist.

The new metadata files include the build date, svn branch, and
revision of the build.

Requested by: Mellanox Technologies (via kib)
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoCroatian calendar: update / fix names, dates, group national public
zec [Tue, 25 Jun 2019 14:50:03 +0000 (14:50 +0000)]
Croatian calendar: update / fix names, dates, group national public
holidays, sort by date.

MFC after: 3 days

4 years agoFix parsing of corrupt data in usbdump(8). Check that the transfer
hselasky [Tue, 25 Jun 2019 13:15:29 +0000 (13:15 +0000)]
Fix parsing of corrupt data in usbdump(8). Check that the transfer
type array lookup is within bounds to avoid segfault.

PR: 238801
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoConvert all IPv4 and IPv6 multicast memberships into using a STAILQ
hselasky [Tue, 25 Jun 2019 11:54:41 +0000 (11:54 +0000)]
Convert all IPv4 and IPv6 multicast memberships into using a STAILQ
instead of a linear array.

The multicast memberships for the inpcb structure are protected by a
non-sleepable lock, INP_WLOCK(), which needs to be dropped when
calling the underlying possibly sleeping if_ioctl() method. When using
a linear array to keep track of multicast memberships, the computed
memory location of the multicast filter may suddenly change, due to
concurrent insertion or removal of elements in the linear array. This
in turn leads to various invalid memory access issues and kernel
panics.

To avoid this problem, put all multicast memberships on a STAILQ based
list. Then the memory location of the IPv4 and IPv6 multicast filters
become fixed during their lifetime and use after free and memory leak
issues are easier to track, for example by: vmstat -m | grep multi

All list manipulation has been factored into inline functions
including some macros, to easily allow for a future hash-list
implementation, if needed.

This patch has been tested by pho@ .

Differential Revision: https://reviews.freebsd.org/D20080
Reviewed by: markj @
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFree all allocated unit IDs in cuse(3) after the client character
hselasky [Tue, 25 Jun 2019 11:46:01 +0000 (11:46 +0000)]
Free all allocated unit IDs in cuse(3) after the client character
devices have been destroyed to avoid creating character devices with
identical name.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix for deadlock situation in cuse(3)
hselasky [Tue, 25 Jun 2019 11:42:53 +0000 (11:42 +0000)]
Fix for deadlock situation in cuse(3)

The final server unref should be done by the server thread to prevent
deadlock in the client cdevpriv destructor, which cannot destroy
itself.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFollow the RFC 3128 and drop short TCP fragments with offset = 1.
ae [Tue, 25 Jun 2019 11:40:37 +0000 (11:40 +0000)]
Follow the RFC 3128 and drop short TCP fragments with offset = 1.

Reported by: emaste
MFC after: 1 week

4 years agoMark default rule with IPFW_RULE_NOOPT flag, so it can be showed in
ae [Tue, 25 Jun 2019 09:11:22 +0000 (09:11 +0000)]
Mark default rule with IPFW_RULE_NOOPT flag, so it can be showed in
compact form.

MFC after: 1 week

4 years agoRestore ipfw(8)'s compact output support broken after r331668.
ae [Tue, 25 Jun 2019 09:08:24 +0000 (09:08 +0000)]
Restore ipfw(8)'s compact output support broken after r331668.

Also modify it a bit. Now -c option omits only 'from any to any' part
and works for different protocols (not just for ip).

Reported by: Dmitry Selivanov <dseliv at gmail>
MFC after: 1 week

4 years agovm_map_protect may return an INVALID_ARGUMENT or PROTECTION_FAILURE
dougm [Tue, 25 Jun 2019 07:44:37 +0000 (07:44 +0000)]
vm_map_protect may return an INVALID_ARGUMENT or PROTECTION_FAILURE
error response after clipping the first map entry in the region to be
reserved. This creates a pair of matching entries that should have
been "simplified" back into one, or never created. This change defers
the clipping of that entry until those two vm_map_protect failure
cases have been ruled out.

Reviewed by: alc
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20711

4 years agoThe definition of icmptypes in ip_compt.h is dead code as it already
cy [Tue, 25 Jun 2019 07:04:47 +0000 (07:04 +0000)]
The definition of icmptypes in ip_compt.h is dead code as it already
use the icmptypes in ip_icmp.h.

MFC after: 1 week

4 years agoAdd SPDX tags to bhyve(8) HD Audio device.
araujo [Tue, 25 Jun 2019 06:24:56 +0000 (06:24 +0000)]
Add SPDX tags to bhyve(8) HD Audio device.

Reviewed by: bcran
Differential Revision: https://reviews.freebsd.org/D20750

4 years agoReplay r349342 by imp accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:31 +0000 (06:14 +0000)]
Replay r349342 by imp accidentally reverted by r349352

Use the cam_ed copy of ata_params rather than malloc and freeing
memory for it. This reaches into internal bits of xpt a little, and
I'll clean that up later.

4 years agoReplay r349341 by imp accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:26 +0000 (06:14 +0000)]
Replay r349341 by imp accidentally reverted by r349352

Use ata_param_fixup instead of a custom copy here

4 years agoReplay r349340 by imp accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:21 +0000 (06:14 +0000)]
Replay r349340 by imp accidentally reverted by r349352

Create ata_param_fixup

Create a common fixup routine to do the canonical fixup of the
ata_param fixup. Call it from both the ATA and the ATA over SCSI
paths.

4 years agoReplay r349339 by imp accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:16 +0000 (06:14 +0000)]
Replay r349339 by imp accidentally reverted by r349352

Go ahead and completely fix the ata_params before calling the veto
function. This breaks nothing that uses it in the tree since
ata_params is ignored in storvsc_ada_probe_veto which is the only
in-tree consumer.

4 years agoReplay r349336 by scottl accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:11 +0000 (06:14 +0000)]
Replay r349336 by scottl accidentally reverted by r349352

Add a section about the HD Audio module support

4 years agoReplay r349335 by scottl accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:05 +0000 (06:14 +0000)]
Replay r349335 by scottl accidentally reverted by r349352

Add the PCI HDAudio device model from the 2016 GSoC.  Detailed information
can be found at

https://wiki.freebsd.org/SummerOfCode2016/HDAudioEmulationForBhyve

This commit has evolved from the original work to include Capsicum
integration.  As part of that, it only opens the host audio devices once
and leaves them open, instead of opening and closing them on each guest
access.  Thanks to Peter Grehan and Marcelo Araujo for their help in
bringing the work forward and providing some of the final techncial push.

Submitted by: Alex Teaca <iateaca@freebsd.org>
Differential Revision: D7840, D12419

4 years agoReplay r349334 by markj accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:14:00 +0000 (06:14 +0000)]
Replay r349334 by markj accidentally reverted by r349352

Remove a lingering use of splbio().

The buffer must be locked by the caller.  No functional change
intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoReplay r349333 by emaste accidentally reverted by r349352
imp [Tue, 25 Jun 2019 06:13:56 +0000 (06:13 +0000)]
Replay r349333 by emaste accidentally reverted by r349352

vtfontcvt: improve .bdf validation

Previously if we had a FONTBOUNDINGBOX or DWIDTH entry that had missing
or invalid values and and failed sscanf, we would proceeded with
partially initialized bounding box / device width variables.

Reported by: afl (FONTBOUNDINGBOX)
MFC with: r349100
Sponsored by: The FreeBSD Foundation

4 years agoRemove NAND and NANDFS support
imp [Tue, 25 Jun 2019 04:50:09 +0000 (04:50 +0000)]
Remove NAND and NANDFS support

NANDFS has been broken for years. Remove it. The NAND drivers that
remain are for ancient parts that are no longer relevant. They are
polled, have terrible performance and just for ancient arm
hardware. NAND parts have evolved significantly from this early work
and little to none of it would be relevant should someone need to
update to support raw nand. This code has been off by default for
years and has violated the vnode protocol leading to panics since it
was committed.

Numerous posts to arch@ and other locations have found no actual users
for this software.

Relnotes: Yes
No Objection From: arch@
Differential Revision: https://reviews.freebsd.org/D20745

4 years agopowerpc: Transition to Secure-PLT, like most other OSs (Toolchain part)
jhibbits [Tue, 25 Jun 2019 02:35:22 +0000 (02:35 +0000)]
powerpc: Transition to Secure-PLT, like most other OSs (Toolchain part)

Summary:
Toolchain follow-up to r349350.  LLVM patches will be submitted upstream for
9.0 as well.

The bsd.cpu.mk change is required because GNU ld assumes BSS-PLT if it
cannot determine for certain that it needs Secure-PLT, and some binaries do
not compile in such a way to make it know to use Secure-PLT.

Reviewed By: nwhitehorn, bdragon, pfg
Differential Revision: https://reviews.freebsd.org/D20598

4 years agopowerpc: Transition to Secure-PLT, like most other OSs
jhibbits [Tue, 25 Jun 2019 00:40:44 +0000 (00:40 +0000)]
powerpc: Transition to Secure-PLT, like most other OSs

Summary:
PowerPC has two PLT models: BSS-PLT and Secure-PLT.  BSS-PLT uses runtime
code generation to generate the PLT stubs.  Secure-PLT was introduced with
GCC 4.1 and Binutils 2.17 (base has GCC 4.2.1 and Binutils 2.17), and is a
more secure PLT format, using a read-only linkage table, with the dynamic
linker populating a non-executable index table.

This is the libc, rtld, and kernel support only.  The toolchain and build
parts will be updated separately.

Reviewed By: nwhitehorn, bdragon, pfg
Differential Revision: https://reviews.freebsd.org/D20598
MFC after: 1 month

4 years agoloader: add HTTP support using UEFI
bcran [Mon, 24 Jun 2019 23:18:42 +0000 (23:18 +0000)]
loader: add HTTP support using UEFI

Add support for an HTTP "network filesystem" using the UEFI's HTTP
stack.

This also supports HTTPS, but TianoCore EDK2 implementations currently
crash while fetching loader files.
Only IPv4 is supported at the moment. IPv6 support is planned for a
follow-up changeset.

Note that we include some headers from the TianoCore EDK II project in
stand/efi/include/Protocol verbatim, including links to the license instead
of including the full text because that's their preferred way of
communicating it, despite not being normal FreeBSD project practice.

Submitted by: scottph
Reviewed by: imp, bcran
Differential Revision: https://reviews.freebsd.org/D20643

4 years agoarm64 acpi_iort: add some error handling
jchandra [Mon, 24 Jun 2019 21:24:55 +0000 (21:24 +0000)]
arm64 acpi_iort: add some error handling

Print warnings for some bad kernel configurations (like NUMA disabled
with multiple domains). Check and report some firmware errors (like
incorrect proximity domain entries).

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

4 years agoarm64 gicv3_its: enable all ITS blocks for a CPU
jchandra [Mon, 24 Jun 2019 21:13:45 +0000 (21:13 +0000)]
arm64 gicv3_its: enable all ITS blocks for a CPU

We now support multiple ITS blocks raising interrupts to a CPU.
Add all available CPUs to the ITS when no NUMA information is
available.

This reverts the check added in r340602, at that tim we did not
suppport multiple ITS blocks for a CPU.

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

4 years agokbdcontrol -h prints two error messages.
imp [Mon, 24 Jun 2019 21:05:14 +0000 (21:05 +0000)]
kbdcontrol -h prints two error messages.

We loop through getopt(3) twice. Once for -P args and once for the
rest. Catch '?' and print usage when that happens.

4 years agoarm64 gic: Drop unused GICV3_IVAR_REDIST_VADDR
jchandra [Mon, 24 Jun 2019 21:00:28 +0000 (21:00 +0000)]
arm64 gic: Drop unused GICV3_IVAR_REDIST_VADDR

Now that GICV3_IVAR_REDIST is available, GICV3_IVAR_REDIST_VADDR
is unused and can be removed. Drop the define and add a comment.

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

4 years agoAdd missing include of sys/boot.h
imp [Mon, 24 Jun 2019 20:52:21 +0000 (20:52 +0000)]
Add missing include of sys/boot.h

This change was dropped out in a rebase and I didn't catch that before
I committed.

4 years agoMove to using a common kernel path between the boot / laoder bits and
imp [Mon, 24 Jun 2019 20:34:53 +0000 (20:34 +0000)]
Move to using a common kernel path between the boot / laoder bits and
the kernel.

4 years agoUse the cam_ed copy of ata_params rather than malloc and freeing
imp [Mon, 24 Jun 2019 20:23:19 +0000 (20:23 +0000)]
Use the cam_ed copy of ata_params rather than malloc and freeing
memory for it. This reaches into internal bits of xpt a little, and
I'll clean that up later.

4 years agoUse ata_param_fixup instead of a custom copy here
imp [Mon, 24 Jun 2019 20:19:03 +0000 (20:19 +0000)]
Use ata_param_fixup instead of a custom copy here

4 years agoCreate ata_param_fixup
imp [Mon, 24 Jun 2019 20:18:58 +0000 (20:18 +0000)]
Create ata_param_fixup

Create a common fixup routine to do the canonical fixup of the
ata_param fixup. Call it from both the ATA and the ATA over SCSI
paths.

4 years agoGo ahead and completely fix the ata_params before calling the veto
imp [Mon, 24 Jun 2019 20:18:49 +0000 (20:18 +0000)]
Go ahead and completely fix the ata_params before calling the veto
function. This breaks nothing that uses it in the tree since
ata_params is ignored in storvsc_ada_probe_veto which is the only
in-tree consumer.

4 years agoAdd a section about the HD Audio module support
scottl [Mon, 24 Jun 2019 19:42:32 +0000 (19:42 +0000)]
Add a section about the HD Audio module support

4 years agoAdd the PCI HDAudio device model from the 2016 GSoC. Detailed information
scottl [Mon, 24 Jun 2019 19:31:32 +0000 (19:31 +0000)]
Add the PCI HDAudio device model from the 2016 GSoC.  Detailed information
can be found at

https://wiki.freebsd.org/SummerOfCode2016/HDAudioEmulationForBhyve

This commit has evolved from the original work to include Capsicum
integration.  As part of that, it only opens the host audio devices once
and leaves them open, instead of opening and closing them on each guest
access.  Thanks to Peter Grehan and Marcelo Araujo for their help in
bringing the work forward and providing some of the final techncial push.

Submitted by: Alex Teaca <iateaca@freebsd.org>
Differential Revision: D7840, D12419

4 years agoRemove a lingering use of splbio().
markj [Mon, 24 Jun 2019 19:19:37 +0000 (19:19 +0000)]
Remove a lingering use of splbio().

The buffer must be locked by the caller.  No functional change
intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agovtfontcvt: improve .bdf validation
emaste [Mon, 24 Jun 2019 17:25:14 +0000 (17:25 +0000)]
vtfontcvt: improve .bdf validation

Previously if we had a FONTBOUNDINGBOX or DWIDTH entry that had missing
or invalid values and and failed sscanf, we would proceeded with
partially initialized bounding box / device width variables.

Reported by: afl (FONTBOUNDINGBOX)
MFC with: r349100
Sponsored by: The FreeBSD Foundation

4 years agoClean out duplicate definitions of TCP macros also found in netinet/tcp.h.
cy [Mon, 24 Jun 2019 02:58:02 +0000 (02:58 +0000)]
Clean out duplicate definitions of TCP macros also found in netinet/tcp.h.

MFC after: 1 week

4 years agoAdd pwm devices to NOTES.
ian [Mon, 24 Jun 2019 02:39:56 +0000 (02:39 +0000)]
Add pwm devices to NOTES.

4 years agoAdd gpio(4) and related drivers to NOTES.
ian [Mon, 24 Jun 2019 02:30:05 +0000 (02:30 +0000)]
Add gpio(4) and related drivers to NOTES.

4 years agoThe gpiopps(4) driver currently has probe and attach code only for FDT based
ian [Mon, 24 Jun 2019 02:27:17 +0000 (02:27 +0000)]
The gpiopps(4) driver currently has probe and attach code only for FDT based
systems, so conditionalize it accordingly in conf/files.

4 years agoBuild an armv7 LINT kernel in addition to armv5 LINT. You might think this
ian [Mon, 24 Jun 2019 01:42:09 +0000 (01:42 +0000)]
Build an armv7 LINT kernel in addition to armv5 LINT.  You might think this
had been done years ago.  I did.  All this time we've only compiled a LINT
kernel for TARGET_ARCH=arm.  Now separate LINT-V5 and LINT-V7 configs are
generated and built.

There are two new files in arm/conf, NOTES.armv5 and NOTES.armv7, containing
some of what used to be in the arm NOTES file.  That file now contains only
the bits that are common to v5 and v7.

The makeLINT.mk file now creates the LINT-V5 and LINT-V7 files by concatening
sys/conf/NOTES, arm/conf/NOTES, and arm/conf/NOTES.armv{5,7} in that order.

4 years agoamd64 pmap: block on turnstile for lock-less DI.
kib [Sun, 23 Jun 2019 21:21:11 +0000 (21:21 +0000)]
amd64 pmap: block on turnstile for lock-less DI.

Port the code to block on turnstile instead of yielding, to lock-less
delayed invalidation. The yield might cause tight loop due to priority
inversion.

Since it is impossible to avoid race between block and wake-up, arm
1-tick callout to wakeup when thread blocks itself.

Reported and tested by: mjg
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 months
Differential revision: https://reviews.freebsd.org/D20636

4 years agoAllow compiling ukbdmap.h on arm, since it appears to work fine.
ian [Sun, 23 Jun 2019 21:17:41 +0000 (21:17 +0000)]
Allow compiling ukbdmap.h on arm, since it appears to work fine.

4 years agoSwitch to check for effective user id in r349320, and disable dumping
kib [Sun, 23 Jun 2019 21:15:31 +0000 (21:15 +0000)]
Switch to check for effective user id in r349320, and disable dumping
into existing files for sugid processes.

Despite using real user id pronounces the intent, it actually breaks
suid coredumps, while not making any difference for non-sugid
processes.  The reason for the breakage is that non-existent core file
is created with the effective uid (unless weird hacks like SUIDDIR are
configured).

Then, if user enabled kern.sugid_coredump, core dumping should not
overwrite core files owned by effective uid, but we cannot pretend to
use real uid for dumping.

PR: 68905
admbugs: 358
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agopmap_enter_quick_locked() never replaces a valid mapping, so it need not
alc [Sun, 23 Jun 2019 21:06:56 +0000 (21:06 +0000)]
pmap_enter_quick_locked() never replaces a valid mapping, so it need not
perform a TLB invalidation.  A barrier suffices.  (See r343876.)

Add a comment to pmap_enter_quick_locked() in order to highlight the
fact that it does not replace valid mappings.

Correct a typo in one of pmap_enter()'s comments.

MFC after: 1 week

4 years agoSkip sys.netinet.socket_afinet.socket_afinet_bind_zero temporarily because it
lwhsu [Sun, 23 Jun 2019 19:37:12 +0000 (19:37 +0000)]
Skip sys.netinet.socket_afinet.socket_afinet_bind_zero temporarily because it
doesn't work when mac_portacl(4) loaded

PR: 238781
Sponsored by: The FreeBSD Foundation

4 years agoImprove AHCI Enclosure Management and SES interoperation.
mav [Sun, 23 Jun 2019 19:05:01 +0000 (19:05 +0000)]
Improve AHCI Enclosure Management and SES interoperation.

Since SES specs do not define mechanism to map enclosure slots to SATA
disks, AHCI EM code I written many years ago appeared quite useless,
that always bugged me.  I was thinking whether it was a good idea, but
if LSI HBAs do that, why I shouldn't?

This change introduces simple non-standard mechanism for the mapping
into both AHCI EM and SES code, that makes AHCI EM on capable controllers
(most of Intel's) a first-class SES citizen, allowing it to report disk
physical path to GEOM, show devices inserted into each enclosure slot in
`sesutil map` and `getencstat`, control locate and fault LEDs for specific
devices with `sesutil locate adaX on` and `sesutil fault adaX on`, etc.

I've successfully tested this on Supermicro X10DRH-i motherboard connected
with sideband cable of its S-SATA Mini-SAS connector to SAS815TQ backplane.
It can indicate with LEDs Locate, Fault and Rebuild/Remap SES statuses for
each disk identical to real SES of Supermicro SAS2 backplanes.

MFC after: 2 weeks

4 years agocoredump: avoid writing to core files not owned by the real user.
kib [Sun, 23 Jun 2019 18:35:11 +0000 (18:35 +0000)]
coredump: avoid writing to core files not owned by the real user.

Reported by: blake frantz <trew@hick.org>
PR: 68905
admbugs: 358
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoAdd some i2c slave-device drivers that were missing from NOTES.
ian [Sun, 23 Jun 2019 17:39:13 +0000 (17:39 +0000)]
Add some i2c slave-device drivers that were missing from NOTES.

4 years agoThe sy8106a and syr827 drviers require FDT and the ext_resources subsystem.
ian [Sun, 23 Jun 2019 17:38:30 +0000 (17:38 +0000)]
The sy8106a and syr827 drviers require FDT and the ext_resources subsystem.

4 years agoAdd the rtc8583 driver to conf/files. Also, move sy8106a from
ian [Sun, 23 Jun 2019 17:23:56 +0000 (17:23 +0000)]
Add the rtc8583 driver to conf/files.  Also, move sy8106a from
file.allwinner to conf/files... it's not allwinner-specific, some day
other platforms could use the same regulator chip.

4 years agoRemove some unused header files from the ad7418 driver.
ian [Sun, 23 Jun 2019 17:20:39 +0000 (17:20 +0000)]
Remove some unused header files from the ad7418 driver.

4 years agoAdd libc stub for pthread_getthreadid_np(3).
kib [Sun, 23 Jun 2019 10:50:26 +0000 (10:50 +0000)]
Add libc stub for pthread_getthreadid_np(3).

Requested by: jbeich
PR: 238650
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoFix two WARNS=6 warnings in opendir.c and telldir.c
arichardson [Sun, 23 Jun 2019 10:47:07 +0000 (10:47 +0000)]
Fix two WARNS=6 warnings in opendir.c and telldir.c

This is in preparation for compiling these files as part of rtld (which is
built with WARNS=6). See https://reviews.freebsd.org/D20663 for more details.

4 years agoRemove redundand 'else' and 'return'.
kib [Sun, 23 Jun 2019 10:45:50 +0000 (10:45 +0000)]
Remove redundand 'else' and 'return'.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoAdd DragonFly BSD 5.6.1
sevan [Sat, 22 Jun 2019 22:43:40 +0000 (22:43 +0000)]
Add DragonFly BSD 5.6.1

4 years agoRemove question mark from the link between NetBSD & Darwin.
sevan [Sat, 22 Jun 2019 22:34:59 +0000 (22:34 +0000)]
Remove question mark from the link between NetBSD & Darwin.
As linked to in bug 26137 as a source
https://web.archive.org/web/20001012121507/http://www.opensource.apple.com/projects/darwin/faq.html
mentions:
"We already synchronize our code periodically with NetBSD for most of our user commands"

4 years agoYou can't use block special nodes for swap, so don't let that happen.
dougm [Sat, 22 Jun 2019 19:27:09 +0000 (19:27 +0000)]
You can't use block special nodes for swap, so don't let that happen.

Fix a style violation with regard to header file arrangement.

Improved by: alc
Approved by: markj, kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20723

4 years agoDecouple enc/ses verbosity from bootverbose.
mav [Sat, 22 Jun 2019 19:09:10 +0000 (19:09 +0000)]
Decouple enc/ses verbosity from bootverbose.

I don't want to be regularly notified that my enclosure violates standards
until there is some real problem I want to debug.

MFC after: 2 weeks

4 years agoAdd list of valid CPUTYPE flags for arm/arm64 to make.conf example
imp [Sat, 22 Jun 2019 16:54:23 +0000 (16:54 +0000)]
Add list of valid CPUTYPE flags for arm/arm64 to make.conf example

Summary:
Adds a list of valid CPUTYPE flags for arm and arm64 architectures
List taken from share/mk/bsd.cpu.mk

Submitted by: Daniel Engberg
Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D20315

4 years agoIntroduce pmap_remove_l3_range() and use it in two places:
alc [Sat, 22 Jun 2019 16:26:38 +0000 (16:26 +0000)]
Introduce pmap_remove_l3_range() and use it in two places:
(1) pmap_remove(), where it eliminates redundant TLB invalidations by
pmap_remove() and pmap_remove_l3(), and (2) pmap_enter_l2(), where it may
optimize the TLB invalidations by batching them.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12725

4 years ago`libjail/jail.c' includes both <sys/param.h> and <sys/types.h>
dteske [Sat, 22 Jun 2019 15:39:34 +0000 (15:39 +0000)]
`libjail/jail.c' includes both <sys/param.h> and <sys/types.h>

Latter is undesired when including <sys/param.h> according to style(9)

Submitted by: Faraz Vahedi
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D20637

4 years agoddb show proc typo
rlibby [Sat, 22 Jun 2019 05:35:23 +0000 (05:35 +0000)]
ddb show proc typo

4 years agoRemove ancient SCSI-2/3 mentioning.
mav [Sat, 22 Jun 2019 03:50:43 +0000 (03:50 +0000)]
Remove ancient SCSI-2/3 mentioning.

MFC after: 2 weeks

4 years agoModify swapon(8) to invoke BIO_DELETE to trim swap devices, either if
dougm [Sat, 22 Jun 2019 03:16:01 +0000 (03:16 +0000)]
Modify swapon(8) to invoke BIO_DELETE to trim swap devices, either if
'-E' appears on the swapon command line, or if "trimonce" appears as
an fstab option.

Discussed at: BSDCAN
Tested by: markj
Reviewed by: markj
Approved by: markj (mentor)
Differential Revision:https://reviews.freebsd.org/D20599

4 years agoVirtIO SCSI: validate seg_max on attach
vangyzen [Sat, 22 Jun 2019 01:20:45 +0000 (01:20 +0000)]
VirtIO SCSI:  validate seg_max on attach

Until r349278, bhyve presented a seg_max to the guest that was too large.
Detect this case and clamp it to the virtqueue size.  Otherwise, we would
fail the "too many segments to enqueue" assertion in virtqueue_enqueue().

I hit this by running a guest with a MAXPHYS of 256 KB.

Reviewed by: bryanv cem
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20703

4 years agoMake ELEMENT INDEX validation more strict.
mav [Sat, 22 Jun 2019 01:06:41 +0000 (01:06 +0000)]
Make ELEMENT INDEX validation more strict.

SES specifications tell: "The Additional Element Status descriptors shall
be in the same order as the status elements in the Enclosure Status
diagnostic page".  It allows us to question ELEMENT INDEX that is lower
then values we already processed.  There are many SAS2 enclosures with
this kind of problem.

While there, add more specific error messages for cases when ELEMENT INDEX
is obviously wrong.  Also skip elements with INVALID bit set.

MFC after: 2 weeks

4 years agoRefactor xpt_getattr() to make it more readable. No outwardly
scottl [Fri, 21 Jun 2019 23:40:26 +0000 (23:40 +0000)]
Refactor xpt_getattr() to make it more readable.  No outwardly
visible functional changes, though code flow was modified a bit
internally to lessen the need for goto jumps and chained if
conditionals.

4 years agoFix individual_element_index when some type has 0 elements.
mav [Fri, 21 Jun 2019 23:29:16 +0000 (23:29 +0000)]
Fix individual_element_index when some type has 0 elements.

When some type has 0 elements, saved_individual_element_index was set
to -1 on second type bump, since individual_element_index was not
restored after the first.  To me it looks easier just to increment
saved_individual_element_index separately than think when to save it.

MFC after: 2 weeks

4 years agoReduce namespace pollution from r349233
asomers [Fri, 21 Jun 2019 21:50:14 +0000 (21:50 +0000)]
Reduce namespace pollution from r349233

Define __daddr_t in _types.h and use it in filio.h

Reported by: ian, bde
Reviewed by: ian, imp, cem
MFC after: 2 weeks
MFC-With: 349233
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20715

4 years agobhyve: Fix vtscsi maximum segment config
vangyzen [Fri, 21 Jun 2019 18:57:33 +0000 (18:57 +0000)]
bhyve: Fix vtscsi maximum segment config

The seg_max value reported to the guest should be two less than the
host's maximum, in order to leave room for the request and the
response.  This is analogous to r347033 for virtio_block.

We hit the "too many segments to enqueue" assertion on OneFS because
we increase MAXPHYS to 256 KB.

Reviewed by: bryanv
Discussed with: cem jhb rgrimes
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20529

4 years agoLinuxKPI: Additions to rcu list.
johalun [Fri, 21 Jun 2019 18:48:07 +0000 (18:48 +0000)]
LinuxKPI: Additions to rcu list.

- Add rcu list functions.
- Make rcu hlist's foreach macro use rcu calls instead of the non-rcu macro.
- Bump FreeBSD version so we have a checkpoint for the vboxvideo drm driver.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week
Differential Revision: D20719

4 years agoLinuxKPI: Add atomic_long_sub macro.
johalun [Fri, 21 Jun 2019 16:43:16 +0000 (16:43 +0000)]
LinuxKPI: Add atomic_long_sub macro.

Reviewed by: imp (mentor), hps
Approved by: imp (mentor), hps
MFC after: 1 week
Differential Revision: D20718

4 years agoAdd pwm to the armv7 GENERIC kernel, it's now used by TI and Allwinner.
ian [Fri, 21 Jun 2019 15:44:58 +0000 (15:44 +0000)]
Add pwm to the armv7 GENERIC kernel, it's now used by TI and Allwinner.

4 years agoDo some general cleanup and light wordsmithing.
ian [Fri, 21 Jun 2019 15:12:17 +0000 (15:12 +0000)]
Do some general cleanup and light wordsmithing.

Sort methods alphabetically.  Wrap long lines.  Start sentences on a new
line.  Remove contractions (not because it's a good idea, just to silence
igor).  Add some explanation of the units for the period and duty arguments
and the convention for channel numbers.

4 years agoCatch up with recent changes in pwmbus(9). The pwm(9) and pwmbus(9)
ian [Fri, 21 Jun 2019 14:46:43 +0000 (14:46 +0000)]
Catch up with recent changes in pwmbus(9).  The pwm(9) and pwmbus(9)
interfaces were unified into pwmbus(9), and the PWMBUS_CHANNEL_MAX method
was renamed PWMBUS_CHANNEL_COUNT.  The pwmbus_attach_bus() function just
went away completely.  Also, fix a few typos such as s/is/if/.

4 years agoAdd support for the PWM(9) API. This allows configuring the pwm output using
ian [Fri, 21 Jun 2019 14:24:33 +0000 (14:24 +0000)]
Add support for the PWM(9) API.  This allows configuring the pwm output using
pwm(9), but also maintains the historical sysctl config interface for
compatiblity with existing apps.  The two config systems are not compatible
with each other; if you use both interfaces to change configurations you're
likely to end up with incorrect output or none at all.

4 years agoSome mundane tweaks and cleanups to help de-clutter the diffs of some
ian [Fri, 21 Jun 2019 14:01:02 +0000 (14:01 +0000)]
Some mundane tweaks and cleanups to help de-clutter the diffs of some
upcoming functional changes.

Add an ofw_compat_data table for probing compat strings, and use it to add
PNP data.  Remove some stray semicolons at the end of macro definitions,
and add a PWM_LOCK_ASSERT macro to round out the usual suite.  Move the
device_t and driver_methods structs to the end of the file.  Tweak comments.

4 years agonandsim: correct test to avoid out-of-bounds access
emaste [Fri, 21 Jun 2019 13:42:40 +0000 (13:42 +0000)]
nandsim: correct test to avoid out-of-bounds access

Previously nandsim_chip_status returned EINVAL iff both of user-provided
chip->ctrl_num and chip->num were out of bounds.  If only one failed the
bounds check arbitrary memory would be read and returned.

The NAND framework is not built by default, nandsim is not intended for
production use (it is a simulator), and the nandsim device has root-only
permissions.

admbugs: 827
Reported by: Daniel Hodson of elttam
MFC after: 3 days
Security: kernel information leak or DoS
Sponsored by: The FreeBSD Foundation

4 years agoAdd "tcpmss" opcode to match the TCP MSS value.
ae [Fri, 21 Jun 2019 10:54:51 +0000 (10:54 +0000)]
Add "tcpmss" opcode to match the TCP MSS value.

With this opcode it is possible to match TCP packets with specified
MSS option, whose value corresponds to configured in opcode value.
It is allowed to specify single value, range of values, or array of
specific values or ranges. E.g.

 # ipfw add deny log tcp from any to any tcpmss 0-500

Reviewed by: melifaro,bcr
Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

4 years agoip_output: pass PFIL_FWD in the slow path
kp [Fri, 21 Jun 2019 07:58:08 +0000 (07:58 +0000)]
ip_output: pass PFIL_FWD in the slow path

If we take the slow path for forwarding we should still tell our
firewalls (hooked through pfil(9)) that we're forwarding. Pass the
ip_output() flags to ip_output_pfil() so it can set the PFIL_FWD flag
when we're forwarding.

MFC after: 1 week
Sponsored by: Axiado

4 years agoNo need for each bsnmpd(1) module to open connection to syslog
syrinx [Fri, 21 Jun 2019 07:45:58 +0000 (07:45 +0000)]
No need for each bsnmpd(1) module to open connection to syslog

bsnmpd(1) main does that early on init and the connection is available
to all loaded modules

Event: Vienna Hackathon 2019
PR: 233431 , 221487
MFC after: 2 weeks

4 years agoUnbreak snmp_pf(3) after the changes introduced in r338209
syrinx [Fri, 21 Jun 2019 07:29:02 +0000 (07:29 +0000)]
Unbreak snmp_pf(3) after the changes introduced in r338209

PR: 237011
Event: Vienna Hackathon 2019
MFC after: 2 weeks

4 years agoMount and unmount devfs around calls to add packages.
imp [Fri, 21 Jun 2019 03:49:36 +0000 (03:49 +0000)]
Mount and unmount devfs around calls to add packages.

pkg now uses /dev/null for some of its operations. NanoBSD's packaging
stuff didn't mount that for the chroot it ran in, so any config that
added packages would see the error:
pkg: Cannot open /dev/null:No such file or directory
when trying to actually add those packages. It's easy enough for
nanobsd to mount /dev and it won't hurt anything that was already
working and may help things that weren't (like this). I moved the
mount/unmount pair to be in the right push/pop order from the
submitted patch.

PR: 238727
Submitted by: mike tancsa
Tested by: Karl Denninger

4 years agoCorrect function names.
kevlo [Fri, 21 Jun 2019 02:49:36 +0000 (02:49 +0000)]
Correct function names.

4 years agorc.d/motd: Update motd more robustly
cem [Fri, 21 Jun 2019 02:37:54 +0000 (02:37 +0000)]
rc.d/motd: Update motd more robustly

Use appropriate fsyncs to persist the rewritten /etc/motd file, when a
rewrite is performed.

Reported by: Jonathan Walton <jonathan AT isilon.com>
Reviewed by: allanjude, vangyzen
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20701

4 years agoFixup UPDATING text for r349253
cem [Fri, 21 Jun 2019 00:33:45 +0000 (00:33 +0000)]
Fixup UPDATING text for r349253

Requested by: delphij

4 years agosys: Remove DEV_RANDOM device option
cem [Fri, 21 Jun 2019 00:16:30 +0000 (00:16 +0000)]
sys: Remove DEV_RANDOM device option

Remove 'device random' from kernel configurations that reference it (most).
Replace perhaps mistaken 'nodevice random' in two MIPS configs with 'options
RANDOM_LOADABLE' instead.  Document removal in UPDATING; update NOTES and
random.4.

Reviewed by: delphij, markm (previous version)
Approved by: secteam(delphij)
Differential Revision: https://reviews.freebsd.org/D19918

4 years agoFix the case where no root hub object while host controller object exist in ACPI...
takawata [Thu, 20 Jun 2019 23:52:33 +0000 (23:52 +0000)]
Fix the case where no root hub object while host controller object exist in ACPI namespace.
Also you can disable ACPI support for USB by setting
debug.acpi.disabled="usb"

PR: 238711

4 years agofcntl: fix overflow when setting F_READAHEAD
asomers [Thu, 20 Jun 2019 23:07:20 +0000 (23:07 +0000)]
fcntl: fix overflow when setting F_READAHEAD

VOP_READ and VOP_WRITE take the seqcount in blocks in a 16-bit field.
However, fcntl allows you to set the seqcount in bytes to any nonnegative
31-bit value. The result can be a 16-bit overflow, which will be
sign-extended in functions like ffs_read. Fix this by sanitizing the
argument in kern_fcntl. As a matter of policy, limit to IO_SEQMAX rather
than INT16_MAX.

Also, fifos have overloaded the f_seqcount field for a completely different
purpose ever since r238936.  Formalize that by using a union type.

Reviewed by: cem
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20710

4 years agoSPC-3 and up require some UAs to be returned as fixed.
mav [Thu, 20 Jun 2019 22:20:30 +0000 (22:20 +0000)]
SPC-3 and up require some UAs to be returned as fixed.

MFC after: 2 weeks

4 years agoAdd PROT_MAX to the HISTORY section.
brooks [Thu, 20 Jun 2019 21:52:30 +0000 (21:52 +0000)]
Add PROT_MAX to the HISTORY section.

In the case of mmap(), add a HISTORY section.  Mention that mmap() and
mprotect()'s documentation predates an implementation.  The
implementation first saw wide use in 4.3-Reno, but there seems to be no
easy way to express that in mdoc so stick with 4.4BSD.

Reviewed by: emaste
Requested by: cem
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20713

4 years agoOptimize xpt_getattr().
mav [Thu, 20 Jun 2019 20:29:42 +0000 (20:29 +0000)]
Optimize xpt_getattr().

Do not allocate temporary buffer for attributes we are going to return
as-is, just make sure to NUL-terminate them.  Do not zero temporary 64KB
buffer for CDAI_TYPE_SCSI_DEVID, XPT tells us how much data it filled
and there are also length fields inside the returned data also.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agocxgbe/t4_tom: DDP_DEAD is a ddp flag and not a toepcb flag.
np [Thu, 20 Jun 2019 20:06:19 +0000 (20:06 +0000)]
cxgbe/t4_tom: DDP_DEAD is a ddp flag and not a toepcb flag.

The driver was in effect setting TPF_ABORT_SHUTDOWN on the toepcb
instead of what was intended.

MFC after: 1 week
Sponsored by: Chelsio Communications

4 years agoClarify vm_map_protect max_protection downgrade
emaste [Thu, 20 Jun 2019 18:30:19 +0000 (18:30 +0000)]
Clarify vm_map_protect max_protection downgrade

As reported in review D20709 by brooks calling vm_map_protect to set a
new max_protection value downgrades existing mappings if necessary (as
opposed to returning an error).

Reported by: brooks
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoExtend mmap/mprotect API to specify the max page protections.
brooks [Thu, 20 Jun 2019 18:24:16 +0000 (18:24 +0000)]
Extend mmap/mprotect API to specify the max page protections.

A new macro PROT_MAX() alters a protection value so it can be OR'd with
a regular protection value to specify the maximum permissions.  If
present, these flags specify the maximum permissions.

While these flags are non-portable, they can be used in portable code
with simple ifdefs to expand PROT_MAX() to 0.

This change allows (e.g.) a region that must be writable during run-time
linking or JIT code generation to be made permanently read+execute after
writes are complete.  This complements W^X protections allowing more
precise control by the programmer.

This change alters mprotect argument checking and returns an error when
unhandled protection flags are set.  This differs from POSIX (in that
POSIX only specifies an error), but is the documented behavior on Linux
and more closely matches historical mmap behavior.

In addition to explicit setting of the maximum permissions, an
experimental sysctl vm.imply_prot_max causes mmap to assume that the
initial permissions requested should be the maximum when the sysctl is
set to 1.  PROT_NONE mappings are excluded from this for compatibility
with rtld and other consumers that use such mappings to reserve
address space before mapping contents into part of the reservation.  A
final version this is expected to provide per-binary and per-process
opt-in/out options and this sysctl will go away in its current form.
As such it is undocumented.

Reviewed by: emaste, kib (prior version), markj
Additional suggestions from: alc
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18880

4 years agoClarify that vm_map_protect cannot upgrade max_protection
emaste [Thu, 20 Jun 2019 18:19:09 +0000 (18:19 +0000)]
Clarify that vm_map_protect cannot upgrade max_protection

It's implied by the man page's RETURN VALUES section, but be explicit in
the description that vm_map_protect can not set new protection bits that
are already in each entry's max_protection.

Reviewed by: brooks
MFC After: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20709

4 years agoVOP_REVOKE(9): update locking requirements per r143495
asomers [Thu, 20 Jun 2019 16:36:20 +0000 (16:36 +0000)]
VOP_REVOKE(9): update locking requirements per r143495

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20524