]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAdd riscv minidump support to libkvm.
markj [Tue, 5 Mar 2019 23:59:55 +0000 (23:59 +0000)]
Add riscv minidump support to libkvm.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
Differential Revision: https://reviews.freebsd.org/D19171

5 years agoInitialize dump_avail[] on riscv.
markj [Tue, 5 Mar 2019 23:58:16 +0000 (23:58 +0000)]
Initialize dump_avail[] on riscv.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
Differential Revision: https://reviews.freebsd.org/D19170

5 years agoAdd pmap_get_tables() for riscv.
markj [Tue, 5 Mar 2019 23:56:40 +0000 (23:56 +0000)]
Add pmap_get_tables() for riscv.

This mirrors the arm64 implementation and is for use in the minidump
code.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
Differential Revision: https://reviews.freebsd.org/D18321

5 years agoRound # partitions up to fill the last GPT table sector
marcel [Tue, 5 Mar 2019 22:55:33 +0000 (22:55 +0000)]
Round # partitions up to fill the last GPT table sector

Set the number of partitions entries in the GPT header to a
multiple of the number of entries that fit in a sector.

PR: 236238
Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19465

5 years agoAdd a few missed files to the MK_LLVM_TARGET_BPF=yes case, otherwise
dim [Tue, 5 Mar 2019 22:04:23 +0000 (22:04 +0000)]
Add a few missed files to the MK_LLVM_TARGET_BPF=yes case, otherwise
clang and various other executables will fail to link with undefined
symbols.

Reported by: O. Hartmann <ohartmann@walstatt.org>
MFC after: 1 month
X-MFC-With: r344779

5 years agoShow wiring state of map entries in procstat -v.
markj [Tue, 5 Mar 2019 19:45:37 +0000 (19:45 +0000)]
Show wiring state of map entries in procstat -v.

Note that only entries wired by userspace are shown as such.  In
particular, entries transiently wired by sysctl_wire_old_buffer() are
not flagged as wired in procstat -v output.

Reviewed by: kib (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19461

5 years agofreebsd-update.8: update example to contemporary versions
emaste [Tue, 5 Mar 2019 19:17:24 +0000 (19:17 +0000)]
freebsd-update.8: update example to contemporary versions

PR: 235761
Reported by: linimon
MFC after: 1 week

5 years agoRemove references to CONTIGMALLOC_WORKS in iflib and em
erj [Tue, 5 Mar 2019 19:12:51 +0000 (19:12 +0000)]
Remove references to CONTIGMALLOC_WORKS in iflib and em

From Jake:
"The iflib_fl_setup() function tries to pick various buffer sizes based
on the max_frame_size value defined by the parent driver. However, this
code was wrapped under CONTIGMALLOC_WORKS, which was never actually
defined anywhere.

This same code pattern was used in if_em.c, likely trying to match
what iflib uses.

Since CONTIGMALLOC_WORKS is not defined, remove this dead code from
iflib_fl_setup and if_em.c

Given that various iflib drivers appear to be using a similar
calculation, it might be worth making this buffer size a value that the
driver can peek at in the future."

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: shurd@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19199

5 years agolibllvm: promote WithColor and xxhash to SRCS_MIN
emaste [Tue, 5 Mar 2019 16:18:06 +0000 (16:18 +0000)]
libllvm: promote WithColor and xxhash to SRCS_MIN

The armv6 build failed in CI due to missing symbols (from these two
source files) in the bootstrap Clang.

This affected only armv6 because other Clang-using archs are using LLD
as the bootstrap linker, and thus include SRCS_MIW via LLD_BOOTSTRAP.

Reported by: CI, via lwhsu
Sponsored by: The FreeBSD Foundation

5 years agotun tests: Test renaming and destroying a tun interface in a vnet jail
kp [Tue, 5 Mar 2019 15:49:30 +0000 (15:49 +0000)]
tun tests: Test renaming and destroying a tun interface in a vnet jail

There was a problem destroying renamed tun interfaces in vnet jails. This was
fixed in r344794. Test the previously failing scenario.

PR: 235704
MFC after: 2 weeks

5 years agoremove the removed-from-source drm/drm2 parts
netchild [Tue, 5 Mar 2019 15:23:28 +0000 (15:23 +0000)]
remove the removed-from-source drm/drm2 parts

5 years agoFix typos in libusb.
hselasky [Tue, 5 Mar 2019 14:47:15 +0000 (14:47 +0000)]
Fix typos in libusb.

Found by: Denis Ahrens <denis@h3q.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agotun: VIMAGE fix for if_tun cloner
kp [Tue, 5 Mar 2019 13:21:07 +0000 (13:21 +0000)]
tun: VIMAGE fix for if_tun cloner

The if_tun cloner is not virtualised, but if_clone_attach() does use a
virtualised list of cloners.
The result is that we can't find the if_tun cloner when we try to remove
a renamed tun interface. Virtualise the cloner, and move the final
cleanup into a sysuninit so that we're sure this happens after all of
the vnet_sysuninits

Note that we need unit numbers to be system-unique (rather than unique
per vnet, as is done by if_clone_simple()). The unit number is used to
create the corresponding /dev/tunX device node, and this node must match
with the interface.
Switch to if_clone_advanced() so that we have control over the unit
numbers.

Reproduction scenario:
jail -c -n foo persist vnet
jexec test ifconfig tun create
jexec test ifconfig tun0 name wg0
jexec test ifconfig wg0 destroy

PR: 235704
Reviewed by: bz, hrs, hselasky
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19248

5 years agoFix binutils compilation error with Clang 8
jhibbits [Tue, 5 Mar 2019 04:16:50 +0000 (04:16 +0000)]
Fix binutils compilation error with Clang 8

Summary:
This change fixes the following compilation error when using clang 8 to cross
compile base to powerpc64:

```
/usr/src/gnu/usr.bin/binutils/libopcodes/../../../../contrib/binutils/opcodes/ppc-dis.c:100:35:
error: arithmetic on a null pointer treated as a cast from integer to pointer is
a GNU extension [-Werror,-Wnull-pointer-arithmetic]
  info->private_data = (char *) 0 + dialect;
       ~~~~~~~~~~ ^
1 error generated.
*** [ppc-dis.o] Error code 1

make[6]: stopped in /usr/src/gnu/usr.bin/binutils/libopcodes
1 error
```

Test Plan:
- buildworld for x86_64 (native)
- buildworld for powerpc64 (cross)
- buildworld for powerpc64 (native)

Submitted by: alfredo.junior_eldorado.org.br
Reviewed By: emaste, pfg, brooks
Differential Revision: https://reviews.freebsd.org/D19235

5 years agoRevert revision 254095
marcel [Tue, 5 Mar 2019 04:15:34 +0000 (04:15 +0000)]
Revert revision 254095

In revision 254095, gpt_entries is not set to match the on-disk
hdr_entries, but rather is computed based on available space.
There are 2 problems with this:

1.  The GPT backend respects hdr_entries and only reads and writes
    that number of partition entries.  On top of that, CRC32 is
    computed over the table that has hdr_entries elements.  When
    the common code works on what is possibly a larger number, the
    behaviour becomes inconsistent and problematic.  In particular,
    it would be possible to add a new partition that on a reboot
    isn't there anymore.
2.  The calculation of gpt_entries is based on flawed assumptions.
    The GPT specification does not dictate that sectors are layed
    out in a particular way that the available space can be
    determined by looking at LBAs.  In practice, implementations
    do the same thing, because there's no reason to do it any
    other way.  Still, GPT allows certain freedoms that can be
    exploited in some form or shape if the need arises.

PR: 229977
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19438

5 years agoFix grammar.
hrs [Tue, 5 Mar 2019 02:53:41 +0000 (02:53 +0000)]
Fix grammar.

Submitted by: Massimiliano Stucchi

5 years agoAllow for reproducible build
sjg [Mon, 4 Mar 2019 22:04:21 +0000 (22:04 +0000)]
Allow for reproducible build

Use SOURCE_DATE_EPOCH for BUILD_UTC if MK_REPRODUCIBLE_BUILD is yes.
Default SOURCE_DATE_EPOCH to 2019-01-01

Reviewed by: emaste
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D19464

5 years agobridge: Fix spurious warnings about capabilities
mav [Mon, 4 Mar 2019 22:01:09 +0000 (22:01 +0000)]
bridge: Fix spurious warnings about capabilities

Mask off the bits we don't care about when checking that capabilities
of the member interfaces have been disabled as intended.

Submitted by: Ryan Moeller <ryan@ixsystems.com>
Reviewed by: kristof, mav
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D18924

5 years agoAdd -d flag to load command
sjg [Mon, 4 Mar 2019 19:50:59 +0000 (19:50 +0000)]
Add -d flag to load command

When doing load -t manifest -d increments debug level

Reviewed by: stevek

5 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
dim [Mon, 4 Mar 2019 19:39:59 +0000 (19:39 +0000)]
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
the upstream release_80 branch r355313 (effectively, 8.0.0 rc3).  The
release will follow very soon, but no more functional changes are
expected.

Release notes for llvm, clang and lld 8.0.0 will soon be available here:
<https://releases.llvm.org/8.0.0/docs/ReleaseNotes.html>
<https://releases.llvm.org/8.0.0/tools/clang/docs/ReleaseNotes.html>
<https://releases.llvm.org/8.0.0/tools/lld/docs/ReleaseNotes.html>

PR: 236062
Relnotes: yes
MFC after: 1 month

5 years agoSet tentative merge date, and bump __FreeBSD_version.
dim [Mon, 4 Mar 2019 19:23:11 +0000 (19:23 +0000)]
Set tentative merge date, and bump __FreeBSD_version.

5 years agoMerge ^/head r344549 through r344775.
dim [Mon, 4 Mar 2019 19:14:32 +0000 (19:14 +0000)]
Merge ^/head r344549 through r344775.

5 years agoMerge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
dim [Mon, 4 Mar 2019 19:06:51 +0000 (19:06 +0000)]
Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r355313, resolve conflicts, and bump version numbers.

5 years agotests: Move common (vnet) test functions into a common file
kp [Mon, 4 Mar 2019 18:15:06 +0000 (18:15 +0000)]
tests: Move common (vnet) test functions into a common file

The netipsec and pf tests have a number of common test functions. These
used to be duplicated, but it makes more sense for them to re-use the
common functions.

PR: 236223

5 years agoDon't pass td to nfsvno_open().
trasz [Mon, 4 Mar 2019 14:50:00 +0000 (14:50 +0000)]
Don't pass td to nfsvno_open().

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDon't pass td to nfsvno_createsub().
trasz [Mon, 4 Mar 2019 14:30:53 +0000 (14:30 +0000)]
Don't pass td to nfsvno_createsub().

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd IBM TS1160 density codes to libmt and the mt(1) man page.
ken [Mon, 4 Mar 2019 14:30:37 +0000 (14:30 +0000)]
Add IBM TS1160 density codes to libmt and the mt(1) man page.

These are taken directly from the density report from a TS1160
tape drive.  (Using mt getdensity)

A TS1160 drive stores 20TB raw (60TB with compression) on a JE tape.

lib/libmt/mtlib.c:
Add 3592A6 encrypted/unencrypted density codes, and bpmm/bpi
values.

usr.bin/mt/mt.1:
Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
values and number of tracks.  Bump the man page date.

MFC after: 3 days
Sponsored by: Spectra Logic

5 years agoDon't pass td to nfsd_fhtovp(), it's unused.
trasz [Mon, 4 Mar 2019 13:18:04 +0000 (13:18 +0000)]
Don't pass td to nfsd_fhtovp(), it's unused.

Reviewed by: rmacklem (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19421

5 years agoPush down the thread argument in NFS server code, using curthread
trasz [Mon, 4 Mar 2019 13:12:23 +0000 (13:12 +0000)]
Push down the thread argument in NFS server code, using curthread
instead of passing it explicitly. No functional changes

Reviewed by: rmacklem (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19419

5 years agoPush down td in nfsrvd_dorpc() - make it use curthread instead
trasz [Mon, 4 Mar 2019 13:02:36 +0000 (13:02 +0000)]
Push down td in nfsrvd_dorpc() - make it use curthread instead
of it being explicitly passed as an argument. No functional changes.

The big picture here is that I want to get rid of the 'td' argument
being passed everywhere, and this is the first piece that affects
the NFS server.

Reviewed by: rmacklem
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19417

5 years agoFix double free in case of mount error.
fsu [Mon, 4 Mar 2019 11:33:49 +0000 (11:33 +0000)]
Fix double free in case of mount error.

Reported by:    Christopher Krah <krah@protonmail.com>
Reported as:    FS-9-EXT3-2: Denial Of Service in nmount-5 (vm_fault_hold)
Reviewed by:    pfg
MFC after:      1 week

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

5 years agoDo not read the on-disk inode in case of vnode allocation.
fsu [Mon, 4 Mar 2019 11:27:47 +0000 (11:27 +0000)]
Do not read the on-disk inode in case of vnode allocation.

Reported by:    Christopher Krah <krah@protonmail.com>
Reported as:    FS-6-EXT2-4: Denial Of Service in mkdir-0 (ext2_mkdir/vn_rdwr)
Reviewed by:    pfg
MFC after:      1 week

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

5 years agoFix integer overflow possibility.
fsu [Mon, 4 Mar 2019 11:19:21 +0000 (11:19 +0000)]
Fix integer overflow possibility.

Reported by:    Christopher Krah <krah@protonmail.com>
Reported as:    FS-2-EXT2-1: Out-of-Bounds Write in nmount (ext2_vget)
Reviewed by:    pfg
MFC after:      1 week

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

5 years agoDo not panic if inode bitmap is corrupted.
fsu [Mon, 4 Mar 2019 11:12:19 +0000 (11:12 +0000)]
Do not panic if inode bitmap is corrupted.

admbug:         804
Reported by:    Ilja Van Sprundel <ivansprundel@ioactive.com>
Reviewed by:    pfg
MFC after:      1 week

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

5 years agoValidate block bitmaps.
fsu [Mon, 4 Mar 2019 11:01:23 +0000 (11:01 +0000)]
Validate block bitmaps.

Reviewed by:    pfg
MFC after:      1 week

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

5 years agoAdd additional on-disk inode checks.
fsu [Mon, 4 Mar 2019 10:55:01 +0000 (10:55 +0000)]
Add additional on-disk inode checks.

Reviewed by:    pfg
MFC after:      1 week

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

5 years agoMake superblock reading logic more strict.
fsu [Mon, 4 Mar 2019 10:42:25 +0000 (10:42 +0000)]
Make superblock reading logic more strict.

Add more on-disk superblock consistency checks to ext2_compute_sb_data() function.
It should decrease the probability of mounting filesystems with corrupted superblock data.

Reviewed by:    pfg
MFC after:      1 week

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

5 years ago[ath_hal_ar9300] Add the extra ANI configuration fields for the AR93xx HAL.
adrian [Mon, 4 Mar 2019 06:43:00 +0000 (06:43 +0000)]
[ath_hal_ar9300] Add the extra ANI configuration fields for the AR93xx HAL.

Tested:

* Carambola2 (Ar9331), STA/AP modes

5 years ago[ath_hal] add extra ANI fields for the AR9300 HAL.
adrian [Mon, 4 Mar 2019 06:42:06 +0000 (06:42 +0000)]
[ath_hal] add extra ANI fields for the AR9300 HAL.

I'm trying to debug why reception upstairs here is so terrible and it
turns out ANI is buggy.  (Which is no surprise, ANI is always buggy.)

Tested:

* Carambola2 (AR9331), STA/AP modes

5 years agoAllow to build ifconfig(8) without wireless support
avos [Mon, 4 Mar 2019 03:47:06 +0000 (03:47 +0000)]
Allow to build ifconfig(8) without wireless support

The change removes SIOC[GS]IEEE80211 handling from ifconfig(8)
if WITHOUT_WIRELESS_SUPPORT=yes is set in src.conf(5).

Reviewed by: bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19289

5 years agortwn_usb(4): fix Tx instability with RTL8192CU chipsets
avos [Mon, 4 Mar 2019 03:02:14 +0000 (03:02 +0000)]
rtwn_usb(4): fix Tx instability with RTL8192CU chipsets

- Fix data frames transmission via POWER_STATUS register setup -
it seems to be set by MACID_CONFIG firmware command, which was broken*
in r290439 and later disabled in r307529.

We can re-enable it later if / when firmware rate adaptation will be
ready; however, this step will be required anyway - for firmware-less
builds.

- Force RTS / CTS protection frame rate to CCK1 (this rate works fine
without any additional setup; no better workaround is known yet).

The problem was not observed on the channel 1 or with CCK1 rate enforced
('ifconfig wlan0 ucastrate 1' for 11 b/g; not possible for 11n networks
due to ifconfig(8) bug).

* I'm not sure if it works before r290439 because - AFAIR - I never seen
firmware rate adaptation working for 10-STABLE urtwn(4)
(It needs EN_BCN bit set and RSSI updates at least).

Tested with RTL8188CUS in STA mode
(in regular mode and with disabled MRR - DARFRC*8 is set to 0)

PR: 233949
MFC after: 2 weeks

5 years agortwn_usb(4): fix LED blinking for RTL8192CU during scanning
avos [Mon, 4 Mar 2019 01:54:28 +0000 (01:54 +0000)]
rtwn_usb(4): fix LED blinking for RTL8192CU during scanning

Tested with RTL8188CUS, STA mode.

MFC after: 5 days

5 years agoReduce CTL threads priority to about PUSER.
mav [Mon, 4 Mar 2019 00:49:07 +0000 (00:49 +0000)]
Reduce CTL threads priority to about PUSER.

Since in most configurations CTL serves as network service, we found
that this change improves local system interactivity under heavy load.
Priority of main threads is set slightly higher then worker taskqueues
to make them quickly sort incoming requests not creating bottlenecks,
while plenty of worker taskqueues should be less sensitive to latency.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

5 years agoAllocate an assocition id and register the stcb with holding the lock.
tuexen [Sun, 3 Mar 2019 19:55:06 +0000 (19:55 +0000)]
Allocate an assocition id and register the stcb with holding the lock.
This avoids a race where stcbs can be found, which are not completely
initialized.

This was found by running syzkaller.

MFC after: 3 days

5 years agoRemove bogus assert that I added in r319722. It is a legitimate case
glebius [Sun, 3 Mar 2019 18:57:48 +0000 (18:57 +0000)]
Remove bogus assert that I added in r319722. It is a legitimate case
to call soabort() on a newborn socket created by sonewconn() in case
if further setup of PCB failed. Code in sofree() handles such socket
correctly.

Submitted by: jtl, rrs
MFC after: 3 weeks

5 years agoFix compilation of world with WITHOUT_{INET,INET6}_SUPPORT or both set.
bz [Sun, 3 Mar 2019 10:00:26 +0000 (10:00 +0000)]
Fix compilation of world with WITHOUT_{INET,INET6}_SUPPORT or both set.

Buildworld failed when both WITHOUT_INET6_SUPPORT and INET equivalent were set.
Fix netstat and syslogd by applying appropriate #ifdef INET/INET6 to make world
compile again.

Reviewed by: ngie, hrs, ume
Welcomed by: Michael Dexter (D17040)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D19418

5 years agoUse struct addrinfo instead of struct sockaddr_storage
hrs [Sun, 3 Mar 2019 05:30:15 +0000 (05:30 +0000)]
Use struct addrinfo instead of struct sockaddr_storage
to store peer addresses.

5 years agoAdd ABORTED_BY_REQUEST to the list of things we look at DNR bit and tell why to comme...
imp [Sun, 3 Mar 2019 03:36:33 +0000 (03:36 +0000)]
Add ABORTED_BY_REQUEST to the list of things we look at DNR bit and tell why to comment (code already does this)

5 years agoAllow the sector size of the disk device to be configured using hints or
ian [Sat, 2 Mar 2019 23:20:47 +0000 (23:20 +0000)]
Allow the sector size of the disk device to be configured using hints or
FDT data.  The sector size must be a multiple of the device's page size.
If not configured, use the historical default of the device page size.

Setting the disk sector size to 512 or 4096 allows a variety of standard
filesystems to be used on the device.  Of course you wouldn't want to be
writing frequently to a SPI flash chip like it was a disk drive, but for
data that gets written once (or rarely) and read often, using a standard
filesystem is a nice convenient thing.

5 years agoAdd some comments. Give #define'd names to some scattered numbers. Change
ian [Sat, 2 Mar 2019 22:28:43 +0000 (22:28 +0000)]
Add some comments.  Give #define'd names to some scattered numbers.  Change
some #define'd names to be more descriptive.  When reporting a post-write
compare failure, report the page number, not the byte address of the page.
The latter is the only functional change, it makes the number match the
words of the error message.

5 years agoProperly calculate the last used logical block of a file when checking
mckusick [Sat, 2 Mar 2019 21:30:01 +0000 (21:30 +0000)]
Properly calculate the last used logical block of a file when checking
inodes that reference directories. While here tighten the check for
comparing the last logical block with the end of the file.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: Netflix

5 years agoThe size of the UFS soft-updates journal must be a multiple of the
mckusick [Sat, 2 Mar 2019 21:22:56 +0000 (21:22 +0000)]
The size of the UFS soft-updates journal must be a multiple of the
filesystem block size. When a size is specified with the -S flag
to tunefs(8), round it up to the filesystem block size.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: Netflix

5 years agopowerpc: fix 'show spr' for ELFv1 powerpc64
jhibbits [Sat, 2 Mar 2019 21:11:46 +0000 (21:11 +0000)]
powerpc: fix 'show spr' for ELFv1 powerpc64

Update and flush the right cache range for the ELFv1 ABI.

MFC after: 1 week

5 years agopowerpc/booke: Depessimize MAS register updates even more
jhibbits [Sat, 2 Mar 2019 20:59:18 +0000 (20:59 +0000)]
powerpc/booke: Depessimize MAS register updates even more

Remove isyncs between MAS register updates in the TLB miss handler, since
it's only needed before the TLB update instructions.

5 years agoBugfix: use a dummy buffer for the inactive side of a transfer.
ian [Sat, 2 Mar 2019 20:58:51 +0000 (20:58 +0000)]
Bugfix: use a dummy buffer for the inactive side of a transfer.

This is especially important for writes.  SPI is inherently a bidirectional
bus; you receive data (even if it's garbage) while writing.  We should not
receive that data into the same buffer we're writing to the device.

When reading it doesn't matter what we send to the device, but using the
dummy buffer for that as well is pleasingly symmetrical.

5 years agoRemove debug output.
tuexen [Sat, 2 Mar 2019 16:10:11 +0000 (16:10 +0000)]
Remove debug output.

MFC after: 3 days

5 years agoAllow SCTP stream reconfiguration operations only in ESTABLISHED
tuexen [Sat, 2 Mar 2019 14:30:27 +0000 (14:30 +0000)]
Allow SCTP stream reconfiguration operations only in ESTABLISHED
state.

This issue was found by running syzkaller.

MFC after: 3 days

5 years agoHandle the case when calling the IPPROTO_SCTP level socket option
tuexen [Sat, 2 Mar 2019 14:15:33 +0000 (14:15 +0000)]
Handle the case when calling the IPPROTO_SCTP level socket option
SCTP_STATUS on an association with no primary path (early state).

This issue was found by running syzkaller.

MFC after: 3 days

5 years agoUse correct buffer sizes in sctp_get[lp]addrs().
tuexen [Sat, 2 Mar 2019 13:16:01 +0000 (13:16 +0000)]
Use correct buffer sizes in sctp_get[lp]addrs().

MFC after: 3 days

5 years agoReport the correct length when using the IPPROTO_SCTP level
tuexen [Sat, 2 Mar 2019 13:12:37 +0000 (13:12 +0000)]
Report the correct length when using the IPPROTO_SCTP level
socket options SCTP_GET_PEER_ADDRESSES and SCTP_GET_LOCAL_ADDRESSES.

5 years agopf tests: Test for nested inline anchor issue
kp [Sat, 2 Mar 2019 12:30:59 +0000 (12:30 +0000)]
pf tests: Test for nested inline anchor issue

PR: 196314
MFC after: 1 week

5 years agocxgbev(4): Enable 32b port capabilities in the VF driver.
np [Sat, 2 Mar 2019 04:39:59 +0000 (04:39 +0000)]
cxgbev(4): Enable 32b port capabilities in the VF driver.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoEFI: don't call printf after ExitBootServices, since it uses Boot Services
bcran [Sat, 2 Mar 2019 04:02:11 +0000 (04:02 +0000)]
EFI: don't call printf after ExitBootServices, since it uses Boot Services

ExitBootServices terminates all boot services including console access.
Attempting to call printf afterwards can result in a crash, depending on the
implementation.

Move any printf statements to before we call bi_load, and remove any that
depend on calling bi_load first.

Reviewed by: imp, tsoome
Differential Revision: https://reviews.freebsd.org/D19374

5 years agopowerpc: Scale intrcnt by mp_ncpus
jhibbits [Sat, 2 Mar 2019 01:51:41 +0000 (01:51 +0000)]
powerpc: Scale intrcnt by mp_ncpus

On very large powerpc64 systems (2x22x4 power9) it's very easy to run out of
available IRQs and crash the system at boot.  Scale the count by mp_ncpus,
similar to x86, so this doesn't happen.  Further work can be done in the future
to scale the I/O IRQs as well, but that's left for the future.

Submitted by: mmacy
MFC after: 3 weeks

5 years agoEmbedded chacha: Add 0-bit iv + 128-bit counter mode
cem [Fri, 1 Mar 2019 23:30:23 +0000 (23:30 +0000)]
Embedded chacha: Add 0-bit iv + 128-bit counter mode

This mode might be suitable for a Fortuna keystream primitive.

Reviewed by: markm
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19410

5 years agofortuna: Deduplicate kernel vs user includes
cem [Fri, 1 Mar 2019 22:51:45 +0000 (22:51 +0000)]
fortuna: Deduplicate kernel vs user includes

No functional change.

Reviewed by: markj, markm
Approved by: secteam (delphij), core (brooks)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19409

5 years agoFix missed posted interrupts in VT-x in bhyve.
jhb [Fri, 1 Mar 2019 20:43:48 +0000 (20:43 +0000)]
Fix missed posted interrupts in VT-x in bhyve.

When a vCPU is HLTed, interrupts with a priority below the processor
priority (PPR) should not resume the vCPU while interrupts at or above
the PPR should.  With posted interrupts, bhyve maintains a bitmap of
pending interrupts in PIR descriptor along with a single 'pending'
bit.  This bit is checked by a CPU running in guest mode at various
places to determine if it should be checked.  In addition, another CPU
can force a CPU in guest mode to check for pending interrupts by
sending an IPI to a special IDT vector reserved for this purpose.

bhyve had a bug in that it would only notify a guest vCPU of an
interrupt (e.g. by sending the special IPI or by resuming it if it was
idle due to HLT) if an interrupt arrived that was higher priority than
PPR and no interrupts were currently pending.  This assumed that if
the 'pending' bit was set, any needed notification was already in
progress.  However, if the first interrupt sent to a HLTed vCPU was
lower priority than PPR and the second was higher than PPR, the first
interrupt would set 'pending' but not notify the vCPU, and the second
interrupt would not notify the vCPU because 'pending' was already set.
To fix this, track the priority of pending interrupts in a separate
per-vCPU bitmask and notify a vCPU anytime an interrupt arrives that
is above PPR and higher than any previously-received interrupt.

This was found and debugged in the bhyve port to SmartOS maintained by
Joyent.  Relevant SmartOS bugs with more background:

https://smartos.org/bugview/OS-6829
https://smartos.org/bugview/OS-6930
https://smartos.org/bugview/OS-7354

Submitted by: Patrick Mooney <pmooney@pfmooney.com>
Reviewed by: tychon, rgrimes
Obtained from: SmartOS / Joyent
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19299

5 years agoFortuna: push CTR-mode loop down into randomdev hash.h interface
cem [Fri, 1 Mar 2019 19:21:45 +0000 (19:21 +0000)]
Fortuna: push CTR-mode loop down into randomdev hash.h interface

As a step towards adding other potential streaming ciphers.  As well as just
pushing the loop down into the rijndael APIs (basically 128-bit wide AES-ICM
mode) to eliminate some excess explicit_bzero().

No functional change intended.

Reviewed by: delphij, markm
Approved by: secteam (delphij)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19411

5 years agoFix typos and caps for ipfw(8) man page.
ygy [Fri, 1 Mar 2019 19:06:13 +0000 (19:06 +0000)]
Fix typos and caps for ipfw(8) man page.

MFC after: 3 days
PR: 236030
Submitted by: olgeni

5 years agoHonor the memory limits provided when processing the IPPROTO_SCTP
tuexen [Fri, 1 Mar 2019 18:47:41 +0000 (18:47 +0000)]
Honor the memory limits provided when processing the IPPROTO_SCTP
level socket option SCTP_GET_LOCAL_ADDRESSES in a getsockopt() call.

Thanks to Thomas Barabosch for reporting the issue which was found by
running syzkaller.

MFC after: 3 days

5 years agoRemove sv_pagesize, originally introduced with r100384.
trasz [Fri, 1 Mar 2019 16:16:38 +0000 (16:16 +0000)]
Remove sv_pagesize, originally introduced with r100384.

In all of the architectures we have today, we always use PAGE_SIZE.
While in theory one could define different things, none of the
current architectures do, even the ones that have transitioned from
32-bit to 64-bit like i386 and arm. Some ancient mips binaries on
other systems used 8k instead of 4k, but we don't support running
those and likely never will due to their age and obscurity.

Reviewed by: imp (who also contributed the commit message)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19280

5 years agoImprove consistency, not functional change.
tuexen [Fri, 1 Mar 2019 15:57:55 +0000 (15:57 +0000)]
Improve consistency, not functional change.

MFC after: 3 days

5 years agoThere is no `device atacard` but there is `device atapccard`.
mav [Fri, 1 Mar 2019 15:00:13 +0000 (15:00 +0000)]
There is no `device atacard` but there is `device atapccard`.

Reported by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week

5 years agoFix incorrect / unused sector_count for identify requests
smh [Fri, 1 Mar 2019 14:39:15 +0000 (14:39 +0000)]
Fix incorrect / unused sector_count for identify requests

Fix incorrect / unused sector_count for identify requests from camcontrol.

Submitted by: Alexey Dokuchaev
Reported by: Alexey Dokuchaev
MFC after: 1 week
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D19408

5 years agoAdd ushort and ulong to linux/types.h.
bz [Fri, 1 Mar 2019 14:33:20 +0000 (14:33 +0000)]
Add ushort and ulong to linux/types.h.

When porting code once written for Linux we find not only uints but also ushort and ulong.
Provide central typedefs as part of the linuxkpi for those as well.

Reviewed by: hselasky, emaste
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19405

5 years agoarm64: rockchip: rk3399_pll: Fix the recalc function
manu [Fri, 1 Mar 2019 13:05:37 +0000 (13:05 +0000)]
arm64: rockchip: rk3399_pll: Fix the recalc function

The plls frequency are now correctly calculated in fractional mode
and integer mode.
While here add some debug printfs (disabled by default)
Tested with powerd on the little cluster on a RockPro64.

MFC after: 1 week

5 years agonetmap: pkt-gen: fix bug in send_packets()
vmaffione [Fri, 1 Mar 2019 09:10:16 +0000 (09:10 +0000)]
netmap: pkt-gen: fix bug in send_packets()

The send_packets() function was using ring->cur as index to scan
the transmit ring. This function may also set ring->cur ahead of
ring->head, in case no more slots are available. However, the function
also uses nm_ring_space() which looks at ring->head to check how many
slots are available. If ring->head and ring->cur are different, this
results in pkt-gen advancing ring->cur beyond ring->tail.

This patch fixes send_packets() (and similar source locations) to
use ring->head as a index, rather than using ring->cur.

MFC after: 1 week

5 years agopf tests: Test CVE-2019-5597
kp [Fri, 1 Mar 2019 07:39:55 +0000 (07:39 +0000)]
pf tests: Test CVE-2019-5597

Generate a fragmented packet with different header chains, to provoke
the incorrect behaviour of pf.
Without the fix this will trigger a panic.

Obtained from: Corentin Bayet, Nicolas Collignon, Luca Moro at Synacktiv

5 years agopf: IPv6 fragments with malformed extension headers could be erroneously passed by...
kp [Fri, 1 Mar 2019 07:37:45 +0000 (07:37 +0000)]
pf: IPv6 fragments with malformed extension headers could be erroneously passed by pf or cause a panic

We mistakenly used the extoff value from the last packet to patch the
next_header field. If a malicious host sends a chain of fragmented packets
where the first packet and the final packet have different lengths or number of
extension headers we'd patch the next_header at the wrong offset.
This can potentially lead to panics or rule bypasses.

Security:       CVE-2019-5597
Obtained from:  OpenBSD
Reported by:    Corentin Bayet, Nicolas Collignon, Luca Moro at Synacktiv

5 years agoImprove readability of the code by making it explicit where the 'c' variable
pjd [Fri, 1 Mar 2019 05:54:13 +0000 (05:54 +0000)]
Improve readability of the code by making it explicit where the 'c' variable
starts. It is also more consistent with similar code in this file.

5 years agopowerpc/powernv: Add OPAL flash device driver
jhibbits [Fri, 1 Mar 2019 04:36:55 +0000 (04:36 +0000)]
powerpc/powernv: Add OPAL flash device driver

Firmware needed by petitboot, for example, GPU firmware, can be installed to
a partition in the flash filesystem.  This driver exposes the full flash
given by the device tree, letting the user manage firmware, etc, from
FreeBSD.

To use the partitions provided by the flash module, the fdt_slicer module is
needed, but the module isn't needed for raw access, so there's no direct
dependency link in here.

MFC after: 2 weeks

5 years agoAdd another required header file.
ian [Fri, 1 Mar 2019 04:17:43 +0000 (04:17 +0000)]
Add another required header file.

For some reason this seems to be required on aarch64, but I can build armv7
from clean without needing this in the list.  (The file does get included,
so the mystery is why armv7 works.)

5 years agoAdd required header file to SRCS.
ian [Fri, 1 Mar 2019 03:09:43 +0000 (03:09 +0000)]
Add required header file to SRCS.

5 years agoUndo accidental part of r344681.
ian [Fri, 1 Mar 2019 02:53:54 +0000 (02:53 +0000)]
Undo accidental part of r344681.

I think I must have accidentally mouse-click pasted while scrolling and
didn't notice it.

Reported by: jhibbits@

5 years agopowerpc/powernv: Add asynchronous token management for powernv
jhibbits [Fri, 1 Mar 2019 02:49:47 +0000 (02:49 +0000)]
powerpc/powernv: Add asynchronous token management for powernv

The OPAL firmware only supports a finite number of in-flight asynchronous
operations.  Rather than have each subsystem try to manage its own, use a
central management service to hand out tokens.

More work can be done to improve asynchronous behavior, such as funneling
things through a future OPAL heartbeat handler, but capabilities will be
added as needed.

Augment the existing consumers (i2c and sensors) to use this new API.

MFC after: 4 weeks

5 years agocxgbe(4): Don't forget to report link state to the kernel if the link is
np [Fri, 1 Mar 2019 02:43:30 +0000 (02:43 +0000)]
cxgbe(4): Don't forget to report link state to the kernel if the link is
already up at attach.

Reported by: Fabrice Bruel @ Orange Business Service
MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoBuild fdt support modules on systems that use fdt data.
ian [Fri, 1 Mar 2019 02:31:43 +0000 (02:31 +0000)]
Build fdt support modules on systems that use fdt data.

kern.opts.mk sets make var OPT_FDT to a non-empty value if platform.h
contains OPT_FDT.

5 years agoRevert r344675
jhibbits [Fri, 1 Mar 2019 02:08:12 +0000 (02:08 +0000)]
Revert r344675

It's an incorrect approach to solve the problem.  We already have a
fdt/fdt_slicer module, it just needs to be wired into the build.

5 years agocxgb(4): Netdump: only reference allocated qsets
cem [Fri, 1 Mar 2019 01:57:22 +0000 (01:57 +0000)]
cxgb(4): Netdump: only reference allocated qsets

SGE_QSETS is an upper bound -- fewer qsets may be allocated depending on
the number of CPUs.

Reviewed by: markj, np, vangyzen
X-MFC-With: r333288
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D17274

5 years agopatch(1): Exit successfully if we're fed a 0-length patch
kevans [Fri, 1 Mar 2019 01:20:21 +0000 (01:20 +0000)]
patch(1): Exit successfully if we're fed a 0-length patch

This change is made in the name of GNU patch compatibility. If GNU patch is
fed a zero-length patch, it will exit successfully with no output. This is
used in at least one port to date (comms/wsjtx), and we break on this usage.

It seems unlikely that anyone relies on patch(1) calling their completely
empty patch garbage and failing, and GNU compatibility is a plus if it helps
with porting, so make the switch.

Reported by: db
MFC after: 2 weeks

5 years agoPrevent detaching driver if the attach is not finished
mw [Fri, 1 Mar 2019 01:18:39 +0000 (01:18 +0000)]
Prevent detaching driver if the attach is not finished

When the device is in attaching state, detach should return
EBUSY instead of success. In other case, there could be race
between attach and detach during the driver unloading.

If driver goes sleep and releases GIANT lock during attaching,
unloading module could start. In such case when attach continues
after module unload, page fault "supervisor read instruction,
page not present" occurred.

This patch works around the real issue, which is a locking
deficiency of the busses.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: imp
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Differential Revision: https://reviews.freebsd.org/D19375

5 years agoGEOM: Add fdt_slicer to the GEOM flashmap module for fdt-based platforms
jhibbits [Thu, 28 Feb 2019 23:00:47 +0000 (23:00 +0000)]
GEOM: Add fdt_slicer to the GEOM flashmap module for fdt-based platforms

geom_flashmap depends on a slicer being available in order to do any
work.  On fdt platforms this is provided by fdt_slicer, but this needs
to be available.  Often it's compiled into the kernel for platforms that
boot from the relevant media, but this is not always the case.  Add the
file to the geom_flashmap module so that it can be used on platforms
which don't always need this functionality available.

5 years agoDon't assume all children of a nexus are ports.
jhb [Thu, 28 Feb 2019 22:10:19 +0000 (22:10 +0000)]
Don't assume all children of a nexus are ports.

Specifically, ccr(4) devices are also children of cxgbe nexus devices.
Rather than making assumptions about the child device's softc, walk
the list of ports from the nexus' softc to determine if a child is a
port in t4_child_location_str().  This fixes a panic when detaching a
ccr device.

Reviewed by: np
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D19399

5 years agoAllow FIONBIO and FIOASYNC ioctls on POSIX shm descriptors.
markj [Thu, 28 Feb 2019 22:00:36 +0000 (22:00 +0000)]
Allow FIONBIO and FIOASYNC ioctls on POSIX shm descriptors.

They have no effect, as with filesystem file descriptors.
This improves compatibility with some existing userspace code.

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19330

5 years agoLimit 24xx adapters to only MSI interrupts by default.
mav [Thu, 28 Feb 2019 21:07:16 +0000 (21:07 +0000)]
Limit 24xx adapters to only MSI interrupts by default.

This was actually the known good configuration we used before.
Single MSI-X configuration doesn't even work there on my tests, just due
to lack of documentation not sure whether by design or I am doing something
wrong.

PR: 233654
MFC after: 1 week

5 years agobsd.nls.mk isn't optional.
bdrewery [Thu, 28 Feb 2019 20:48:18 +0000 (20:48 +0000)]
bsd.nls.mk isn't optional.

It is protected by MK_NLS.  If it should really be optional then
it needs to be documented as such in share/mk/bsd.README and
.sinclude used where needed.

This fixes a regression from r335011.

PR: 232527
Submitted by: jarrod@downtools.com.au
Reported by: ktullavik@gmail.com
MFC after: 3 days

5 years agoGrammar tweaks in ipfw manual page.
trhodes [Thu, 28 Feb 2019 20:43:03 +0000 (20:43 +0000)]
Grammar tweaks in ipfw manual page.

5 years agoInvalidate cache for the PDPTE page when using PAE paging but PAT is
kib [Thu, 28 Feb 2019 19:19:02 +0000 (19:19 +0000)]
Invalidate cache for the PDPTE page when using PAE paging but PAT is
not supported.

According to SDM rev. 69 vol. 3, for PDPTE registers loads:
- when PAT is not supported, access to the PDPTE page is performed as
  UC, see 4.9.1;
- when PAT is supported, the access is WB, see 4.9.2.

So potentially CPU might load stale memory as PDPTEs if both PAT and
self-snoop are not implemented.  To be safe, add total local cache
flush to pmap_cold() before initial load of cr3, and flush PDPTE page
in pmap_pinit(), if PAT is not implemented.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D19365

5 years agoRemove references to pdwait4(2) and `CAP_PDWAIT` from rights(4)
ngie [Thu, 28 Feb 2019 18:12:14 +0000 (18:12 +0000)]
Remove references to pdwait4(2) and `CAP_PDWAIT` from rights(4)

@cem removed references to pdwait4(2) (a nonexistent syscall) in
r320058.

This change removes references to pdwait4(2) and `CAP_PDWAIT` in
rights(4) to not mislead the user into thinking that pdwait4(2)/`CAP_PDWAIT` is
actually implemented in the stock FreeBSD kernel.

The goal of this functionality was to simplify monitoring/manipulating
processes started with `pdfork`, et al, and avoid races with waiting on pids.
The syscall was never completed though--just discussed on the capsicum mailing
list back in 2015:
https://lists.cam.ac.uk/pipermail/cl-capsicum-discuss/2015-May/msg00012.html
. That being said, there are members of the project (@rwatson, etc) who
have longterm goals to implement this syscall to better secure pdfork(2)
calls.

PR: 235871
Reviewed by: emaste
Discussed with: rwatson
Approved by: emaste (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18950

5 years agoLimit 24xx adapters to only one MSI-X interrupt by default.
mav [Thu, 28 Feb 2019 15:36:03 +0000 (15:36 +0000)]
Limit 24xx adapters to only one MSI-X interrupt by default.

These are 4Gb/s and pretty old and slow now, so I see no reason to fight
for their performance over stability.

PR: 233654
MFC after: 1 week
Sponsored by: iXsystems, Inc.