Gleb Smirnoff [Tue, 8 Nov 2022 18:24:39 +0000 (10:24 -0800)]
tcp: inp_socket is valid through the lifetime of a TCP inpcb
The inp_socket is cleared only in in_pcbdetach(), which for TCP is
always accompanied with inp_pcbfree(). An inpcb that went through
in_pcbfree() shall never be returned by any kind of pcb lookup.
Gleb Smirnoff [Tue, 8 Nov 2022 18:24:39 +0000 (10:24 -0800)]
tcp: remove INP_DROPPED check from notify functions
These functions tcp_notify(), tcp_drop_syn_sent() and tcp_mtudisc()
are called from tcp*_ctlinput*() right after successfull
in_pcblookup*(). They shall never get a pcb that is dropped.
Gleb Smirnoff [Tue, 8 Nov 2022 18:24:39 +0000 (10:24 -0800)]
inpcb: don't return INP_DROPPED entries from pcb lookups
The in_pcbdrop() KPI, which is used solely by TCP, allows to remove a
pcb from hash list and mark it as dropped. The comment suggests that
such pcb won't be returned by lookups. Indeed, every call to
in_pcblookup*() is accompanied by a check for INP_DROPPED. Do what
comment suggests: never return such pcbs and remove unnecessary checks.
Bjoern A. Zeeb [Sun, 30 Oct 2022 17:20:11 +0000 (17:20 +0000)]
LinuxKPI: tasklet add (*callback) support
In addition to (*func) tasklet also seems to have a (*callback) with
a different argument. Add support for this and add tasklet_setup()
as well for support in more drivers.
The from_tasklet() definition is duplicated in the tree; hide it there
under #ifndef to avoid a re-definition. People should generally add
LinuxKPI bits to linuxkpi rather than private files if they also rely
on other LinuxKPI bits.
X-MFC: DO NOT MFC, space allocated by drivers not us.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37216
Bjoern A. Zeeb [Mon, 31 Oct 2022 14:33:58 +0000 (14:33 +0000)]
LinuxKPI: implement cpumask_of()
Add a static set of cpumasks for all (possible) cpus with only the one
indexed cpu enabled in each set.
This is needed for cpumask_of(_cpuid) which returns a cpumask (cpuset)
with only cpu _cpuid enabled and is used by one wireless driver at least.
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37223
tcp: allow packets to be marked as ECT1 instead of ECT0
This adds the capability for a modular congestion control
to select which variant of ECN-capable-transport it wants to use
when sending out elegible segments. As an initial CC to utilize
this, DCTCP was selected.
John Baldwin [Mon, 7 Nov 2022 22:43:49 +0000 (14:43 -0800)]
git-arc: Accept message via -m when updating reviews.
If a -m argument is given to update, it is passed through to arc diff
when updating each review. Note that if an empty message is specified
via -m, arc diff will update the review without adding a note.
If an -m argument is not given, then the user's editor is invoked by
arc to supply a message for each review matching the previous
behavior.
This can be used to simplify the process for updating a set of
reviews, e.g.:
git checkout foo
git rebase main
git arc update -m "Rebase" main..
This will rebase the 'foo' branch and update the reviews for all
commits on the branch without invoking the user's editor separately
for each review.
Mark Johnston [Mon, 7 Nov 2022 21:07:26 +0000 (16:07 -0500)]
ksan: Build sanitizer runtimes without stack-smashing protection
On arm64 with per-thread stack canaries enabled (the PERTHREAD_SSP
option), the compiler may load curthread->td_md.md_canary in function
prologues. This is not safe in data_abort(); see commit 2c10be9e06d4.
Thus, sanitizer runtimes must also avoid accessing the current thread's
canary.
Since SSP has limited utility in sanitizer runtimes, simply disable it
unconditionally to avoid unpleasant surprises in the future.
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Mark Johnston [Mon, 7 Nov 2022 20:53:41 +0000 (15:53 -0500)]
arm64: Disable per-thread stack-smashing protection in data_abort()
With PERTHREAD_SSP configured, the compiler's stack-smashing protection
uses a per-thread canary value instead of a global value. The value is
stored in td->td_md.md_canary; the sp_el0 register always contains a
pointer to that value, and certain functions selected by the compiler
will store the canary value on the stack as a part of the function
prologue (and will verify the copy as part of the epilogue). In
particular, the thread structure may be accessed.
This happens to occur in data_abort(), which leads to the same problem
addressed by commit 2c10be9e06d4 ("arm64: Handle translation faults for
thread structures"). This commit fixes that directly, by disabling SSP
in data_abort() and a couple of related functions by using a function
attribute. It also moves the update of sp_el0 out of C code in case
the compiler decides to start checking the canary in pmap_switch()
someday.
A different solution might be to move the canary value to the PCB, which
currently lives on the kernel stack and isn't subject to the same
problem as thread structures (if only because guard pages inhibit
superpage promotion). However, there isn't any particular reason the
PCB has to live on the stack today; on amd64 it is embedded in struct
thread, reintroducing the same problem. Keeping the reference canary
value at the top of the stack is also rather dubious since it could be
clobbered by a sufficiently large stack overflow.
A third solution could be to go back to the approach of commit 5aa5420ff2e8, and modify UMA to use the direct map for thread structures
even if KASAN is enabled. But, transient promotions and demotions in
the direct map are possible too.
Reviewed by: alc, kib, andrew
MFC after: 1 month
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37255
Bjoern A. Zeeb [Sun, 30 Oct 2022 17:05:52 +0000 (17:05 +0000)]
LinuxKPI: add linux/leds.h
This is just a dummy enum and struct in order to make drivers compile
more happily as some parts are simply not hidden behind #ifdefs and
this avoids a longer-term maintenance problem.
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37215
Bjoern A. Zeeb [Mon, 31 Oct 2022 22:17:00 +0000 (22:17 +0000)]
LinuxKPI: string.h implement memcpy_and_pad()
Add a memcpy variant which takes length of source and destination
buffers and a padding character in case there is free space in the
destination. This is used by a wireless driver.
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37226
Bjoern A. Zeeb [Mon, 7 Nov 2022 12:39:46 +0000 (12:39 +0000)]
LinuxKPI: 802.11: enable WME support
Most of the WME code has been there disabled for months. One of the
reasons was that it lead to crashes early on. It is now understood
that the crashes are independent event and we can enable WME.
Update the code and deal with the calls from net80211 and adjust the
updates to when mac80211 drivers expect them, coherently put it under
LKPI_80211_WME and enable the define locally.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
mail: make The Dragonfly Mail Agent (dma) the default mta.
dma accepts mail from a local Mail User Agent (MUA) and delivers it
locally or to a smarthost for delivery. dma does not accept inbound
mail (i.e., it does not listen on port 25) and is not intended to
provide the same functionality as a full MTA like postfix or sendmail.
It is intended for use cases such as delivering cron(8) mail. which
is the default configuration and usage of sendmail in the default
setup of the base system.
In order to switch the default from sendmail to dma, we teach
mailwrapper to fallback on dma directly if the mailer.conf file cannot
be opened.
We install by default a mailer.conf file which points at dma
We install a mailer.conf file for sendmail in the examples.
Gordon Bergling [Mon, 7 Nov 2022 10:34:00 +0000 (11:34 +0100)]
intro.3: Document 'libstdthreads' (the ISO C11 '<threads.h>' library).
It's still relatively uncommon to see C11 '<threads.h>' being used,
but it's worth documenting, especially since FreeBSD requires a
different library for C11 threads compared to glibc (part of '-lpthread')
or musl libc (included by default).
PR: 267551
Submitted by: Alois Klink <alois plus freebsd at aloisklink dot com>
Reviewed by: pauamma
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37284
Gordon Bergling [Mon, 7 Nov 2022 10:23:33 +0000 (11:23 +0100)]
Update HISTORY and AUTHORS sections for cut(1) and paste(1)
In an e-mail Brian Walden wrote that:
"GWRL stands for Gottfried W. R. Luderer, the author of cut(1) and
paste(1), probably around 1978. Those came either from PWB or USG,
as he worked with, or for, Berkley Tague. Thus they made their way
into AT&T commercial UNIX, first into System III and the into System
V, and that's why they are missing from early BSD releases as they
didn't get into Research UNIX until the 8th Edition."
So update the HISTORY and AUTHORS sections for cut(1) and paste(1).
Li-Wen Hsu [Mon, 7 Nov 2022 03:30:09 +0000 (11:30 +0800)]
rc(8): Add a zpoolupgrade rc.d script
If a zpool is created by makefs(8), its version is 5000, i.e., all
feature flags are off. Introduce an rc script to run `zpool upgrade`
over the assigned zpools on the first boot. This is useful to the
ZFS based VM images built from release(7).
Reviewed by: imp, markj, mav
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37282
Accurate ECN asks to conservatively estimate, when the
ACE counter may have wrapped due to a single ACK covering a larger
number of segments. This is described in Annex A.2 of the
accurate-ecn draft.
Justin Hibbits [Sun, 6 Nov 2022 00:01:50 +0000 (20:01 -0400)]
dpaa: Go to cleanup exit point on fman attach error
If fman_init() fails it can leave things in a state where it cannot
attach at all in the future, because it would simply exit without
tearing down everything that was already set up. Go to the exit point
to clean up on error instead, so that it can try again later.
Ed Maste [Fri, 4 Nov 2022 15:59:49 +0000 (11:59 -0400)]
Clang: Add Diags for targets pre to i686 for -fcf-protection
Intel Control-flow Enforcement Technology (CET) provides new
instructions `endbr32/64` for the indirect branch control.
They are NOPs on i686 and new targets. We need to check for that
in case it crashes on older targets.
PR: 264497
Reviewed by: dim
MFC after: 1 week
Obtained from: LLVM commit 52516782972730ff065a34123a9d8876da08c254
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37268
Sumit Saxena [Fri, 4 Nov 2022 22:40:29 +0000 (16:40 -0600)]
if_bnxt: Added support for mgmt interface for passthrough hwrms
Added support for application management interface. There are two types of commands supported:
1. Firmware IOCTLs: These ioctls are meant for firmware
consumption. Driver acts as a transport for these.
2. Driver only IOCTLs: These ioctls are meant for driver
consumption. Driver will serve these ioctls without sending them down
to firmware.
Sumit Saxena [Fri, 4 Nov 2022 22:05:57 +0000 (16:05 -0600)]
if_bnxt: add support for Thor controller
Added support for Thor controller.
Below are the supported operations:
1. IPv4 ping (ICMP)
2. iperf / netperf (IPv4 TCP)
3. Promiscuous (tcpdump)
4. Can achieve 20 Gbps on a 25 G link (Uni-Di)
5. Can achieve 60 Gbps on a 100 G link (Uni-Di)
6. Port level and queue level driver stats.
Warner Losh [Fri, 4 Nov 2022 21:28:26 +0000 (15:28 -0600)]
stand: Remove unused enum
enum disk_ioctl is unused. It's only ever defined. All of the stand
code uses DIOCGSECTORSIZE and DIOCGMEDIASIZE instead, both to query and
to implement ioctl.
* Avoid unnecessary use of `unsigned char *`
* Use explicit casts when assigning `unsigned char *` to `char *` or vice versa
* Drop unused global variables (and fix memory leak in `gettable()`)
* Use `snprintf()` instead of `strcpy()` + `strcat()`
* Drop spurious braces in switch
Sponsored by: Klara, Inc.
Obtained from: Apple OSS Distributions (in part)
Differential Revision: https://reviews.freebsd.org/D37263
Li-Wen Hsu [Thu, 3 Nov 2022 19:17:43 +0000 (03:17 +0800)]
release/azure: Don't use azure-agent deprovision to build image
Deprovision feature of waagent is used for preparing to capture a
running VM and turn it into a VM image. Using it in the process of
building a VM image from scratch will cause some side effects such as
the hostname of the building host getting reset.
Remove calling the deprovision command and use a simpler way to fulfill
the requirements of the Azure VM image.
Jose Luis Duran [Wed, 2 Nov 2022 11:43:40 +0000 (08:43 -0300)]
ping_test: Fix tests ping_46 and ping6_46
If no IPv4-host, IPv4-mcast-group or IPv6-host is passed, it will
display the usage. The tests are passing because they are just checking
that the exit code is 1.
Fix the tests by checking the appropriate output message.
While here, change the description to match the output and add the
missing requirements.
Jose Luis Duran [Tue, 1 Nov 2022 08:01:36 +0000 (05:01 -0300)]
ping: Remove a vestigial notdef
It was once a function on 4.3BSD, pr_type() [1], used to convert an ICMP
"type" field to a printable string. In 4.4BSD it was superseded by
pr_icmph() [2].
NetBSD [3] and OpenBSD [4] have already removed it.
In order to handle those mbufs correctly on netfront use the bus_dma
interface and explicitly request that segments must not cross a page
boundary. No other requirements are necessary, so it's expected that
bus_dma won't need to bounce the data and hence it shouldn't
introduce a too big performance penalty.
Using bus_dma requires some changes to netfront, mainly in order to
accommodate for the fact that now ring slots no longer have a 1:1
match with mbufs, as a single mbuf can use two ring slots if the data
buffer crosses a page boundary. Store the first packet of the mbuf
chain in every ring slot that's used, and use a mbuf tag in order to
store the bus_dma related structures and a refcount to keep track of
the pending slots before the mbuf chain can be freed.