Commit Graph

272500 Commits

Author SHA1 Message Date
Simon J. Gerraty
01b0c35984 module_verbose should also affect non-ELF modules. 2022-02-14 10:44:46 -08:00
Wolfram Schneider
a9a43945d3 grammar
Reported by:	jrtc27
2022-02-14 18:16:43 +00:00
Gleb Smirnoff
65572cade3 unix/dgram: return EAGAIN instead of ENOBUFS when O_NONBLOCK set
This is behavior what some programs expect and what Linux does.  For
example nginx expects EAGAIN when sending messages to /var/run/log,
which it connects to with O_NONBLOCK.  Particularly with nginx the
problem is magnified by the fact that a ENOBUFS on send(2) is also
logged, so situation creates a log-bomb - a failed log message
triggers another log message.

Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D34187
2022-02-14 09:21:55 -08:00
Franco Fichtner
abf5bff71d dhclient: support VID 0 (no vlan) decapsulation
VLAN ID 0 is supposed to be interpreted as having no VLAN with a bit of
priority on the side, but the kernel is not able to decapsulate this on
the fly so dhclient needs to take care of it.

Reviewed by:	markj
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D31515
2022-02-14 10:06:47 -05:00
Mark Johnston
99589993ce git-arc: Fix review title matching
Properly handle the case where the title of one commit is a suffix or
prefix of the title of a second commit, and one wishes to create reviews
for both.

Reported by:	chuck
2022-02-14 10:06:47 -05:00
Mark Johnston
c7cd607a4e msdosfs: Fix mounting when the device sector size is >512B
HugeSectors * BytesPerSec should be computed before converting
HugeSectors to a DEV_BSIZE-based count.

Fixes:	ba2c98389b ("msdosfs: sanity check sector count from BPB")
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34264
2022-02-14 10:06:47 -05:00
Mark Johnston
852ff943b9 sleepqueue: Annotate sleepq_max_depth as static
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-02-14 10:06:47 -05:00
Mark Johnston
893be9d8ac sleepqueue: Address a lock order reversal
After commit 74cf7cae4d ("softclock: Use dedicated ithreads for
running callouts."), there is a lock order reversal between the per-CPU
callout lock and the scheduler lock.  softclock_thread() locks callout
lock then the scheduler lock, when preparing to switch off-CPU, and
sleepq_remove_thread() stops the timed sleep callout while potentially
holding a scheduler lock.  In the latter case, it's the thread itself
that's locked, and if the thread is sleeping then its lock will be a
sleepqueue lock, but if it's still in the process of going to sleep
it'll be a scheduler lock.

We could perhaps change softclock_thread() to try to acquire locks in
the opposite order, but that'd require dropping and re-acquiring the
callout lock, which seems expensive for an operation that will happen
quite frequently.  We can instead perhaps avoid stopping the
td_slpcallout callout if the thread is still going to sleep, which is
what this patch does.  This will result in a spurious call to
sleepq_timeout(), but some counters suggest that this is very rare.

PR:		261198
Fixes:		74cf7cae4d ("softclock: Use dedicated ithreads for running callouts.")
Reported and tested by:	thj
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34204
2022-02-14 10:06:47 -05:00
Stefan Eßer
eaf3c3af9c cpuset.9: add description of CPU_ISSET()
PR:		261947
Reported by:	thmu7 at freenet.de (Thomas Mueller)
MFC after:	3 days
2022-02-14 15:59:37 +01:00
Bjoern A. Zeeb
a4529c46d4 LinuxKPI; add the beginning of a tracepoint.h implementation
Add a beginning of a tracepoint.h implementation to ease porting drivers
making use of this Linux facility.

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D34236
2022-02-14 00:24:43 +00:00
Bjoern A. Zeeb
85d61bd872 LinuxKPI: add NETIF_F_HW_CSUM to netdev_features.h
Add NETIF_F_HW_CSUM to netdev_features.h as needed by a driver.

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D34233
2022-02-14 00:22:24 +00:00
Bjoern A. Zeeb
c840d5cec2 LinuxKPI: add kstrtoint_from_user() and DECLARE_FLEX_ARRAY()
Add an implementation of kstrtoint_from_user() based on the other
implementations and an attempt at DECLARE_FLEX_ARRAY() which works
for the driver needing it.

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D34231
2022-02-14 00:20:41 +00:00
Bjoern A. Zeeb
0c37ffda79 LinuxKPI: add an initial ethtool.h
Add an initial ethtool.h for a define and a dummy struct for now
needed by drivers.

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D34229
2022-02-14 00:19:08 +00:00
Bjoern A. Zeeb
3cd6d6ff52 LinuxKPI: add eth_random_addr() and device_get_mac_address()
Add eth_random_addr() and a dummy of device_get_mac_address()
pending OF (FDT) support needed by drivers.

While here remove a white space in random_ether_addr().

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D34228
2022-02-14 00:17:14 +00:00
Bjoern A. Zeeb
8f33ad3cf5 LinuxKPI: add more errno
Add ENOMEDIUM, ENOSR, and ELNRNG to linux/errno.h needed by drivers.

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D34227
2022-02-14 00:15:41 +00:00
Bjoern A. Zeeb
e5b95b2201 LinuxKPI: add sizeof_field()
Add sizeof_field() to linux/compiler.h needed by a driver.

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D34226
2022-02-14 00:13:56 +00:00
Bjoern A. Zeeb
d17b78aa14 LinuxKPI: add __ffs64()
Add __ffs64() to linux/bitops.h needed by a driver.

Reviewed by:	hselasky
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D34225
2022-02-14 00:12:09 +00:00
Bjoern A. Zeeb
2e818fbcfc LinuxKPI: add get_unaligned_le16()
Add get_unaligned_le16() to asm/unaligned.h needed by a driver.

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D34224
2022-02-14 00:09:57 +00:00
Bjoern A. Zeeb
232d323ef2 TCP syncache: enhance KASSERT output
Improve the "syncache: mbuf too small" assertion message with various
variables (some not actually needed) but enough that it will be obvious
if (a) we use IPv4 or IPv6, (b) if UDP tunneling is on, (c) what
max_linkhdr is, and (d) what MHLEN is.

This should help diagnostics in the future.
The case was hit with wireless drivers setting a large ic_headroom
and using IPv6.

Reviewed by:	gallatin, tuexen, rscheff
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D34217
2022-02-14 00:03:20 +00:00
Simon J. Gerraty
ec042f46e9 Add support for module_verbose
Set module_verbose to control the printing of information
about loaded modules and kernel:

0	MODULE_VERBOSE_SILENT	None
1	MODULE_VERBOSE_SIZE	Pathname and size
2	MODULE_VERBOSE_TWIDDLE	as for 1 but also twiddle for progress
3	MODULE_VERBOSE_FULL	extra detail

When the loader is verifying modules we already have a
running indication of progress and module_verbose=0 makes sense.

Reviewed by:	rpokala
Differential Revision:	https://reviews.freebsd.org/D34245
2022-02-13 12:45:57 -08:00
Wolfram Schneider
93885bb041 Better help message if locate database does not exists
PR:		211501
Reported by:	Oliver Peter
Reviewed by:	Pau Amma
Differential Revision:	https://reviews.freebsd.org/D34243
2022-02-13 17:00:22 +00:00
Dimitry Andric
09d0a0fbe8 bwi: Fix clang 14 warning about possible unaligned access
On architectures with strict alignment requirements (e.g. arm), clang 14
warns about a packed struct which encloses a non-packed union:

In file included from sys/dev/bwi/bwimac.c:79:
sys/dev/bwi/if_bwivar.h:308:7: error: field iv_val within 'struct bwi_fw_iv' is less aligned than 'union (unnamed union at sys/dev/bwi/if_bwivar.h:305:2)' and is usually due to 'struct bwi_fw_iv' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
	}			iv_val;
				^

It appears to help if you also add __packed to the inner union (i.e.
iv_val). No change to the layout is intended.

MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D34196
2022-02-13 14:35:58 +01:00
Mateusz Guzik
6aa246e605 vfs: convert vnsz2log to a macro 2022-02-13 13:07:08 +00:00
Mateusz Guzik
5c31025060 fd: use FILEDESC_FOREACH_{FDE,FP} where appropriate 2022-02-13 13:07:08 +00:00
Mateusz Guzik
60b699f99c fd: add FILEDESC_FOREACH_{FDE,FP}
Right now they naively walk the fd table just like all the other code,
but that's going to change.
2022-02-13 13:07:08 +00:00
Mateusz Guzik
809f3121be fd: assign fd_freefile early when copying
This is to simplify an upcomming change.
2022-02-13 13:07:08 +00:00
Mateusz Guzik
893d20c95a fd: move fd table sizing out of fdinit
now it is placed with the rest of actual initialisation
2022-02-13 13:07:08 +00:00
Mateusz Guzik
4103c3cd5b fd: drop volatile keyword from refcounts
While here move a comment where it belongs and do small whitespace clean up.
2022-02-13 13:07:08 +00:00
Mateusz Guzik
b53133a778 proc: load/store p_cowgen using atomic primitives 2022-02-13 13:07:08 +00:00
Mateusz Guzik
29ee49f66b thread: remove dead store from thread_cow_update 2022-02-13 13:07:08 +00:00
Peter Holm
91f821f8e4 stress2: Add a fsck_ffs regression test scenario 2022-02-13 10:49:58 +01:00
Kirk McKusick
6fbbb48063 stress2: Added a tool to zero out a superblock check hash. 2022-02-13 10:47:20 +01:00
Richard Scheffenegger
70e9f880d8 iscsi: address unused-but-set-variable warning
remove "interrupted" in icl_soft_proxy_connect()

Reviewed By: hselasky
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34223
2022-02-12 06:15:02 +01:00
Kyle Evans
e01e8f911b freebsd-update: improve BE creation feature
This addresses one nit and one bug in the BE creation feature of
freebsd-update:

The nit addressed is that it currently only names the BEs after the
userland version, but the kernel version may be higher.  After this
change, we request both and pass them through sort(1) to choose the
highest.  This is especially helpful if a freebsd-update patch touched
one but not the other.

The bug fixed is that roots updated that are not located at '/', e.g.,
by using -b or -j, will no longer create boot environments
automatically.  There's a very low chance these will actually change the
BE in any meaningful way, anyways.  It could make sense in the future
to allow an argument-override to create the BE anyways if someone comes
up with a non-standard setup, e.g., where a jail is an important part of
their boot environment on an appliance or some such setup.

Half of this patch is submitted by delphij@, the other half kevans@.

PR:		261446
MFC after:	3 days
Reviewed by:	delphij, emaste, Dave Fullard <dave_fullard.ca>
Differential Revision:	https://reviews.freebsd.org/D34257
2022-02-12 15:36:24 -06:00
Navdeep Parhar
08c7dc7fd4 cxgbe(4): Fix illegal hardware access in cxgbe_refresh_stats.
cxgbe_refresh_stats takes into account VI_SKIP_STATS but not
VI_INIT_DONE when deciding whether to read the hardware stats.  But
before this change VI_SKIP_STATS was set only for VIs with VI_INIT_DONE.
That meant that cxgbe_refresh_stats always accessed the hardware for
uninitialized VIs, and this is a problem if the adapter is suspended or
in the middle of a reset.

Fix this by setting VI_SKIP_STATS on all VIs during suspend.  While
here, ignore VI_INIT_DONE in vi_refresh_stats too to be consistent with
cxgbe_refresh_stats.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-02-12 09:53:50 -08:00
Alan Somers
0b6a34acda [skip ci] fusefs: delete a stray comment from 91972cfcdd
MFC after:	3 days
2022-02-12 09:27:56 -07:00
Ed Maste
acfb506b3d newvers.sh: allow multiple -V args in one invocation
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34253
2022-02-12 11:06:54 -05:00
Wolfram Schneider
98839c40c7 better unique file names
Our mktemp(1) implementation uses 8-X for a temp file by default.
That's ok, but we should increase the value from 8 to 10 as
many other OS already did.

PR:		261438
2022-02-12 11:35:51 +00:00
Navdeep Parhar
39a36707bd cxgbe(4): Avoid unsafe hardware access in the ifmedia ioctls.
The hardware is unavailable when the device is suspended or in the
middle of a reset.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-02-11 16:35:27 -08:00
John Baldwin
dba02df30d Cast pointer to uintptr_t to avoid alignment warnings.
Both struct ip and struct udphdr both have an aligment of 2, but the
cast from struct ip to a uint32_t pointer confused GCC 9 into raising
the required alignment to 4 and then raising a
-Waddress-of-packed-member error when casting to struct udphdr.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D31941
2022-02-11 16:04:52 -08:00
John Baldwin
cd0525f615 ktls: Write-lock the INP when changing a transmit TLS session.
The TCP rate pacing code relies on being able to read this pointer
safely while holding an INP lock.  The initial TLS session pointer is
set while holding the write lock already.

Reviewed by:	gallatin, hselasky
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D34086
2022-02-11 15:16:25 -08:00
Konstantin Belousov
fd8d4e53bc vdso linker scripts: explicitly specify output arch and target
Requested by:	jhb
Reviewed by:	emaste, imp, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34157
2022-02-12 00:32:23 +02:00
John Baldwin
b0c1600a8c linuxkpi xarray: Correct expression in assertion.
Reported by:	GCC -Wparantheses
Reviewed by:	wulf, hselasky
Differential Revision:	https://reviews.freebsd.org/D34197
2022-02-11 13:59:27 -08:00
John Baldwin
13916064fc rescue: Link with -lncursesw instead of -lncursesw_real.
ld.bfd fails to link rescue with undefined symbol errors otherwise.

This reverts commit b158d4d7a1.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D34123
2022-02-11 13:58:59 -08:00
Warner Losh
3e65b7d94d cleankernel: A target to delete the kernel compile file
With the meta-build, it's always a NO_CLEAN build. Provide a way to
remove so one can rebuild from scratch. 'cleankernel' will delete the
kernel and modules object directories. Document this in build(7).

Sponsored by:		Netflix
Reviewed by:		debdrup, markj
Differential Revision:	https://reviews.freebsd.org/D32978
2022-02-11 12:51:24 -07:00
Johan Jansson
d4b0fa45dc ucred.9: fix typo
PR:	261889
MFC after:	3 days
2022-02-11 20:10:19 +02:00
Konstantin Belousov
b1b5174123 rtld: Add ${TOKEN} aliases to $TOKEN
it seems that glibc supports them, and such spelling is mentioned in the
ld.bfd manual. Idea seems to auto-correct some quoting/makefile sytnax
errors on linker command line.

Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34247
2022-02-11 20:01:20 +02:00
Konstantin Belousov
55abf23dd3 rtld: make token substitution table-driven
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34247
2022-02-11 20:00:47 +02:00
Ed Maste
ea9a92d210 Makefile.inc1: synthesize PKG_ABI from newvers.sh variables
Previously we inspected ${WSTAGEDIR}/usr/bin/uname to determine PKG_ABI,
but the file will not exist in some cases - for example, if building
only kernel packages.  We can instead synthesize the PKG_ABI from
information already provided by newvers.sh.

Reviewed by:	kevans, manu (both earlier rev)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34249
2022-02-11 11:26:07 -05:00
Mateusz Guzik
1d65a9b47e cache: improve vnode vs name assertion in cache_enter_time 2022-02-11 12:29:26 +00:00