]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoImport lib9p 7ddb1164407da19b9b1afb83df83ae65a71a9a66.
jceel [Thu, 14 May 2020 19:57:52 +0000 (19:57 +0000)]
Import lib9p 7ddb1164407da19b9b1afb83df83ae65a71a9a66.

Approved by: trasz
MFC after: 1 month
Sponsored by: Conclusive Engineering (development), vStack.com (funding)

4 years agoFix the i386 build after r361033.
markj [Thu, 14 May 2020 17:56:44 +0000 (17:56 +0000)]
Fix the i386 build after r361033.

Reported by: Jenkins

4 years agoFix spurious ENOTCONN from closed unix domain socket other' side.
kib [Thu, 14 May 2020 17:54:08 +0000 (17:54 +0000)]
Fix spurious ENOTCONN from closed unix domain socket other' side.

Sometimes, when doing read(2) over unix domain socket, for which the
other side socket was closed, read(2) returns -1/ENOTCONN instead of
EOF AKA zero-size read. This is because soreceive_generic() does not
lock socket when testing the so_state SS_ISCONNECTED|SS_ISCONNECTING
flags. It could end up that we do not observe so->so_rcv.sb_state bit
SBS_CANTRCVMORE, and then miss SS_ flags.

Change the test to check that the socket was never connected before
returning ENOTCONN, by adding all state bits for connected.

Reported and tested by: pho
In collaboration with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24819

4 years agoinetd(8): Add comments to all examples
kevans [Thu, 14 May 2020 17:52:29 +0000 (17:52 +0000)]
inetd(8): Add comments to all examples

Submitted by: debdrup (with some minor changes by kevans)
Reviewed by: bcr (manpages)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D24818

4 years agoObsoleteFiles.inc: use date (not xxxx) for ubsec removal
emaste [Thu, 14 May 2020 17:19:07 +0000 (17:19 +0000)]
ObsoleteFiles.inc: use date (not xxxx) for ubsec removal

4 years agoCall acpi_pxm_set_proximity_info() slightly earlier on x86.
markj [Thu, 14 May 2020 16:07:27 +0000 (16:07 +0000)]
Call acpi_pxm_set_proximity_info() slightly earlier on x86.

This function is responsible for setting pc_domain in each pcpu
structure.  Call it from the main function that starts APs, rather than
a separate SYSINIT.  This makes it easier to close the window where
UMA's per-CPU slab allocator may be called while pc_domain is
uninitialized.  In particular, the allocator uses pc_domain to allocate
domain-local pages, so allocations before this point end up using domain
0 for everything.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24757

4 years agoAllocate UMA per-CPU counters earlier.
markj [Thu, 14 May 2020 16:06:54 +0000 (16:06 +0000)]
Allocate UMA per-CPU counters earlier.

Otherwise anything counted before SI_SUB_VM_CONF is discarded.  However,
it is useful to be able to see stats from allocations done early during
boot.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24756

4 years agoAssert that page table traversal functions don't operate on superpages.
markj [Thu, 14 May 2020 15:49:37 +0000 (15:49 +0000)]
Assert that page table traversal functions don't operate on superpages.

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

4 years agoAdd new stats(7) man page and hook it up to the build.
bcr [Thu, 14 May 2020 09:18:50 +0000 (09:18 +0000)]
Add new stats(7) man page and hook it up to the build.

This man page contains stat utilities that are available in
the base system. This is a better approach than looking them
up via "apropos stat" or similar commands.

Thanks to Daniel Ebdrup Jensen for writing the original page
and incorporating the feedback given.

Submitted by: Daniel Ebdrup Jensen
Reviewed by: 0mp, allanjude, brueffer, bcr
Approved by: bcr
MFC after: 3 days
Relnotes: yes (new stats(7) man page)
Differential Revision: https://reviews.freebsd.org/D24417

4 years ago[ath] Extend the colours to 4, not 2.
adrian [Thu, 14 May 2020 05:01:18 +0000 (05:01 +0000)]
[ath] Extend the colours to 4, not 2.

There's 8 bins in the upcoming changeset to ath/ath_rate, so I need
more colours.  Yeah, I know.

4 years ago[PowerPC] Fix wrong instructions in _savegpr_X.
bdragon [Thu, 14 May 2020 04:00:35 +0000 (04:00 +0000)]
[PowerPC] Fix wrong instructions in _savegpr_X.

We were accidentally using stfd instead of stw in our SAVEGPR macro.

This has almost certainly been causing crashes when compiling with -Os.

Reviewed by: jhibbits (in irc)
MFC after: 3 days
Sponsored by: Tag1 Consulting, Inc.

4 years agocertctl: follow-up to r361022, prune blacklist as well
kevans [Thu, 14 May 2020 03:30:27 +0000 (03:30 +0000)]
certctl: follow-up to r361022, prune blacklist as well

Otherwise, removals from the blacklist may not get processed as they should.

While we're here, restructure these to not bother with mkdir(1) if we've
already tested them to exist.

MFC after: 3 days

4 years agocertctl(8): don't completely nuke $CERTDESTDIR
kevans [Thu, 14 May 2020 03:25:12 +0000 (03:25 +0000)]
certctl(8): don't completely nuke $CERTDESTDIR

It's been reported/noted that a well-timed `certctl rehash` will completely
obliterate $CERTDESTDIR, which may get used by ports or system
administrators. While we can't guarantee the certctl semantics when other
non-certctl-controlled bits live here, we should make some amount of effort
to play nice.

Pruning all existing links, which we'll subsequently rebuild as needed, is
sufficient for our needs. This can still be destructive, but it's perhaps
less likely to cause issues.

I also note that we should probably be pruning /etc/ssl/blacklisted upon
rehash as well.

Reported by: cem's dovecot server
MFC after: 3 days

4 years agovfs_extattr: Allow extattr names up to the full max
cem [Thu, 14 May 2020 03:01:23 +0000 (03:01 +0000)]
vfs_extattr: Allow extattr names up to the full max

Extattr names are allowed to be 255 bytes -- not 254 bytes plus trailing
NUL.  Provide a 256 buffer so that copyinstr() has room for the trailing
NUL.

Re-enable test for maximal name lengths.

PR: 208965
Reported by: asomers
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D24584

4 years agoOnly skip sys.net.if_clone_test.epair_stress in CI env
lwhsu [Wed, 13 May 2020 20:37:46 +0000 (20:37 +0000)]
Only skip sys.net.if_clone_test.epair_stress in CI env

PR: 246443
Sponsored by: The FreeBSD Foundation

4 years agoTemporarily skip sys.net.if_bridge_test.stp in CI as it always times out
lwhsu [Wed, 13 May 2020 20:36:38 +0000 (20:36 +0000)]
Temporarily skip sys.net.if_bridge_test.stp in CI as it always times out

PR: 244229
Sponsored by: The FreeBSD Foundation

4 years agoTemporarily skip sys.net.if_clone_test.epair_stress
lwhsu [Wed, 13 May 2020 19:29:14 +0000 (19:29 +0000)]
Temporarily skip sys.net.if_clone_test.epair_stress

This case timed out so often

PR: 246443
Sponsored by: The FreeBSD Foundation

4 years agoAdd nvd alias back to nda now that it actually works.
imp [Wed, 13 May 2020 19:17:35 +0000 (19:17 +0000)]
Add nvd alias back to nda now that it actually works.

4 years agoReimplement aliases in geom
imp [Wed, 13 May 2020 19:17:28 +0000 (19:17 +0000)]
Reimplement aliases in geom

The alias needs to be part of the provider instead of the geom to work
properly. To bind the DEV geom, we need to look at the provider's names and
aliases and create the dev entries from there. If this lives in the GEOM, then
it won't propigate down the tree properly. Remove it from geom, add it provider.

Update geli, gmountver, gnop, gpart, and guzip to use it, which handles the bulk
of the uses in FreeBSD. I think this is all the providers that create a new name
based on their parent's name.

4 years agoTrim a few more things I missed from xform_enc.h.
jhb [Wed, 13 May 2020 18:36:02 +0000 (18:36 +0000)]
Trim a few more things I missed from xform_enc.h.

An extern declaration for the now-removed Blowfish encryption
transform, and an include of the DES header.

4 years agoRemove unused header for DES.
jhb [Wed, 13 May 2020 18:35:02 +0000 (18:35 +0000)]
Remove unused header for DES.

The NFS port doesn't use any of the DES functions.

4 years agokernel: provide panicky version of __unreachable
kevans [Wed, 13 May 2020 18:07:37 +0000 (18:07 +0000)]
kernel: provide panicky version of __unreachable

__builtin_unreachable doesn't raise any compile-time warnings/errors on its
own, so problems with its usage can't be easily detected. While it would be
nice for this situation to change and compilers to at least add a warning
for trivial cases where local state means the instruction can't be reached,
this isn't the case at the moment and likely will not happen.

This commit adds an __assert_unreachable, whose intent is incredibly clear:
it asserts that this instruction is unreachable. On INVARIANTS builds, it's
a panic(), and on non-INVARIANTS it expands to  __unreachable().

Existing users of __unreachable() are converted to __assert_unreachable,
to improve debuggability if this assumption is violated.

Reviewed by: mjg
Differential Revision: https://reviews.freebsd.org/D23793

4 years agoriscv: Fix pmap_protect for superpages
jrtc27 [Wed, 13 May 2020 17:20:51 +0000 (17:20 +0000)]
riscv: Fix pmap_protect for superpages

When protecting a superpage, we would previously fall through to the
non-superpage case and read the contents of the superpage as PTEs,
potentially modifying them and trying to look up underlying VM pages that
don't exist if they happen to look like PTEs we would care about. This led
to nginx causing an unexpected page fault in pmap_protect that panic'ed the
kernel. Instead, if we see a superpage, we are done for this range and
should continue to the next.

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

4 years ago[ath] Prepare for .. more sample rate control entries
adrian [Wed, 13 May 2020 16:36:42 +0000 (16:36 +0000)]
[ath] Prepare for .. more sample rate control entries

This is in preparation for me bumping how many size buckets are used
for ath_rate_sample statistics.

* Bump buffer size to 64k
* Don't waste 4 lines per bucket size, condense it to two
* Alternate colours; my logic made everything after the first two just
  be black.  Oops.

4 years agolinuxkpi: Add EBADRQC to errno.h
manu [Wed, 13 May 2020 07:49:12 +0000 (07:49 +0000)]
linuxkpi: Add EBADRQC to errno.h

This is used in the amdgpu driver from Linux 5.2

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

4 years agolinuxkpi: print stack trace in WARN_ON macros
avg [Wed, 13 May 2020 07:47:56 +0000 (07:47 +0000)]
linuxkpi: print stack trace in WARN_ON macros

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

4 years agosnd_hda: fix typos related to quirks set via 'config' tunable
avg [Wed, 13 May 2020 06:26:30 +0000 (06:26 +0000)]
snd_hda: fix typos related to quirks set via 'config' tunable

One wrong quirk bit, one wrong variable name.

MFC after: 1 week

4 years agosound/hda: newer AMD devices still require the same PCIe snoop
avg [Wed, 13 May 2020 06:24:54 +0000 (06:24 +0000)]
sound/hda: newer AMD devices still require the same PCIe snoop

So, replicate the ATI vendor snoop configuration for the AMD vendor.
I think that this should fix a number of cases where users currently
have to resort to polling or disabling MSI.

MFC after: 1 week

4 years agoinetd(8): Provide HTTP proxy example using netcat
kevans [Wed, 13 May 2020 02:17:27 +0000 (02:17 +0000)]
inetd(8): Provide HTTP proxy example using netcat

One of the fortunes that are included in freebsd-tips talks about how
the superserver can be used to proxy connections with netcat, but there are
no examples provided. This commit adds an example with comment explaining
what it does.

Submitted by: debdrup
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24800

4 years agoMake the ata probe* and xpt* routines aprobe* and axpt* respectively.
imp [Wed, 13 May 2020 00:18:44 +0000 (00:18 +0000)]
Make the ata probe* and xpt* routines aprobe* and axpt* respectively.

Often, in traiging core files, one only has a traceback of where a
panic occurred. We have probe* and xpt* routines that live in both the
scsi and ata layers with identical names. To make one or the other
stand out, prefix all the probe and xpt routines in ata with an
'a'. I've left the scsi ones alone since they were there first and are
more numerous. I also rejected using #define to do this as being too
confusing. I chose this method because the CAM name for the probe
device was already 'aprobe'.

Normally, this doesn't matter because file scope protects one from
interfering with the other. However, due to the indirect nature of
CAM's state machine, you don't know if the following traceback is
SCSI or ATA:
xpt_done
probedone
xpt_done_process
xpt_done_td
fork_exit

nvme and mmc already have unique names.

MFC: 1 week
Differential revision: https://reviews.freebsd.org/D24825

4 years ago[ath] [ath_rate] Add some extra data into the rate control lookup.
adrian [Wed, 13 May 2020 00:05:11 +0000 (00:05 +0000)]
[ath] [ath_rate] Add some extra data into the rate control lookup.

Right now (well, since I did this in 2011/2012) the rate control code
makes some super bad choices for 11n aggregates/rates, and it tracks
statistics even more questionably.

It's been long enough and I'm now trying to use it again daily, so let's
start by:

* telling the rate control code if it's an aggregate or not;
* being clearer about the TID - yes it can be extracted from the
  ath_buf but this way it can be overridden by the caller without
  changing the TID itself.

  (This is for doing experiments with voice/video QoS at some point..)

* Return an optional field to limit how long the aggregate is in
  microseconds.  Right now the rate control code supplies a rate table
  and the ath aggr form code will look at the rate table and limit
  the aggregate size to 4ms at the slowest rate.  Yeah, this is pretty
  terrible.

* Add some more TODO comments around handling txpower, rate and
  handling filtered frames status so if I continue to have spoons for
  this I can go poke at it.

4 years agoKill trailing newline while I'm here...
imp [Tue, 12 May 2020 23:46:52 +0000 (23:46 +0000)]
Kill trailing newline while I'm here...

4 years agoRefine the history of uname. It appeared in 4.4BSD. It was not in v7 unix. It
imp [Tue, 12 May 2020 22:44:51 +0000 (22:44 +0000)]
Refine the history of uname. It appeared in 4.4BSD. It was not in v7 unix. It
was one of the additions in PWB, and appeared in System III and later commercial
versions of Unix. The different args to uname weren't aded until System III. Add
a quick note to note the late entry into the BSD fork of Unix since PWB
otherwise implies a pre-fork date.

4 years agosh/tests: Test some obscure cases with aliasing keywords
jilles [Tue, 12 May 2020 21:59:21 +0000 (21:59 +0000)]
sh/tests: Test some obscure cases with aliasing keywords

4 years agoFix the name reported when the core supports a 64-bit CCIDX
andrew [Tue, 12 May 2020 21:00:13 +0000 (21:00 +0000)]
Fix the name reported when the core supports a 64-bit CCIDX

4 years agoMake include/malloc.h usable again.
kib [Tue, 12 May 2020 18:17:57 +0000 (18:17 +0000)]
Make include/malloc.h usable again.

Lot of third-party Linux code uses #include <malloc.h>, expecting to
find the malloc extensions there. Instead of trying to fight them,
accept that attempt to deprecate the header causes more troubles than
solves potential portability issues, and provide our jemalloc
extensions.

PR: 155429
Reviewed by: imp, jhibbits, dab, hselasky, philip, emaste, jilles
Exp-run by: antoine (PR 245366)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D24297

4 years agoClear namespace pollution in include/malloc_np.h
kib [Tue, 12 May 2020 18:12:20 +0000 (18:12 +0000)]
Clear namespace pollution in include/malloc_np.h

Do not include stdbool.h, it makes the header incompatible with some
third-party code that typedefs bool manually.
Remove inclusion of strings.h, which typically conflicts with the use
of symbol 'index'.
Separate inclusion of sys/cdefs.h is not needed because sys/types.h
already handles that.

Exp-run by: antoine (PR 245366)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24297

4 years agoIPv6: Fix a panic in the nd6 code with unmapped mbufs.
gallatin [Tue, 12 May 2020 17:18:44 +0000 (17:18 +0000)]
IPv6: Fix a panic in the nd6 code with unmapped mbufs.

If the neighbor entry for an IPv6 TCP session using unmapped
mbufs times out, IPv6 will send an icmp6 dest. unreachable
message. In doing this, it will try to do a software checksum
on the reflected packet. If this is a TCP session using unmapped
mbufs, then there will be a kernel panic.

To fix this, just free packets with unmapped mbufs, rather
than sending the icmp.

Reviewed by: np, rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24821

4 years agoRe-enable proc_test:symbol_lookup after r360979.
markj [Tue, 12 May 2020 17:05:55 +0000 (17:05 +0000)]
Re-enable proc_test:symbol_lookup after r360979.

PR: 244732
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agolibrtld_db: Fix shlib mapping offsets.
markj [Tue, 12 May 2020 17:00:47 +0000 (17:00 +0000)]
librtld_db: Fix shlib mapping offsets.

kve_offset gives the offset into the backing file, which is not what we
want since different segments may map the same page.  Use the base of
the mapping to determine the offset exported by librtld_db instead.

PR: 244732
Reported by: Jenkins, Nicolò Mazzucato <nicomazz97@gmail.com>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agolibalias: fix potential memory disclosure from ftp module
emaste [Tue, 12 May 2020 16:38:28 +0000 (16:38 +0000)]
libalias: fix potential memory disclosure from ftp module

admbugs: 956
Submitted by: markj
Reported by: Vishnu Dev TJ working with Trend Micro Zero Day Initiative
Security: FreeBSD-SA-20:13.libalias
Security: CVE-2020-7455
Security: ZDI-CAN-10849

4 years agolibalias: validate packet lengths before accessing headers
emaste [Tue, 12 May 2020 16:33:04 +0000 (16:33 +0000)]
libalias: validate packet lengths before accessing headers

admbugs: 956
Submitted by: ae
Reported by: Lucas Leong (@_wmliang_) of Trend Micro Zero Day Initiative
Reported by: Vishnu working with Trend Micro Zero Day Initiative
Security: FreeBSD-SA-20:12.libalias

4 years agortwn: Add a USB ID for the TP-Link TL-WN727N.
markj [Tue, 12 May 2020 16:10:07 +0000 (16:10 +0000)]
rtwn: Add a USB ID for the TP-Link TL-WN727N.

PR: 246417
Submitted by: Viktor G. <viktor@netgate.com>
MFC after: 1 week

4 years agoRemove tests for obsolete compilers in the build system
vangyzen [Tue, 12 May 2020 15:22:40 +0000 (15:22 +0000)]
Remove tests for obsolete compilers in the build system

Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree.
Assume clang is at least 6, which was in 11.2-RELEASE.  Drop conditions
for older compilers.

Reviewed by: imp (earlier version), emaste, jhb
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D24802

4 years agoIPv6: sync IP_NO_SND_TAG_RL support from IPv4
gallatin [Tue, 12 May 2020 14:01:12 +0000 (14:01 +0000)]
IPv6: sync IP_NO_SND_TAG_RL support from IPv4

The IP_NO_SND_TAG_RL flag to ip{,6}_output() means that the packets
being sent should bypass hardware rate limiting. This is typically used
by modern TCP stacks for rexmits.

This support was added to IPv4 in r352657, but never added to IPv6, even
though rack and bbr call ip6_output() with this flag.

Reviewed by: rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24822

4 years agonfs: Remove APPLESTATIC macro
freqlabs [Tue, 12 May 2020 13:23:25 +0000 (13:23 +0000)]
nfs: Remove APPLESTATIC macro

It is no longer useful.

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

4 years agoAdd a new bhyve network backend that allow to connect the VM to the netgraph(4) network.
afedorov [Tue, 12 May 2020 11:18:14 +0000 (11:18 +0000)]
Add a new bhyve network backend that allow to connect the VM to the netgraph(4) network.
The backend uses the socket API with the PF_NETGRAPH protocol family, which is provided by the ng_socket(4).

To use the new backend, provide the following bhyve option:
-s X:Y:Z,[virtio-net|e1000],netgraph,socket=[ng_socket name],path=[destination node],hook=[our socket src hook],peerhook=[dst node hook]

Reviewed by: vmaffione, lutz_donnerhacke.de
Approved by: vmaffione (mentor)
Sponsored by: vstack.com
Differential Revision: https://reviews.freebsd.org/D24620

4 years agoamd64/pmap: unbreak !NUMA case for fictitious pages
avg [Tue, 12 May 2020 09:31:48 +0000 (09:31 +0000)]
amd64/pmap: unbreak !NUMA case for fictitious pages

A fictitious page can have a physical address beyond the end of the RAM.
In the NUMA case there is some special code to handle such pages, but in
the other case the pages are handled the same as normal pages.  So, we
cannot assert that the physical address is within RAM addresses.

Suggested by: kib
Reviewed by: kib
X-MFC note: NUMA support has not been MFC-ed

4 years agozfs allow/unallow should work with numeric uid/gid
avg [Tue, 12 May 2020 09:04:57 +0000 (09:04 +0000)]
zfs allow/unallow should work with numeric uid/gid

And that should work even (especially) if there is no matching user or
group name.  This change allows to see and modify delegations for
deleted groups and users.

The change is originally by Xin Li.
illumos report: https://www.illumos.org/issues/6037
OpenZFS (ZoL) PR: https://github.com/openzfs/zfs/pull/10280

Obtained from: delphij
MFC after: 2 weeks

4 years agoRevert r360944 and r360946 until reported issues can be resolved
cem [Tue, 12 May 2020 04:34:26 +0000 (04:34 +0000)]
Revert r360944 and r360946 until reported issues can be resolved

Reported by: cy

4 years ago[ath_hal_ar9300] Ensure AH_BYTE_ORDER is defined before used.
adrian [Tue, 12 May 2020 02:23:11 +0000 (02:23 +0000)]
[ath_hal_ar9300] Ensure AH_BYTE_ORDER is defined before used.

Same deal here - ensure endian bits are set here first!

4 years ago[ath_hal] [ath_hal_ar9300] Fix endian macros to work in and out of kernel tree.
adrian [Tue, 12 May 2020 02:20:27 +0000 (02:20 +0000)]
[ath_hal] [ath_hal_ar9300] Fix endian macros to work in and out of kernel tree.

Yes, people shouldn't use bitfields in C for structure parsing.
If someone ever wants a cleanup task then it'd be great to remove them
from this vendor code and other places in the ar9285/ar9287 HALs.

Alas, here we are.

AH_BYTE_ORDER wasn't defined and neither were the two values it could be.
So when compiling ath_ee_print_9300 it'd default to the big endian struct
layout and get a WHOLE lot of stuff wrong.

So:

* move AH_BYTE_ORDER into ath_hal/ah.h where it can be used by everyone.
* ensure that AH_BYTE_ORDER is actually defined before using it!

This should work on both big and little endian platforms.

4 years agoGenerate zlib.pc from source.
delphij [Tue, 12 May 2020 01:47:33 +0000 (01:47 +0000)]
Generate zlib.pc from source.

Reviewed by: bapt
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D24806

4 years ago[ar9300] Fix up this tool after test compiling it with LLVM. Le oops.
adrian [Tue, 12 May 2020 01:40:48 +0000 (01:40 +0000)]
[ar9300] Fix up this tool after test compiling it with LLVM.  Le oops.

4 years ago[ar9300] Update the ar9300 eeprom dump utility to include target power and CTL.
adrian [Tue, 12 May 2020 01:36:48 +0000 (01:36 +0000)]
[ar9300] Update the ar9300 eeprom dump utility to include target power and CTL.

This lets me easily see what the EEPROM target power and regulatory
compliance table limits are.

(Yeah, should've done this in 2013..)

4 years ago[PowerPC64] Minor correctness fix in rstcode.
bdragon [Tue, 12 May 2020 01:04:50 +0000 (01:04 +0000)]
[PowerPC64] Minor correctness fix in rstcode.

TRAP_ENTRY(0) should be TRAP_GENTRAP(0) here.

However, in practice, it doesn't matter, as the only time TRAP_ENTRY and
TRAP_GENTRAP can differ is when bridge mode is active, which is impossible
on the 64 bit kernel.

Fix it anyway in case we ever need to add a trap preamble on PPC64.

4 years agoRemove deleted files from the build
cem [Tue, 12 May 2020 00:42:16 +0000 (00:42 +0000)]
Remove deleted files from the build

Fix build break introduced in r360944.

Reported by: kevans

4 years agocopystr(9): Move to deprecate [2/2]
cem [Mon, 11 May 2020 22:57:21 +0000 (22:57 +0000)]
copystr(9): Move to deprecate [2/2]

Unlike the other copy*() functions, it does not serve to copy from one
address space to another or protect against potential faults.  It's just
an older incarnation of the now-more-common strlcpy().

Add a coccinelle script to tools/ which can be used to mechanically
convert existing instances where replacement with strlcpy is trivial.
In the two cases which matched, fuse_vfsops.c and union_vfsops.c, the
code was further refactored manually to simplify.

Replace the declaration of copystr() in systm.h with a small macro
wrapper around strlcpy.

Remove N redundant MI implementations of copystr.  For MIPS, this
entailed inlining the assembler copystr into the only consumer,
copyinstr, and making the latter a leaf function.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D24672

4 years agocopystr(9): Move to deprecate [1/2]
cem [Mon, 11 May 2020 22:48:00 +0000 (22:48 +0000)]
copystr(9): Move to deprecate [1/2]

Unlike the other copy*() functions, it does not serve to copy from one
address space to another or protect against potential faults. It's just
an older incarnation of the now-more-common strlcpy().

Reviewed by: jhb
MFC after: i² days
Differential Revision: yes (see 2/2)

4 years agoFix a copy and paste error introduced in r360878.
tuexen [Mon, 11 May 2020 22:47:20 +0000 (22:47 +0000)]
Fix a copy and paste error introduced in r360878.

Reported-by: syzbot+a0863e972771f2f0d4b3@syzkaller.appspotmail.com
Reported-by: syzbot+4481757e967ba83c445a@syzkaller.appspotmail.com
MFC after: 3 days

4 years agogeom(4) mirror: Do not panic on gmirror(8) insert, resize
cem [Mon, 11 May 2020 22:39:53 +0000 (22:39 +0000)]
geom(4) mirror: Do not panic on gmirror(8) insert, resize

Geom_mirror initialization occurs in spurts and the present of a
non-destroyed g_mirror softc does not always indicate that the geom has
launched (i.e., has an sc_provider).

Some gmirror(8) commands (via g_mirror_ctl) depend on a g_mirror's
sc_provider (insert and resize).  For those commands, g_mirror_ctl is
modified to sleep-poll in an interruptible way until the target geom is
either launched or destroyed.

Reviewed by: markj
Tested by: markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D24780

4 years agosigfastblock: fix delivery of the pending signals in single-threaded processes.
kib [Mon, 11 May 2020 22:38:32 +0000 (22:38 +0000)]
sigfastblock: fix delivery of the pending signals in single-threaded processes.

If single-threaded process receives a signal during critical section
established by sigfastblock(2) word, unblock did not caused signal
delivery because sigfastblock(SIGFASTBLOCK_UNBLOCK) failed to request
ast handling of the pending signals.

Set TDF_ASTPENDING | TDF_NEEDSIGCHK on unblock or when kernel forces
end of sigfastblock critical section, to cause syscall exit to recheck
and deliver any signal pending.

Reported by: corydoras@ridiculousfish.com
PR: 246385
Sponsored by: The FreeBSD Foundation

4 years agoRemove various empty directories.
jhb [Mon, 11 May 2020 22:26:39 +0000 (22:26 +0000)]
Remove various empty directories.

Some of these I orphaned today, others were emptied by earlier commits
to head.

4 years agoDocument removal of deprecated algorithms from OCF.
jhb [Mon, 11 May 2020 22:15:46 +0000 (22:15 +0000)]
Document removal of deprecated algorithms from OCF.

Sponsored by: Chelsio Communications

4 years agoRemove MD5 HMAC from OCF.
jhb [Mon, 11 May 2020 22:08:08 +0000 (22:08 +0000)]
Remove MD5 HMAC from OCF.

There are no in-kernel consumers.

Reviewed by: cem
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24775

4 years agoopencrypto: Add missing ioctl exit SDTs
kp [Mon, 11 May 2020 21:42:19 +0000 (21:42 +0000)]
opencrypto: Add missing ioctl exit SDTs

The opencrypto ioctl code has very useful probe points at the various exit
points. These allow us to figure out exactly why a request failed. However, a
few paths did not have these probe points. Add them here.

Reviewed by: jhb

4 years agokgssapi no longer supports RC4, so don't list it as a build dependency.
jhb [Mon, 11 May 2020 21:39:02 +0000 (21:39 +0000)]
kgssapi no longer supports RC4, so don't list it as a build dependency.

Reviewed by: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24774

4 years agoRemove support for DES and Triple DES from OCF.
jhb [Mon, 11 May 2020 21:34:29 +0000 (21:34 +0000)]
Remove support for DES and Triple DES from OCF.

It no longer has any in-kernel consumers via OCF.  smbfs still uses
single DES directly, so sys/crypto/des remains for that use case.

Reviewed by: cem
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24773

4 years agoRemove support for the Blowfish algorithm from OCF.
jhb [Mon, 11 May 2020 21:24:05 +0000 (21:24 +0000)]
Remove support for the Blowfish algorithm from OCF.

It no longer has any in-kernel consumers.

Reviewed by: cem
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24772

4 years agoFix the build
gallatin [Mon, 11 May 2020 21:23:22 +0000 (21:23 +0000)]
Fix the build

Back out the IPv6 portion of r360903, as the stamp_tag param
is apparently not supported in upstream FreeBSD.

Sponsored by: Netflix
Pointy hat to: gallatin

4 years agoAdd missing sysput.c
mr [Mon, 11 May 2020 21:22:16 +0000 (21:22 +0000)]
Add missing sysput.c

PR: 237664
Submitted by: ota@j.email.ne.jp
Reported by: imb, cy

4 years agoRemove support for the ARC4 algorithm from OCF.
jhb [Mon, 11 May 2020 21:17:08 +0000 (21:17 +0000)]
Remove support for the ARC4 algorithm from OCF.

There are no longer any in-kernel consumers.  The software
implementation was also a non-functional stub.

Reviewed by: cem
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24771

4 years agoRemove support for keyed MD5 and SHA1 authentication hashes.
jhb [Mon, 11 May 2020 21:04:59 +0000 (21:04 +0000)]
Remove support for keyed MD5 and SHA1 authentication hashes.

They no longer have any in-tree consumers.  Note that these are a
different from MD5-HMAC and SHA1-HMAC and were only used with IPsec.

Reviewed by: cem
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24770

4 years agoRefresh the USB device strings when a USB device is re-enumerated.
hselasky [Mon, 11 May 2020 20:55:04 +0000 (20:55 +0000)]
Refresh the USB device strings when a USB device is re-enumerated.

Submitted by: Horse Ma <Shichun.Ma@dell.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoRemove support for the skipjack encryption algorithm.
jhb [Mon, 11 May 2020 20:54:59 +0000 (20:54 +0000)]
Remove support for the skipjack encryption algorithm.

This was removed from IPsec in r286100 and no longer has any in-tree
consumers.

Reviewed by: cem
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24769

4 years agoRemove support for the cast128 encryption algorithm.
jhb [Mon, 11 May 2020 20:52:18 +0000 (20:52 +0000)]
Remove support for the cast128 encryption algorithm.

It no longer has any in-tree consumers.

Reviewed by: cem
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24768

4 years agoFix NOINET[6] build by using af-independent route lookup function.
melifaro [Mon, 11 May 2020 20:41:03 +0000 (20:41 +0000)]
Fix NOINET[6] build by using af-independent route lookup function.

Reported by: rpokala

4 years agoRemove incomplete support for plain MD5 from OCF.
jhb [Mon, 11 May 2020 20:40:30 +0000 (20:40 +0000)]
Remove incomplete support for plain MD5 from OCF.

Although a few drivers supported this algorithm, there were never any
in-kernel consumers.  cryptosoft and cryptodev never supported it,
and there was not a software xform auth_hash for it.

Reviewed by: cem
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24767

4 years agoPatch systat -zarc to display cumulative rate and round down large numbers by SI...
mr [Mon, 11 May 2020 20:34:52 +0000 (20:34 +0000)]
Patch systat -zarc to display cumulative rate and round down large numbers by SI units

PR: 237664
Submitted by: ota@j.email.ne.jp
MFC after: 2 weeks

4 years agoRemove ubsec(4).
jhb [Mon, 11 May 2020 20:30:28 +0000 (20:30 +0000)]
Remove ubsec(4).

This driver was previously marked for deprecation in r360710.

Approved by: csprng (cem, gordon, delphij)
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24766

4 years agoUse -fno-asynchronous-unwind-tables to compile lib/csu
dim [Mon, 11 May 2020 19:36:38 +0000 (19:36 +0000)]
Use -fno-asynchronous-unwind-tables to compile lib/csu

Summary:
In r209294 kib added -fno-asynchronous-unwind-tables to the compile
flags for the GNU C startup components. This was done to work around a
BFD ld assertion, "no .eh_frame_hdr table will be created", which is
produced because of the layout of the startup objects.

Add the same flag to lib/csu too, for the same reason. And similarly to
r209294, also add -fno-omit-frame-pointer.

This is primarily meant to quickly MFC to stable/11, so it can end up in
the 11.4 release, as a fix for https://bugs.freebsd.org/246322.

PR: 246322
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D24797

4 years agoKtls: never skip stamping tags for NIC TLS
gallatin [Mon, 11 May 2020 19:17:33 +0000 (19:17 +0000)]
Ktls: never skip stamping tags for NIC TLS

The newer RACK and BBR TCP stacks have added a mechanism
to disable hardware packet pacing for TCP retransmits.
This mechanism works by skipping the send-tag stamp
on rate-limited connections when the TCP stack calls
ip_output() with the IP_NO_SND_TAG_RL flag set.

When doing NIC TLS, we must ignore this flag, as
NIC TLS packets must always be stamped.  Failure
to stamp a NIC TLS packet will result in crypto
issues.

Reviewed by: hselasky, rrs
Sponsored by: Netflix, Mellanox

4 years agoAdd a basic table entry counter regression test.
markj [Mon, 11 May 2020 19:08:03 +0000 (19:08 +0000)]
Add a basic table entry counter regression test.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24809

4 years agoRemove the svn:executable property from some pf test files.
markj [Mon, 11 May 2020 19:07:33 +0000 (19:07 +0000)]
Remove the svn:executable property from some pf test files.

The test makefiles will handle setting mode bits during install.  Also,
Phabricator gets upset when uploading an executable plain-text file
without a shebang.

MFC after: 1 week

4 years agopf: Don't allocate per-table entry counters unless required.
markj [Mon, 11 May 2020 18:47:38 +0000 (18:47 +0000)]
pf: Don't allocate per-table entry counters unless required.

pf by default does not do per-table address accounting unless the
"counters" keyword is specified in the corresponding pf.conf table
definition.  Yet, we always allocate 12 per-CPU counters per table.  For
large tables this carries a lot of overhead, so only allocate counters
when they will actually be used.

A further enhancement might be to use a dedicated UMA zone to allocate
counter arrays for table entries, since close to half of the structure
size comes from counter pointers.  A related issue is the cost of
zeroing counters, since counter_u64_zero() calls smp_rendezvous() on
some architectures.

Reported by: loos, Jim Pingle <jimp@netgate.com>
Reviewed by: kp
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D24803

4 years agoem/ix/ixv/ixl/iavf: Implement ifdi_needs_restart iflib method
erj [Mon, 11 May 2020 17:42:04 +0000 (17:42 +0000)]
em/ix/ixv/ixl/iavf: Implement ifdi_needs_restart iflib method

Pursuant to r360398, implement driver-specific versions of the
ifdi_needs_restart iflib device method.

Some (if not most?) Intel network cards don't need reinitializing when a
VLAN is added or removed from the device hardware, so these implement
ifdi_needs_restart in a way that tell iflib not to bring the interface
up or down when a VLAN is added or removed, regardless of whether the
VLAN_HWFILTER interface capability flag is set or not.

This could potentially solve several PRs relating to link flaps that
occur when VLANs are added/removed to devices.

Signed-off-by: Eric Joyner <erj@freebsd.org>
PR: 240818, 241785
Reviewed by: gallatin@, olivier@
MFC after: 3 days
MFC with: r360398
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D24659

4 years agovfs_exports: Tighten bounds and assert consistency of numsecflavors
freqlabs [Mon, 11 May 2020 15:38:44 +0000 (15:38 +0000)]
vfs_exports: Tighten bounds and assert consistency of numsecflavors

We know the value must be greater than 0 and less than MAXSECFLAVORS.

Reject values outside this range in the initial check in vfs_export and add KASSERTs
in the later consumers.

Also check that we are called with one of either MNT_DELEXPORT or MNT_EXPORTED set.

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

4 years agoAdd le_scan subcommand to hccontrol.
takawata [Mon, 11 May 2020 15:32:32 +0000 (15:32 +0000)]
Add le_scan subcommand to hccontrol.

PR: 246141
Submitted by: Marc Veldman

4 years agoAvoid using non-portable dd conv=osync option
arichardson [Mon, 11 May 2020 08:40:33 +0000 (08:40 +0000)]
Avoid using non-portable dd conv=osync option

The same thing can be achieved using the bs=$SIZE and conv=sync options.
Unlike conv=osync, conv=sync is support on both Linux and macOS.

Reviewed By: imp, jhb (earlier version)
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D24788

4 years agoRemove unused rnh_close callback from rtable & cleanup depends.
melifaro [Mon, 11 May 2020 06:09:18 +0000 (06:09 +0000)]
Remove unused rnh_close callback from rtable & cleanup depends.

rnh_close callbackes was used by the in[6]_clsroute() handlers,
 doing cleanup in the route cloning code. Route cloning was eliminated
 somewhere around r186119. Last callback user was eliminated in r186215,
 11 years ago.

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

4 years ago[ar9300] Disable unconditionally reducing transmit power in the case of FCC.
adrian [Mon, 11 May 2020 05:53:12 +0000 (05:53 +0000)]
[ar9300] Disable unconditionally reducing transmit power in the case of FCC.

Ok, yeah, the commit title is a bit misleading.

This has to do with CDD (cyclic delay diversity) - how this and later
wifi hardware transmits lower rates over more antennas.  Eg, if you're
transmitting legacy 11abg rates on 2 or 3 antennas, you COULD just
send them all at the same time or you could delay each by tens/hundreds
of nanoseconds to try and get some better diversity characteristics.

However, this has a fun side effect - the antenna pattern is no longer
a bunch of interacting dipoles, but are a bunch of interacting dipoles
plus a bunch of changing phases.  And it's frequency dependent - 50-200nS
is not exactly the same fraction of a wavelength across all of 2GHz or 5GHz!

Thus the power spectral density and maximum directional gain that you're
effectively getting is not .. well, as flat as it once was.

For more information, look up FCC/OET 13TR1003 in the FCC technical report
database.  It has pretty graphics and everything.

Anyway, the problem lies thusly - the CDD code just subtracts another 3dB
or 5dB for the lower rates based on transmit antenna configuration.
However, it's not done based on operating configuration and it doesn't
take into account how far from any regulatory limits the hardware is at.
It also doesn't let us do things like transmit legacy rates and frames
on a single antenna without losing up to 5dB when we absolutely don't
need to in that case (there's no CDD used when one antenna is used!)

This shows up as the hardware behaving even worse for longer distance links
at 20MHz because, well, those are the exact rates losing a bunch more
transmit power.

* For lower power NICs (ie the majority of what is out there!) it's highly
  unlikely we're going to hit anywhere near the PSD limits.
* It's doing it based on the existing limits from the CTL table (conformance
  testing limits) - this isn't the regulatory max!  It's what the NIC is
  allowed to put out in each frequency and rate configuration!  So things like
  band edges, power amplifier behaviour and maximum current draw apply here.
  Blindly subtracting 3 to 5dB from /this/ value is /very/ conservative..
* /and/ ath9k just plainly doesn't do any of this at all.

So, for now disable it and get the TX power back, thus matching what ath9k
in Linux is doing.  If/once I get some more cycles I'll look at making it
a bit more adaptive and really only kick in if we're a few dB away from
hard regulatory limits.

Tested:

* AR9344 (2GHz + SoC, 2x2 configuration) - AP and STA modes
* QCA9580 (5GHz 2x2 and 3x3 configurations) - AP and STA modes

4 years agopowerpc64: Implement Radix MMU for POWER9 CPUs
jhibbits [Mon, 11 May 2020 02:33:37 +0000 (02:33 +0000)]
powerpc64: Implement Radix MMU for POWER9 CPUs

Summary:
POWER9 supports two MMU formats: traditional hashed page tables, and Radix
page tables, similar to what's presesnt on most other architectures.  The
PowerISA also specifies a process table -- a table of page table pointers--
which on the POWER9 is only available with the Radix MMU, so we can take
advantage of it with the Radix MMU driver.

Written by Matt Macy.

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

4 years agoEnsure that the SCTP iterator runs with an stcb and inp, which belong to
tuexen [Sun, 10 May 2020 22:54:30 +0000 (22:54 +0000)]
Ensure that the SCTP iterator runs with an stcb and inp, which belong to
each other.

Reported by: syzbot+82d39d14f2f765e38db0@syzkaller.appspotmail.com
MFC after: 3 days

4 years agobuildworld: add back in missing semicolon
kevans [Sun, 10 May 2020 20:28:38 +0000 (20:28 +0000)]
buildworld: add back in missing semicolon

if foo; then blah else blah; fi has a drastically different meaning than
if foo; then blah; else blah; fi. Fix it.

Reported by: 0mp
X-MFC-With: r360833

4 years agopowerpc: Add a CPU-custom machine check handler
jhibbits [Sun, 10 May 2020 19:00:57 +0000 (19:00 +0000)]
powerpc: Add a CPU-custom machine check handler

Summary:
Some machine checks are process-recoverable, others are not.  Let a
CPU-specific handler decide what to do.

This works around a machine check error hit while building www/firefox
and mail/thunderbird, which would otherwise cause the build to fail.

More work is needed to handle all possible machine check conditions, but
this is sufficient to unblock some ports building.

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

4 years agoRemove trailing whitespace.
tuexen [Sun, 10 May 2020 17:43:42 +0000 (17:43 +0000)]
Remove trailing whitespace.

4 years agoEnsure that we have a path when starting the T3 RXT timer.
tuexen [Sun, 10 May 2020 17:19:19 +0000 (17:19 +0000)]
Ensure that we have a path when starting the T3 RXT timer.

Reported by: syzbot+f2321629047f89486fa3@syzkaller.appspotmail.com
MFC after: 3 days

4 years agoAdd pkgbase METALOG parse/check tool
emaste [Sun, 10 May 2020 16:11:19 +0000 (16:11 +0000)]
Add pkgbase METALOG parse/check tool

`metalog.lua` is a script that reads METALOG file created by pkgbase
(make packages) and generates reports about the installed system
and issues.

This was developed as part of Yang's W2020 University of Waterloo co-
operative education term with the FreeBSD Foundation.  kevans provided
some initial review; we will iterate on it in the tree.

Submitted by: Yang Wang <2333@outlook.jp>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24563

4 years agoqnlx: Do not redifines types.
manu [Sun, 10 May 2020 14:09:30 +0000 (14:09 +0000)]
qnlx: Do not redifines types.

r360870 added linux/slab.h into liunx/bitmap.h and this include linux/types.h
The qlnx driver is redefining some of those types so remove them and add an
explicit linux/types.h include.

Pointy hat: manu
Reported by: Austin Shafer <ashafer@badland.io>

4 years agolinuxkpi: Really add bitmap_alloc and bitmap_zalloc
manu [Sun, 10 May 2020 13:12:05 +0000 (13:12 +0000)]
linuxkpi: Really add bitmap_alloc and bitmap_zalloc

This was missing in r360870

Sponsored-by: The FreeBSD Foundation