]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agolz4 hash table does not start zeroed
tsoome [Tue, 19 May 2020 19:53:12 +0000 (19:53 +0000)]
lz4 hash table does not start zeroed

illumos issue: https://www.illumos.org/issues/12757

Submitted by: andyf

4 years agoMention new jail(8) command hooks in RELNOTES
freqlabs [Tue, 19 May 2020 18:41:46 +0000 (18:41 +0000)]
Mention new jail(8) command hooks in RELNOTES

Reported by: 0mp
Approved by: mmacy (mentor)

4 years agoMention new dd flags in RELNOTES
freqlabs [Tue, 19 May 2020 18:38:46 +0000 (18:38 +0000)]
Mention new dd flags in RELNOTES

Approved by: mmacy (mentor)
Sponsored by: iXsystems, Inc.

4 years agoDefine a module version for accept filter modules.
markj [Tue, 19 May 2020 18:35:08 +0000 (18:35 +0000)]
Define a module version for accept filter modules.

Otherwise accept filters compiled into the kernel do not preempt
preloaded accept filter modules.  Then, the preloaded file registers its
accept filter module before the kernel, and the kernel's attempt fails
since duplicate accept filter list entries are not permitted.  This
causes the preloaded file's module to be released, since
module_register_init() does a lookup by name, so the preloaded file is
unloaded, and the accept filter's callback points to random memory since
preload_delete_name() unmaps the file on x86 as of r336505.

Add a new ACCEPT_FILTER_DEFINE macro which wraps the accept filter and
module definitions, and ensures that a module version is defined.

PR: 245870
Reported by: Thomas von Dein <freebsd@daemon.de>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoUse the symbolic name for "modmetadata_set".
markj [Tue, 19 May 2020 18:34:50 +0000 (18:34 +0000)]
Use the symbolic name for "modmetadata_set".

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agocxgbe/iw_cxgbe: Add an async callback to notify iw_cxgbe in case of a
np [Tue, 19 May 2020 16:28:20 +0000 (16:28 +0000)]
cxgbe/iw_cxgbe: Add an async callback to notify iw_cxgbe in case of a
fatal error.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 2 weeks
Sponsored by: Chelsio Communications

4 years agoUpdate leap-seconds to leap-seconds.3676924800.
delphij [Tue, 19 May 2020 16:06:03 +0000 (16:06 +0000)]
Update leap-seconds to leap-seconds.3676924800.

Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800
MFC after: 3 days

4 years agoStop performing a full icache sync when the DIC and IDC flags are set
andrew [Tue, 19 May 2020 16:04:27 +0000 (16:04 +0000)]
Stop performing a full icache sync when the DIC and IDC flags are set

The DIC and IDC bits in the CTR_EL0 register signal to the kernel when it
can relax the instruction cache synchronisation operations. The IDC bit
means we can relax cleaning the data cache to the point of unification
while the DIC bit means we don't need to invalidate the instruction cache
for data coherence. In both cases an appropriate barrier is still needed.

For now only implement the case where both bits are set, as is the case
on the Neoverse-N1 as used in the Amazon AWS Graviton 2 CPU. Note that
this behaviour is a optional on the N1 so we may later need to implement
only one or the other bit being set.

There is a tunable to disable each flag on boot.

Testing on a 4 core Graviton 2 instance found a significant improvement
in sys and real time when running "make buildkernel -j4", with no
significant difference in user time.

Reviewed by: markj
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D24853

4 years agoCreate MSI/MSI-X isrcs as needed in the GICv3 ITS driver
andrew [Tue, 19 May 2020 15:27:20 +0000 (15:27 +0000)]
Create MSI/MSI-X isrcs as needed in the GICv3 ITS driver

Previously we would create an isrc for each MSI/MSI-X interrupt. This
causes issues for other interrupt sources in the system, e.g. a GPIO
driver, as they may be unable to allocate interrupts. This works around
this by allocating the isrc only when needed.

Reported by: alisaidi@amazon.com
Reviewed by: mmel
Sponsored by: Innovaate UK
Differential Revision: https://reviews.freebsd.org/D24876

4 years agobsdinstall: do a `certctl rehash` upon installation of configuration
kevans [Tue, 19 May 2020 15:19:39 +0000 (15:19 +0000)]
bsdinstall: do a `certctl rehash` upon installation of configuration

If certctl is installed on the system we're configuring, do a certctl
rehash.

Note that certctl may not be present if the world we've installed was built
either WITHOUT_OPENSSL or WITHOUT_CAROOT. In this scenario, we don't
currently see if the host has a certctl as this may be an indication that
the system *shouldn't* have certs installed into /etc/ssl.

Reviewed by: allanjude, dteske
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D24640

4 years agoFix Typo in ng_hci_le_connection_complete_ep struct.
takawata [Tue, 19 May 2020 13:58:52 +0000 (13:58 +0000)]
Fix Typo in ng_hci_le_connection_complete_ep struct.

PR: 246538
Submitted by: Marc Veldman

4 years agoBelatedly add a RELNOTES entry for r347532.
markj [Tue, 19 May 2020 13:54:33 +0000 (13:54 +0000)]
Belatedly add a RELNOTES entry for r347532.

4 years agoAdd LE Whitelist commands to hccontrol
takawata [Tue, 19 May 2020 13:44:32 +0000 (13:44 +0000)]
Add LE Whitelist commands to hccontrol

PR: 214555
Submitted by Marc Veldman

4 years agoThe -F flag of swapon(8) requires -a to work.
bcr [Tue, 19 May 2020 12:16:44 +0000 (12:16 +0000)]
The -F flag of swapon(8) requires -a to work.

Before this change, swapon(8) implied that -F works as a standalone option,
which is not the case and would produce a usage message. This change extends
the description of the -F option to mention that -a is required with it.

PR: 238551
Submitted by: Christian Baltini
MFC after: 5 days

4 years agoFix a typo: argments -> arguments
bcr [Tue, 19 May 2020 11:05:27 +0000 (11:05 +0000)]
Fix a typo: argments -> arguments

PR: 243294
Submitted by: Igor Ostapenko
MFC after: 5 days

4 years agoUpdate SYNOPSIS section to be consistent regarding -u, -i, and -I.
bcr [Tue, 19 May 2020 09:17:20 +0000 (09:17 +0000)]
Update SYNOPSIS section to be consistent regarding -u, -i, and -I.

Apparently, when the -u, -i and -I options where added to sed(1), it was
forgotten to add them to both lines in the SYNOPSIS section. They were only
added to the second line, although they apply to both.

With the updated SYNOPSIS, it is now allowed (and consistent) to run:

sed -i BAK s/foo/bar/g some_file

PR: 240556
Submitted by: Oliver Fromme
MFC after: 5 days

4 years agolinuxkpi: Add irq_work.h
manu [Tue, 19 May 2020 09:04:35 +0000 (09:04 +0000)]
linuxkpi: Add irq_work.h

Since handlers are call in a thread context we can simply use a workqueue
to emulate those functions.
The DRM code was patched to do that already, having it in linuxkpi allows us
to not patch the upstream code.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24859

4 years agolinuxkpi: add pci_dev_present
manu [Tue, 19 May 2020 08:44:33 +0000 (08:44 +0000)]
linuxkpi: add pci_dev_present

pci_dev_present shows if a set of pci ids are present in the system.
It just wraps pci_find_device.
Needed by DRMv5.2

Submitted by: Austing Shafer (ashafer@badland.io)
Differential Revision: https://reviews.freebsd.org/D24796

4 years agolinuxkpi: Add __init_waitqueue_head
manu [Tue, 19 May 2020 08:43:17 +0000 (08:43 +0000)]
linuxkpi: Add __init_waitqueue_head

The only difference with init_waitqueue_head is that the name and the
lock class key are provided but we don't use those so use init_waitqueue_head
directly.

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

4 years agoReplace snprintf() by SCTP_SNPRINTF() and let SCTP_SNPRINTF() map
tuexen [Tue, 19 May 2020 07:23:35 +0000 (07:23 +0000)]
Replace snprintf() by SCTP_SNPRINTF() and let SCTP_SNPRINTF() map
to snprintf() on FreeBSD. This allows to check for failures of snprintf()
on platforms other than FreeBSD kernel.

4 years agoRevert r361209:
tuexen [Tue, 19 May 2020 07:21:11 +0000 (07:21 +0000)]
Revert r361209:

cem noted that on FreeBSD snprintf() can not fail and code should not
check for that.

A followup commit will replace the usage of snprintf() in the SCTP
sources with a variadic macro SCTP_SNPRINTF, which will simply map to
snprintf() on FreeBSD and do a checking similar to r361209 on
other platforms.

4 years agoRevert r361237, it's fixed by r361231
lwhsu [Tue, 19 May 2020 07:16:09 +0000 (07:16 +0000)]
Revert r361237, it's fixed by r361231

PR: 246560
Sponsored by: The FreeBSD Foundation

4 years agoBelated RELNOTES entry for r361238
kevans [Tue, 19 May 2020 03:19:01 +0000 (03:19 +0000)]
Belated RELNOTES entry for r361238

This may get revised later if the larger change lands, but we should note
this.

4 years agozfs: reject read(2) of a dirfd with EISDIR
kevans [Tue, 19 May 2020 02:41:05 +0000 (02:41 +0000)]
zfs: reject read(2) of a dirfd with EISDIR

This is independent of the recently-discussed global change, which is still
in review/discussion stage.

This is effectively a measure for consistency in the ZFS world, where
FreeBSD was the only platform (as far as I could find) that allowed this.
What ZFS exposes is decidedly not useful for any real purposes, to
paraphrase (hopefully faithfully) jhb's findings when exploring this:

The size of a directory in ZFS is the number of directory entries within.
When reading a directory, you would instead get the leading part of its raw
contents; the amount you get being dictated by the "size," i.e. number of
directory entries. There's decidedly (luckily) no stack disclosure happening
here, though the behavior is bizarre and almost certainly a historical
accident.

This change has already been upstreamed to OpenZFS.

MFC after: 1 week

4 years agoTemporarily disable test case causes kernel panic in CI:
lwhsu [Tue, 19 May 2020 02:07:08 +0000 (02:07 +0000)]
Temporarily disable test case causes kernel panic in CI:

- sys.netinet.so_reuseport_lb_test.basic_ipv6

PR: 246560
Sponsored by: The FreeBSD Foundation

4 years agopowerpc/mmu: Don't use the cache instructions to zero pages
jhibbits [Tue, 19 May 2020 01:06:31 +0000 (01:06 +0000)]
powerpc/mmu: Don't use the cache instructions to zero pages

A page (even physmem) can be marked as cache-inhibited.  Attempting to use
'dcbz' to zero a page mapped cache-inhibited triggers an alignment
exception, which is fatal in kernel.  This was seen when testing hardware
acceleration with X on POWER9.

At some point in the future, this should be changed to a more straight
forward zero loop instead of bzero(), and a similar change be made to the
other pmaps.

Reported by: pkubaj@

4 years agoFix NULL-pointer bug from r361228.
karels [Tue, 19 May 2020 01:05:13 +0000 (01:05 +0000)]
Fix NULL-pointer bug from r361228.

Note that in_pcb_lport and in_pcb_lport_dest can be called with a NULL
local address for IPv6 sockets; handle it.  Found by syzkaller.

Reported by: cem
MFC after: 1 month

4 years agoblacklistd.conf.5: typo/grammar fixes
emaste [Tue, 19 May 2020 00:15:19 +0000 (00:15 +0000)]
blacklistd.conf.5: typo/grammar fixes

PR: 246467
Submitted by: Mike Lempriere

4 years agoRevert 357780, `dtrace -c` has been fixed in head`
lwhsu [Mon, 18 May 2020 23:43:48 +0000 (23:43 +0000)]
Revert 357780, `dtrace -c` has been fixed in head`

PR: 244053
Sponsored by: The FreeBSD Foundation

4 years agoAllow TCP to reuse local port with different destinations
karels [Mon, 18 May 2020 22:53:12 +0000 (22:53 +0000)]
Allow TCP to reuse local port with different destinations

Previously, tcp_connect() would bind a local port before connecting,
forcing the local port to be unique across all outgoing TCP connections
for the address family. Instead, choose a local port after selecting
the destination and the local address, requiring only that the tuple
is unique and does not match a wildcard binding.

Reviewed by: tuexen (rscheff, rrs previous version)
MFC after: 1 month
Sponsored by: Forcepoint LLC
Differential Revision: https://reviews.freebsd.org/D24781

4 years agoRemove assignment without effect.
tuexen [Mon, 18 May 2020 19:48:38 +0000 (19:48 +0000)]
Remove assignment without effect.

MFC after: 3 days

4 years agoDon't check an unsigned variable for being negative.
tuexen [Mon, 18 May 2020 19:35:46 +0000 (19:35 +0000)]
Don't check an unsigned variable for being negative.

MFC after: 3 days.

4 years agoRemove redundant assignment.
tuexen [Mon, 18 May 2020 19:23:01 +0000 (19:23 +0000)]
Remove redundant assignment.

MFC after: 3 days

4 years agoCleanup, no functional change intended.
tuexen [Mon, 18 May 2020 18:42:43 +0000 (18:42 +0000)]
Cleanup, no functional change intended.

MFC after: 3 days

4 years agofusefs: fix intermittency in some ENOENT tests
asomers [Mon, 18 May 2020 18:36:32 +0000 (18:36 +0000)]
fusefs: fix intermittency in some ENOENT tests

When a FUSE operation other than LOOKUP returns ENOENT, the kernel will
reclaim that vnode, resuling in a FUSE_FORGET being sent a short while
later.  Many of the ENOENT tests weren't expecting those FUSE_FORGET
operations.  They usually passed by luck since FUSE_FORGET is often delayed.
This commit adds appropriate expectations.

MFC after: 2 weeks

4 years agoAvoid an integer underflow.
tuexen [Mon, 18 May 2020 18:32:58 +0000 (18:32 +0000)]
Avoid an integer underflow.

MFC after: 3 days

4 years agoRemove redundant check.
tuexen [Mon, 18 May 2020 18:27:10 +0000 (18:27 +0000)]
Remove redundant check.

MFC after: 3 days

4 years agoCorrect the order of arguments to copyin() for Q_SETQUOTA.
jhb [Mon, 18 May 2020 16:47:44 +0000 (16:47 +0000)]
Correct the order of arguments to copyin() for Q_SETQUOTA.

MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24656

4 years agoGNU as: move deprecation message after option parsing
emaste [Mon, 18 May 2020 16:07:14 +0000 (16:07 +0000)]
GNU as: move deprecation message after option parsing

Some cmake test parses the output of the first line of as --version, and
emits an error if it does not contain some expected strings:

Checking whether the ASM compiler is GNU using "--version" did not match
"(GNU assembler)|(GCC)|(Free Software Foundation)"

Emit the deprecation message later, after parsing argv and thus --version.

PR: 246540
Reported by: dch
Sponsored by: The FreeBSD Foundation

4 years agoAllow the FACS and XFACS to be zero in acpidump.
andrew [Mon, 18 May 2020 15:05:59 +0000 (15:05 +0000)]
Allow the FACS and XFACS to be zero in acpidump.

These are allowed to be zero when the hardware reduced APCI flag is set

Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D23207

4 years agobhyve(8): Add the netgraph network backend decription to the manpage.
afedorov [Mon, 18 May 2020 15:03:52 +0000 (15:03 +0000)]
bhyve(8): Add the netgraph network backend decription to the manpage.

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

4 years agoFix logical condition by looking at usecs.
tuexen [Mon, 18 May 2020 15:02:15 +0000 (15:02 +0000)]
Fix logical condition by looking at usecs.

This issue was found by cpp-check running on the userland stack.

MFC after: 3 days

4 years agoWhitespace change.
tuexen [Mon, 18 May 2020 15:00:18 +0000 (15:00 +0000)]
Whitespace change.

MFC after: 3 days

4 years agoTemporarily disable failing case in CI of amd64:
lwhsu [Mon, 18 May 2020 12:36:28 +0000 (12:36 +0000)]
Temporarily disable failing case in CI of amd64:

- lib.libexecinfo.backtrace_test.backtrace_fmt_basic

PR: 246537
Sponsored by: The FreeBSD Foundation

4 years agoHandle failures of snprintf().
tuexen [Mon, 18 May 2020 10:07:01 +0000 (10:07 +0000)]
Handle failures of snprintf().

MFC after: 3 days

4 years agoAdd ebsnvme-id to EC2 AMIs and enable /dev/aws/disk
cperciva [Mon, 18 May 2020 02:14:25 +0000 (02:14 +0000)]
Add ebsnvme-id to EC2 AMIs and enable /dev/aws/disk

The ebsnvme-id utility exposes information about EC2 disks -- for
Elastic Block Store volumes, their volume IDs and "linux device
names", and for Instance Store (aka "Ephemeral") disks, their
serial numbers.

The dev_aws_disk rc.d script and associated devd.conf rule maintains
a tree under /dev/aws/disk:
/dev/aws/disk/ebs/<volume ID>
/dev/aws/disk/linuxname/<linux device name>
/dev/aws/disk/ephemeral/<serial number>
which are symlinks to the corresponding nda or nvd devices.

MFC after: 1 week
Sponsored by: https://www.patreon.com/cperciva

4 years agoRevert r360833, r360882: certctl rehash in installworld
kevans [Mon, 18 May 2020 01:48:55 +0000 (01:48 +0000)]
Revert r360833, r360882: certctl rehash in installworld

This was solving the correct-ish problem in the wrong place. Noted by
brooks; while he didn't request a prompt revert, doing so now will
facilitate proper testing for the revised version of this.

4 years agocertctl: don't fall over flat with relative DESTDIR
kevans [Mon, 18 May 2020 01:35:44 +0000 (01:35 +0000)]
certctl: don't fall over flat with relative DESTDIR

Up until now, all of our DESTDIR use has been with absolute paths. It turned
out that the cd in/out dance we do here breaks us down later on, as the
relative path no longer resolves.

Convert EXTENSIONS to an ERE that we'll use to grep ls -1 of the dir we're
inspecting, rather than cd'ing into it and globbing it up.

MFC after: 3 days

4 years agoAdd a function nfsm_set() to initialize "struct nfsrv_descript" for building
rmacklem [Mon, 18 May 2020 00:07:45 +0000 (00:07 +0000)]
Add a function nfsm_set() to initialize "struct nfsrv_descript" for building
mbuf lists.

This function is currently trivial, but will that will change when
support for building NFS messages in ext_pgs mbufs is added.
Adding support for ext_pgs mbufs is needed for KERN_TLS, which will
be used to implement nfs-over-tls.

4 years agoNon-functional changes, cleanups.
tuexen [Sun, 17 May 2020 22:31:38 +0000 (22:31 +0000)]
Non-functional changes, cleanups.

MFC after: 3 days

4 years agoAdd /etc/autofs/special_efs to EC2 AMIs
cperciva [Sun, 17 May 2020 21:54:59 +0000 (21:54 +0000)]
Add /etc/autofs/special_efs to EC2 AMIs

Since Amazon Elastic File System is only available within AWS, it seems
more appropriate to have this added only in EC2 AMIs rather than
"polluting" non-EC2 images with it.

Reviewed by: gjb
MFC after: 7 days
Relnotes: Amazon EFS filesystems can be automounted by enabling autofs
and placing "/efs -efs" into /etc/auto_master.
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D24791

4 years agolinuxkpi: Add offsetofend macro
manu [Sun, 17 May 2020 20:14:49 +0000 (20:14 +0000)]
linuxkpi: Add offsetofend macro

This calculate the offset of the end of the member in the given struct.
Needed by DRM in Linux v5.3

Sponsored-by: The FreeBSD Foudation
Differential Revision: https://reviews.freebsd.org/D24849

4 years agolinuxkpi: Add __mutex_init
manu [Sun, 17 May 2020 20:12:16 +0000 (20:12 +0000)]
linuxkpi: Add __mutex_init

Same as mutex_init, the lock_class_key argument seems to be only used for
debug in Linux, simply ignore it for now.
Needed by DRM in Linux v5.3

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

4 years agolinuxkpi: Add atomic_dec_and_mutex_lock
manu [Sun, 17 May 2020 20:09:11 +0000 (20:09 +0000)]
linuxkpi: Add atomic_dec_and_mutex_lock

This function decrement the counter and if the result is 0 it acquires
the mutex and returns 1, if not it simply returns 0.
Needed by DRM from Linux v5.3

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

4 years agoRemove redundant checks for nhop validity.
melifaro [Sun, 17 May 2020 15:32:36 +0000 (15:32 +0000)]
Remove redundant checks for nhop validity.
 Currently NH_IS_VALID() simly aliases to RT_LINK_IS_UP(), so we're
 checking the same thing twice.

In the near future the implementation of this check will be simpler,
 as there are plans to introduce control-plane interface status monitoring
 similar to ipfw interface tracker.

4 years agoAdd BE architectures support.
fsu [Sun, 17 May 2020 14:52:54 +0000 (14:52 +0000)]
Add BE architectures support.

Author of most initial version: pfg (https://reviews.freebsd.org/D23259)

Reviewed by:    pfg
MFC after:      3 months

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

4 years agoRestrict the max runp and runb return values in case of extents mapping.
fsu [Sun, 17 May 2020 14:10:46 +0000 (14:10 +0000)]
Restrict the max runp and runb return values in case of extents mapping.

This restriction already present in case of indirect mapping, do the same
in case of extents.

PR: 246182
Reported by: Teran McKinney
MFC after: 2 weeks

4 years agoFix incorrect inode link count check in case of rename.
fsu [Sun, 17 May 2020 14:03:13 +0000 (14:03 +0000)]
Fix incorrect inode link count check in case of rename.

The check was incorrect because the directory inode link count have
min value 2 after dir_nlink extfs feature introduction.

4 years agoAdd inode bitmap tail initialization.
fsu [Sun, 17 May 2020 14:00:54 +0000 (14:00 +0000)]
Add inode bitmap tail initialization.

Make ext2fs compatible with changes introduced in e2fsprogs v1.45.2.
Now the tail of inode bitmap is filled with 0xff pattern explicitly during
bitmap initialization phase to avoid e2fsck error like:
"Padding at end of inode bitmap is not set."

4 years agoReenable sys.geom.class.gate.ggate_test.ggated in CI
asomers [Sun, 17 May 2020 02:41:50 +0000 (02:41 +0000)]
Reenable sys.geom.class.gate.ggate_test.ggated in CI

Should be fixed by r360613

PR: 244737
Reported by: lwhsu

4 years ago[ath_rate_sample] Fix correct status when completing frames with short failures.
adrian [Sat, 16 May 2020 21:59:41 +0000 (21:59 +0000)]
[ath_rate_sample] Fix correct status when completing frames with short failures.

My preivous logic was a bit wrong.  This caused transmissions that failed due
to a mix of short and long retries to count intermediate rates as OK if the
LONG retry count indicated some retries had made it to this intermediate rate,
but the SHORT retry count was the one that caused the whole transmit to fail.

Now status is passed in again - and this is the status for the whole transmission -
and then update_stats() does some quick math to see if the current transmission
series hit its long retry count or not before updating things as a success
or failure.

4 years agosh/tests: Fix keywords on newly added test
jilles [Sat, 16 May 2020 19:38:58 +0000 (19:38 +0000)]
sh/tests: Fix keywords on newly added test

4 years agoEnsure that an stcb is not dereferenced when it is about to be
tuexen [Sat, 16 May 2020 19:26:39 +0000 (19:26 +0000)]
Ensure that an stcb is not dereferenced when it is about to be
freed.
This issue was found by SYZKALLER.

MFC after: 3 days

4 years ago[ath] Flip athratestats to use two columns for now.
adrian [Sat, 16 May 2020 18:49:37 +0000 (18:49 +0000)]
[ath] Flip athratestats to use two columns for now.

Yeah I have too many rates on the screen now...

4 years agoMove the devmatch rc.d script before netif in the boot process.
cperciva [Sat, 16 May 2020 18:37:48 +0000 (18:37 +0000)]
Move the devmatch rc.d script before netif in the boot process.

Prior to this change, using lagg to aggregate wired and wireless networks
was broken in the (relatively common) case where wifi drivers + firmware
are loaded by devmatch, since the interface didn't exist at the time when
the lagg interface was being created.

Suggested by: imp
MFC after: 3 days

4 years agosysctl: fix setting net.isr.dispatch during early boot
kaktus [Sat, 16 May 2020 17:05:44 +0000 (17:05 +0000)]
sysctl: fix setting net.isr.dispatch during early boot

Fix another collateral damage of r357614: netisr is initialised way before
malloc() is available hence it can't use sysctl_handle_string() that
allocates temporary buffer.  Handle that internally in
sysctl_netisr_dispatch_policy().

PR: 246114
Reported by: delphij
Reviewed by: kib
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D24858

4 years agosh: Fix double INTON with vfork
jilles [Sat, 16 May 2020 16:29:23 +0000 (16:29 +0000)]
sh: Fix double INTON with vfork

The shell maintains a count of the number of times SIGINT processing has
been disabled via INTOFF, so SIGINT processing resumes when all disables
have enabled again (INTON).

If an error occurs in a vfork() child, the processing of the error enables
SIGINT processing again, and the INTON in vforkexecshell() causes the count
to become negative.

As a result, a later INTOFF may not actually disable SIGINT processing. This
might cause memory corruption if a SIGINT arrives at an inopportune time. As
of r360452, it causes the shell to abort when it would unsafely allocate or
free memory in certain ways.

Note that various places such as errors in non-special builtins
unconditionally reset the count to 0, so the problem might still not always
be visible.

PR: 246497
Reported by: jbeich
MFC after: 2 weeks

4 years agocam: ANSIfy 0-argument function definitions
cem [Sat, 16 May 2020 14:33:08 +0000 (14:33 +0000)]
cam: ANSIfy 0-argument function definitions

No functional change.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D24854

4 years agoImplement synchronize_srcu_expedited() in the LinuxKPI.
hselasky [Sat, 16 May 2020 14:27:50 +0000 (14:27 +0000)]
Implement synchronize_srcu_expedited() in the LinuxKPI.

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

4 years ago[ath] ok ok, fix the indenting now that I have 5 column packet sizes.
adrian [Sat, 16 May 2020 06:09:24 +0000 (06:09 +0000)]
[ath] ok ok, fix the indenting now that I have 5 column packet sizes.

Now things line up nicely again.  There's a lot of them, and I don't have a long
enough screen right now, but they at least line up right.

4 years ago[ath_rate_sample] Limit the tx schedules for A-MPDU ; don't take short retries
adrian [Sat, 16 May 2020 05:07:45 +0000 (05:07 +0000)]
[ath_rate_sample] Limit the tx schedules for A-MPDU ; don't take short retries
into account and remove the requirement that the MCS rate is "higher" if we're
 considering a new rate.

Ok, another fun one.

* In order for reliable non-software retried higher MCS rates, the TX schedules
  (inconsistently!) use hard-coded lower rates at the end of the schedule.
  Now, hard-coded is a problem because (a) it means that aggregate formation
  is limited by the SLOWEST rate, so I never formed large AMDU frames for
  3 stream rates, and (b) if the AP disables lower rates as base rates, it
  complains about "unknown rix" every frame you transmit at that rate.

  So, for now just disable the third and fourth schedule entry for AMPDUs.
  Now I'm forming 32k and 64k aggregates for the higher density MCS rates
  much more reliably.

  It would be much nicer if the rate schedule stuff wasn't fixed but instead
  I'd just populate ath_rc_series[] when I fetch the rates.  This is all a
  holdover of ye olde pre-11n stuff and I really just need to nuke it.

  But for now, ye hack.

* The check for "is this MCS rate better" based on MCS itself is just garbage.
  It meant things like going MCS0->7 would be fine, and say 0->8->16 is fine,
  (as they're equivalent encoding but 1,2,3 spatial streams), BUT it meant
  going something like MCS7->11 would fail even though it's likely that
  MCS11 would just be better, both for EWMA/BER and throughput.

  So for now just use the average tx time.  The "right" way for this comparison
  would be to compare PHY bitrates rather than MCS / rate indexes, but I'm not
  yet there.  The bit rates ARE available in the PHY index, but honestly
  I have a lot of other cleaning up to here before I think about that.

* Don't include the RTS/CTS retry count (and thus time) into the average tx time
  caluation.  It just makes temporarily failures make the rate look bad by
  QUITE A LOT, as RTS/CTS exchanges are (a) long, and (b) mostly irrelevant
  to the actual rate being tried.  If we keep hitting RTS/CTS failures then
  there's something ELSE wrong on the channel, not our selected rate.

4 years agoprocctl(2): correct a minor cut-n-pasto
kevans [Sat, 16 May 2020 04:52:29 +0000 (04:52 +0000)]
procctl(2): correct a minor cut-n-pasto

This is clearly describing PROC_PROTMAX_FORCE_DISABLE, rather than
PROC_ASL_FORCE_DISABLE.

Submitted by: sigsys@gmail.com

4 years agoelftoolchain: Add powerpc64 definition to elftoolchain config
jhibbits [Sat, 16 May 2020 03:52:30 +0000 (03:52 +0000)]
elftoolchain: Add powerpc64 definition to elftoolchain config

powerpc is already in place, but powerpc64 is needed separately.

4 years agoAdd BSM record conversion for a number of syscalls:
csjp [Sat, 16 May 2020 03:45:15 +0000 (03:45 +0000)]
Add BSM record conversion for a number of syscalls:

- thr_kill(2) and thr_exit(2) generally (no argument auditing here.
- A set of syscalls for the process descriptor family, specifically:
  pdfork(2), pdgetpid(2) and pdkill(2)

  For these syscalls, audit the file descriptor. In the case of pdfork(2)
  a pointer to an integer (file descriptor) is passed in as an argument.
  We audit the post initialized file descriptor (not the random garbage
  that would have been passed in). We will also audit the child process
  which was created from the fork operation (similar to what is done for
  the fork(2) syscall).

  pdkill(2) we audit the signal value and fd, and finally pdgetpid(2)
  just the file descriptor:

- Following is a sample of the produced audit trails:

  header,111,11,pdfork(2),0,Sat May 16 03:07:50 2020, + 394 msec
  argument,0,0x39d,child PID
  argument,2,0x2,flags
  argument,1,0x8,fd
  subject,root,root,0,root,0,924,0,0,0.0.0.0
  return,success,925

  header,79,11,pdgetpid(2),0,Sat May 16 03:07:50 2020, + 394 msec
  argument,1,0x8,fd
  subject,root,root,0,root,0,924,0,0,0.0.0.0
  return,success,0
  trailer,79

  header,135,11,pdkill(2),0,Sat May 16 03:07:50 2020, + 395 msec
  argument,1,0x8,fd
  argument,2,0xf,signal
  process_ex,root,root,0,root,0,925,0,0,0.0.0.0
  subject,root,root,0,root,0,924,0,0,0.0.0.0
  return,success,0
  trailer,135

MFC after:      1 week

4 years agopowerpc/qoriq: Add more devices to config for desktop usage
jhibbits [Sat, 16 May 2020 03:33:28 +0000 (03:33 +0000)]
powerpc/qoriq: Add more devices to config for desktop usage

The most likely users of the QORIQ64 config nowadays are users of AmigaOne
X5000 systems, which are desktops.  They need a framebuffer and
keyboard/mouse, so add these to the config so it works by default once
drm-current-kmod is installed.

4 years agolibalias: retire cuseeme support
emaste [Sat, 16 May 2020 02:29:10 +0000 (02:29 +0000)]
libalias: retire cuseeme support

The CU-SeeMe videoconferencing client and associated protocol is at this
point a historical artifact; there is no need to retain support for this
protocol today.

Reviewed by: philip, markj, allanjude
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24790

4 years ago[ath_rate_sample] Fix logic for determining whether to bump up an MCS rate.
adrian [Sat, 16 May 2020 01:56:06 +0000 (01:56 +0000)]
[ath_rate_sample] Fix logic for determining whether to bump up an MCS rate.

* Fix formatting, cause reasons;
* Put back the "and the chosen rate is within 90% of the current rate" logic;
* Ensure the best rate and the current rate aren't the same; this ...
* ... fixes the packets_since_switch[] tracking to actually conut how many
  frames since the rate switched, so now I know how stable stuff is; and
* Ensure that MCS can go up to a higher MCS at this or any other spatial stream.
  My previous quick hack attempt was doing > rather than >= so you had to go
  to both a higher root MCS rate (0..7) and spatial stream. Eg, you couldn't
  go from MCS0 (1ss) to MCS8 (2ss) this way.

The best rate and switching rate logic still have a bunch more work to do
because they're still quite touchy when it comes to average tx time but at least
now it's choosing higher rates correctly when it wants to try a higher rate.

Tested:

* AR9380, STA mode

4 years agoSend Lid status notification via devd from acpi_lid_status_update.
cperciva [Sat, 16 May 2020 01:50:28 +0000 (01:50 +0000)]
Send Lid status notification via devd from acpi_lid_status_update.

Some laptops don't send ACPI "lid status changed" notifications upon
opening the lid if the system was currently suspended.  In r358219
this was partially fixed, updating the "lid_status" variable upon
resume even if there is no "status changed" notification from ACPI.

Unfortunately the fix in r358219 did not include notifying userland
via devd; this causes problems on systems using upowerd (e.g. KDE),
since upowerd remembers the most recent devd notification about the
lid status rather than querying the sysctl to get the current status.

This showed up as two symptoms when KDE's "When laptop lid closed: Sleep"
option is set:
1. 50% of the time, closing the lid would not trigger S3 sleep.
2. 50% of the time, plugging/unplugging AC power would trigger S3 sleep.

PR: 246477
MFC after: 3 days

4 years agopf: Add a new zone for per-table entry counters.
markj [Sat, 16 May 2020 00:28:12 +0000 (00:28 +0000)]
pf: Add a new zone for per-table entry counters.

Right now we optionally allocate 8 counters per table entry, so in
addition to memory consumed by counters, we require 8 pointers worth of
space in each entry even when counters are not allocated (the default).

Instead, define a UMA zone that returns contiguous per-CPU counter
arrays for use in table entries.  On amd64 this reduces sizeof(struct
pfr_kentry) from 216 to 160.  The smaller size also results in better
slab efficiency, so memory usage for large tables is reduced by about
28%.

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

4 years agoFix typo that snuck in
csjp [Fri, 15 May 2020 23:44:52 +0000 (23:44 +0000)]
Fix typo that snuck in

Reported by: Jose Luis Duran
MFC after: 1 week

4 years agoDon't remove ubsec(4) manual page for WITHOUT_USB=yes.
jhb [Fri, 15 May 2020 22:56:59 +0000 (22:56 +0000)]
Don't remove ubsec(4) manual page for WITHOUT_USB=yes.

In head this manpage has been removed entirely, but ubsec(4) is a PCI
device and not a USB device.

MFC after: 1 week

4 years agoRemove Doxyfile for sys/dev/ubsec since it has been removed.
jhb [Fri, 15 May 2020 22:55:49 +0000 (22:55 +0000)]
Remove Doxyfile for sys/dev/ubsec since it has been removed.

4 years agoRemove the ubsecstats tool since ubsec(4) has been removed.
jhb [Fri, 15 May 2020 22:55:28 +0000 (22:55 +0000)]
Remove the ubsecstats tool since ubsec(4) has been removed.

Reported by: markj

4 years agoBump revision date to today.
csjp [Fri, 15 May 2020 20:29:41 +0000 (20:29 +0000)]
Bump revision date to today.

MFC after: 1 week

4 years agoRemove references to pdwait4(2). This syscall was never implemented
csjp [Fri, 15 May 2020 20:24:08 +0000 (20:24 +0000)]
Remove references to pdwait4(2). This syscall was never implemented
and its presence just creates confusion.

Discussed with: cem
MFC after: 1 week

4 years ago[ath] [ath_rate_sample] le oops, trim out an #if 1 that I didn't fully delete.
adrian [Fri, 15 May 2020 20:03:53 +0000 (20:03 +0000)]
[ath] [ath_rate_sample] le oops, trim out an #if 1 that I didn't fully delete.

Cool, so now I know it's about 3 weeks between starting on freebsd coding
and breaking the build again. Queue dunce cap.

4 years ago[ath] [ath_rate] Extend ath_rate_sample to better handle 11n rates and aggregates.
adrian [Fri, 15 May 2020 18:51:20 +0000 (18:51 +0000)]
[ath] [ath_rate] Extend ath_rate_sample to better handle 11n rates and aggregates.

My initial rate control code was .. suboptimal.  I wanted to at least get MCS
rates sent, but it didn't do anywhere near enough to handle low signal level links
or remotely keep accurate statistics.

So, 8 years later, here's what I should've done back then.

* Firstly, I wasn't at all tracking packet sizes other than the two buckets
  (250 and 1600 bytes.)  So, extend it to include 4096, 8192, 16384, 32768 and
  65536.  I may go add 2048 at some point if I find it's useful.

  This is important for a few reasons.  First, when forming A-MPDU or AMSDU
  aggregates the frame sizes are larger, and thus the TX time calculation
  is woefully, increasingly wrong.  Secondly, the behaviour of 802.11 channels
  isn't some fixed thing, both due to channel conditions and radios themselves.
  Notably, there was some observations done a few years ago on 11n chipsets
  which noticed longer aggregates showed an increase in failed A-MPDU sub-frame
  reception as you got further along in the transmit time.  It could be due to
  a variety of things - transmitter linearity, channel conditions changing,
  frequency/phase drift, etc - but the observation was to potentially form
  shorter aggregates to improve BER.

* .. and then modify the ath TX path to report the length of the aggregate sent,
  so as the statistics kept would line up with the correct bucket.

* Then on the rate control look-up side - i was also only using the first frame
  length for an A-MPDU rate control lookup which isn't good enough here.
  So, add a new method that walks the TID software queue for that node to
  find out what the likely length of data available is.  It isn't ALL of the
  data in the queue because we'll only ever send enough data to fit inside the
  block-ack window, so limit how many bytes we return to roughly what ath_tx_form_aggr()
  would do.

* .. and cache that in the first ath_buf in the aggregate so it and the eventual
  AMPDU length can be returned to the rate control code.

* THEN, modify the rate control code to look at them both when deciding which bucket
  to attribute the sent frame on.  I'm erring on the side of caution and using the
  size bucket that the lookup is based on.

Ok, so now the rate lookups and statistics are "more correct".  However, MCS rates
are not the same as 11abg rates in that they're not a monotonically incrementing
set of faster rates and you can't assume that just because a given MCS rate fails,
the next higher one wouldn't work better or be a lower average tx time.

So, I had to do a bunch of surgery to the best rate and sample rate math.
This is the bit that's a WIP.

* First, simplify the statistics updates (update_stats()) to do a single pass on
  all rates.
* Next, make sure that each rate average tx time is updated based on /its/ failure/success.
  Eg if you sent a frame with { MCS15, MCS12, MCS8 } and MCS8 succeeded, MCS15 and MCS
  12 would have their average tx time updated for /their/ part of the transmission,
  not the whole transmission.
* Next, EWMA wasn't being fully calculated based on the /failures/ in each of the
  rate attempts.  So, if MCS15, MCS12 failed above but MCS8 didn't, then ensure
  that the statistics noted that /all/ subframes failed at those rates, rather than
  the eventual set of transmitted/sent frames.   This ensures the EWMA /and/ average
  TX time are updated correctly.
* When picking a sample rate and initial rate, probe rates aroud the current MCS
  but limit it to MCS0..7 /for all spatial streams/, rather than doing crazy things
  like hitting MCS7 and then probing MCS8 - MCS8 is basically MCS0 but two spatial
  streams.  It's a /lot/ slower than MCS7.  Also, the reverse is true - if we're at
  MCS8 then don't probe MCS7 as part of it, it's not likely to succeed.
* Fix bugs in pick_best_rate() where I was /immediately/ choosing the highest MCS
  rate if there weren't any frames yet transmitted.  I was defaulting to 25% EWMA and
  .. then each comparison would accept the higher rate.  Just skip those; sampling
  will fill in the details.

So, this seems to work a lot better.  It's not perfect; I'm still seeing a lot of
instability around higher MCS rates because there are bursts of loss/retransmissions
that aren't /too/ bad.  But i'll keep iterating over this and tidying up my hacks.

Ok, so why this still something I'm poking at? rather than porting minstrel_ht?

ath_rate_sample tries to minimise airtime, not maximise throughput.  I have
extended it with an EWMA based on sub-frame success/failures - high MCS rates
that have partially successful receptions still show super short average frame
times, but a /lot/ of retransmits have to happen for that to work.
So for MCS rates I also track this EWMA and ensure that the rates I'm choosing
don't have super crappy packet failures.  I don't mind not getting lower
peak throughput versus minstrel_ht; instead I want to see if I can make "minimise
airtime" work well.

Tested:

* AR9380, STA mode
* AR9344, STA mode
* AR9580, STA/AP mode

4 years agoIntroduce sysputpage() to display large page size with human readable format.
mr [Fri, 15 May 2020 17:37:08 +0000 (17:37 +0000)]
Introduce sysputpage() to display large page size with human readable format.
Using UI units allows to fit larger numbers in columns.
Stop calling v_page_size - this is a value that doesn't change at runtime.
Renamed WINDOW *wnd to *wd to avoid conflict with global *wnd variable.
Use bit-shift to convert page size to byte.

PR:             246458
Submitted by:   ota@j.email.ne.jp
MFC after: 2 weeks
Differential Revision:  D24834

4 years agovmm(4), bhyve(8): Expose kernel-emulated special devices to userspace
cem [Fri, 15 May 2020 15:54:22 +0000 (15:54 +0000)]
vmm(4), bhyve(8): Expose kernel-emulated special devices to userspace

Expose the special kernel LAPIC, IOAPIC, and HPET devices to userspace
for use in, e.g., fallback instruction emulation (when userspace has a
newer instruction decode/emulation layer than the kernel vmm(4)).

Plumb the ioctl through libvmmapi and register the memory ranges in
bhyve(8).

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D24525

4 years agoAllow only IPv4 addresses in sendto() for TCP on AF_INET sockets.
tuexen [Fri, 15 May 2020 14:06:37 +0000 (14:06 +0000)]
Allow only IPv4 addresses in sendto() for TCP on AF_INET sockets.

This problem was found by looking at syzkaller reproducers for some other
problems.

Reviewed by: rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D24831

4 years agoThis fixes several skyzaller issues found with the
rrs [Fri, 15 May 2020 14:00:12 +0000 (14:00 +0000)]
This fixes several skyzaller issues found with the
help of Michael Tuexen. There was some accounting
errors with TCPFO for bbr and also for both rack
and bbr there was a FO case where we should be
jumping to the just_return_nolock label to
exit instead of returning 0. This of course
caused no timer to be running and thus the
stuck sessions.

Reported by: Michael Tuexen and Skyzaller
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D24852

4 years agoImprove comment for compat32 handling of sysctl hw.pagesizes.
kib [Fri, 15 May 2020 13:53:10 +0000 (13:53 +0000)]
Improve comment for compat32 handling of sysctl hw.pagesizes.

Explain why truncation works as intended.
Reformat.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agoRevert r361077 to recommit with proper message.
kib [Fri, 15 May 2020 13:52:39 +0000 (13:52 +0000)]
Revert r361077 to recommit with proper message.

4 years agoImplement RTLD_DEEPBIND.
kib [Fri, 15 May 2020 13:50:08 +0000 (13:50 +0000)]
Implement RTLD_DEEPBIND.

PR: 246462
Tested by: Martin Birgmeier <d8zNeCFG@aon.at>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24841

4 years agoRemove arm64_idcache_wbinv_range as it's unused.
andrew [Fri, 15 May 2020 13:33:48 +0000 (13:33 +0000)]
Remove arm64_idcache_wbinv_range as it's unused.

Sponsored by: Innovate UK

4 years agoAssign process group of the TTY under the "proctree_lock".
hselasky [Fri, 15 May 2020 12:47:39 +0000 (12:47 +0000)]
Assign process group of the TTY under the "proctree_lock".

This fixes a race where concurrent calls to doenterpgrp() and
leavepgrp() while TIOCSCTTY is executing may result in tp->t_pgrp
changing value so that tty_rel_pgrp() misses clearing it to NULL. For
more details refer to the use of pgdelete() in the kernel.

No functional change intended.

Panic backtrace:
__mtx_lock_sleep() # page fault due to using destroyed mutex
tty_signal_pgrp()
tty_ioctl()
ptsdev_ioctl()
kern_ioctl()
sys_ioctl()
amd64_syscall()

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix SYNPOSIS section to point to the proper include directive.
bcr [Fri, 15 May 2020 12:04:39 +0000 (12:04 +0000)]
Fix SYNPOSIS section to point to the proper include directive.

netgraph(3) points to #include <netgraph/netgraph.h>, which is kernel only.
The man page refers to the user-space part of the netgraph module, which is
located in <netgraph.h>.

Submitted by: lutz_donnerhacke.de
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D23814

4 years agoImplement RTLD_DEEPBIND.
kib [Fri, 15 May 2020 11:58:01 +0000 (11:58 +0000)]
Implement RTLD_DEEPBIND.

PR: 246462
Tested by: Martin Birgmeier <d8zNeCFG@aon.at>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24841

4 years agobhyve: Fix processing of netgraph backend options.
afedorov [Fri, 15 May 2020 11:03:27 +0000 (11:03 +0000)]
bhyve: Fix processing of netgraph backend options.

After r360820, additional parameters are passed through the argument 'opts', and the name of the backend through the argument 'devname'. So, there is no need to skip the backend name from the 'opts' argument.

4 years agoObsoleteFiles: pdwait4.2.gz
cem [Fri, 15 May 2020 03:54:25 +0000 (03:54 +0000)]
ObsoleteFiles: pdwait4.2.gz

A belated follow-up to r320058.