]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoRevert r361770 "Add pthread_getname_np() and pthread_setname_np() aliases" for now.
kib [Thu, 4 Jun 2020 09:06:03 +0000 (09:06 +0000)]
Revert r361770 "Add pthread_getname_np() and pthread_setname_np() aliases" for now.

It is not compatible enough with Linux.

Requested by: antoine, jkim
Sponsored by: The FreeBSD Foundation

3 years agoAdd EXAMPLES to killall(1)
bjk [Thu, 4 Jun 2020 04:29:43 +0000 (04:29 +0000)]
Add EXAMPLES to killall(1)

Submitted by: fernape
Differential Revision: https://reviews.freebsd.org/D25002

3 years agoAdd copyright headers to spigen overlays for rpi3 and rpi4
gonzo [Thu, 4 Jun 2020 02:36:41 +0000 (02:36 +0000)]
Add copyright headers to spigen overlays for rpi3 and rpi4

Reported by: Rodney W. Grimes <freebsd@gndrsh.dnsmgr.net> (for rpi4)

3 years agoCorrect terminology in vm.imply_prot_max sysctl description
emaste [Thu, 4 Jun 2020 01:49:29 +0000 (01:49 +0000)]
Correct terminology in vm.imply_prot_max sysctl description

As with r361769 (man page), PROT_* are properly called protections, not
permissions.

MFC after: 1 week
MFC with: r361769
Sponsored by: The FreeBSD Foundation

3 years agoFix mountd to handle getgrouplist() not returning groups[0] == groups[1].
rmacklem [Thu, 4 Jun 2020 00:28:20 +0000 (00:28 +0000)]
Fix mountd to handle getgrouplist() not returning groups[0] == groups[1].

Prior to r174547, getgrouplist(3) always returned a groups list with
element 0 and 1 set to the basegid argument, so long as ngroups was > 1.
Post-r174547 this is not the case. r328304 disabled the deduplication that
removed the duplicate, but the duplicate still does not occur unless the
group for a user in the password database is also entered in the group
database.
This patch fixes mountd so that it handles the case where a user specified
with the -maproot or -mapall exports option has a getgrouplist(3) groups
list where groups[0] != groups[1].
Found while testing another mountd patch.

MFC after: 2 weeks

3 years agoAdd opt_compat.h needed by r359374.
jhb [Wed, 3 Jun 2020 23:21:44 +0000 (23:21 +0000)]
Add opt_compat.h needed by r359374.

Reported by: kevans

3 years ago[run] Fix up tx/rx frame size.
adrian [Wed, 3 Jun 2020 22:30:44 +0000 (22:30 +0000)]
[run] Fix up tx/rx frame size.

This specifically fixes that TX frames are large enough now to hold a 3900 odd
byte AMSDU (the little ones); me flipping it on earlier messed up transmit!

Tested:

* if_run, STA mode, TX/RX TCP/UDP iperf.  TCP is now back to normal and
  correctly does ~ 3200 byte AMSDU/fast frames (2x1600ish byte MSDUs).

3 years agoExplicitly zero IVs on the stack.
jhb [Wed, 3 Jun 2020 22:19:52 +0000 (22:19 +0000)]
Explicitly zero IVs on the stack.

Reviewed by: delphij
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25057

3 years agoExplicitly zero AES key schedules on the stack.
jhb [Wed, 3 Jun 2020 22:18:21 +0000 (22:18 +0000)]
Explicitly zero AES key schedules on the stack.

Reviewed by: delphij
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25057

3 years agoAdd spigen overlay for Raspberry Pi 4
gonzo [Wed, 3 Jun 2020 22:18:15 +0000 (22:18 +0000)]
Add spigen overlay for Raspberry Pi 4

Submitted by: gergely.czuczy@harmless.hu

3 years agoExplicitly zero on-stack IVs, tags, and HMAC keys.
jhb [Wed, 3 Jun 2020 22:15:11 +0000 (22:15 +0000)]
Explicitly zero on-stack IVs, tags, and HMAC keys.

Reviewed by: delphij
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25057

3 years agoAdd explicit bzero's of sensitive data in software crypto consumers.
jhb [Wed, 3 Jun 2020 22:11:05 +0000 (22:11 +0000)]
Add explicit bzero's of sensitive data in software crypto consumers.

Explicitly zero IVs, block buffers, and hashes/digests.

Reviewed by: delphij
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25057

3 years agoAdd dtb for Firefly RK3399 to the list of Rockchip dtbs
gonzo [Wed, 3 Jun 2020 21:19:57 +0000 (21:19 +0000)]
Add dtb for Firefly RK3399 to the list of Rockchip dtbs

3 years agoAdd pthread_getname_np() and pthread_setname_np() aliases
kib [Wed, 3 Jun 2020 20:54:36 +0000 (20:54 +0000)]
Add pthread_getname_np() and pthread_setname_np() aliases

for pthread_get_name_np() and pthread_set_name_np(), to be
compatible with Linux.

PR: 238404
Proposed and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25117

3 years agommap.2: correct prot argument terminology
emaste [Wed, 3 Jun 2020 20:42:52 +0000 (20:42 +0000)]
mmap.2: correct prot argument terminology

One of the error descriptions referred to permissions; in context the
meaning was probably clear, but the prot values are properly called
protections.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years ago[otus] enable 802.11n for 2GHz and 5GHz.
adrian [Wed, 3 Jun 2020 20:25:02 +0000 (20:25 +0000)]
[otus] enable 802.11n for 2GHz and 5GHz.

This flips on basic 11n for 2GHz/5GHz station operation.

* It flips on HT20 and MCS rates;
* It enables A-MPDU decap - the payload format is a bit different;
* It does do some basic checks for HT40 but I haven't yet flipped on
  HT40 support;
* It enables software A-MSDU transmit; I honestly don't want to make
  A-MPDU TX work and there are apparently issues with QoS and A-MPDU TX.
  So I totally am ignoring A-MPDU TX;
* MCS rate transmit is fine.

I haven't:

* A-MPDU TX, as I said above;
* made radiotap work fully;
* HT40;
* short-GI support;
* lots of other stuff that honestly no-one is likely to use.

But! Hey, this is another ye olde 11n USB NIC that now works pretty OK
in 11n rates. A-MPDU receive seems fine enough given it's a draft-n
device from before 2010.

Tested:

* Ye olde UB82 Test NIC (AR9170 + AR9104) - 2GHz/5GHz

3 years agoDocument SO_NO_OFFLOADS and SO_NO_DDP.
jhb [Wed, 3 Jun 2020 18:59:31 +0000 (18:59 +0000)]
Document SO_NO_OFFLOADS and SO_NO_DDP.

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

3 years agoRevise r361712 to disable tcpmd5.ko for 'options TCP_SIGNATURE'
jhb [Wed, 3 Jun 2020 18:42:28 +0000 (18:42 +0000)]
Revise r361712 to disable tcpmd5.ko for 'options TCP_SIGNATURE'

3 years agolualoader: drop the filename and word "LUA" from errors
kevans [Wed, 3 Jun 2020 18:29:32 +0000 (18:29 +0000)]
lualoader: drop the filename and word "LUA" from errors

The filename is nearly always wrong since it's /boot/lua/loader.lua, which
is not useful for diagnostics. The actual errmsg will include a lua filename
if this is relevant.

Dropping "LUA" while we're here because that's almost universally
irrelevant to whatever error follows, unless the error states that it's
actually a lua problem.

Both of these are minor nits that just detract from identifying the
pertinent information.

MFC after: 3 days

3 years agonetmap: vtnet: clean up rxsync disabled logs
vmaffione [Wed, 3 Jun 2020 17:47:32 +0000 (17:47 +0000)]
netmap: vtnet: clean up rxsync disabled logs

MFC after: 1 week

3 years agonetmap: vtnet: fix race condition in rxsync
vmaffione [Wed, 3 Jun 2020 17:46:21 +0000 (17:46 +0000)]
netmap: vtnet: fix race condition in rxsync

This change prevents a race that happens when rxsync dequeues
N-1 rx packets (with N being the size of the netmap rx ring).
In this situation, the loop exits without re-enabling the
rx interrupts, thus causing the VQ to stall.

MFC after: 1 week

3 years agonetmap: vtnet: add vtnrx_nm_refill index to receive queues
vmaffione [Wed, 3 Jun 2020 17:42:17 +0000 (17:42 +0000)]
netmap: vtnet: add vtnrx_nm_refill index to receive queues

The new index tracks the next netmap slot that is going
to be enqueued into the virtqueue. The index is necessary
to prevent the receive VQ and the netmap rx ring from going
out of sync, considering that we never enqueue N slots, but
at most N-1. This change fixes a bug that causes the VQ
and the netmap ring to go out of sync after N-1 packets
have been received.

MFC after: 1 week

3 years agoFix typo in previous commit
freqlabs [Wed, 3 Jun 2020 17:26:00 +0000 (17:26 +0000)]
Fix typo in previous commit

Applied the wrong patch

Reported by: Michael Butler <imb@protected-networks.net>
Approved by: mav (mentor)
Sponsored by: iXsystems.com

3 years agoscope6: Check for NULL afdata before dereferencing
freqlabs [Wed, 3 Jun 2020 16:57:30 +0000 (16:57 +0000)]
scope6: Check for NULL afdata before dereferencing

Narrows the race window with if_detach.

Approved by: mav (mentor)
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25017

3 years agogptboot.efi: align secbuf to 4K
mhorne [Wed, 3 Jun 2020 16:38:16 +0000 (16:38 +0000)]
gptboot.efi: align secbuf to 4K

The u-boot EFI implementation of the ReadBlocks and WriteBlocks methods
requires that the provided buffer meet the IO alignment requirements of
the underlying disk. Unlike loader.efi, gptboot.efi doesn't check this
requirement, and therefore fails to perform a successful read. Adjust
secbuf's alignment to 4K in hopes that we will always meet this
requirement.

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25111

3 years agoWe should never allow either the broadcast or IN_ADDR_ANY to be
rrs [Wed, 3 Jun 2020 14:16:40 +0000 (14:16 +0000)]
We should never allow either the broadcast or IN_ADDR_ANY to be
connected to or sent to. This was fond when working with Michael
Tuexen and Skyzaller. Skyzaller seems to want to use either of
these two addresses to connect to at times. And it really is
an error to do so, so lets not allow that behavior.

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

3 years agoThis fixes a couple of skyzaller crashes. Most
rrs [Wed, 3 Jun 2020 14:07:31 +0000 (14:07 +0000)]
This fixes a couple of skyzaller crashes. Most
of them have to do with TFO. Even the default stack
had one of the issues:

1) We need to make sure for rack that we don't advance
   snd_nxt beyond iss when we are not doing fast open. We
   otherwise can get a bunch of SYN's sent out incorrectly
   with the seq number advancing.
2) When we complete the 3-way handshake we should not ever
   append to reassembly if the tlen is 0, if TFO is enabled
   prior to this fix we could still call the reasemmbly. Note
   this effects all three stacks.
3) Rack like its cousin BBR should track if a SYN is on a
   send map entry.
4) Both bbr and rack need to only consider len incremented on a SYN
   if the starting seq is iss, otherwise we don't increment len which
   may mean we return without adding a sendmap entry.

This work was done in collaberation with Michael Tuexen, thanks for
all the testing!
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D25000

3 years agoRestrict enabling TCP-FASTOPEN to end-points in CLOSED or LISTEN state
tuexen [Wed, 3 Jun 2020 13:51:53 +0000 (13:51 +0000)]
Restrict enabling TCP-FASTOPEN to end-points in CLOSED or LISTEN state

Enabling TCP-FASTOPEN on an end-point which is in a state other than
CLOSED or LISTEN, is a bug in the application. So it should not work.
Also the TCP code does not (and needs not to) handle this.
While there, also simplify the setting of the TF_FASTOPEN flag.

This issue was found by running syzkaller.

Reviewed by: rrs
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D25115

3 years agoAdd if_reassing method to all tunneling interfaces.
ae [Wed, 3 Jun 2020 13:02:31 +0000 (13:02 +0000)]
Add if_reassing method to all tunneling interfaces.

After r339550 tunneling interfaces have started handle appearing and
disappearing of ingress IP address on the host system.
When such interfaces are moving into VNET jail, they lose ability to
properly handle ifaddr_event_ext event. And this leads to need to
reconfigure tunnel to make it working again.

Since moving an interface into VNET jail leads to removing of all IP
addresses, it looks consistent, that tunnel configuration should also
be cleared. This is what will do if_reassing method.

Reported by: John W. O'Brien <john saltant com>
MFC after: 1 week

3 years agotmpfs: Preserve alignment of struct fid fields
freqlabs [Wed, 3 Jun 2020 09:38:51 +0000 (09:38 +0000)]
tmpfs: Preserve alignment of struct fid fields

On 64-bit platforms, the two short fields in `struct tmpfs_fid` are padded to
the 64-bit alignment of the long field.  This pushes the offsets of the
subsequent fields by 4 bytes and makes `struct tmpfs_fid` bigger than
`struct fid`.  `tmpfs_vptofh()` casts a `struct fid *` to `struct tmpfs_fid *`,
causing 4 bytes of adjacent memory to be overwritten when the struct fields are
set.  Through several layers of indirection and embedded structs, the adjacent
memory for one particular call to `tmpfs_vptofh()` happens to be the stack
canary for `nfsrvd_compound()`.  Half of the canary ends up being clobbered,
going unnoticed until eventually the stack check fails when `nfsrvd_compound()`
returns and a panic is triggered.

Instead of duplicating fields of `struct fid` in `struct tmpfs_fid`, narrow the
struct to cover only the unique fields for tmpfs and assert at compile time
that the struct fits in the allotted space.  This way we don't have to
replicate the offsets of `struct fid` fields, we just use them directly.

Reviewed by: kib, mav, rmacklem
Approved by: mav (mentor)
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25077

3 years agonetmap: vale: fix disabled logs
vmaffione [Wed, 3 Jun 2020 05:49:19 +0000 (05:49 +0000)]
netmap: vale: fix disabled logs

MFC after: 1 week

3 years agonetmap: vtnet: remove leftover memory barriers
vmaffione [Wed, 3 Jun 2020 05:48:42 +0000 (05:48 +0000)]
netmap: vtnet: remove leftover memory barriers

MFC after: 1 week

3 years agonetmap: vtnet: call netmap_rx_irq() under VQ lock
vmaffione [Wed, 3 Jun 2020 05:27:29 +0000 (05:27 +0000)]
netmap: vtnet: call netmap_rx_irq() under VQ lock

The netmap_rx_irq() function normally wakes up user-space threads
waiting for more packets. In this case, it is not necessary to
call it under the driver queue lock. However, if the interface is
attached to a VALE switch, netmap_rx_irq() ends up calling rxsync
on the interface (see netmap_bwrap_intr_notify()). Although
concurrent rxsyncs are serialized through the kring lock
(see nm_kr_tryget()), the lock acquire operation is not blocking.
As a result, it may happen that netmap_rx_irq() is called on
an RX ring while another instance is running, causing the
second call to fail, and received packets stall in the receive VQ.
We fix this issue by calling netmap_irx_irq() under the VQ lock.

MFC after: 1 week

3 years agonetmap: vtnet: honor NM_IRQ_RESCHED
vmaffione [Wed, 3 Jun 2020 05:09:33 +0000 (05:09 +0000)]
netmap: vtnet: honor NM_IRQ_RESCHED

The netmap_rx_irq() function may return NM_IRQ_RESCHED to inform the
driver that more work is pending, and that netmap expects netmap_rx_irq()
to be called again as soon as possible.
This change implements this behaviour in the vtnet driver.

MFC after: 1 week

3 years agoRemove unnecessary WITNESS check in x86 bus_dma
jah [Wed, 3 Jun 2020 00:16:36 +0000 (00:16 +0000)]
Remove unnecessary WITNESS check in x86 bus_dma

When I did some bus_dma cleanup in r320528, I brought forward some sketchy
WITNESS checks from the prior x86 busdma wrappers, instead of recognizing
them as technical debt and just dropping them.  Two of these were removed in
r346351 and r346851, but one remains in bounce_bus_dmamem_alloc(). This check
could be constrained to only apply in the BUS_DMA_NOWAIT case, but it's cleaner
to simply remove it and rely on the checks already present in the sleepable
allocation paths used by this function.

While here, remove another unnecessary witness check in bus_dma_tag_create
(the tag is always allocated with M_NOWAIT), and fix a couple of typos.

Reported by: cem
Reviewed by: kib, cem
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25107

3 years agolld: Set DF_1_PIE for -pie
emaste [Tue, 2 Jun 2020 22:57:13 +0000 (22:57 +0000)]
lld: Set DF_1_PIE for -pie

DF_1_PIE originated from Solaris[1].

GNU ld[2] sets the flag on non-Solaris platforms.

It can help distinguish PIE from ET_DYN.
eu-classify from elfutils uses this to recognize PIE[3].

glibc uses this flag to reject dlopen'ing a PIE[4]

[1] https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5fe2850dd96483f176858fd75c098313d5b20bc2
[3] https://sourceware.org/git/?p=elfutils.git;a=commit;h=3f489b5c7c78df6d52f8982f79c36e9a220e8951
[4] https://sourceware.org/bugzilla/show_bug.cgi?id=24323

Discussed with: dim
Obtained from: LLVM ee9a251caf1d
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agollvm: Add DF_1_PIE
emaste [Tue, 2 Jun 2020 22:55:51 +0000 (22:55 +0000)]
llvm: Add DF_1_PIE

Discussed with: dim
Obtained from: LLVM d9943e7f0ce8
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years ago[run] note that PHY_HT is for mixed mode.
adrian [Tue, 2 Jun 2020 22:37:53 +0000 (22:37 +0000)]
[run] note that PHY_HT is for mixed mode.

Submitted by: Ashish Gupta <ashishgu@andrew.cmu.edu>
Differential Revision: https://reviews.freebsd.org/D25108

3 years ago[run] Set the number of HT chains.
adrian [Tue, 2 Jun 2020 22:36:17 +0000 (22:36 +0000)]
[run] Set the number of HT chains.

* Set the tx/rx chains based on the existing MIMO eeprom reads
* Add 3-chain rates

Tested:

* MAC/BBP RT5390 (rev 0x0502), RF RT5370 (MIMO 1T1R), 2g/5g STA
* MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R), 2g/5g STA

4 years agoUppercase 'dso' to indicate that it is abbreviation.
kib [Tue, 2 Jun 2020 17:33:10 +0000 (17:33 +0000)]
Uppercase 'dso' to indicate that it is abbreviation.

Suggested by: arichardson
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoRemove from RB_REMOVE_COLOR some null checks where the pointer checked
dougm [Tue, 2 Jun 2020 17:18:16 +0000 (17:18 +0000)]
Remove from RB_REMOVE_COLOR some null checks where the pointer checked
is provably never null.  Restructure the surrounding code just enough
to make the non-nullness obvious.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25089

4 years ago[run] Add 11NA flags for 5G NICs that support HT.
adrian [Tue, 2 Jun 2020 16:40:58 +0000 (16:40 +0000)]
[run] Add 11NA flags for 5G NICs that support HT.

Now that I'm a proud owner of an ASUS USB-N66, I can test 2G/5G and
3-stream configurations.

For now, just flip on 5G HT rates.  I've tested this in both
5G HT20 and 5G 11a modes.  It's still one stream for now until
we verify that the number of streams reported (ie the MIMO below)
is actually the number of 11n streams, NOT the number of antennas.
(They don't have to match! You can have more antennas than MIMO
streams!)

Tested:

* run0: MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R)

4 years agoDo not allow to load ET_DYN object with DF_1_PIE flag set.
kib [Tue, 2 Jun 2020 16:20:58 +0000 (16:20 +0000)]
Do not allow to load ET_DYN object with DF_1_PIE flag set.

Linkers are supposed to mark PIE binaries with DF_1_PIE, such binary
cannot be correctly and usefully loaded neither by dlopen(3) nor as a
dependency of other object.  For instance, we cannot do anything
useful with COPY relocations, among other things.

Glibc already added similar restriction.

Requested and reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25086

4 years agoImplement __is_constexpr() function macro in the LinuxKPI.
hselasky [Tue, 2 Jun 2020 12:23:04 +0000 (12:23 +0000)]
Implement __is_constexpr() function macro in the LinuxKPI.
Bump the FreeBSD version.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement struct_size() function macro in the LinuxKPI.
hselasky [Tue, 2 Jun 2020 10:19:45 +0000 (10:19 +0000)]
Implement struct_size() function macro in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement BUILD_BUG_ON_ZERO() in the LinuxKPI.
hselasky [Tue, 2 Jun 2020 09:45:43 +0000 (09:45 +0000)]
Implement BUILD_BUG_ON_ZERO() in the LinuxKPI.
Tested using gcc and clang.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoPer-rule hit counts (-h) can be used with either -i (input) or -o (output)
cy [Tue, 2 Jun 2020 03:44:22 +0000 (03:44 +0000)]
Per-rule hit counts (-h) can be used with either -i (input) or -o (output)
filter rule lists.

MFC after: 3 days

4 years agopkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL
kevans [Tue, 2 Jun 2020 02:38:54 +0000 (02:38 +0000)]
pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL

When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf that
conflict, and hilarity ensues. There's currently three different places that
we might install mailer.conf:

- ^/etc/Makefile (package=runtime, contingent on MK_MAIL != no)
- ^/libexec/dma/dmagent/Makefile (package=dma, contingent on MK_SENDMAIL !=
no)
- ^/usr.sbin/mailwrapper/Makefile (package=utilities, contingent on
not-installed)

The mailwrapper installation will effectively never happen because the ^/etc
one will first.

This patch simplifies the whole situation; remove the ^/etc/Makefile version
and install it primarily in mailwrapper if MK_MAILWRAPPER != "no". The
scenarios covered in mailwrapper are:

- sendmail(8) is installed, dma(8) may or may not be installed
- neither sendmail(8) nor dma(8) is installed

In the first scenario, sendmail(8) is dominant so we can go ahead and
install the version in ^/etc/mail. In the unlisted scenario, sendmail(8) is
not installed but dma(8) is, we'll let ^/libexec/dma/dmagent do the
installation. In the second listed scenario, we still want to install an
example mailer.conf so just install the base sendmail(8) version.

Reviewed by: bapt
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24924

4 years agovt(4): reset scrollback and cursor position after clearing history buffer
jah [Tue, 2 Jun 2020 01:21:48 +0000 (01:21 +0000)]
vt(4): reset scrollback and cursor position after clearing history buffer

r361601 implemented basic support for cleaing the console history buffer.
But after clearing the history buffer, it's not especially useful to be
able to scroll back through that buffer, or for the cursor position to
remain at (very likely) the bottom of the screen.

PR: 224436
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D25079

4 years ago[psm] Workaround active PS/2 multiplexor hang
wulf [Tue, 2 Jun 2020 01:04:49 +0000 (01:04 +0000)]
[psm] Workaround active PS/2 multiplexor hang

which happens on some laptops after returning to legacy multiplexing mode
at initialization stage.

PR: 242542
Reported by: Felix Palmen <felix@palmen-it.de>
MFC after: 1 week

4 years ago[psm] Do not disable trackpoint when hw.psm.elantech.touchpad_off is enabled
wulf [Tue, 2 Jun 2020 00:53:39 +0000 (00:53 +0000)]
[psm] Do not disable trackpoint when hw.psm.elantech.touchpad_off is enabled

PR: 246117
Reported by: Alexander Sieg <ports@xanderio.de>
MFC after: 1 week

4 years agobsd.prog.mk: split MK_PIE test for clarity
emaste [Tue, 2 Jun 2020 00:46:15 +0000 (00:46 +0000)]
bsd.prog.mk: split MK_PIE test for clarity

And a comment explaining why PIE flags are disabled for static binaries.

4 years agomodules: don't build ipsec/tcpmd5 if the kernel is configured for IPSEC
kevans [Tue, 2 Jun 2020 00:32:36 +0000 (00:32 +0000)]
modules: don't build ipsec/tcpmd5 if the kernel is configured for IPSEC

IPSEC_SUPPORT can currently only cope with either IPSEC || IPSEC_SUPPORT,
not both. Refrain from building if IPSEC is set, as the resulting module
won't be able to load anyways if it's built into the kernel.

KERN_OPTS is safe here; for tied modules, it will reflect the kernel
configuration. For untied modules, it will defer to whatever is set in
^/sys/conf/config.mk, which doesn't set IPSEC for modules. The latter
situation has some risk to it for uncommon scenarios, but such is the life
of untied kernel modules.

Reported by: jenkins (a lot), O. Hartmann (once)
Generally discussed with: imp, jhb

4 years agoFix build issue introduced by r361699.
rmacklem [Tue, 2 Jun 2020 00:03:26 +0000 (00:03 +0000)]
Fix build issue introduced by r361699.

Reported by: cy (and others)

4 years agostand/uboot: fix setting of gateip.s_addr
sjg [Mon, 1 Jun 2020 23:44:03 +0000 (23:44 +0000)]
stand/uboot: fix setting of gateip.s_addr

Missplaced paren.

Reviewed by: imp
MFC after: 1 week

4 years agolualoader: improve drawer error handling
kevans [Mon, 1 Jun 2020 23:26:37 +0000 (23:26 +0000)]
lualoader: improve drawer error handling

At least one user has landed in a scenario where logo files appear to be
misnamed, and we failed to find them. Our fallback for missing logodefs is
orb/orbbw, based on the color status. In a scenario where we can't locate
the logos, though, this is not ideal. Add in one more layer of fallback
to properly just don't draw any logo if the fan has been jam packed with
foreign material.

PR: 246046
MFC after: 3 days

4 years agoAdd rib subscription API.
melifaro [Mon, 1 Jun 2020 21:52:24 +0000 (21:52 +0000)]
Add rib subscription API.

Currently there is no easy way of subscribing for the routing table changes.
The only existing way is to set ifa_rtrequest callback in the each protocol
 ifaddr, which is not convenient or extandable.

This change provides generic notification subscription mechanism, that will
 replace current ifa_rtrequest one and allow other applications such as
 accelerated routing lookup modules subscribe for the changes.

In particular, this change provides 2 hooks: 1) synchronous one
 (RIB_NOTIFY_IMMEDIATE), called under RIB_WLOCK, which ensures exact
 ordering of the changes and 2) async one, (RIB_NOTIFY_DELAYED)
 that is called after the change w/o holding locks. The latter one does not
 provide any notification ordering guarantee.

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

4 years agoFinish r361706: add sys/net/route/route_ctl.h, missed in previous commit.
melifaro [Mon, 1 Jun 2020 21:51:20 +0000 (21:51 +0000)]
Finish r361706: add sys/net/route/route_ctl.h, missed in previous commit.

4 years ago* Add rib_<add|del|change>_route() functions to manipulate the routing table.
melifaro [Mon, 1 Jun 2020 20:49:42 +0000 (20:49 +0000)]
* Add rib_<add|del|change>_route() functions to manipulate the routing table.

The main driver for the change is the need to improve notification mechanism.
Currently callers guess the operation data based on the rtentry structure
 returned in case of successful operation result. There are two problems with
 this appoach. First is that it doesn't provide enough information for the
 upcoming multipath changes, where rtentry refers to a new nexthop group,
 and there is no way of guessing which paths were added during the change.
 Second is that some rtentry fields can change during notification and
 protecting from it by requiring customers to unlock rtentry is not desired.

Additionally, as the consumers such as rtsock do know which operation they
 request in advance, making explicit add/change/del versions of the functions
 makes sense, especially given the functions don't share a lot of code.

With that in mind, introduce rib_cmd_info notification structure and
 rib_<add|del|change>_route() functions, with mandatory rib_cmd_info pointer.
 It will be used in upcoming generalized notifications.

* Move definitions of the new functions and some other functions/structures
 used for the routing table manipulation to a separate header file,
 net/route/route_ctl.h. net/route.h is a frequently used file included in
 ~140 places in kernel, and 90% of the users don't need these definitions.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D25067

4 years agoRevert r361704, it accidentally committed merged D25067 and D25070.
melifaro [Mon, 1 Jun 2020 20:40:40 +0000 (20:40 +0000)]
Revert r361704, it accidentally committed merged D25067 and D25070.

4 years ago* Add rib_<add|del|change>_route() functions to manipulate the routing table.
melifaro [Mon, 1 Jun 2020 20:32:02 +0000 (20:32 +0000)]
* Add rib_<add|del|change>_route() functions to manipulate the routing table.

The main driver for the change is the need to improve notification mechanism.
Currently callers guess the operation data based on the rtentry structure
 returned in case of successful operation result. There are two problems with
 this appoach. First is that it doesn't provide enough information for the
 upcoming multipath changes, where rtentry refers to a new nexthop group,
 and there is no way of guessing which paths were added during the change.
 Second is that some rtentry fields can change during notification and
 protecting from it by requiring customers to unlock rtentry is not desired.

Additionally, as the consumers such as rtsock do know which operation they
 request in advance, making explicit add/change/del versions of the functions
 makes sense, especially given the functions don't share a lot of code.

With that in mind, introduce rib_cmd_info notification structure and
 rib_<add|del|change>_route() functions, with mandatory rib_cmd_info pointer.
 It will be used in upcoming generalized notifications.

* Move definitions of the new functions and some other functions/structures
 used for the routing table manipulation to a separate header file,
 net/route/route_ctl.h. net/route.h is a frequently used file included in
 ~140 places in kernel, and 90% of the users don't need these definitions.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D25067

4 years ago[PowerPC] Fix build-id note on powerpc64 kernel
bdragon [Mon, 1 Jun 2020 19:40:59 +0000 (19:40 +0000)]
[PowerPC] Fix build-id note on powerpc64 kernel

Due to the ordering of the powerpc64 linker script, we were discarding
all notes before emitting .note.gnu.build-id. This had the effect of
generating an empty build id section and breaking the kern.build_id
sysctl added in r348611.

powerpc and powerpcspe are uneffected.

PR: 246430
MFC after: 3 days
Sponsored by: Tag1 Consulting, Inc.

4 years agoCatch up with r361700.
jkim [Mon, 1 Jun 2020 19:34:21 +0000 (19:34 +0000)]
Catch up with r361700.

OpenSSL 32-bit compat engines are moved to /usr/lib32/engines.

4 years agobridge tests: Avoid building a switching loop
kp [Mon, 1 Jun 2020 19:26:16 +0000 (19:26 +0000)]
bridge tests: Avoid building a switching loop

Enable STP before bringing the bridges up. This avoids a switching loop,
which has a tendency to drown out progress in userspace processes,
especially on single-core systems.

Only check that we have indeed shut down one of the looped interfaces

PR: 246448
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D25084

4 years agoInstall 32-bit libcrypto engines in /usr/lib32/engines instead of
tijl [Mon, 1 Jun 2020 18:58:09 +0000 (18:58 +0000)]
Install 32-bit libcrypto engines in /usr/lib32/engines instead of
/usr/lib32 and let 32-bit libcrypto search that location instead of
/usr/lib/engines.

Reviewed by: jkim

4 years agoAssign default security flavor when converting old export args
freqlabs [Mon, 1 Jun 2020 18:43:51 +0000 (18:43 +0000)]
Assign default security flavor when converting old export args

vfs_export requires security flavors be explicitly listed when
exporting as of r360900.

Use the default AUTH_SYS flavor when converting old export args to
ensure compatibility with the legacy mount syscall.

Reported by: rmacklem
Reviewed by: rmacklem
Approved by: mav (mentor)
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25045

4 years agonetmap: if_vtnet: avoid netmap ring wraparound
vmaffione [Mon, 1 Jun 2020 16:14:29 +0000 (16:14 +0000)]
netmap: if_vtnet: avoid netmap ring wraparound

netmap assumes the one "slot" is left unused to distinguish
the empty ring and full ring conditions. This assumption was
violated by vtnet_netmap_rxq_populate().

MFC after: 1 week

4 years agonetmap: if_vtnet: replace vtnet_free_used()
vmaffione [Mon, 1 Jun 2020 16:12:09 +0000 (16:12 +0000)]
netmap: if_vtnet: replace vtnet_free_used()

The functionality contained in this function is duplicated,
as it is already available in vtnet_txq_free_mbufs()
and vtnet_rxq_free_mbufs().

MFC after: 1 week

4 years agonetmap: vtnet: fix RX virtqueue initialization bug
vmaffione [Mon, 1 Jun 2020 16:10:44 +0000 (16:10 +0000)]
netmap: vtnet: fix RX virtqueue initialization bug

The vtnet_netmap_rxq_populate() function erroneously assumed
that kring->nr_hwcur = 0, i.e. the kring was in the initial
state. However, this is not always the case: for example,
when a vtnet reinit is triggered by some changes in the
interface flags or capenable.
This patch changes the behaviour of vtnet_netmap_kring_refill()
so that it always starts publishing the netmap buffers starting
from the current value of kring->nr_hwcur.

MFC after: 1 week

4 years agoRemove ->f_label from struct file
mjg [Mon, 1 Jun 2020 15:58:22 +0000 (15:58 +0000)]
Remove ->f_label from struct file

The field was added in r141137 in 2005 and is unused.

It avoidably grows a struct which is NOFREE and easily gets hundreds of
thousands of instances.

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

4 years agocap_fileargs: Fix a descriptor leak in the service process.
markj [Mon, 1 Jun 2020 15:32:13 +0000 (15:32 +0000)]
cap_fileargs: Fix a descriptor leak in the service process.

The service handler for fileargs_open() tries to pre-open multiple files
and pass descriptors for each back to the sandboxed process in a single
message.  This is to amortize the cost of round-trips between the two
processes.

The service process adds a "cache" nvlist to the reply to "open",
containing file descriptors for pre-opened files.  However, when adding
that nvlist to the reply, it was making a copy, effectively leaking the
cached descriptors.

While here, fix spelling in a local variable name.

PR: 241226
Reviewed by: oshogbo
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25095

4 years agoUpdate Subversion to 1.14.0 LTS. See contrib/subversion/CHANGES for a
dim [Mon, 1 Jun 2020 10:27:05 +0000 (10:27 +0000)]
Update Subversion to 1.14.0 LTS. See contrib/subversion/CHANGES for a
summary of changes, or for a more thorough overview:

https://subversion.apache.org/docs/release-notes/1.14

NOTE: there is no need to dump and reload repositories, and the working
copy format is still the same as Subversion 1.8 through 1.13.

Relnotes: yes
MFC after: 2 weeks
X-MFC-With: r361677

4 years agoUpdate apr-util to 1.6.1. See contrib/apr-util/CHANGES for a summary of
dim [Mon, 1 Jun 2020 10:14:45 +0000 (10:14 +0000)]
Update apr-util to 1.6.1. See contrib/apr-util/CHANGES for a summary of
changes.

MFC after: 2 weeks
X-MFC-With: r361677

4 years agoFollow-up r361678 (update apr to 1.7.0) by also regenerating the apr
dim [Mon, 1 Jun 2020 10:08:18 +0000 (10:08 +0000)]
Follow-up r361678 (update apr to 1.7.0) by also regenerating the apr
internal headers through the upstream configure script, with some minor
custom tweaks.

MFC after: 2 weeks
X-MFC-With: r361677

4 years agoDocument long version of -b option
bapt [Mon, 1 Jun 2020 09:15:15 +0000 (09:15 +0000)]
Document long version of -b option

PR: 234195
Submitted by: Fehmi Noyan Isi <fnoyanisi@yahoo.com>
Reported by: Andras Farkas <deepbluemistake@gmail.com>
MFC after: 3 days

4 years agodiff: restore compatibility with GNU diff regarding -N option
bapt [Mon, 1 Jun 2020 09:09:36 +0000 (09:09 +0000)]
diff: restore compatibility with GNU diff regarding -N option

When -N is used the missing files are treated as empty.

PR: 233402
Submitted by: Fehmi Noyan Isi <fnoyanisi@yahoo.com>
Reported by: Roman Neuhauser <roman@sigpipe.cz>
MFC after: 3 days
Differential Revision: D25081

4 years agoRestore compatibility with GNU diff regarding --label
bapt [Mon, 1 Jun 2020 09:01:13 +0000 (09:01 +0000)]
Restore compatibility with GNU diff regarding --label

Various options to "diff(1)" show filenames, and traditionally make use of the
"--label" parameter, if set.

Restore this behaviour in BSD diff.

While here add a regression test

PR: 244533
Submitted by: Jamie Landeg-Jones <jamie@catflap.org>
MFC after: 3 days

4 years ago[ath] Don't re-program the beacon timers if we miss a beacon in software-beacon STA...
adrian [Mon, 1 Jun 2020 06:10:25 +0000 (06:10 +0000)]
[ath] Don't re-program the beacon timers if we miss a beacon in software-beacon STA mode.

This is something I added a few years ago to handle resyncing the beacon if
we miss a beacon or need to sync after association/reassociation/powersave.

However, if we're doing STA+AP mode (eg DWDS) then we don't want
to reprogram the beacons here; this may upset normal AP operation.
I missed checking for the sc->sc_swbmiss flag so I was reinitialising
the beacon timers after every beacon miss / TSFOOR option, and
that isn't likely good.

This plus ensuring that STA's are created with "-beacon" to disable
BMISS/TSFOOR processing will hopefully quieten some of the issues
I've seen with missed beacons / TSFOOR (out of range) interrupts
coming in when operating in STA mode.

Tested:

* AR9380/AR9580, STA+AP modes

4 years agoClarify which hints file is the source of an error message.
peter [Mon, 1 Jun 2020 03:37:58 +0000 (03:37 +0000)]
Clarify which hints file is the source of an error message.

PR: 246688
Submitted by: Ashish Gupta <lrx337@gmail.com>
MFC after: 1 week

4 years agoapr: build some needed emulated 64-bit atomic bits after r361678
kevans [Mon, 1 Jun 2020 02:54:10 +0000 (02:54 +0000)]
apr: build some needed emulated 64-bit atomic bits after r361678

This should fix the build on armv{6,7}, mips, and mips64, which all need
emulated 64-bit atomics for apr.

X-MFC-With: r361678

4 years agocertctl: fix test syntax
kevans [Mon, 1 Jun 2020 01:25:19 +0000 (01:25 +0000)]
certctl: fix test syntax

test doesn't understand &&, but it does understand -a.

MFC after: 1 week

4 years agoOops, I didn't notice the "cd" is needed for each install line.
rmacklem [Sun, 31 May 2020 22:46:32 +0000 (22:46 +0000)]
Oops, I didn't notice the "cd" is needed for each install line.

4 years agoChange more Makefiles under usr.bin/svn to make them easier to
dim [Sun, 31 May 2020 22:40:39 +0000 (22:40 +0000)]
Change more Makefiles under usr.bin/svn to make them easier to
incrementally update. No functional change intended.

MFC after: 2 weeks
X-MFC-With: r361677

4 years agortld: Add -b option to allow to specify image name different from arg0.
kib [Sun, 31 May 2020 22:37:33 +0000 (22:37 +0000)]
rtld: Add -b option to allow to specify image name different from arg0.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoUpdate the Makefile to copy rpcsec_tls.h to /usr/include/rpc.
rmacklem [Sun, 31 May 2020 22:15:34 +0000 (22:15 +0000)]
Update the Makefile to copy rpcsec_tls.h to /usr/include/rpc.

4 years agoUpdate apr to 1.7.0. See contrib/apr/CHANGES for a summary of changes.
dim [Sun, 31 May 2020 22:12:56 +0000 (22:12 +0000)]
Update apr to 1.7.0. See contrib/apr/CHANGES for a summary of changes.

MFC after: 2 weeks
X-MFC-With: r361677

4 years agoChange Makefiles under usr.bin/svn to make them easier to incrementally
dim [Sun, 31 May 2020 22:04:51 +0000 (22:04 +0000)]
Change Makefiles under usr.bin/svn to make them easier to incrementally
update. No functional change intended.

MFC after: 2 weeks

4 years agortld: Fix indent in print_usage().
kib [Sun, 31 May 2020 21:56:07 +0000 (21:56 +0000)]
rtld: Fix indent in print_usage().

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agortld: Add -v switch to print some useful information about the rtld binary.
kib [Sun, 31 May 2020 21:53:15 +0000 (21:53 +0000)]
rtld: Add -v switch to print some useful information about the rtld binary.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoCorrect the release date for 2.11BSD
imp [Sun, 31 May 2020 21:38:33 +0000 (21:38 +0000)]
Correct the release date for 2.11BSD

2.11BSD was announced on March 14, 1991 in comp.bugs.2bsd by
Steven M. Schultz. The document has a 'revised January 1991'
date at the top.

Patch/1 in the official repo is dated March 31, 1991, and an identical copy of
it was posted to comp.bugs.2bsd on May 5, 1991. Patch 2 in 22 parts was likewise
posted May 18, 1991. This makes the Feb 1992 date too late. It's possible it's a
typo for Feb 1991 since that lines up with the announcement being 2 weeks
later. Without an extant copy of the 2.11 tape, however, it's hard to say for
sure. Go with the date we have the most independent, direct evidence for, which
is the announcement date.

4 years agortld: Add -p switch to direct exec mode summary line.
kib [Sun, 31 May 2020 21:34:21 +0000 (21:34 +0000)]
rtld: Add -p switch to direct exec mode summary line.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoVendor import svn-1.14.0.
dim [Sun, 31 May 2020 20:58:28 +0000 (20:58 +0000)]
Vendor import svn-1.14.0.

4 years agoVendor import apr-1.7.0
dim [Sun, 31 May 2020 20:56:05 +0000 (20:56 +0000)]
Vendor import apr-1.7.0

4 years agoFix panics when using iflib pseudo device support
mmacy [Sun, 31 May 2020 18:42:00 +0000 (18:42 +0000)]
Fix panics when using iflib pseudo device support

Reviewed by: gallatin@, hselasky@
MFC after: 1 week
Sponsored by: Netgate, Inc.
Differential Revision: https://reviews.freebsd.org/D23710

4 years agoHandle getcpu() calls in vsyscall emulation on amd64.
markj [Sun, 31 May 2020 18:20:20 +0000 (18:20 +0000)]
Handle getcpu() calls in vsyscall emulation on amd64.

linux_getcpu() has been implemented since r356241.

PR: 246339
Submitted by: John Hay <john@sanren.ac.za>
MFC after: 1 week

4 years agoFix installation of libxo encoder modules.
tijl [Sun, 31 May 2020 17:20:17 +0000 (17:20 +0000)]
Fix installation of libxo encoder modules.

Because the install location was hardcoded in the Makefile as
/usr/lib/libxo/encoder, the lib32 version was installed over the native
version.  Replace /usr/lib with ${LIBDIR}.

Also define SHLIB_NAME instead of LIB + FILES.  This prevents building a
static library.

MFC after: 2 weeks

4 years agoreadelf: add more DT_FLAGS_1 flags
emaste [Sun, 31 May 2020 15:31:47 +0000 (15:31 +0000)]
readelf: add more DT_FLAGS_1 flags

Reference:
https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html

> DF_1_SINGLETON  Singleton symbols exist.
> DF_1_STUB       Object is a stub.
> DF_1_PIE        Object is a position-independent executable.

Sponsored by: The FreeBSD Foundation

4 years agoRemove remnant of arm's ELF trampoline
mhorne [Sun, 31 May 2020 14:43:04 +0000 (14:43 +0000)]
Remove remnant of arm's ELF trampoline

The trampoline code used for loading gzipped a.out kernels on arm was
removed in r350436. A portion of this code allowed for DDB to find the
symbol tables when booting without loader(8), and some of this was
untouched in the removal. Remove it now.

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

4 years agoFix directly building in sys/modules
lwhsu [Sun, 31 May 2020 05:02:15 +0000 (05:02 +0000)]
Fix directly building in sys/modules

Sponsored by: The FreeBSD Foundation

4 years agoAdd the .h file that describes the operations for the rpctls_syscall.
rmacklem [Sun, 31 May 2020 01:12:52 +0000 (01:12 +0000)]
Add the .h file that describes the operations for the rpctls_syscall.

This .h file will be used by the nfs-over-tls daemons to do the system
call that was added by r361599.