f17f94cd melifaro Feb. 20, 2021, 6:26 p.m.
e5b394f2 melifaro Feb. 20, 2021, 6:26 p.m.
rtsock message validation changes committed in 2fe5a79425c7
 did not take llinfo messages into account.

Add a special validation case for RTA_GATEWAY llinfo messages.

MFC after:	2 days
020f4112 emaste Feb. 20, 2021, 4:55 p.m.
Reviewed by:	mw
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28418
fbc57e2d emaste Feb. 20, 2021, 4:54 p.m.
Reduce copy-paste and use a more typical construct.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28417
504e64af ygy Feb. 20, 2021, 8:05 a.m.
Add a BUGS section about using pwrite(2) when O_APPEND is set on the fd.

MFC after:	3 days
Submitted by:	Ka Ho Ng <khng300@gmail.com>
Reviewed by:	gbe, yuripv
Differential Revision:	https://reviews.freebsd.org/D28372
150fc89a markj Feb. 20, 2021, 2:51 a.m.
After commit 8ba333e02e ("libdtrace: Stop relying on lex
compatibility"), there have been several reports of incremental
buildworlds failing since make does not know that dt_lex.c needs to be
regenerated, and I want to avoid this when merging to stable/13.

MFC with:	8ba333e02e
8cd1b2b1 imp Feb. 19, 2021, 10:34 p.m.
conical hat reduction: Make sure we also remove gotboot.efifat. It was created,
briefly, and shouldn't have existed in the first place. Kill it at the same
place we kill boot1.efifat.

Pointy Hat to: imp@
038148c1 np Feb. 19, 2021, 10:23 p.m.
Tighten up the validation of filter modes while here.  Unrecognized
keywords will be now be flagged as errors instead of being ignored.
0460a450 np Feb. 19, 2021, 10:23 p.m.
T5 and above have extra bits for the optional filter fields.  This is a
correctness issue and not just a waste because a filter mode valid on a
T4 (36b) may not be valid on a T5+ (40b).

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
c91dda5a np Feb. 19, 2021, 10:23 p.m.
Allow the filter mask (aka the hashfilter mode when hashfilters are
in use) to be set any time it is safe to do so.  The requested mask
must be a subset of the filter mode already.  The driver will not change
the mode or ingress config just to support a new mask.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
7ac8040a np Feb. 19, 2021, 10:23 p.m.
1. Query the firmware for filter mode, mask, and related ingress config
   instead of trying to figure them out from hardware registers.  Read
   configuration from the registers only when the firmware does not
   support this query.

2. Use the firmware to set the filter mode.  This is the correct way to
   do it and is more flexible as well.  The filter mode (and associated
   ingress config) can now be changed any time it is safe to do so.

   The user can specify a subset of a valid mode and the driver will
   enable enough bits to make sure that the mode is maxed out -- that
   is, it is not possible to set another bit without exceeding the
   total width for optional filter fields.  This is a hardware
   requirement that was not enforced by the driver previously.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
d4380c0c jamie Feb. 19, 2021, 10:13 p.m.
jail_attach(2) performs an internal chroot operation, leaving it up to
the calling process to assure the working directory is inside the jail.

Add a matching internal chdir operation to the jail's root.  Also
ignore kern.chroot_allow_open_directories, and always disallow the
operation if there are any directory descriptors open.

Reported by:    mjg
Approved by:    markj, kib
MFC after:      3 days
0f9544d0 markj Feb. 19, 2021, 10:10 p.m.
In commit 38bfc6dee33b we added an IFDI_DETACH() call to
iflib_pseudo_deregister() since it looked like it was missing.  One is
present in the error-handling path of iflib_pseudo_register().  However,
the detach actually comes from the DEVICE_DETACH() method for the
above-mentioned device_t, so now we're calling IFDI_DETACH() twice when
destroying a pseudo interface.

Fix the problem by not calling IFDI_DETACH() from the device detach
routine.  This way we can ensure that iflib de-initialization always
happens in a consistent order.  It also ensures that you can't do silly
things like "devctl detach <pseudo ifnet>", which would previously
detach the driver without tearing down the corresponding ifnet.

PR:		253541
Reviewed by:	erj
MFC after:	1 week
Fixes:		38bfc6dee33b
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28774
d2b3fadf dim Feb. 19, 2021, 9:18 p.m.
In 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 I imported a more recent
libcxxrt snapshot, which includes an upstream fix for the padding of
struct _Unwind_Exception:


However, we also had a similar fix in our tree as:

Since having both fixes makes the struct too large again, it leads to
SIGBUSes when throwing exceptions on amd64 (or other LP64 arches). This
is most easily tested by running kyua without any arguments.

It looks like our fix is no longer needed now, so revert it to reduce
diffs against upstream.

PR:		253226
Reviewed by:	arichardson, kp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D28799
f9e1cd6c melifaro Feb. 19, 2021, 9:17 p.m.
Changes in the 2fe5a79425c7 moved dst sockaddr masking from the
 routing control plane to the rtsock code.

It broke arp/ndp deletion.
It turns out, arp/ndp perform RTM_GET request first to get an
 interface index necessary for the deletion.
Then they simply stamp the reply with RTF_LLDATA and set the
 command to RTM_DELETE.
As a result, kernel receives request with non-empty RTA_NETMASK
 and clears RTA_DST host bits before passing the message to the
 lla code.

De facto, the only needed bits are RTA_DST, RTA_GATEWAY and the
 subset of rtm_flags.

With that in mind, fix the interace by clearing RTA_NETMASK
 for every messages with RTF_LLDATA.

While here, cleanup arp/ndp code a bit.

MFC after:	1 day
Reviewed by:	gnn
Differential Revision:	https://reviews.freebsd.org/D28804