]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoRemove tests for obsolete compilers in the build system
Eric van Gyzen [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
Andrew 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
Ryan Moeller [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.
Aleksandr Fedorov [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
Andriy Gapon [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
Andriy Gapon [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
Conrad Meyer [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 Chadd [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 Chadd [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.
Xin LI [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 Chadd [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 Chadd [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.
Brandon Bergren [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
Conrad Meyer [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]
Conrad Meyer [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]
Conrad Meyer [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.
Michael 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
Conrad Meyer [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.
Konstantin Belousov [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.
John Baldwin [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.
John Baldwin [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.
John Baldwin [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
Kristof Provost [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.
John Baldwin [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.
John Baldwin [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.
John Baldwin [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
Andrew 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
Michael Reifenberger [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.
John Baldwin [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.
John Baldwin [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.
Hans Petter Selasky [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.
John Baldwin [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.
John Baldwin [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.
Alexander V. Chernikov [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.
John Baldwin [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...
Michael Reifenberger [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).
John Baldwin [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
Dimitry Andric [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
Andrew 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.
Mark Johnston [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.
Mark Johnston [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.
Mark Johnston [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
Eric Joyner [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
Ryan Moeller [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.
Takanori Watanabe [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
Alex Richardson [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.
Alexander V. Chernikov [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 Chadd [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
Justin Hibbits [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
Michael 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
Kyle Evans [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
Justin Hibbits [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.
Michael 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.
Michael 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
Ed Maste [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.
Emmanuel Vadot [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
Emmanuel Vadot [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
4 years agolinuxkpi: Add bitmap_alloc and bitmap_free
Emmanuel Vadot [Sun, 10 May 2020 13:07:00 +0000 (13:07 +0000)]
linuxkpi: Add bitmap_alloc and bitmap_free

This is a simple call to kmallock_array/kfree, therefore include linux/slab.h as
this is where the kmalloc_array/kfree definition is.

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

4 years agoOnly drop DATA chunk with lower priorities as specified in RFC 7496.
Michael Tuexen [Sun, 10 May 2020 10:03:10 +0000 (10:03 +0000)]
Only drop DATA chunk with lower priorities as specified in RFC 7496.
This issue was found by looking at a reproducer generated by syzkaller.

MFC after: 3 days

4 years agoRemove rtalloc1(_fib) KPI.
Alexander V. Chernikov [Sun, 10 May 2020 09:34:48 +0000 (09:34 +0000)]
Remove rtalloc1(_fib) KPI.

Last user of rtalloc1() KPI has been eliminated in rS360631.
As kernel is now fully switched to use new routing KPI defined in
rS359823, remove old lookup functions.

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

4 years ago[atheros] [if_arge] Various fixes to avoid TX stalls and bad sized packets
Adrian Chadd [Sun, 10 May 2020 03:36:11 +0000 (03:36 +0000)]
[atheros] [if_arge] Various fixes to avoid TX stalls and bad sized packets

This is stuff I've been running for a couple years.  It's inspired by changes
I found in the linux ag71xx ethernet driver.

* Delay between stopping DMA and checking to see if it's stopped; this gives
  the hardware time to do its thing.

* Non-final frames in the chain need to be a multiple of 4 bytes in size.
  Ensure this is the case when assembling a TX DMA list.

* Add counters for tx/rx underflow and too-short packets.

* Log if TX/RX DMA couldn't be stopped when resetting the MAC.

* Add some more debugging / logging around TX/RX ring bits.

Tested:

* AR7240, AR7241
* AR9344 (TL-WDR3600/TL-WDR4300 APs)
* AR9331 (Carambola 2)

4 years agoclang: Reject %n for __attribute__((format(__freebsd_kprintf__)))
Conrad Meyer [Sat, 9 May 2020 19:26:44 +0000 (19:26 +0000)]
clang: Reject %n for __attribute__((format(__freebsd_kprintf__)))

A follow-up to r360849.

Reported by: imp
Reviewed by: emaste, imp
X-MFC-With: r360849
Differential Revision: https://reviews.freebsd.org/D24786

4 years agolinuxkpi: Add bitmap_copy and bitmap_andnot
Emmanuel Vadot [Sat, 9 May 2020 17:52:50 +0000 (17:52 +0000)]
linuxkpi: Add bitmap_copy and bitmap_andnot

bitmap_copy simply copy the bitmaps, no idea why it exists.
bitmap_andnot is similar to bitmap_and but uses !src2.

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

4 years agoremove %n support from printf(9)
Ed Maste [Sat, 9 May 2020 15:56:02 +0000 (15:56 +0000)]
remove %n support from printf(9)

It can be dangerous and there is no need for it in the kernel.
Inspired by Kees Cook's change in Linux, and later OpenBSD.

Reviewed by: cem, gordon, philip
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24760

4 years agortwn: Add a new USB ID.
Mark Johnston [Sat, 9 May 2020 14:49:56 +0000 (14:49 +0000)]
rtwn: Add a new USB ID.

PR: 246315
Submitted by: Idwer Vollering <vidwer+fbsdbugs@gmail.com>
MFC after: 1 week

4 years agoAdd ARM loader path to uefi(8) man page.
Edward Tomasz Napierala [Sat, 9 May 2020 14:19:29 +0000 (14:19 +0000)]
Add ARM loader path to uefi(8) man page.

MFC after: 2 weeks
Sponsored by: DARPA

4 years agoAdd space for RSSI in data member.
Takanori Watanabe [Sat, 9 May 2020 14:15:44 +0000 (14:15 +0000)]
Add space for RSSI in data member.
RSSI is put just after actual data.

Submitted by: Marc Veldman
PR: 245920

4 years agoAvoid spurious ENOMEMs from sysctl hw.pagesizes.
Konstantin Belousov [Sat, 9 May 2020 13:00:38 +0000 (13:00 +0000)]
Avoid spurious ENOMEMs from sysctl hw.pagesizes.

Reported by: Paul Floyd <paulf@free.fr>
PR: 246215
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24737

4 years agoDocument BUS_OOMERR.
Konstantin Belousov [Sat, 9 May 2020 12:58:27 +0000 (12:58 +0000)]
Document BUS_OOMERR.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D24761

4 years agoDon't send clear screen until we are committed to run.
Poul-Henning Kamp [Sat, 9 May 2020 10:55:34 +0000 (10:55 +0000)]
Don't send clear screen until we are committed to run.

4 years agoMention the existence of /etc/defaults/vendor.conf
Benedict Reuschling [Sat, 9 May 2020 10:22:00 +0000 (10:22 +0000)]
Mention the existence of /etc/defaults/vendor.conf
for custom vendor-specific changes to FreeBSD's
default settings.

While here, fix a typo: perfomance -> performance

PR: 245404
Submitted by: Jose Luis Duran

4 years agobhyve: update man page to describe the virtio-net mtu option
Vincenzo Maffione [Sat, 9 May 2020 07:57:41 +0000 (07:57 +0000)]
bhyve: update man page to describe the virtio-net mtu option

r359704 introduced an 'mtu' option for the virtio-net device emulation.
Update the man page to describe the new option.

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D24723

4 years agoloader: vdev_read() can corrupt memory
Toomas Soome [Sat, 9 May 2020 06:25:20 +0000 (06:25 +0000)]
loader: vdev_read() can corrupt memory

When reading less than sector size but from sector boundary,
the vdev_read() will read full sector into the provided buffer
and therefore corrupting memory past buffer end.

MFC after: 2 days

4 years agoinstallworld: attempt a certctl rehash at the tail end
Kyle Evans [Sat, 9 May 2020 02:01:29 +0000 (02:01 +0000)]
installworld: attempt a certctl rehash at the tail end

This can be run as root or normal user with no problem; if they hadn't
twisted the WITHOUT_CAROOT knob, we'll attempt to use the host certctl to
rehash the DESTDIR. This would allow one to build systems WITHOUT_OPENSSL +
WITH_CAROOT with a populated /etc/ssl that they can then use with an
appropriate *ssl from somewhere else.

Cross-builds are fine because this will always use the host certctl, or just
nag if it's missing and it wasn't a WITHOUT_CAROOT build.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24641

4 years agofusefs: fix two small bugs in the tests' expectations
Alan Somers [Fri, 8 May 2020 23:00:02 +0000 (23:00 +0000)]
fusefs: fix two small bugs in the tests' expectations

These two errors have been present since the tests' introduction.
Coincidentally every test (I think there's only one) that cares about that
field also works when the field's value is 0.

MFC after: 2 weeks

4 years agofusefs: better dtrace probes for asynchronous invalidation operations
Alan Somers [Fri, 8 May 2020 22:26:52 +0000 (22:26 +0000)]
fusefs: better dtrace probes for asynchronous invalidation operations

MFC after: 2 weeks

4 years ago[etherswitch] bump register width to 32 bits.
Adrian Chadd [Fri, 8 May 2020 22:22:12 +0000 (22:22 +0000)]
[etherswitch] bump register width to 32 bits.

Some ethernet switches have very large register windows; for example
the AR8316 switch MIB starts at 0x20000.

Submitted by: Mori Hiroki <yamori813@yahoo.co.jp>

4 years agoSync relocation definitions
Mitchell Horne [Fri, 8 May 2020 22:21:56 +0000 (22:21 +0000)]
Sync relocation definitions

Add the most recent relocation types from the RISC-V ELF psABI spec.

MFC after: 3 days

4 years agoEmbed dst sockaddr into rtentry and remove rte packet counter
Alexander V. Chernikov [Fri, 8 May 2020 21:06:10 +0000 (21:06 +0000)]
Embed dst sockaddr into rtentry and remove rte packet counter

Currently each rtentry has dst&gateway allocated separately from another zone,
 bloating cache accesses.

Current 'struct rtentry' has 12 "mandatory" radix pointers in the beginning,
 leaving 4 usable pointers/32 bytes in the first 2 cache lines (amd64).
Fields needed for the datapath are destination sockaddr and rt_nhop.

So far it doesn't look like there is other routable addressing protocol other
 than IPv4/IPv6/MPLS, which uses keys longer than 20 bytes.
With that in mind, embed dst into struct rtentry, making the first 24 bytes
 of rtentry within 128 bytes. That is enough to make IPv6 address within first
 128 bytes.

It is still pretty easy to add code for supporting separately-allocated dst,
 however it doesn't make a lot of sense in having such code without a use case.

As rS359823 moved the gateway to the nexthop structure, the dst embedding change
 removes the need for any additional allocations done by rt_setgate().

Lastly, as a part of cleanup, remove counter(9) allocation code, as this field
 is not used in packet processing anymore.

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

4 years agoAdd more obsolete files
Antoine Brodin [Fri, 8 May 2020 20:15:18 +0000 (20:15 +0000)]
Add more obsolete files

4 years agobhyve: Pass the full string of options to the network backends.
Aleksandr Fedorov [Fri, 8 May 2020 17:15:54 +0000 (17:15 +0000)]
bhyve: Pass the full string of options to the network backends.

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

4 years ago[net80211] Use the unicast key when transmitting DWDS AP multicast frames.
Adrian Chadd [Fri, 8 May 2020 17:01:33 +0000 (17:01 +0000)]
[net80211] Use the unicast key when transmitting DWDS AP multicast frames.

I'm still not sure whether this is the full solution, but here goes.

I have a two node DWDS setup - a main AP with the ethernet bridge uplink
and a satellite AP in the back of the house. They're both AR9344+AR9580
dual band 11n APs.

The problem was that multicast frames was not going from the DWDS AP to
the DWDS STA. Unicast frames are fine, and multicast frames from the
DWDS STA to AP are fine.

Now, multicast and unicast frames from the STA -> AP are just transmitted
using the unicast key.  That's fine.  However, the AP -> STA multicast
frames by default are transmitted using the current default / multicast
key, the shared one between all STAs in a BSS.  Now, the DWDS implementation
ignores non WDS frames - it only allows about 4 address frames outside
of management / EAPOL frames! - so the STA side ignores the normal multicast
frames.

Instead, the AP side uses ieee80211_dwds_mcast() to send multicast frames
to each WDS VAP that was created as part of the "dynamic" part of DWDS.
This should be queuing them individually to each node instead of using
the normal multicast send path; and this is how they should get turned into
4-addr WDS frames.

HOWEVER, ieee80211_encap() was trying to use the default TX key to queue
them rather than the unicast key that's already setup.  Since this synthetic
node doesn't have the default TX key setup, transmission fails.  Things
would be fine in WEP and in open mode because in both cases you would
have static keys (or no keys) setup.  It just fails in WPA mode.

This resolves the issue.  AP DWDS multicast is now sent using the unicast
key just like in STA mode and I'm pretty sure the STA mode side will stil
work fine (as it's a STA VAP with a DWDS flag..)

Tested:

* TL-WDR3600/4300 APs

4 years agoFix a memory leak for ENCIOC_GETSTRING I introduced in r360171.
John Baldwin [Fri, 8 May 2020 16:41:23 +0000 (16:41 +0000)]
Fix a memory leak for ENCIOC_GETSTRING I introduced in r360171.

MFC after: 1 week
Sponsored by: DARPA

4 years agosrc.conf.5: regen after BINUTILS changes
Ed Maste [Fri, 8 May 2020 15:03:28 +0000 (15:03 +0000)]
src.conf.5: regen after BINUTILS changes

4 years agosrc.opts.mk: update BINUTILS options and add comments
Ed Maste [Fri, 8 May 2020 14:54:40 +0000 (14:54 +0000)]
src.opts.mk: update BINUTILS options and add comments

BINUTILS is needed only for ports, and will be disabled once the failing
ports are addressed (likely by growing a binutils dependency).

BINUTILS_BOOTSTRAP is needed only on amd64, for skein_block_asm.s. There
is no need to enable it on i386.

This will all be removed before FreeBSD 13.0.

4 years agoRemove APPLEKEXT ifndefs
Ryan Moeller [Fri, 8 May 2020 14:39:38 +0000 (14:39 +0000)]
Remove APPLEKEXT ifndefs

They are no longer useful.

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

4 years agoReinitialize thread0's stack base after enabling XSAVE.
Mark Johnston [Fri, 8 May 2020 14:38:48 +0000 (14:38 +0000)]
Reinitialize thread0's stack base after enabling XSAVE.

Otherwise the initial call to set_top_of_stack(), which occurs before
fpuinit() sets the correct value for cpu_max_ext_state_size, leaves the
stack base at an incorrect location.  Then, when the full area is
zeroed, we end up erroneously zeroing part of the following page.

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

4 years agoFix the sys.geom.class.multipath.misc.fail_on_error test on stable/12
Alan Somers [Fri, 8 May 2020 02:42:15 +0000 (02:42 +0000)]
Fix the sys.geom.class.multipath.misc.fail_on_error test on stable/12

This test uses a gnop feature (delay probability) that isn't available on
stable/12.  But it's unnecessary; the test works fine without it.  Removing
it simplifies the test and, once MFCed, will allow it to pass on stable/12.

PR: 244158
Reported by: lwhsu
MFC after: 2 weeks

4 years agoDocument le_enable subcommand
Takanori Watanabe [Fri, 8 May 2020 01:19:29 +0000 (01:19 +0000)]
Document le_enable subcommand

4 years agoMerge commit 21e5e1724b75 from llvm git:
Ed Maste [Thu, 7 May 2020 21:18:37 +0000 (21:18 +0000)]
Merge commit 21e5e1724b75 from llvm git:

  getMainExecutable: Fix hand-rolled AT_EXECPATH for older FreeBSD

  Once we hit AT_NULL, we need to bail out of the loop; not just the
  enclosing switch.  This fixes basic usage (e.g. `cc --version`) when
  AT_EXECPATH isn't present on older branches (e.g. under
  emu-user-static, at the moment), where we would previously run off
  the end of ::environ.

  Patch By: kevans

  Reviewed By: arichardson

  Differential Revision:  https://reviews.llvm.org/D79239

MFC after: 3 days

4 years agoWhen in the SYN-SENT state bbr and rack will not properly send an ACK but instead...
Randall Stewart [Thu, 7 May 2020 20:29:38 +0000 (20:29 +0000)]
When in the SYN-SENT state bbr and rack will not properly send an ACK but instead start the D-ACK timer. This
causes so_reuseport_lb_test to fail since it slows down how quickly the program runs until the timeout occurs
and fails the test

Sponsored by: Netflix inc.
Differential Revision: https://reviews.freebsd.org/D24747

4 years agoBump __FreeBSD_version after linuxkpi changes
Emmanuel Vadot [Thu, 7 May 2020 19:51:53 +0000 (19:51 +0000)]
Bump __FreeBSD_version after linuxkpi changes

Requested by: zeising

4 years ago[PowerPC] kernel ifunc support for powerpc*, fix ppc64 relocation oddities.
Brandon Bergren [Thu, 7 May 2020 19:32:49 +0000 (19:32 +0000)]
[PowerPC] kernel ifunc support for powerpc*, fix ppc64 relocation oddities.

This is a general cleanup of the relocatable kernel support on powerpc,
needed to enable kernel ifuncs.

 * Fix some relocatable issues in the kernel linker, and change to using
   a RELOCATABLE_KERNEL #define instead of #ifdef __powerpc__ for parts that
   other platforms can use in the future if they wish to have ET_DYN kernels.

 * Get rid of the DB_STOFFS hack now that the kernel is relocated to the DMAP
   properly across the board on powerpc64.

 * Add powerpc64 and powerpc32 ifunc functionality.

 * Allow AIM64 virtual mode OF kernels to run from the DMAP like other AIM64
   by implementing a virtual mode restart. This fixes the runtime address on
   PowerMac G5.

 * Fix symbol relocation problems on post-relocation kernels by relocating
   the symbol table.

 * Add an undocumented method for supplying kernel symbols on powernv and
   other powerpc machines using linux-style kernel/initrd loading -- If
   you pass the kernel in as the initrd as well, the copy resident in initrd
   will be used as a source for symbols when initializing the debugger.
   This method is subject to removal once we have a better way of doing this.

Approved by: jhibbits
Relnotes: yes
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23156

4 years agoOptionalObsoleteFiles.inc: remove objdump
Ed Maste [Thu, 7 May 2020 18:24:32 +0000 (18:24 +0000)]
OptionalObsoleteFiles.inc: remove objdump

objdump is removed unconditionally in ObsoleteFiles.inc

4 years agoSet PCM_CAP_VIRTUAL for virtual DSP devices.
Hans Petter Selasky [Thu, 7 May 2020 18:15:35 +0000 (18:15 +0000)]
Set PCM_CAP_VIRTUAL for virtual DSP devices.

Submitted by: Kevin Zheng <kevinz5000@gmail.com>
PR: 246206
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agovirtio_mmio: Add casts missing from r360722
Jessica Clarke [Thu, 7 May 2020 17:59:17 +0000 (17:59 +0000)]
virtio_mmio: Add casts missing from r360722

This fixes -Wshift-count-overflow warnings/errors on architectures using
32-bit physical addresses.

Reported by: lwhsu

4 years ago[PowerPC] Fix powerpcspe build failure after r360569
Brandon Bergren [Thu, 7 May 2020 17:58:07 +0000 (17:58 +0000)]
[PowerPC] Fix powerpcspe build failure after r360569

On powerpcspe, vm_paddr_t is 64 bit despite it being a 32 bit platform.
Adjust compile time assertion to compensate.

4 years agolinuxkpi: Add pci_iomap and pci_iounmap
Emmanuel Vadot [Thu, 7 May 2020 17:00:51 +0000 (17:00 +0000)]
linuxkpi: Add pci_iomap and pci_iounmap

Those function are use to map/unmap io region of a pci device.
Different resource can be mapped depending on the bar so use a
tailq to store them all.

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

4 years agops: extend the non-standard option -d (tree view) to work with -p
Piotr Pawel Stefaniak [Thu, 7 May 2020 16:56:18 +0000 (16:56 +0000)]
ps: extend the non-standard option -d (tree view) to work with -p

Initially it seemed that there were multiple possible ways to do it.

Processing option -p could conditionally add selected processes and
their descendants to the list for further work, but it is not guaranteed
to know whether the -d option has been used or not, and it also doesn't
have access to the process list just yet.

There is also descendant_sort() which has access to all possibly needed
information, but serves the purely post-processing purpose of sorting
output.

Then there is the loop that uses invocation information and full process
list to create a list of processes for final display. It seems the most
natural place to implement this, but indeterminate state of the process
list and volatility of the final list that is being created obstruct
adding an elegant search for all elements of process descendancy trees.

So I opted for adding another loop, just before the one I mentioned
above. For all selected processes it conditionally adds direct
descendants to the end of this list of selected processes.

Possible usage:
* ps -auxd -p $$
* ps -auxd -p 1
* while x=$(pgrep svnlite); do clear; ps auxd -p $x; sleep 2; done
* ps -auxd -p `pgrep make`

Reviewed by: kevans, kaktus (earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24380

4 years agogpioiic_attach: fix a NULL pointer crash on hints-based systems
Andriy Gapon [Thu, 7 May 2020 13:11:32 +0000 (13:11 +0000)]
gpioiic_attach: fix a NULL pointer crash on hints-based systems

The attach method uses GPIO_GET_BUS() to get a "newbus" device
that provides a pin.  But on hints-based systems a GPIO controller
driver might not be fully initialized yet and it does not know gpiobus
hanging off it.  Thus, GPIO_GET_BUS() cannot be called yet.
The reason is that controller drivers typically create a child gpiobus
using gpiobus_attach_bus() and that leads to the following call chain:
gpiobus_attach_bus() -> gpiobus_attach() ->
bus_generic_attach(gpiobus) -> gpioiic_attach().
So, gpioiic_attach() is called before gpiobus_attach_bus() returns.

I observed this bug with nctgpio driver on amd64.
I think that the problem was introduced in r355276.

The fix is to avoid calling GPIO_GET_BUS() from the attach method.
Instead, we know that on hints-based systems only the parent gpiobus can
provide the pins.
Nothing is changed for FDT-based systems.

MFC after: 1 week