Commit Graph

271317 Commits

Author SHA1 Message Date
Alan Somers
1613087a81 fusefs: fix .. lookups when the parent has been reclaimed.
By default, FUSE file systems are assumed not to support lookups for "."
and "..".  They must opt-in to that.  To cope with this limitation, the
fusefs kernel module caches every fuse vnode's parent's inode number,
and uses that during VOP_LOOKUP for "..".  But if the parent's vnode has
been reclaimed that won't be possible.  Previously we paniced in this
situation.  Now, we'll return ESTALE instead.  Or, if the file system
has opted into ".." lookups, we'll just do that instead.

This commit also fixes VOP_LOOKUP to respect the cache timeout for ".."
lookups, if the FUSE file system specified a finite timeout.

PR:		259974
MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33239
2021-12-31 20:38:27 -07:00
Alan Somers
8d99a6b91b fusefs: move common code from forget.cc to utils.cc
MFC after:	2 weeks
2021-12-31 20:38:20 -07:00
Alan Somers
19ab361045 fusefs: in the tests, always assume debug.try_reclaim_vnode is available
In an earlier version of the revision that created that sysctl (D20519)
the sysctl was gated by INVARIANTS, so the test had to check for it.
But in the committed version it is always available.

MFC after:	2 weeks
2021-12-31 18:04:52 -07:00
Alan Somers
5169832c96 fusefs: copy_file_range must update file timestamps
If FUSE_COPY_FILE_RANGE returns successfully, update the atime of the
source and the mtime and ctime of the destination.

MFC after:	2 weeks
Reviewers:	pfg
Differential Revision: https://reviews.freebsd.org/D33159
2021-12-31 17:43:57 -07:00
Alan Somers
13d593a5b0 Fix a race in fusefs that can corrupt a file's size.
VOPs like VOP_SETATTR can change a file's size, with the vnode
exclusively locked.  But VOPs like VOP_LOOKUP look up the file size from
the server without the vnode locked.  So a race is possible.  For
example:

1) One thread calls VOP_SETATTR to truncate a file.  It locks the vnode
   and sends FUSE_SETATTR to the server.
2) A second thread calls VOP_LOOKUP and fetches the file's attributes from
   the server.  Then it blocks trying to acquire the vnode lock.
3) FUSE_SETATTR returns and the first thread releases the vnode lock.
4) The second thread acquires the vnode lock and caches the file's
   attributes, which are now out-of-date.

Fix this race by recording a timestamp in the vnode of the last time
that its filesize was modified.  Check that timestamp during VOP_LOOKUP
and VFS_VGET.  If it's newer than the time at which FUSE_LOOKUP was
issued to the server, ignore the attributes returned by FUSE_LOOKUP.

PR:		259071
Reported by:	Agata <chogata@moosefs.pro>
Reviewed by:	pfg
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D33158
2021-12-31 17:38:42 -07:00
Warner Losh
0c8968c6b0 mips: remove forgotten options file too
Sponsored by:		Netflix
2021-12-31 15:09:46 -07:00
Warner Losh
bf89848811 netfpga10: mips only, remove
Sponsored by:		Netflix
2021-12-31 15:09:46 -07:00
Warner Losh
c66fd95c8f mips: Remove dtrace build support
Sponsored by:		Netflix
2021-12-31 15:09:46 -07:00
Warner Losh
f9bf88760d mips: Remove system module support
Remove all mips .if conditionals. Since _sym was now set
unconditionally, just add it to the right place w/o a variable.

Sponsored by:		Netflix
2021-12-31 15:09:46 -07:00
Mark Johnston
6b95cf5bde callout: Wait for the softclock thread to switch before rescheduling
When a softclock thread prepares to go off-CPU, the following happens in
the context of the thread:

1. callout state is locked
2. thread state is set to IWAIT
3. thread lock is switched from the tdq lock to the callout lock
4. tdq lock is released
5. sched_switch() sets td_lock to &blocked_lock
6. sched_switch() releases old td_lock (callout lock)
7. sched_switch() removes td from its runqueue
8. cpu_switch() sets td_lock back to the callout lock

Suppose a timer interrupt fires while the softclock thread is switching
off, and callout_process() schedules the softclock thread.  Then there
is a window between steps 5 and 8 where callout_process() can call
sched_add() while td_lock is &blocked_lock, but this is not correct
since the thread is not logically locked.

callout_process() thus needs to spin waiting for the softclock thread to
finish switching off (i.e., after step 8 completes) before rescheduling
it, since callout_process() does not acquire the thread lock directly.

Reported by:	syzbot+fb44dbf6734ff492c337@syzkaller.appspotmail.com
Fixes:		74cf7cae4d ("softclock: Use dedicated ithreads for running callouts.")
Reviewed by:	mav, kib, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33709
2021-12-31 17:01:39 -05:00
Warner Losh
5a73a6c178 Add lio back to NOTES
lio appears to be partially removed from this file. It's a modern enough
card, so add it back. It builds everywhere.

Sponsored by:		Netflix
2021-12-31 14:56:16 -07:00
Ed Maste
daf481f3d5 rescue: include ping iff at least one of INET & INET6 is enabled
Ping does not build (and serves no purpose) if neither is enabled
(i.e., building WITHOUT_INET and WITHOUT_INET6).

This is equvalent to a4ef9e58bc but for rescue/.

PR:		260082
Fixes:		a4ef9e58bc ("sbin: build ping if at least one of...")
Sponsored by:	The FreeBSD Foundation
2021-12-31 13:16:30 -05:00
Dmitry Wagin
881059955a libc: Some enhancements to syslog(3)
This is a re-application of commit
2d82b47a5b, which was reverted since it
broke with syslog daemons that don't adjust the /dev/log recv buffer
size.  Now that the default is large enough to accomodate 8KB messages,
restore support for large messages.

PR:		260126
2021-12-31 12:57:01 -05:00
Mark Johnston
963f5dc7a3 ctfconvert: Handle arrays of empty structs
Members with such a type will legitimately have a size of zero, so don't
emit a warning.

PR:		260818
Reviewed by:	bz
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33700
2021-12-31 12:55:01 -05:00
Mark Johnston
f04a096049 exec: Simplify sv_copyout_strings implementations a bit
Simplify control flow around handling of the execpath length and signal
trampoline.  Cache the sysentvec pointer in a local variable.

No functional change intended.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33703
2021-12-31 12:50:15 -05:00
Alexander Motin
757089f01e CAM: List few missed opcodes.
MFC after:	1 weeks
2021-12-31 11:48:03 -05:00
Stefan Eßer
5650d340ad sys/cpuset.h: fix macro definition
The _s parameter was missing in the paramater list.

Reported by:	gljennjohn at gmail.com (Gary Jennejohn)
2021-12-31 14:09:44 +01:00
Bjoern A. Zeeb
58101517cb iwlwifi: import correct firmware versions for select Intel iwlwifi/mvm
The firmware files for 3160, 7260, and 7265 imported contain old versions
no longer supported by the driver.
Replace with latest versions from linux-firmware to possibly also
support these chip revisions.

Reported by:	FreeBSD User (freebsd walstatt-de.de) on wireless (2021-12-30)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-31 11:51:18 +00:00
Bjoern A. Zeeb
500be2e803 LinuxKPI: 802.11 fix queue wait
We are using a bandaid to wait for queues after station creation
looping and pausing.
The abort condition was looping in the wrong direction so we were
potentially waiting forever if queues never became ready.
From initial user test data we also found that the wait time was
too low in some cases so increase the length.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-31 11:47:14 +00:00
Stefan Eßer
cb65d4432a sys/cpuset.h: add 3 more macros provided by GLIBC
The lang/python* ports failed since they expected CPU_COUNT_S() to be
provided by sys/cpuset.h. Add this function plus 2 more in a way that
is compatible with GLIBC.

Reported by:	ler at lerctr.org (Larry Rosenman)
2021-12-31 11:08:34 +01:00
Doug Moore
b7810e05ff x86-busdma - Add missing paren
Reported by:	jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere
2021-12-31 02:33:54 -06:00
Doug Moore
b496126886 riscv-busdma: Balance parens.
Reported by:	jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere
2021-12-31 02:01:58 -06:00
Warner Losh
f7eed0c124 ar71xx: Remove atheros modules
These are mips only for the atheros MIPS-based SoCs.

Sponsored by:		Netflix
2021-12-31 00:56:43 -07:00
Doug Moore
cfb2aa3f53 iommu_gas: Rename a function missed earlier
Reported by:	jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere
2021-12-31 01:50:30 -06:00
Warner Losh
abae2c01c5 hwpmc: deorbit mips support
Sponsored by:		Netflix
2021-12-31 00:46:56 -07:00
Warner Losh
373d5df3e3 remove octeon sdk
Octeon is a mips-only target.

Sponsored by:		Netflix
2021-12-31 00:28:12 -07:00
Warner Losh
cb264bc716 mips: Remove thread_db support
Sponsored by:		Netflix
2021-12-31 00:14:53 -07:00
Warner Losh
39034b1254 mips: remove pthread support
Sponsored by:		Netflix
2021-12-31 00:14:53 -07:00
Warner Losh
8ff32ab58e mips: remove libc
Remove mips specific libc code and build infrasturcture.

Sponsored by:		Netflix
2021-12-31 00:14:53 -07:00
Warner Losh
b94b8bf702 mips: Remove msun support
Decommision msun (libm) support for mips.

Sponsored by:		Netflix
2021-12-31 00:14:52 -07:00
Warner Losh
e8399cfbbd mips: Remove CSU
Remove the CSU support for mips.

Sponsored by:		Netflix
2021-12-31 00:14:52 -07:00
Doug Moore
f76916c095 vm_reserv: #include vm_extern.h explicitly, for arm.
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere
2021-12-31 00:40:25 -06:00
Doug Moore
e6930b1c5f vm_phys: convert error back to warning
Move an assignment back to where it was before, to turn the
defined-but-not-used error back into a set-but-not-used warning.

Fixes:	01e115ab83 vm_phys: #include vm_extern
2021-12-31 00:23:46 -06:00
Doug Moore
01e115ab83 vm_phys: #include vm_extern
Arm64 and powerpc don't include vm_extern.h indirectly in vm_phys.c, which
means that for the sake of those architectures, it must be included explicitly.

Also, fix a set-unused warning that jenkins also found.

Reported by:	Jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere
2021-12-30 23:31:18 -06:00
Doug Moore
029abd3b29 Remove discarded mips source. 2021-12-30 22:12:46 -06:00
Doug Moore
c606ab59e7 vm_extern: use standard address checkers everywhere
Define simple functions for alignment and boundary checks and use them
everywhere instead of having slightly different implementations
scattered about. Define them in vm_extern.h and use them where
possible where vm_extern.h is included.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D33685
2021-12-30 22:09:08 -06:00
Warner Losh
c09981f142 mips: Remove sys/mips
Remove sys/mips as the next step of decomissioning mips from the tree.
Remove mips special cases from the kernel make files. Remove the mips
specific linker scripts.

Sponsored by:		Netflix
2021-12-30 20:57:24 -07:00
Warner Losh
fe532f1a50 libkvm: Remove mips support
libkvm references files in sys/mips, so remove it ahead of removing
sys/mips.

Sponsored by:		Netflix
2021-12-30 20:57:24 -07:00
Ed Maste
818952c638 Fix kernel build without INET6
Reported by:	Gary Jennejohn
Fixes:		ff3a85d324 ("[lltable] Add per-family lltable ...")
Sponsored by:	The FreeBSD Foundation
2021-12-30 18:40:46 -05:00
Warner Losh
5974cfe1ba kboot: move to generic syscall interface
Just have the MD code provide syscall and have generic code for the
rest.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D33515
2021-12-30 16:07:20 -07:00
Warner Losh
6497250f6f kboot: Split out powerpc build
Split the powerpc specific parts into kboot/arch/powerpc64. More may be
needed here.

Sponsored by:		Netflix
Reviewed by:		jhibbits
Differential Revision:	https://reviews.freebsd.org/D33514
2021-12-30 16:07:13 -07:00
Warner Losh
4366199644 kboot: Move powerpc kboot to top level
As the first step at making this more generic, move kboot to top level.

Sponsored by:		Netflix
Reviewed by:		luporl, tsoome
Differential Revision:	https://reviews.freebsd.org/D33513
2021-12-30 16:07:06 -07:00
Warner Losh
20a0965182 kboot: Add docs for WITH/WITHOUT LOADER_KBOOT
Sponsored by:		Netflix
Suggestion by:		emaste
Differential Revision:	https://reviews.freebsd.org/D33512
2021-12-30 16:06:53 -07:00
Warner Losh
1a7ed7fe93 kboot: Add MK_LOADER_KBOOT
Control building of KBOOT same as we do for uboot.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D33511
2021-12-30 16:06:28 -07:00
Warner Losh
0c7a642ae8 tinybsd: Remove
This hasn't been updated in 10 years in any real way. It's time to
retire it. It hasn't worked in some time due to drivers being removed
starting in FreeBSD 10.  All the interesting bits have already been
hoisted into other parts of base. The google code site hasn't had any
commits since 2011 and claims to Target FreeBSD 5, 6, 7, and 8.

Should someone fix the numerous issues, it can be restored.

Sponsored by:		Netflix
Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D33450
2021-12-30 15:57:22 -07:00
John Baldwin
74cf7cae4d softclock: Use dedicated ithreads for running callouts.
Rather than using the swi infrastructure, rewrite softclock() as a
thread loop (softclock_thread()) and use it as the main routine of the
softclock threads.  The threads use the CC_LOCK as the thread lock
when idle.

Reviewed by:	mav, imp, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D33683
2021-12-30 14:55:08 -08:00
John Baldwin
dda9847275 depend-cleanup.sh: Handle stale libc++.so ldscripts.
libc++ was moved from /usr/lib to /lib, but the libc++.so linker
script is not regenerated when the value of SHLIB changes.

Reported by:	cy
2021-12-30 14:25:47 -08:00
Garance A Drosehn
b7b447fd4c When parsing a rule to rotate log files on a specific week day,
parseDWM() can advance the time to the next week. If the next week is
in the next month, then tm_mon is incremented. However, the increment
was failing to handle the wraparound from December to January, so when
parsing a rule during the last week of the December, the month would
advance to month 12. This triggered an out-of-bounds read of the
mtab[] array in days_pmonth() after parseDWM() returned.  To fix,
this change resets the month to January and increment the year when
the month increment wraps.

The default rule for /var/log/weekly.log triggers this during the
last week of December each year.
Reported by:	CHERI
Obtained from:	CheriBSD
Reviewed by:	jhb
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	<https://reviews.freebsd.org/D33687>
2021-12-30 20:45:13 +00:00
Dimitry Andric
5e6a2d6eb2 Reapply: move libc++ from /usr/lib to /lib
As with other runtime components like libc or libcxxrt.

If desired we can stop linking devd statically after this change (to
achive approximately no net change in required root filesystem size).

We must set SHLIBDIR with ?= before including <src.opts.mk>, otherwise
that will have set SHBLIDIR to its default value of /usr/lib.

Otherwise, "make delete-old-libs" would suggest to delete libc++.so.1
from /usr/lib, while there was not yet a copy in /lib.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33123
2021-12-30 17:08:54 +01:00
Emmanuel Vadot
dfc9c1d493 loader: tftp: Copy the first block into the cache
tftp_open reads the first block so copy it in the cached data.
If we have more than one block (i.e. we called tftp_read before
tftp_preload) simply just reset the transfer.

Reported by:	mmel
Reviewed by:	mmel, tsoome
MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33697
2021-12-30 16:30:13 +01:00