]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoAdd a RELNOTES entry for r363084.
Mark Johnston [Fri, 10 Jul 2020 19:58:26 +0000 (19:58 +0000)]
Add a RELNOTES entry for r363084.

3 years agoAdjust .Dd, missed in r363084.
Mark Johnston [Fri, 10 Jul 2020 19:58:07 +0000 (19:58 +0000)]
Adjust .Dd, missed in r363084.

MFC with: r363084

3 years agoAdd a --sctp flag to nc.
Mark Johnston [Fri, 10 Jul 2020 19:54:04 +0000 (19:54 +0000)]
Add a --sctp flag to nc.

The change adds an SCTP mode akin to UDP mode.  This is handy for doing
smoke testing of SCTP.

Use a long option to minimize the risk of option conflicts with OpenBSD.
For bonus points, this change unbreaks --no-tcpopt by adding a missing
case required by getopt_long().

Reviewed by: delphij, tuexen
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25610

3 years agoinstall(1): addition to r363067
Eugene Grosbein [Fri, 10 Jul 2020 17:42:22 +0000 (17:42 +0000)]
install(1): addition to r363067

Also, make it not break if STRIPBIN points to strip version without -o support
and destination does not exist before installing.

Reported by: lwhsu
MFC after:      1 month
X-MFC-With:     363064

3 years agoWhitespace changes due to upstreaming r363079.
Michael Tuexen [Fri, 10 Jul 2020 16:59:06 +0000 (16:59 +0000)]
Whitespace changes due to upstreaming r363079.

3 years agoProvide support for building SCTP as a loadable module.
Mark Johnston [Fri, 10 Jul 2020 14:56:05 +0000 (14:56 +0000)]
Provide support for building SCTP as a loadable module.

With this change, a kernel compiled with "options SCTP_SUPPORT" and
without "options SCTP" supports dynamic loading of the SCTP stack.

Currently sctp.ko cannot be unloaded since some prerequisite teardown
logic is not yet implemented.  Attempts to unload the module will return
EOPNOTSUPP.

Discussed with: tuexen
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21997

3 years agoImplement the bitmap_subset() function in the LinuxKPI. This function
Hans Petter Selasky [Fri, 10 Jul 2020 12:06:18 +0000 (12:06 +0000)]
Implement the bitmap_subset() function in the LinuxKPI. This function
checks if the bitmap pointed to by the first argument is a subset of
the bitmap pointed to by the second argument. The function returns one
on success and zero on failure.

MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoImplement the array_size() function in the LinuxKPI. This function
Hans Petter Selasky [Fri, 10 Jul 2020 11:27:54 +0000 (11:27 +0000)]
Implement the array_size() function in the LinuxKPI. This function
basically multiplies its two arguments and returns SIZE_MAX if the
result overflows the size_t type.  Else the product of the two
arguments is returned.

Bump the FreeBSD_version to mitigate issues with existing
implementation of array_size() in drm-devel-kmod.

Discussed with: manu@
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoFix a use-after-free bug for the userland stack. The kernel
Michael Tuexen [Fri, 10 Jul 2020 11:15:10 +0000 (11:15 +0000)]
Fix a use-after-free bug for the userland stack. The kernel
stack is not affected.
Thanks to Mark Wodrich from Google for finding and reporting the
bug.

MFC after: 1 week

3 years agoSplit long lines in the Raspberry Pi FB driver
Andrew Turner [Fri, 10 Jul 2020 09:34:47 +0000 (09:34 +0000)]
Split long lines in the Raspberry Pi FB driver

Sponsored by: Innovate UK

3 years agovfs: fix early termination of kern_getfsstat
Mateusz Guzik [Fri, 10 Jul 2020 09:24:27 +0000 (09:24 +0000)]
vfs: fix early termination of kern_getfsstat

The kernel would unlock already unlocked mutex if the buffer got filled up
before the mount list ended.

Reported by: pho
Fixes: r363069 ("vfs: depessimize getfsstat when only the count is requested")

3 years agovfs: fix trivial whitespace issues which don't interefere with blame
Mateusz Guzik [Fri, 10 Jul 2020 09:01:36 +0000 (09:01 +0000)]
vfs: fix trivial whitespace issues which don't interefere with blame

.. even without the -w switch

3 years agoAdvertise 64-bit physical-address capability.
Peter Grehan [Fri, 10 Jul 2020 07:26:50 +0000 (07:26 +0000)]
Advertise 64-bit physical-address capability.

This fixes a coredump with NetBSD guests when XHCI is configured.
On seeing the AC64 flag clear, the NetBSD XHCI driver was only writing
to the lower 32-bits of 64-bit physical address registers. The emulation
relies on a write to the hi 32-bits to calculate a host virtual address
for internal use, and has always supported 64-bit addressing.

All other guests were seen to write to both the lo- and hi- address
registers, regardless of the AC64 setting.

Discussed with:  Leon Dang (author)
Tested with:  Ubuntu 16/18/20, Windows10, OpenBSD UEFI guests.

MFC after: 2 weeks.

3 years agovfs: depessimize getfsstat when only the count is requested
Mateusz Guzik [Fri, 10 Jul 2020 06:47:58 +0000 (06:47 +0000)]
vfs: depessimize getfsstat when only the count is requested

This avoids relocking mountlist_mtx for each entry.

3 years agovfs: avoid spurious memcpy in vfs_statfs
Mateusz Guzik [Fri, 10 Jul 2020 06:46:42 +0000 (06:46 +0000)]
vfs: avoid spurious memcpy in vfs_statfs

It is quite often called for the very same buffer.

3 years agoinstall(1): correction after r363064
Eugene Grosbein [Fri, 10 Jul 2020 00:45:34 +0000 (00:45 +0000)]
install(1): correction after r363064

Make it not break if STRIPBIN points to strip version without -o support.
In that case, perform extra copy just like before r363064.

MFC after: 1 month
X-MFC-With: 363064

3 years agomemfd_create: turn on SHM_GROW_ON_WRITE
Kyle Evans [Fri, 10 Jul 2020 00:45:16 +0000 (00:45 +0000)]
memfd_create: turn on SHM_GROW_ON_WRITE

memfd_create fds will no longer require an ftruncate(2) to set the size;
they'll grow (to the extent that it's possible) upon write(2)-like syscalls.

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

3 years agoshm_open2: Implement SHM_GROW_ON_WRITE
Kyle Evans [Fri, 10 Jul 2020 00:43:45 +0000 (00:43 +0000)]
shm_open2: Implement SHM_GROW_ON_WRITE

Lack of SHM_GROW_ON_WRITE is actively breaking Python's memfd_create tests,
so go ahead and implement it. A future change will make memfd_create always
set SHM_GROW_ON_WRITE, to match Linux behavior and unbreak Python's tests
on -CURRENT.

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

3 years agoOptimize install(1) a bit.
Eugene Grosbein [Fri, 10 Jul 2020 00:24:42 +0000 (00:24 +0000)]
Optimize install(1) a bit.

Currently, "install -s -S" behaviour is inefficient for upgrade.
First it finds that destination file already exists and copies
source file to temporary file. Then it calls strip(1)
with name of temporary file as single agrument and our strip(1) creates
another temporary file in the /tmp (or TMPDIR) making another copy
that is finally copied to DESTDIR third time.

Meantime, strip(1) has an option "-o dst" to specify destination
so install(1) is allowed to skip initial copying from obj to DESTDIR.
This change makes it do so.

Take a look at https://reviews.freebsd.org/D25551 for details
and efficiency numbers (in short: upto 32% gained for installword).

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D25551

3 years agoProperly backout r362998
Warner Losh [Fri, 10 Jul 2020 00:24:06 +0000 (00:24 +0000)]
Properly backout r362998

Correct a small mistake in r363060's backaout of r362998 by reverse-applying
r362998 by hand to loader.conf.

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

3 years agoshmfd: make shm_size a vm_ooffset_t
Kyle Evans [Fri, 10 Jul 2020 00:03:06 +0000 (00:03 +0000)]
shmfd: make shm_size a vm_ooffset_t

On 32-bit platforms, this expands the shm_size to a 64-bit quantity and
resolves a mismatch between the shmfd size and underlying vm_object size.
The implementation did not account for this kind of mismatch.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25602

3 years agoEnable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
Cy Schubert [Thu, 9 Jul 2020 23:01:36 +0000 (23:01 +0000)]
Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
hostapd and wpa_supplicant.

Submitted by: bz
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

3 years agoRevert r362998, r326999 while a better compatibility strategy is devised.
Scott Long [Thu, 9 Jul 2020 22:38:36 +0000 (22:38 +0000)]
Revert r362998, r326999 while a better compatibility strategy is devised.

3 years agosh: Do not ignore INTOFF during a trap
Jilles Tjoelker [Thu, 9 Jul 2020 20:53:56 +0000 (20:53 +0000)]
sh: Do not ignore INTOFF during a trap

INTOFF postpones SIGINT processing and INTON enables it again. This is
important so an interactive shell can return to the top level prompt when
Ctrl+C is pressed.

Given that INTON is automatically done when a builtin completes, the part
where onsig() ignores suppressint when in_dotrap is true is both unnecessary
and unsafe. If the trap is for some other signal than SIGINT, arbitrary code
could have been interrupted.

Historically, INTOFF remained in effect for longer.

Reviewed by: bdrewery
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25270

3 years agoApply the logic from r363051 to semctl(2) and __sem_base field.
Mark Johnston [Thu, 9 Jul 2020 18:34:54 +0000 (18:34 +0000)]
Apply the logic from r363051 to semctl(2) and __sem_base field.

Reported by: Jeffball <jeffball@grimm-co.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25600

3 years agowhois: Handle referrals to rwhois servers.
Mark Johnston [Thu, 9 Jul 2020 17:27:14 +0000 (17:27 +0000)]
whois: Handle referrals to rwhois servers.

PR: 243862
Submitted by: ben@desync.com
Differential Revision: https://reviews.freebsd.org/D25156

3 years agoAvoid copying out kernel pointers from msgctl(IPC_STAT).
Mark Johnston [Thu, 9 Jul 2020 17:26:49 +0000 (17:26 +0000)]
Avoid copying out kernel pointers from msgctl(IPC_STAT).

While this behaviour is harmless, it is really just an artifact of the
fact that the msgctl(2) implementation uses a user-visible structure as
part of the internal implementation, so it is not deliberate and these
pointers are not useful to userspace.  Thus, NULL them out before
copying out, and remove references to them from the manual page.

Reported by: Jeffball <jeffball@grimm-co.com>
Reviewed by: emaste, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25600

3 years agoAdd a driver to talk to the Raspberry Pi firmware
Andrew Turner [Thu, 9 Jul 2020 16:28:13 +0000 (16:28 +0000)]
Add a driver to talk to the Raspberry Pi firmware

Communicating with the Raspberry Pi firmware is currently handled by each
driver calling into the mbox driver, however the device tree is structured
such that they should be calling into a firmware driver.

Add a driver for this node with an interface to communicate to the firmware
via the mbox interface.

There is a sysctl to get the firmware revision. This is a unix date so can
be parsed with:

root@generic:~ # date -j -f '%s' sysctl -n dev.bcm2835_firmware.0.revision
Tue Nov 19 16:40:28 UTC 2019

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25572

3 years agoOptimize flushing of receive queues.
Michael Tuexen [Thu, 9 Jul 2020 16:18:42 +0000 (16:18 +0000)]
Optimize flushing of receive queues.
This addresses an issue found and reported for the userland stack in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21243

MFC after: 1 week

3 years agoloader: setting vdev size based on label asize is not working
Toomas Soome [Thu, 9 Jul 2020 13:19:00 +0000 (13:19 +0000)]
loader: setting vdev size based on label asize is not working

Because we need to read asize from vdev_tree. We also need to consider
different vdev type difference.

Reviewed by: allanjude
Sponsored by: Netflix, Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25586

3 years agog_concat_find_device: trim /dev/ if it is present, like other GEOM
Xin LI [Thu, 9 Jul 2020 08:00:46 +0000 (08:00 +0000)]
g_concat_find_device: trim /dev/ if it is present, like other GEOM
classes.

Reviewed by: cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25596

3 years agoRevert r363031
Simon J. Gerraty [Thu, 9 Jul 2020 03:46:07 +0000 (03:46 +0000)]
Revert r363031

3 years agosys/geom: consistently use _PATH_DEV instead of hardcoding "/dev/".
Xin LI [Thu, 9 Jul 2020 02:52:39 +0000 (02:52 +0000)]
sys/geom: consistently use _PATH_DEV instead of hardcoding "/dev/".

Reviewed by: cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25565

3 years agoInstall extra TCP stack header files: They are needed to compile a userland
Olivier Cochard [Wed, 8 Jul 2020 21:40:27 +0000 (21:40 +0000)]
Install extra TCP stack header files: They are needed to compile a userland
component of TCP Blackbox Recorder as example.

Approved by: rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25584

3 years agoUpdate to bmake-20200704
Simon J. Gerraty [Wed, 8 Jul 2020 21:20:12 +0000 (21:20 +0000)]
Update to bmake-20200704

Key changes include reduced noise at end of failed build log
and avoid evaluation of unnecessary terms in conditionals.

MFC after: 1 week

3 years agotwsi: Fix for > Allwinner A20
Emmanuel Vadot [Wed, 8 Jul 2020 19:14:44 +0000 (19:14 +0000)]
twsi: Fix for > Allwinner A20

Every revision of twsi after the A20 have a bug where we need to
write again the control register after each interrupts. We also need
to add some delay before writing to this register, a simple read of the
same register does the job so do that.
Also fix the case when we have finish sending all the bytes, it only worked
for 1 byte transfer (the same kind that we do for talking to the PMIC on A20
boards).
While here add more debug messages and rework some of them.

This was tested by talking to a AT23C32 eeprom and a DS3231 RTC from an
H3 and A20 board.

PR: 247576
Reported by: Manuel Stühn (freebsd@justmail.de)
MFC after: 1 week

3 years agotest: add libkvm read test
Alfredo Dal'Ava Junior [Wed, 8 Jul 2020 18:58:44 +0000 (18:58 +0000)]
test: add libkvm read test

This test checks if value received from kvm_read is sane, based on
value returned by sysctl interface.

This should catch regression on bug fixed by r359160

Reviewed by: jhb
Approved by: jhibbits (mentor)
MFC after: 1 week
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D23783

3 years agoImport bmake-20200704
Simon J. Gerraty [Wed, 8 Jul 2020 18:32:15 +0000 (18:32 +0000)]
Import bmake-20200704

from ChangeLog:

    (most of this by rillig@)
    o lots of style and white-space cleanup
    o lots more unit tests for variable modifiers
    o simplified description of some functions
    o str.c: refactor Str_Match
    o var.c: debugging output for :@
      constify VarModify parameter
      fix :hash modifier on 16-bit platforms
      remove unnecessary forward declarations
      refactor ApplyModifier_SysV to have less indentation
      simplify code for :E and :R
      clean up code for :H and :T
      refactor ApplyModifiers

    * var.c: we need stdint.h on some platforms to get uint32_t
    * unit-test/Makefile: we need to supress the specific error
    for RE substitution error in modmisc, since it varies accross
    different OS.

3 years agoextres/syscon_generic: Make device quiet if not in boot verbose
Emmanuel Vadot [Wed, 8 Jul 2020 17:14:44 +0000 (17:14 +0000)]
extres/syscon_generic: Make device quiet if not in boot verbose

On some boards there is a lot of of syscon node that are unused as
more specific drivers is probed before, no need to flood the console
for the mostly-unused generic ones.

MFC after: 1 week

3 years agogeli: enable direct dispatch
Alan Somers [Wed, 8 Jul 2020 17:12:12 +0000 (17:12 +0000)]
geli: enable direct dispatch

geli does all of its crypto operations in a separate thread pool, so
g_eli_start, g_eli_read_done, and g_eli_write_done don't actually do very
much work. Enabling direct dispatch eliminates the g_up/g_down bottlenecks,
doubling IOPs on my system. This change does not affect the thread pool.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25587

3 years agoMerge commit 065fc1eafe7c from llvm git (by Richard Smith):
Dimitry Andric [Wed, 8 Jul 2020 16:50:47 +0000 (16:50 +0000)]
Merge commit 065fc1eafe7c from llvm git (by Richard Smith):

  PR45521: Preserve the value kind when performing a standard
  conversion sequence on a glvalue expression.

  If the sequence is supposed to perform an lvalue-to-rvalue
  conversion, then one will be specified as the first conversion in the
  sequence. Otherwise, one should not be invented.

This should fix clang crashing with "can't implicitly cast lvalue to
rvalue with this cast kind", followed by "UNREACHABLE executed at
/usr/src/contrib/llvm-project/clang/lib/Sema/Sema.cpp:538!", when
building recent versions of Ceph, and the CPAN module SYBER/Date-5.2.0.

Reported by: Willem Jan Withagen <wjw@digiware.nl>, eserte12@yahoo.de
PR: 245530, 247812
MFC after: 3 days

3 years agoImprove consistency.
Michael Tuexen [Wed, 8 Jul 2020 16:23:40 +0000 (16:23 +0000)]
Improve consistency.

MFC after: 1 week

3 years agoFix error description.
Michael Tuexen [Wed, 8 Jul 2020 16:04:06 +0000 (16:04 +0000)]
Fix error description.

MFC after: 1 week

3 years agoDon't accept FORWARD-TSN chunks when I-FORWARD-TSN was negotiated
Michael Tuexen [Wed, 8 Jul 2020 15:49:30 +0000 (15:49 +0000)]
Don't accept FORWARD-TSN chunks when I-FORWARD-TSN was negotiated
and vice versa.

MFC after: 1 week

3 years agoImprove handling of PKTDROP chunks. This includes the input validation
Michael Tuexen [Wed, 8 Jul 2020 12:25:19 +0000 (12:25 +0000)]
Improve handling of PKTDROP chunks. This includes the input validation
to address two issues found by ossfuzz testing the userland stack:
* https://oss-fuzz.com/testcase-detail/5387560242380800
* https://oss-fuzz.com/testcase-detail/4887954068865024
and adding support for I-DATA chunks in addition to DATA chunks.

3 years agoAdd support for [read|write] supported data length commands.
Takanori Watanabe [Wed, 8 Jul 2020 06:33:07 +0000 (06:33 +0000)]
Add support for [read|write] supported data length commands.

Fix ng_hci_le_long_term_key_request_negative_reply_cp struct
while here.

PR: 247809
Submitted by: Marc Veldman

3 years agoAdd le_rand command.
Takanori Watanabe [Wed, 8 Jul 2020 03:57:47 +0000 (03:57 +0000)]
Add le_rand command.

PR: 247808
Submitted by: Marc Veldman

3 years agoAdd support for ext_pgs mbufs to nfsm_uiombuf().
Rick Macklem [Wed, 8 Jul 2020 02:28:08 +0000 (02:28 +0000)]
Add support for ext_pgs mbufs to nfsm_uiombuf().

This patch uses a slightly different algorithm for the non-ext_pgs case,
where a variable called "mcp" is maintained, pointing to the current
location that mbuf data can be filled into. This avoids use of
mtod(mp, char *) + mp->m_len to calculate the location, since this does
not work for ext_pgs mbufs and I think it makes the algorithm more readable.
This change should not result in semantic changes for the non-ext_pgs case.

This is another in the series of commits that add support to the NFS client
and server for building RPC messages in ext_pgs mbufs with anonymous pages.
This is useful so that the entire mbuf list does not need to be
copied before calling sosend() when NFS over TLS is enabled.

Since ND_EXTPG is never set yet, there is no semantic change at this time.

3 years agoBe more precise about Percy Grainger's place of birth.
Greg Lehey [Wed, 8 Jul 2020 01:47:20 +0000 (01:47 +0000)]
Be more precise about Percy Grainger's place of birth.

3 years agoFix a example/docs typo from r362998, no functional change.
Scott Long [Tue, 7 Jul 2020 20:42:35 +0000 (20:42 +0000)]
Fix a example/docs typo from r362998, no functional change.

3 years agoMigrate the feature of excluding RAM pages to use "excludelist"
Scott Long [Tue, 7 Jul 2020 20:33:11 +0000 (20:33 +0000)]
Migrate the feature of excluding RAM pages to use "excludelist"
as its nomenclature.

MFC after: 1 week

3 years agoMFV r362990:
Cy Schubert [Tue, 7 Jul 2020 19:09:38 +0000 (19:09 +0000)]
MFV r362990:

Update sqlite to 3.32.3 (3320300).

Release Announcement: https://www.sqlite.org/releaselog/3_32_3.html
See also: ports r541414

PR: 247819
Reported by: Pavel Volkov <pavelivolkov at gmail.com>
MFC after: 1 week

3 years agoInvoke objcopy on the right object when building Scrt1.o on i386.
John Baldwin [Tue, 7 Jul 2020 18:19:05 +0000 (18:19 +0000)]
Invoke objcopy on the right object when building Scrt1.o on i386.

This was a copy-paste bug in r362902.  While here, switch to using
${.TARGET}.

Reported by: Kjell Tore Ullavik <ktullavik@gmail.com>
Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25585

3 years agotimeout(1): Add EXAMPLES section
Fernando Apesteguía [Tue, 7 Jul 2020 17:02:23 +0000 (17:02 +0000)]
timeout(1): Add EXAMPLES section

Small EXAMPLES section showing the use of -s, -k and the different exit values

Approved by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D25575

3 years agoRebuild sysent when capabilities.conf is updated.
Mark Johnston [Tue, 7 Jul 2020 16:35:52 +0000 (16:35 +0000)]
Rebuild sysent when capabilities.conf is updated.

Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25571

3 years agotime(1): Add EXAMPLES section
Fernando Apesteguía [Tue, 7 Jul 2020 16:07:39 +0000 (16:07 +0000)]
time(1): Add EXAMPLES section

Add EXAMPLES showing all five flags: -a, -h, -l, -o, -p

Approved by: manpages (bcr)

3 years agoImport sqlite 3.32.3 (3320300).
Cy Schubert [Tue, 7 Jul 2020 13:48:26 +0000 (13:48 +0000)]
Import sqlite 3.32.3 (3320300).

3 years agoloader: geli_dev_ioctl does return huge mediasize
Toomas Soome [Tue, 7 Jul 2020 12:24:40 +0000 (12:24 +0000)]
loader: geli_dev_ioctl does return huge mediasize

The DIOCGMEDIASIZE is calculated md->md_sectorsize * md->md_provsize, and
for boot disk, the md_sectorsize is 4k. However, the md_provsize is already
in units of bytes.

Sponsored by: Netflix, Klara Inc.

3 years agoFix KASSERT during tcp_newtcpcb when low on memory
Richard Scheffenegger [Tue, 7 Jul 2020 12:10:59 +0000 (12:10 +0000)]
Fix KASSERT during tcp_newtcpcb when low on memory

While testing with system default cc set to cubic, and
running a memory exhaustion validation, FreeBSD panics for a
missing inpcb reference / lock.

Reviewed by: rgrimes (mentor), tuexen (mentor)
Approved by: rgrimes (mentor), tuexen (mentor)
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D25583

3 years agoUpdate to version 3.1.1
Stefan Eßer [Tue, 7 Jul 2020 07:51:09 +0000 (07:51 +0000)]
Update to version 3.1.1

This version fixes a regression with regard to tradtional behavior of the
non-standard FreeBSD option "-e". In the previous version "-e quit" caused
bc to exit before any computations had been performed, since all -e option
parameters were concatenated and parsed as a whole, with quit causing the
program to exit as soon as it was parsed. This version parses and executes
commands passed with -e one by one and only exits after all prior commands
have been executed.

This commit is not a SVN merge, since the vendor import had been performed
after the import to contrib. Instead the contents of contrib/bc has been
removed and the new version is copied over unchanged from vendor/bc/dist.

3 years agoUpdate to release 3.1.1
Stefan Eßer [Tue, 7 Jul 2020 07:02:33 +0000 (07:02 +0000)]
Update to release 3.1.1

This release fixes a regression from traditional bc behavior in FreeBSD
with regard to "-e quit" being passed on the command line and add Spanish
message catalogs.

3 years agoFixup r362981: remove gzipped manual pages.
Gleb Smirnoff [Tue, 7 Jul 2020 02:43:53 +0000 (02:43 +0000)]
Fixup r362981: remove gzipped manual pages.

Pointy hat to: glebius

3 years agoFixup for r360574: install new mlinks for sglist(9) and remove old ones.
Gleb Smirnoff [Tue, 7 Jul 2020 02:41:51 +0000 (02:41 +0000)]
Fixup for r360574: install new mlinks for sglist(9) and remove old ones.

3 years agoAdd support for ext_pgs mbufs to nfsrvd_rephead().
Rick Macklem [Tue, 7 Jul 2020 00:42:23 +0000 (00:42 +0000)]
Add support for ext_pgs mbufs to nfsrvd_rephead().

This is another in the series of commits that add support to the NFS client
and server for building RPC messages in ext_pgs mbufs with anonymous pages.
This is useful so that the entire mbuf list does not need to be
copied before calling sosend() when NFS over TLS is enabled.

Since ND_EXTPG is never set yet, there is no semantic change at this time.

3 years agoFix a Wvoid-pointer-to-enum-cast warning missed in r359978.
Brooks Davis [Mon, 6 Jul 2020 22:39:42 +0000 (22:39 +0000)]
Fix a Wvoid-pointer-to-enum-cast warning missed in r359978.

This pattern is used in callbacks with void * data arguments and seems
both relatively uncommon and relatively harmless.  Silence the warning
by casting through uintptr_t.

This warning is on by default in Clang 11.

MFC after: 3 days
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24425

3 years agoFix cleandir target post r362973
Mitchell Horne [Mon, 6 Jul 2020 21:39:14 +0000 (21:39 +0000)]
Fix cleandir target post r362973

Reported by: mmacy

3 years agoriscv plic: Do not complete interrupts until the interrupt handler has run
Kristof Provost [Mon, 6 Jul 2020 21:29:50 +0000 (21:29 +0000)]
riscv plic: Do not complete interrupts until the interrupt handler has run

We cannot complete the interrupt (i.e. write to the claims/complete register
until the interrupt handler has actually run. We don't run the interrupt
handler immediately from intr_isrc_dispatch(), we only schedule it for later
execution.

If we immediately complete it (i.e. before the interrupt handler proper has
run) the interrupt may be triggered again if the interrupt source remains set.
From RISC-V Instruction Set Manual: Volume II: Priviliged Architecture, 7.4
Interrupt Gateways:

"If a level-sensitive interrupt source deasserts the interrupt after the PLIC
core accepts the request and before the interrupt is serviced, the interrupt
request remains present in the IP bit of the PLIC core and will be serviced by
a handler, which will then have to determine that the interrupt device no
longer requires service."

In other words, we may receive interrupts twice.

Avoid that by postponing the completion until after the interrupt handler has
run.

If the interrupt is handled by a filter rather than by scheduling an interrupt
thread we must also complete the interrupt, so set up a post_filter handler
(which is the same as the post_ithread handler).

Reviewed by: mhorne
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D25531

3 years agoSplit nhop_ref_object().
Mark Johnston [Mon, 6 Jul 2020 21:20:57 +0000 (21:20 +0000)]
Split nhop_ref_object().

Now nhop_ref_object() unconditionally acquires a reference, and the new
nhop_try_ref_object() uses refcount_acquire_if_not_zero() to
conditionally acquire a reference.  Since the former is cheaper, use it
when we know that the initial counter value is non-zero.  No functional
change intended.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D25535

3 years agosrc.conf.5: regen after r362972, r362973, RISC-V EFI support
Mitchell Horne [Mon, 6 Jul 2020 18:43:00 +0000 (18:43 +0000)]
src.conf.5: regen after r362972, r362973, RISC-V EFI support

3 years agoRISC-V boot1.efi and loader.efi support
Mitchell Horne [Mon, 6 Jul 2020 18:19:42 +0000 (18:19 +0000)]
RISC-V boot1.efi and loader.efi support

This implementation doesn't have any major deviations from the other EFI
ports. I've copied the boilerplate from arm and arm64.

I've tested this with the following boot flows:
OpenSBI (M-mode) -> u-boot (S-mode) -> loader.efi -> FreeBSD
OpenSBI (M-mode) -> u-boot (S-mode) -> boot1.efi -> loader.efi -> FreeBSD

Due to the way that u-boot handles secondary CPUs, OpenSBI >= v0.7 is required,
as the HSM extension is needed to bring them up explicitly. Because of this,
using BBL as the SBI implementation will not be possible. Additionally, there
are a few recent u-boot changes that are required as well, all of which will be
present in the upcoming v2020.07 release.

Looks good: emaste
Differential Revision: https://reviews.freebsd.org/D25135

3 years agolibefivar: define MDE_CPU_RISCV64
Mitchell Horne [Mon, 6 Jul 2020 17:47:29 +0000 (17:47 +0000)]
libefivar: define MDE_CPU_RISCV64

The necessary definitions from EDK2 are present, so this allows the
library to be built on RISC-V.

3 years agoRegenerate.
Mark Johnston [Mon, 6 Jul 2020 16:34:49 +0000 (16:34 +0000)]
Regenerate.

Sponsored by: The FreeBSD Foundation

3 years agoPermit cpuset_(get|set)domain() in capability mode.
Mark Johnston [Mon, 6 Jul 2020 16:34:29 +0000 (16:34 +0000)]
Permit cpuset_(get|set)domain() in capability mode.

These system calls already perform validation of their parameters when
called in capability mode, identical to cpuset_(get|set)affinity().

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agokern.tty_info_kstacks: set compact format as default
Pawel Biernacki [Mon, 6 Jul 2020 16:34:15 +0000 (16:34 +0000)]
kern.tty_info_kstacks: set compact format as default

3 years agoAllow accesses of the caller's CPU and domain sets in capability mode.
Mark Johnston [Mon, 6 Jul 2020 16:34:09 +0000 (16:34 +0000)]
Allow accesses of the caller's CPU and domain sets in capability mode.

cpuset_(get|set)(affinity|domain)(2) permit a get or set of the calling
thread or process' CPU and domain set in capability mode, but only when
the thread or process ID is specified as -1.  Extend this to cover the
case where the ID actually matches the caller's TID or PID, since some
code, such as our pthread_attr_get_np() implementation, always provides
an explicit ID.

It was not and still is not permitted to access CPU and domain sets for
other threads in the same process when the process is in capability
mode.  This might change in the future.

Submitted by: Greg V <greg@unrelenting.technology> (original version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25552

3 years agokern.tty_info_kstacks: add a compact format
Pawel Biernacki [Mon, 6 Jul 2020 16:33:28 +0000 (16:33 +0000)]
kern.tty_info_kstacks: add a compact format

Add a more compact display format for kern.tty_info_kstacks inspired by
procstat -kk. Set it as a default one.

# sysctl kern.tty_info_kstacks=1
kern.tty_info_kstacks: 0 -> 1
# sleep 2
^T
load: 0.17  cmd: sleep 623 [nanslp] 0.72r 0.00u 0.00s 0% 2124k
#0 0xffffffff80c4443e at mi_switch+0xbe
#1 0xffffffff80c98044 at sleepq_catch_signals+0x494
#2 0xffffffff80c982c2 at sleepq_timedwait_sig+0x12
#3 0xffffffff80c43af3 at _sleep+0x193
#4 0xffffffff80c50e31 at kern_clock_nanosleep+0x1a1
#5 0xffffffff80c5119b at sys_nanosleep+0x3b
#6 0xffffffff810ffc69 at amd64_syscall+0x119
#7 0xffffffff810d5520 at fast_syscall_common+0x101
sleep: about 1 second(s) left out of the original 2
^C
# sysctl kern.tty_info_kstacks=2
kern.tty_info_kstacks: 1 -> 2
# sleep 2
^T
load: 0.24  cmd: sleep 625 [nanslp] 0.81r 0.00u 0.00s 0% 2124k
mi_switch+0xbe sleepq_catch_signals+0x494 sleepq_timedwait_sig+0x12
sleep+0x193 kern_clock_nanosleep+0x1a1 sys_nanosleep+0x3b
amd64_syscall+0x119 fast_syscall_common+0x101
sleep: about 1 second(s) left out of the original 2
^C

Suggested by: avg
Reviewed by: mjg
Relnotes: yes
Sponsored by: Mysterious Code Ltd.
Differential Revision: https://reviews.freebsd.org/D25487

3 years agoLift cpuset Capsicum checks into a subroutine.
Mark Johnston [Mon, 6 Jul 2020 16:33:21 +0000 (16:33 +0000)]
Lift cpuset Capsicum checks into a subroutine.

Otherwise the same checks are duplicated across four different system
call implementations, cpuset_(get|set)(affinity|domain)().  No
functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years ago[PowerPC] XIVE dispatch tweaks
Brandon Bergren [Mon, 6 Jul 2020 15:15:37 +0000 (15:15 +0000)]
[PowerPC] XIVE dispatch tweaks

  * Only read the DPCPU pointer once per xive_dispatch call.
  * Optimize HE decoding for the common cases.

Reported by: jhibbits (in irc)
Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D25545

3 years agoiflib: Fix some nits in the rx refill code.
Mark Johnston [Mon, 6 Jul 2020 14:52:21 +0000 (14:52 +0000)]
iflib: Fix some nits in the rx refill code.

- Get rid of the ifl_vm_addrs array.  It is not used by any existing
  consumer, so we are just dirtying a couple of cache lines for no
  reason.
- Use uma_zalloc(fl->ifl_zone) instead of m_cljget().  Otherwise
  m_cljget() is doing unnecessary work to look up the correct zone, when
  iflib already knows what that zone is.
- ifl_gen is only used when INVARIANTS is on, so make that more clear.
- Fix some style nits and inconsistencies.

Reviewed by: gallatin
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25490

3 years agoiflib: Fix handling of mbuf cluster allocation failures.
Mark Johnston [Mon, 6 Jul 2020 14:52:09 +0000 (14:52 +0000)]
iflib: Fix handling of mbuf cluster allocation failures.

When refilling an rx freelist, make sure we only update the hardware
producer index if at least one cluster was allocated.  Otherwise the
NIC is programmed to write a previously used cluster, typically
resulting in a use-after-free when packet data is written by the
hardware.

Also make sure that we don't update the fragment index cursor if the
last allocation attempt didn't succeed.  For at least Intel drivers,
iflib assumes that the consumer index and fragment index cursor stay in
lockstep, but this assumption was violated in the face of cluster
allocation failures.

Reported and tested by: pho
Reviewed by: gallatin, hselasky
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25489

3 years agoHandle non-PLT GNU IFUNC relocations in rtld
Leandro Lupori [Mon, 6 Jul 2020 11:57:59 +0000 (11:57 +0000)]
Handle non-PLT GNU IFUNC relocations in rtld

In the last IFUNC related changes to rtld, the code that handled non-PLT
GNU IFUNC relocations ended up getting lost. This could leave some
relocations unhandled, causing crashes or misbehavior. This change restores
the handling of these relocations, but now together with the other IFUNC
relocations, allowing resolvers to reference external symbols.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D25550

3 years agoFix description of the "\$" sequence for PS1
Mateusz Piotrowski [Mon, 6 Jul 2020 10:05:35 +0000 (10:05 +0000)]
Fix description of the "\$" sequence for PS1

The manual page documents "\$" to expand to either "$" or "#" followed by
a single space. In reality, the single space character is not appended.

PR: 247791
Submitted by: kd-dev@pm.me
MFC after: 7 days

3 years agoClean up cam.3
Mateusz Piotrowski [Mon, 6 Jul 2020 09:53:00 +0000 (09:53 +0000)]
Clean up cam.3

- Add a missing Pp [1]
- Remove uses of Tn
- Use "Xr open 2" when appropriate

PR: 247783 [1]
Submitted by: PauAmma <pauamma@gundo.com> [1]
MFC after: 3 days

3 years agoAdd a driver for bcm2838 PCI express controller
Andrew Turner [Mon, 6 Jul 2020 08:51:55 +0000 (08:51 +0000)]
Add a driver for bcm2838 PCI express controller

This adds support for the Broadcom bcm2711 PCI express controller, found
on the Raspberry Pi 4 (aka the bcm2838 SoC). The driver has only been
developed against the soldered-on VIA XHCI controller and not tested
with other end points.

Submitted by: Robert Crowston <crowston_protonmail.com>
Differential Revision: https://reviews.freebsd.org/D25068

3 years agoInfiniband clients must be attached and detached in a specific order in ibcore.
Hans Petter Selasky [Mon, 6 Jul 2020 08:50:11 +0000 (08:50 +0000)]
Infiniband clients must be attached and detached in a specific order in ibcore.

Currently the linking order of the infiniband, IB, modules decide in which
order the clients are attached and detached. For example one IB client may
use resources from another IB client. This can lead to a potential deadlock
at shutdown. For example if the ipoib is unregistered after the ib_multicast
client is detached, then if ipoib is using multicast addresses a deadlock may
happen, because ib_multicast will wait for all its resources to be freed before
returning from the remove method.

Fix this by using module_xxx_order() instead of module_xxx().

Differential Revision: https://reviews.freebsd.org/D23973
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoSilence ACPI RTC error/warning in Linux guests.
Peter Grehan [Mon, 6 Jul 2020 08:36:14 +0000 (08:36 +0000)]
Silence ACPI RTC error/warning in Linux guests.

Allow guests to set the RTC bit in the ACPI PM control register.
This eliminates an annoying (and harmless) Linux kernel boot message.

PR: 244721
Submitted by: Jose Luis Duran
MFC after: 1 week

3 years agovfs: expand on vhold_smr comment
Mateusz Guzik [Mon, 6 Jul 2020 02:00:35 +0000 (02:00 +0000)]
vfs: expand on vhold_smr comment

3 years agolockf: elide avoidable locking in lf_advlockasync
Mateusz Guzik [Sun, 5 Jul 2020 23:07:54 +0000 (23:07 +0000)]
lockf: elide avoidable locking in lf_advlockasync

While here assert on ls_threads state.

3 years agoAdd support for ext_pgs mbufs to nfsm_strtom().
Rick Macklem [Sun, 5 Jul 2020 21:55:16 +0000 (21:55 +0000)]
Add support for ext_pgs mbufs to nfsm_strtom().

Also, add a new function nfsm_add_ext_pgs() which will either add a page
or add a new ext_pgs mbuf with a page to the mbuf list. Used by nfsm_strtom().
This is another in the series of commits that add support to the NFS client
and server for building RPC messages in ext_pgs mbufs with anonymous pages.
This is useful so that the entire mbuf list does not need to be
copied before calling sosend() when NFS over TLS is enabled.

Since ND_EXTPG is never set yet, there is no semantic change at this time.

3 years agoFix typo.
Konstantin Belousov [Sun, 5 Jul 2020 20:54:01 +0000 (20:54 +0000)]
Fix typo.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agotruss: print more information about traced sysctls
Pawel Biernacki [Sun, 5 Jul 2020 19:53:54 +0000 (19:53 +0000)]
truss: print more information about traced sysctls

MFC after: 2 weeks
Sponsored by: Mysterious Code Ltd.

3 years agoFix include file order in io.h in the LinuxKPI.
Hans Petter Selasky [Sun, 5 Jul 2020 19:38:36 +0000 (19:38 +0000)]
Fix include file order in io.h in the LinuxKPI.
Make sure sys/types.h is included before machine/vm.h.

PR: 247775
Submitted by: pkubaj@
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoAdd a note regarding the introduction of the new bc and dc implementations
Stefan Eßer [Sun, 5 Jul 2020 14:43:14 +0000 (14:43 +0000)]
Add a note regarding the introduction of the new bc and dc implementations
that are built by default on -CURRENT after 2020-06-26.

3 years agoRerun kernel ifunc resolvers after all CPUs have started
Andrew Turner [Sun, 5 Jul 2020 14:38:22 +0000 (14:38 +0000)]
Rerun kernel ifunc resolvers after all CPUs have started

On architectures that use RELA relocations it is safe to rerun the ifunc
resolvers on after all CPUs have started, but while they are sill parked.

On arm64 with big.LITTLE this is needed as some SoCs have shipped with
different ID register values the big and little clusters meaning we were
unable to rely on the register values from the boot CPU.

Add support for rerunning the resolvers on arm64 and amd64 as these are
both RELA using architectures.

Reviewed by: kib
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25455

3 years agoMake linux(4) man page also mention /compat/linux/dev.
Edward Tomasz Napierala [Sun, 5 Jul 2020 13:15:13 +0000 (13:15 +0000)]
Make linux(4) man page also mention /compat/linux/dev.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoshutdown.8: Fix typo
Niclas Zeising [Sun, 5 Jul 2020 13:08:17 +0000 (13:08 +0000)]
shutdown.8: Fix typo

Fix a typo in shutdown.8, use ',' instead of '.' when listing items.

MFC after: 1 week

3 years agoFix Linux recvmsg(2) when msg_namelen returned is 0. Previously
Edward Tomasz Napierala [Sun, 5 Jul 2020 10:57:28 +0000 (10:57 +0000)]
Fix Linux recvmsg(2) when msg_namelen returned is 0.  Previously
it would fail with EINVAL, breaking some of the Python regression
tests.

While here, cap the user-controlled message length.

Note that the code doesn't seem to be copying out the new length
in either (success or failure) case. This will be addressed separately.

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

3 years agocxgbe(4): Fix a bug (introduced in r362905) where some tx traffic wasn't
Navdeep Parhar [Sun, 5 Jul 2020 05:14:33 +0000 (05:14 +0000)]
cxgbe(4): Fix a bug (introduced in r362905) where some tx traffic wasn't
being reported to BPF.

3 years agoUse KERN_MAXPHYS.
Xin LI [Sun, 5 Jul 2020 00:19:08 +0000 (00:19 +0000)]
Use KERN_MAXPHYS.

Suggested by: imp
Reviewed by: imp, cem (earlier version), emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25563

3 years agoGather writes to larger chunks (MAXPHYS) instead of issuing them in
Xin LI [Sat, 4 Jul 2020 18:37:04 +0000 (18:37 +0000)]
Gather writes to larger chunks (MAXPHYS) instead of issuing them in
sectors.

On my SanDisk Cruzer Blade 16GB USB stick this made formatting much faster:

x before
+ after
+--------------------------------------------------------------------------+
|+                                                                         |
|+                                                                      x  |
|+                                                                      x x|
|A                                                                      MA||
+--------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   3         15.89         16.38            16         16.09     0.2570992
+   3          0.32          0.37          0.35    0.34666667   0.025166115
Difference at 95.0% confidence
-15.7433 +/- 0.414029
-97.8455% +/- 0.25668%
(Student's t, pooled s = 0.182665)

Reviewed by: emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24508