FreeBSD/src 3fd38a6share/man/man5 style.Makefile.5

style.Makefile.5: Remove title macros, tag SPDX

Title macros are discouraged in mdoc(7) because they are not portable.
While here, remove a redundant "file". File is still in the title twice.

MFC after:      3 days

(cherry picked from commit 8f480d0075263ff354212ce0558ee811ce62ff09)
DeltaFile
+5-5share/man/man5/style.Makefile.5
+5-51 files

FreeBSD/src 6a2f1e3sbin/nvmecontrol nvmecontrol.8

nvmecontrol.8: Explain non-operational power modes

`nvmecontrol power -l ...` lists the available power modes.
Non-operational modes are marked with an asterisk. While here,
add <device-id | namespace-id> to the "nvmecontrol power" synopsis.

MFC after:              3 days
Reviewed by:            dab, imp, michaelo, ziaee
Differential Revision:  https://reviews.freebsd.org/D58480

(cherry picked from commit 868158f7fd2a172ef22f1b6b682cc1d38e54cf63)
DeltaFile
+5-1sbin/nvmecontrol/nvmecontrol.8
+5-11 files

FreeBSD/src 70c87c0cddl/usr.bin/ctfmerge ctfmerge.1

ctfmerge.1: Fix uniqlabel typos

The flag is -D, but it was written as a second -d. Add a period too.

MFC after:      3 days

(cherry picked from commit 4f293e32e4529617dd05bd64fd3c22a57a56a355)
DeltaFile
+2-2cddl/usr.bin/ctfmerge/ctfmerge.1
+2-21 files

FreeBSD/src 2cdb856share/man/man5 pf.conf.5

pf.conf.5: Fix typo

Fix small typo in pf.conf(5)

MFC after:              3 days
Reviewed by:            ziaee
Differential Revision:  https://reviews.freebsd.org/D57938

(cherry picked from commit bbc2d15857b8c44cf8558bf00663b508d421c94c)
DeltaFile
+1-1share/man/man5/pf.conf.5
+1-11 files

FreeBSD/src 5650618cddl/usr.bin/ctfmerge ctfmerge.1

ctfmerge.1: Import ENVIRONMENT from NetBSD

Import the ENVIRONMENT section from NetBSD, minus the variable that our
ctfmerge does not have. Alphabetize them, polish grammar and alignment,
and add the variables to the man database. While here, remove whitespace
from the end of some lines to quiet linter.

MFC after:      3 days
PR:             291186
Co-authored-by: Alexander Ziaee <ziaee at FreeBSD.org>
Obtained from:  NetBSD (christos <christos at NetBSD.org>, 8a0c0d8)
Differential Revision:  https://reviews.freebsd.org/D54054

(cherry picked from commit 32cf24b725fdf899fb642c47004b69fcfae9b9db)
DeltaFile
+49-27cddl/usr.bin/ctfmerge/ctfmerge.1
+49-271 files

FreeBSD/src 279fdaashare/man/man4 rtw89.4 rtw88.4

iwlwifi.4, rtw88.4, rtw89.4: Fix xref typos

MFC after:      3 days
Reviewed by:    bz, ziaee
Fixes:  0a2f7683bf0c ("man: iwlwifi/rtw88/rtw89: update man pages for Linux v7.0 based updates")
Differential Revision:  https://reviews.freebsd.org/D57720

(cherry picked from commit d036b3b348d3f7be21f79461d7ad48e97b088ba8)
DeltaFile
+2-2share/man/man4/rtw89.4
+2-2share/man/man4/rtw88.4
+2-2share/man/man4/iwlwifi.4
+6-63 files

FreeBSD/src c553a42share/man/man4 padlock.4

padlock.4: Update slightly for 64-bit hardware

- Change the document description to "Via and Zhaoxin CPU crypto driver"
- Add a HARDWARE section mentioning these in the hardware release note

This manual still needs desperate help, but just this little bit could
have saved a lot of confusion. I'd write more if I had information.

PR:             295517
Fixes:          14b8531c4ccb8 (Restore padlock_rng the the amd64 build)
MFC after:      3 days (to 15 only)
Reviewed by:    bcr, asomers
Differential Revision:  https://reviews.freebsd.org/D57920

(cherry picked from commit 380c6f59c4f87dbc45a67983d927700ca7e22be2)
DeltaFile
+13-2share/man/man4/padlock.4
+13-21 files

FreeBSD/src 200de1busr.sbin/rtadvd rtadvd.c

rtadvd(8): Fix RA flag inconsistency messages

During flag inconsistency report, we handle rai->rai_otherflg
as a bool, but the value is 0x40. Make it a simple number comparison.

PR:             295995
Reviewed by:    markj, Faraz Vahedi <kfv at kfv.io>
MFC after:      3 days
Differential Revision: https://reviews.freebsd.org/D58672
DeltaFile
+4-4usr.sbin/rtadvd/rtadvd.c
+4-41 files

FreeBSD/src 9f2c32csys/kern vfs_inotify.c, sys/sys inotify.h

inotify: Fix a couple of locking bugs

When hooking vop_rename_post(), the preexisting dst vnode will be
unlocked.  But, we need to invoke VOP_GETATTR on it in vn_inotify() to
check its link count.

In inotify_unlink_watch_locked(), the vnode interlock is not held, so
don't use vn_irflag_unset_locked().

Reviewed by:    kib
Fixes:          f1f230439fa4 ("vfs: Initial revision of inotify")
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D51401

(cherry picked from commit af0ec3fa29cad823d0196538381f1e832f5974a7)
DeltaFile
+11-3sys/sys/inotify.h
+3-2sys/kern/vfs_inotify.c
+14-52 files

FreeBSD/src 66a50afsys/kern vfs_inotify.c, sys/sys inotify.h

inotify: Fix comment typos

MFC after:      1 week

(cherry picked from commit 3e123be2305a30369f63bcee22ca5e0db527f320)
DeltaFile
+1-1sys/sys/inotify.h
+1-1sys/kern/vfs_inotify.c
+2-22 files

FreeBSD/src a1634ecsys/fs/nullfs null_vnops.c, sys/kern vfs_inotify.c

nullfs: Clear inotify flags during reclaim

The inotify flags are copied from the lower vnode into the nullfs vnode
so that the INOTIFY() macro will invoke VOP_INOTIFY on the nullfs vnode;
this is then bypassed to the lower vnode.  However, when a nullfs vnode
is reclaimed we should clear these flags, as the vnode is now doomed and
no longer forwards VOPs to the lower vnode.

Add regression tests.  Remove a test in vn_inotify_revoke() which is no
longer needed after this change.

PR:             292495
Reviewed by:    kib
Reported by:    Jed Laundry <jlaundry at jlaundry.com>
Fixes:          f1f230439fa4 ("vfs: Initial revision of inotify")
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56639

(cherry picked from commit a02d794f5acd12ba3cf1de5c204a8dd56af47edd)
DeltaFile
+112-0tests/sys/kern/inotify_test.c
+12-0sys/fs/nullfs/null_vnops.c
+0-4sys/kern/vfs_inotify.c
+124-43 files

FreeBSD/src 3136ff5tests/sys/kern inotify_test.c

tests/inotify: Make an error message more useful

MFC after:      3 days

(cherry picked from commit 836a76ad95be2fcf2cd116d754c5888a731d57aa)
DeltaFile
+2-1tests/sys/kern/inotify_test.c
+2-11 files

FreeBSD/src 95d7a7dsys/kern vfs_inotify.c, tests/sys/kern inotify_test.c

inotify: Unconditionally generate IN_IGNORED events for files/dirs

The implementation previously only generated an IN_IGNORED event for a
deleted watched file if the watch explicitly requested IN_DELETE_SELF.
This is not correct, IN_IGNORED should always be raised when the watched
subject is deleted.  Adjust the implementation of inotify_log_one()
accordingly.

This also fixes a problem where a deleted watched file's watch
would not be removed if IN_DELETE_SELF was not in the watch's event
mask, in which case the unlinked vnode would linger until the inotify
descriptor itself is closed.

Add a regression test.

Reported by:    jrtc27
Reviewed by:    jrtc27
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D58050

    [2 lines not shown]
DeltaFile
+23-12sys/kern/vfs_inotify.c
+24-0tests/sys/kern/inotify_test.c
+47-122 files

FreeBSD/src 00c2ff0sys/fs/nullfs null_vnops.c

nullfs: close a race when syncing inotify flags from the lower vnode

After a bypassed VOP, nullfs mirrors the lower vnode's inotify state
onto the upper vnode.  The flags were checked with lockless reads
before being updated with the asserting flag set/unset primitives, so
two threads syncing the same vnode concurrently (or a sync racing a
watch being established) could both decide to make the same change;
the loser then trips the "flags already set" assertion on an
INVARIANTS kernel.  On other kernels the race is harmless.

Keep the lockless check as the fast path, but re-make the decision
under the vnode interlock before actually changing the flags.

Reproduced in a 4-CPU VM with one thread cycling an inotify watch on
a lower-filesystem file while several threads stat(2) the same file
through a nullfs mount: the unpatched INVARIANTS kernel panics under
this load, the patched kernel runs it to completion.

Fixes:                  f1f230439fa4 ("vfs: Initial revision of inotify")

    [6 lines not shown]
DeltaFile
+14-5sys/fs/nullfs/null_vnops.c
+14-51 files

FreeBSD/src 6d9339csys/kern vfs_inotify.c

inotify: Work around the vput() bug directly

For 15.0, apply a minimal fix which at least ensures that inotify can't
trigger the latent race described in commit 99cb3dca4773 ("vnode: Rework
vput() to avoid holding the vnode lock after decrementing").

Reviewed by:    olce, kib
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53774

(cherry picked from commit ebc17879f0885ca87644980f6275b9759b311eb3)
DeltaFile
+8-1sys/kern/vfs_inotify.c
+8-11 files

FreeBSD/src e8c5422sys/kern vfs_inotify.c

inotify: do not call into namei() with a locked vnode

PR:     288127
Reviewed by:    markj
Fixes:  f1f230439fa48581f40a57f095627f667a9713c3
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D51233

(cherry picked from commit 63389aea24f15fe823c775960d77017f1a35f54b)
DeltaFile
+2-0sys/kern/vfs_inotify.c
+2-01 files

FreeBSD/src 3e8d10fsys/kern vfs_inotify.c

inotify: Use memcmp() to compare embedded file names

Otherwise gcc warns that strcmp() will read a byte from a zero-length
array, though in practice we exclude that case with an explicit length
check.

Fixes:  f1f230439fa4 ("vfs: Initial revision of inotify")
(cherry picked from commit bc6b526e2b71cf7e07806db5bc77926ed5c874f7)
DeltaFile
+1-1sys/kern/vfs_inotify.c
+1-11 files

FreeBSD/src 84235bcsys/kern vfs_inotify.c, tests/sys/kern inotify_test.c

inotify: Avoid resetting the cookie

The IN_MOVED_FROM and _TO events only apply to names in a watched
directory, never to a watched directory itself.  So, the cookie value
there is always zero, and in particular we should not reset the
caller-provided cookie value, as it may be used later.

Add a regression test.

Reported by:    arrowd
MFC after:      1 week

(cherry picked from commit da8ab13249420e85935b89794f333f0755e56385)
DeltaFile
+31-0tests/sys/kern/inotify_test.c
+2-5sys/kern/vfs_inotify.c
+33-52 files

FreeBSD/src 59bbde3sys/kern vfs_inotify.c

inotify: Fix a namei path buffer leak

Reviewed by:    kib
Fixes:          f1f230439fa4 ("vfs: Initial revision of inotify")
Differential Revision:  https://reviews.freebsd.org/D51900

(cherry picked from commit e5a2e77352440f23ef8988a934753fd2fba8b821)
DeltaFile
+1-0sys/kern/vfs_inotify.c
+1-01 files

FreeBSD/src 0b184c1lib/libc/sys inotify.2

inotify.2: Fix formatting and lint

MFC after:      1 week

(cherry picked from commit 92dfe30ba254b50a74e14f33ad1d2a0c03393960)
DeltaFile
+8-8lib/libc/sys/inotify.2
+8-81 files

FreeBSD/src d0aec16sys/kern vfs_inotify.c

inotify: Ensure that "allocfail" is initialized in inotify_log_one()

Fixes:  b70997c8c75a ("inotify: Unconditionally generate IN_IGNORED events for files/dirs")
(cherry picked from commit f370bf9fafce82851bedb2b88bc21ec6ca0182df)
DeltaFile
+1-2sys/kern/vfs_inotify.c
+1-21 files

FreeBSD/src 9b094basys/kern vfs_inotify.c

inotify: Avoid calling vrele() with a namecache mutex held

In cache_vop_inotify(), we call inotify_log() with a namecache hash lock
held.  inotify_log() looks at all watches registered with the vnode to
see if any of them are interested in the event.  In some cases, we have
to detach and free the watch after logging the event.  This means we
must vrele() the watched vnode, and this must not be done while a
non-sleepable lock held.

Previously, I deferred the vrele() to until the inotify softc and vnode
pollinfo locks were dropped.  However, this is not enough since we may
still be holding the aforementioned namecache lock.  Go further and use
a taskqueue thread to release vnode references.  Introduce a set of
detached watches, and queue a threaded task which releases the vnode
reference.

Reported by:    syzbot+c128f121cb22df95559b at syzkaller.appspotmail.com
Reviewed by:    kib
Fixes:          f1f230439fa4 ("vfs: Initial revision of inotify")

    [3 lines not shown]
DeltaFile
+52-19sys/kern/vfs_inotify.c
+52-191 files

FreeBSD/src 64a20ddsys/amd64/linux syscalls.master, sys/amd64/linux32 syscalls.master

linux: Add inotify support

Implement the Linux inotify system calls using the native implementation
in vfs_inotify.c.

PR:             240874
Reviewed by:    brooks
MFC after:      3 months
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D50761

(cherry picked from commit 3965de642c29d831649c8307203303de560d721a)
DeltaFile
+121-0sys/compat/linux/linux_file.c
+32-0sys/compat/linux/linux_file.h
+12-3sys/i386/linux/syscalls.master
+12-3sys/amd64/linux32/syscalls.master
+9-2sys/arm64/linux/syscalls.master
+9-2sys/amd64/linux/syscalls.master
+195-104 files not shown
+201-1810 files

FreeBSD/src 03f5651etc/mtree BSD.usr.dist, share/examples Makefile

examples: Add a demo program for inotify

MFC after:      3 months
Sponsored by:   Klara, Inc.

(cherry picked from commit 1d8664d6904149e0be5dbfa0ee35268de2a83f1e)
DeltaFile
+172-0share/examples/inotify/inotify.c
+6-0share/examples/inotify/Makefile
+5-0share/examples/Makefile
+2-0etc/mtree/BSD.usr.dist
+185-04 files

FreeBSD/src 97d0086usr.bin/truss syscall.h syscalls.c

truss: Add a decoder for inotify_add_watch_at(2)

MFC after:      3 months
Sponsored by:   Klara, Inc.

(cherry picked from commit 4d08e7815d6c71c620f19a8abdf0caa26f9c5c57)
DeltaFile
+6-1usr.bin/truss/syscalls.c
+1-0usr.bin/truss/syscall.h
+7-12 files

FreeBSD/src 4d9701ctests/sys/kern Makefile inotify_test.c

tests: Add some regression tests for inotify

Reviewed by:    kib
MFC after:      3 months
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D50315

(cherry picked from commit 739fc14938d58a2ed34c0663bf1f06c83eada685)
DeltaFile
+899-0tests/sys/kern/inotify_test.c
+1-0tests/sys/kern/Makefile
+900-02 files

FreeBSD/src 2e5f492lib/libc/sys Makefile.inc inotify.2, share/man/man9 Makefile VOP_INOTIFY.9

inotify: Add man pages for the new syscalls and for VOP_INOTIFY

Reviewed by:    kib
MFC after:      3 months
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D50315

(cherry picked from commit 5202cfcf93b19b39f3d2bf80e73a8ca94d7fffd1)
DeltaFile
+379-0lib/libc/sys/inotify.2
+60-0share/man/man9/VOP_INOTIFY.9
+6-0lib/libc/sys/Makefile.inc
+2-0share/man/man9/Makefile
+447-04 files

FreeBSD/src 7d91497usr.bin/procstat procstat.1 procstat_files.c

procstat: Add handling for inotify descriptors

MFC after:      3 months
Sponsored by:   Klara, Inc.

(cherry picked from commit f56e0d4755c521b50bf313a85fd399c2b6a7a4bb)
DeltaFile
+9-0usr.bin/procstat/procstat_files.c
+3-0usr.bin/procstat/procstat.1
+12-02 files

FreeBSD/src 09dbcd1tools/build/mk OptionalObsoleteFiles.inc

Remove inotify example code when MK_EXAMPLES == no

This change adds the needed entries to OLD_DIRS and OLD_FILES to ensure
that the paths are properly cleaned up when `make delete-old` is run and
MK_EXAMPLES == no.

MFC after:      2 months
Fixes:          1d8664d69041 ("examples: Add a demo program for inotify")
Differential Revision:  https://reviews.freebsd.org/D51934

(cherry picked from commit 19c8cc3162aca9fde56581caee743d68d322c909)
DeltaFile
+3-0tools/build/mk/OptionalObsoleteFiles.inc
+3-01 files

FreeBSD/src 9e2e70dlib/libprocstat libprocstat.h libprocstat.c

libprocstat: Add handling for inotify descriptors

MFC after:      3 months
Sponsored by:   Klara, Inc.

(cherry picked from commit 79102e108099237b1d702e960706a739c7b071bd)
DeltaFile
+5-0lib/libprocstat/libprocstat.c
+1-0lib/libprocstat/libprocstat.h
+6-02 files