Commit Graph

258842 Commits

Author SHA1 Message Date
Bjoern A. Zeeb
da717031c9 LinuxKPI: compiler.h add three more defines
Add fallthrough, ____cacheline_aligned_in_smp, and smp_mb() to
linux/compiler.h.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30420
2021-05-25 18:01:48 +00:00
Bjoern A. Zeeb
5fce802722 LinuxKPI: add cpu.h for cpumask_*()
Add linux/cpu.h for cpumask_*() functions found in wireless drivers
and make sure cpu_online_mask is always initialised.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30421
2021-05-25 18:01:48 +00:00
Bjoern A. Zeeb
29923fea03 LinuxKPI: add devcoredump.h
Add linux/devcoredump.h with stub implementation of dev_coredumpv()
and dev_coredumpsg() which only free the passed in SG table as needed
for iwlwifi.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30423
2021-05-25 18:01:48 +00:00
Bjoern A. Zeeb
e7a0b68540 LinuxKPI: add dev_crit() to linux/device.h
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	emaste, hselasky
Differential Revision: https://reviews.freebsd.org/D30424
2021-05-25 18:01:48 +00:00
Bjoern A. Zeeb
834227ba6e LinuxKPI: add ether_addr_equal_unaligned()
Replace the implementation for ether_addr_equal() with
ether_addr_equal_unaligned() and add a define for ether_addr_equal()
pointing to the now ether_addr_equal_unaligned() implementation.
This way ether_addr_equal_unaligned() cannot be broken by accident [1].

Suggested by:	emaste [1]
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30425
2021-05-25 18:01:47 +00:00
Bjoern A. Zeeb
ff09f9133f LinuxKPI: net/if_inet6.h add struct inet6_dev { }
Add a dummy struct inet6_dev {}; to net/if_inet6.h.  This is currently
not used for anything but in a declaration.  Just needs to be there.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30426
2021-05-25 18:01:47 +00:00
Bjoern A. Zeeb
602e4e433d LinuxKPI: add irq_set_affinity_hint()
Add an implementation for irq_set_affinity_hint() to linux/interrupt.h
and include linux/hardirq.h for synchronize_irq() as needed by
wireless drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30427
2021-05-25 18:01:47 +00:00
Bjoern A. Zeeb
b26fb63f2b LinuxKPI: add linux/{ip,tcp,udp}.h
Add header files for struct and accessors for IPv4, UDP, and TCP.
Only parts of the fields of the structs have been seen while working
on wireless drivers.  The remaining field names are filled up with
the FreeBSD field names for now.  If you have insights into their
correct naming in Linux, feel free to adjust.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30428
2021-05-25 18:01:47 +00:00
Bjoern A. Zeeb
762efb2d6d LinuxKPI: ipv6.h add missing #include
Include linux/bitops.h for a definition of BITS_PER_LONG so that this
file can be used independently.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30429
2021-05-25 18:01:47 +00:00
Bjoern A. Zeeb
8620fe4c10 LinuxKPI: add time_is_after_jiffies() definition
This is used by wireless drivers.  Use the time_after() macro as
done for the "after_eq" version.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30430
2021-05-25 18:01:47 +00:00
Bjoern A. Zeeb
1082490cd8 LinuxKPI: change BUILD_BUG_ON()
BUILD_BUG_ON() can be used inside functions where the definition to
CTASSERT() (_Static_assert()) seems to not work.
Go back to an old-style CTASSERT() implementation but also add a
variable dclaration to avoid "unsued typedef" errors and dummy-use
the variable to avoid "unusued variable" errors.  Given it is all
self-contained in a block and not used outside this should be
optimised away.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30431
2021-05-25 18:01:47 +00:00
Bjoern A. Zeeb
18d303b05f LinuxKPI: add ktime_get_boottime_ns() implementation to ktime.h
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30432
2021-05-25 18:01:47 +00:00
Bjoern A. Zeeb
c1661d59e6 LinuxKPI: add LINUXKPI_PARAM_charp()
Add yet another version of the various module_param_named() use cases.
This one deals with "charp".

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30433
2021-05-25 18:01:46 +00:00
Bjoern A. Zeeb
fc1d840901 LinuxKPI: add more #defines to pci.h
Add more definitions for various PCI uses to linux/pci.h.  Almost all
are defined to their FreeBSD counterparts which are described there.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30434
2021-05-25 18:01:46 +00:00
Bjoern A. Zeeb
10096cb606 LinuxKPI: add prandom_u32() as used by wireless drivers.
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30435
2021-05-25 18:01:46 +00:00
Bjoern A. Zeeb
fa58da02f7 LinuxKPI: add rcu_dereference_check()
Add a define for rcu_dereference_check() to rcu_dereference_protected()
which ignores the check argument.  Our lockdep compat implementation
for use cases found in iwlwifi would return 1 anyway.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30436
2021-05-25 18:01:46 +00:00
Bjoern A. Zeeb
abcac97f82 LinuxKPI: add kfree_sensitive() using zfree().
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30437
2021-05-25 18:01:46 +00:00
Bjoern A. Zeeb
43b4c00643 LinuxKPI: extract stringify() in their own header file
Add linux/stringify.h as directly included by drivers.  Remove the
definitions from compiler.h and include the new header in places
where the stringify macros are already used without linuxkpi.

I have adjusted the Copyright of the new file according to the commit
originaly adding the macros (99e690772a).

Sposnored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30440
2021-05-25 18:01:46 +00:00
Bjoern A. Zeeb
5878c7c7b0 LinuxKPI: add kernel_ulong_t typedef in linux/kernel.h.
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30438
2021-05-25 18:01:46 +00:00
Bjoern A. Zeeb
cae1683120 LinuxKPI: add guid_t for ACPI consumers.
Add a placeholder struct for guid_t which is needed by ACPI consumers
in at least one wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30439
2021-05-25 18:01:46 +00:00
Andrew Gallatin
086a35562f tcp: enter network epoch when calling tfb_tcp_fb_fini
We need to enter the network epoch when calling into
tfb_tcp_fb_fini.  I noticed this when I hit an assert
running the latest rack

Differential Revision: https://reviews.freebsd.org/D30407
Reviewed by: rrs, tuexen
Sponsored by: Netflix
2021-05-25 13:45:37 -04:00
Randall Stewart
13c0e198ca tcp: Fix bugs related to the PUSH bit and rack and an ack war
Michaels testing with UDP tunneling found an issue with the push bit, which was only partly fixed
in the last commit. The problem is the left edge gets transmitted before the adjustments are done
to the send_map, this means that right edge bits must be considered to be added only if
the entire RSM is being retransmitted.

Now syzkaller also continued to find a crash, which Michael sent me the reproducer for. Turns
out that the reproducer on default (freebsd) stack made the stack get into an ack-war with itself.
After fixing the reference issues in rack the same ack-war was found in rack (and bbr). Basically
what happens is we go into the reassembly code and lose the FIN bit. The trick here is we
should not be going into the reassembly code if tlen == 0 i.e. the peer never sent you anything.
That then gets the proper action on the FIN bit but then you end up in LAST_ACK with no
timers running. This is because the usrclosed function gets called and the FIN's and such have
already been exchanged. So when we should be entering FIN_WAIT2 (or even FIN_WAIT1) we get
stuck in LAST_ACK. Fixing this means tweaking the usrclosed function so that we properly
recognize the condition and drop into FIN_WAIT2 where a timer will allow at least TP_MAXIDLE
before closing (to allow time for the peer to retransmit its FIN if the ack is lost). Setting the fast_finwait2
timer can speed this up in testing.

Reviewed by: mtuexen,rscheff
Sponsored by: Netflix Inc
Differential Revision:	https://reviews.freebsd.org/D30451
2021-05-25 13:23:31 -04:00
Chuck Silvers
84768d1149 fsdb: add missing bufinit() call
The bufinit() call in fsck_ffs was moved in commit f190f9193b
from a function that is shared with fsdb to one that is private to fsck_ffs,
so add a bufinit() call in fsdb to compensate for that.

Reviewed by:	mckusick
Sponsored by:	Netflix
2021-05-25 09:42:10 -07:00
Warner Losh
00e7a55367 cam_sim: style: sort includes
Sort and remove sys/systm.h, it's not needed.

Sponsored by:		Netflix
2021-05-25 09:56:56 -06:00
Edward Tomasz Napierala
3b9971c8da Clean up some of the core dumping code.
No functional changes.

Reviewed By:	kib
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D30397
2021-05-25 16:30:32 +01:00
Mitchell Horne
6f4bb8ecc2 arm64, riscv: remove reference to fsu_intr_fault
This variable no longer exists.

MFC after:	3 days
2021-05-25 12:26:52 -03:00
Kristof Provost
d39d5ee2d6 pf tests: Test cases for fragment reassembly
Obtained from:	Alexander Bluhm, OpenBSD
2021-05-25 15:26:27 +02:00
Ceri Davies
a23b08cf98 man5/{hosts,resolver}.5: note that IPv6 addresses are allowed.
The patch in the PR largely no longer applied due to age, but
thanks to Evgeniy Khramtsov for the patches in the PR.

PR:		120024
Reported by:	bcran
Approved by:	blackend (mentor)
Obtained from:	Evgeniy Khramtsov <evgeniy@khramtsov.org> (partly)
2021-05-25 16:23:20 +01:00
Ceri Davies
2770978d05 man4/inet6.4: use "effect" rather than "affect"
Approved by:	blackend (mentor)
2021-05-25 16:23:20 +01:00
Ceri Davies
17054abf5b usr.bin/chpass: Correct manpage regarding path to temp files
Approved by:	blackend (mentor)
2021-05-25 16:23:20 +01:00
Konstantin Belousov
fd3ac06f45 ptrace: add an option to not kill debuggees on debugger exit
Requested by:	markj
Reviewed by:	jhb (previous version)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differrential revision:	https://reviews.freebsd.org/D30351
2021-05-25 18:22:34 +03:00
Konstantin Belousov
d7a7ea5be6 sys_process.c: extract ptrace_unsuspend()
Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differrential revision:	https://reviews.freebsd.org/D30351
2021-05-25 18:22:27 +03:00
Konstantin Belousov
91aae953cb amd64: clear PSL.AC in the right frame
If copyin family of routines fault, kernel does clear PSL.AC on the
fault entry, but the AC flag of the faulted frame is kept intact.  Since
onfault handler is effectively jump, AC survives until syscall exit.

Reported by:	m00nbsd, via Sony
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
admbugs:	975
2021-05-25 18:20:46 +03:00
Warner Losh
1f348be6f2 cam: remove xpt_polled_action
Since periph_runccb now handles all the polling stuff, and
xpt_polled_action is now unused and can be removed.

Sponsored by:		Netflix
Reviewed by:		mav@
Differential Revision:	https://reviews.freebsd.org/D30394
2021-05-25 09:18:08 -06:00
Warner Losh
6c48134275 cam: Remove CAM_SIM_LOCK/UNLOCK macros, they are unused.
Sponsored by:		Netflix
Reviewed by:		mav@
Differential Revision:	https://reviews.freebsd.org/D30384
2021-05-25 09:18:08 -06:00
Warner Losh
28027f28e6 cam: remove sim callout
Nothing is using the sim callout to unfreeze the queue. Remove it to
simplify the SIM. This was introduced in the original CAM commit in 1998
but setting the CAM_SIM_REL_TIMEOUT_PENDING flag was removed in 1999 in
commit 87cfaf0e1f which reworked how bus reset worked. That work was
merged just after 3.2R was released. Remove the unused residuals.

Sponsored by:		Netflix
Reviewed by:		scottl@, mav@
Differential Revision:	https://reviews.freebsd.org/D30383
2021-05-25 09:18:08 -06:00
Colin Percival
27f09959d5 taskqueue: Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD
Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD arguments to prevent
compilation errors.

Submitted by:	ashafer_badland.io
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30449
2021-05-24 20:37:55 -07:00
Bjoern A. Zeeb
fbf75b113e arm64: log vm_fault error for data_abort
Summary:
Log the vm_fault() error in the data_abort panic so it is easier to
find the reason vm_fault() failed (e.g., invalid address).

Reviewed by:	andrew
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D30362
2021-05-24 21:58:11 +00:00
Lutz Donnerhacke
7b8696bf12 tests/libalias: Add missing copyright statements 2021-05-24 21:56:05 +02:00
Michael Tuexen
9bbd1a8fcb tcp: fix a RACK socket buffer lock issue
Fix a missing socket buffer unlocking of the socket receive buffer.

Reviewed by:		gallatin, rrs
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D30402
2021-05-24 20:31:23 +02:00
Randall Stewart
631449d5d0 tcp: Fix an issue with the PUSH bit as well as fill in the missing mtu change for fsb's
The push bit itself was also not actually being properly moved to
the right edge. The FIN bit was incorrectly on the left edge. We
fix these two issues as well as plumb in the mtu_change for
alternate stacks.

Reviewed by: mtuexen
Sponsored by: Netflix Inc
Differential Revision:	https://reviews.freebsd.org/D30413
2021-05-24 14:42:15 -04:00
Kristof Provost
4483fb4773 pf: fix ioctl() memory leak
When we create an nvlist and insert it into another nvlist we must
remember to destroy it. The nvlist_add_nvlist() function makes a copy,
just like nvlist_add_string() makes a copy of the string. If we don't
we're leaking memory on every (nvlist-based) ioctl() call.

While here remove two redundant 'break' statements.

PR:		255971
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-05-24 15:56:24 +02:00
J.R. Oldroyd
3fdd5c1e49 DRIVER_MODULE(9): Correct the SYNOPSIS of EARLY_DRIVER_MODULE()
The man page SYNOPSIS for EARLY_DRIVER_MODULE() shows that it has
an "enum sysinit_elem_order order" argument.

The actual macro in sys/bus.h does not have an order argument.

PR:	256103
Reported by:	J.R. Oldroyd <fbsd at opal dot com>
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30411
2021-05-24 16:54:45 +02:00
Alan Somers
fc3ba3e9fa Delete obsolete Solaris compat files
These files have been unused ever since the OpenSolaris import

Sponsored by:	Axcient
MFC after:	2 weeks
Reviewed By:	freqlabs
Differential Revision: https://reviews.freebsd.org/D30371
2021-05-24 08:48:47 -06:00
Emmanuel Vadot
996afd401c arm: RPI-B: Add ext_resources driver
mmc_fdt_helpers needs clock and regulators.
Add all the ext_resources driver to RPI-B conf file to fix the build

Reported by:	mjg
2021-05-24 12:53:00 +02:00
Andrew Turner
e779604f1d Clean up early arm64 pmap code
Early in the arm64 pmap code we need to translate between a virtual
address and a physical address. Rather than manually walking the page
table we can ask the hardware to do it for us.

Reviewed by:	kib, markj
Sponsored by:	Innovate UK
Differential Revision: https://reviews.freebsd.org/D30357
2021-05-24 09:22:19 +00:00
Navdeep Parhar
ac02945f7e cxgbetool(8): add a 'clip' subcommand to deal with the CLIP table.
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2021-05-23 16:28:31 -07:00
Navdeep Parhar
24b98f288d cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management.
- Process the list of local IPs once instead of once per adapter.  Add
  addresses from all VNETs to the driver's list but leave hardware
  updates for later when the global VNET/IFADDR list locks have been
  released.

- Add address to the hardware table synchronously when a CLIP entry is
  requested for an address that's not already in there.

- Provide ioctls that allow userspace tools to manage addresses in the
  CLIP table.

- Add a knob (hw.cxgbe.clip_db_auto) that controls whether local IPs are
  automatically added to the CLIP table or not.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2021-05-23 16:07:29 -07:00
Vladimir Kondratyev
47791339f0 ums(4): Start USB xfers on opening of evdev node unconditionally.
This fixes inability to start USB xfers in a case when FIFO has been
already open()-ed but no read() or poll() calls has been issued yet.

MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30343
2021-05-24 01:41:17 +03:00
Vladimir Kondratyev
05ab03a317 ums(4): Do not stop USB xfers on FIFO close when evdev is still active
This fixes lose of evdev events after moused has been killed.

While here use bitwise operations for UMS_EVDEV_OPENED flag.

Reviewed by:	hselasky
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30342
2021-05-24 01:38:53 +03:00