FreeBSD/src d02883b — tools/tools/git/ghpr README ghpr-init.sh

tools/git/ghpr: retire

The project under the .../ghpr subdirectory is an earlier version of the
tool. A newer/supported iteration of the tool can be found on
[GitHub][ghpr-repo].

`ghpr` can be installed via `pkg`, e.g., `pkg install py312-ghpr-5`.

Please see the [README.md][readme] for further details.

MFC after:      1 month

[ghpr-repo]: https://github.com/bsdimp/ghpr/
[readme]: https://github.com/bsdimp/ghpr/blob/main/README.md

Reviewed by:    dteske
Differential Revision:  https://reviews.freebsd.org/D61086
DeltaFile
+0-72tools/tools/git/ghpr/ghpr-stage.sh
+0-51tools/tools/git/ghpr/ghpr-push.sh
+0-29tools/tools/git/ghpr/ghpr-init.sh
+0-5tools/tools/git/ghpr/README
+0-1574 files

FreeBSD/src 71eddb4 — tests/sys/capsicum capsicum-freebsd.h

capsicum-test: Disable `HAVE_SEND_RECV_MMSG` again

04c4b2084eb9 accidentally added some changes from another WIP commit into that
diff. Instead of wholesale reverting the change, just revert the part that's
currently broken (`HAVE_SEND_RECV_MMSG`). While some of the related tests pass,
one of the testcases (`capmode.cc:AllowedMmsgSendRecv`) doesn't currently pass.

Revert the change to make the CI run more green again.

MFC after:      1 week
Fixes:  04c4b2084eb9 ("capsicum-test: make the code WARNS=6 clean")
DeltaFile
+4-0tests/sys/capsicum/capsicum-freebsd.h
+4-01 files

FreeBSD/src 58e5c5c — tests/sys/capsicum capsicum-test-main.cc Makefile

tests/sys/capsicum: restore test coverage with root user

This change builds capsicum_test and installs/runs it as an unprivileged
user ("tests" in vanilla FreeBSD) and root.

This required adjusting logic in the Makefile in order to build two
binaries with the same sources and running them as separate binaries.

Moreover, in order to restore coverage and ensure that some tests which
require `other_uid` (typically specified via `-u` on the CLI with the
test program) don't fail, become the "tests" user when run as root. This
technically doesn't honor unprivileged_user property in kyua.conf: the
property needs to be passed via a command-line parameter to the test
program.

MFC after:      1 week
Reported by:    markj
Fixes:          3fb03fb35b20 ("[tests] switch GoogleTest tests ...")


    [2 lines not shown]
DeltaFile
+18-9tests/sys/capsicum/Makefile
+24-0tests/sys/capsicum/capsicum-test-main.cc
+42-92 files

FreeBSD/src 04c4b20 — tests/sys/capsicum capability-fd.cc fexecve.cc

capsicum-test: make the code WARNS=6 clean

Make the code WARNS=6 clean by doing the following:
- Renaming variables (-Wshadow).
- Use memcpy instead of assigning the result of CMSG_DATA to a variable
  (-Wcast-align).
- Wrap some macros with do-while(0) to avoid variable collisions
  (-Wshadow).
- Push one of the TRACE statements up by 1 layer to avoid a collision
  between 2 calls of TRACE via the same overarching macro.

This was needed in order for the code to build properly with D61066,
since the code was not compiling with WARNS set to 3 at the testcase
level.

MFC after: 1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D61080
DeltaFile
+35-35tests/sys/capsicum/socket.cc
+26-10tests/sys/capsicum/capsicum-test.h
+15-15tests/sys/capsicum/sctp.cc
+8-7tests/sys/capsicum/capsicum-freebsd.h
+6-6tests/sys/capsicum/fexecve.cc
+6-4tests/sys/capsicum/capability-fd.cc
+96-773 files not shown
+107-829 files

FreeBSD/src ab6a3f1 — tests/sys/capsicum procdesc.cc capability-fd.cc

Revert "capsicum-test: make the code WARNS=6 clean"

The wrong patch got committed somehow from one of my git clones. Revert the
change so I can reapply the correct patch >:(.

This reverts commit 5bae837f316ca96b69c61bae15bd61da76e7f3ea.
DeltaFile
+29-29tests/sys/capsicum/socket.cc
+11-27tests/sys/capsicum/capsicum-test.h
+12-12tests/sys/capsicum/sctp.cc
+6-6tests/sys/capsicum/fexecve.cc
+4-6tests/sys/capsicum/capability-fd.cc
+2-4tests/sys/capsicum/procdesc.cc
+64-842 files not shown
+67-858 files

FreeBSD/src 83fc6f5 — tests/sys/capsicum capsicum-test-main.cc Makefile

Revert "tests/sys/capsicum: restore test coverage with root user"

The wrong patch was applied for D61080. Both changes must go.

This reverts commit dda15b669d021346682009f38acc6db2639fb99f.
DeltaFile
+9-18tests/sys/capsicum/Makefile
+0-24tests/sys/capsicum/capsicum-test-main.cc
+9-422 files

FreeBSD/src dda15b6 — tests/sys/capsicum capsicum-test-main.cc Makefile

tests/sys/capsicum: restore test coverage with root user

This change builds capsicum_test and installs/runs it as an unprivileged
user ("tests" in vanilla FreeBSD) and root.

This required adjusting logic in the Makefile in order to build two
binaries with the same sources and running them as separate binaries.

Moreover, in order to restore coverage and ensure that some tests which
require `other_uid` (typically specified via `-u` on the CLI with the
test program) don't fail, become the "tests" user when run as root. This
technically doesn't honor unprivileged_user property in kyua.conf: the
property needs to be passed via a command-line parameter to the test
program.

MFC after:      1 week
Reported by:    markj
Fixes:          3fb03fb35b20 ("[tests] switch GoogleTest tests ...")


    [2 lines not shown]
DeltaFile
+18-9tests/sys/capsicum/Makefile
+24-0tests/sys/capsicum/capsicum-test-main.cc
+42-92 files

FreeBSD/src 5bae837 — tests/sys/capsicum procdesc.cc capability-fd.cc

capsicum-test: make the code WARNS=6 clean

Make the code WARNS=6 clean by doing the following:
- Renaming variables (-Wshadow).
- Use memcpy instead of assigning the result of CMSG_DATA to a variable
  (-Wcast-align).
- Wrap some macros with do-while(0) to avoid variable collisions
  (-Wshadow).
- Push one of the TRACE statements up by 1 layer to avoid a collision
  between 2 calls of TRACE via the same overarching macro.

This was needed in order for the code to build properly with D61066,
since the code was not compiling with WARNS set to 3 at the testcase
level.

MFC after: 1 week

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D61080
DeltaFile
+29-29tests/sys/capsicum/socket.cc
+26-10tests/sys/capsicum/capsicum-test.h
+12-12tests/sys/capsicum/sctp.cc
+6-6tests/sys/capsicum/fexecve.cc
+6-4tests/sys/capsicum/capability-fd.cc
+4-2tests/sys/capsicum/procdesc.cc
+83-632 files not shown
+84-668 files

FreeBSD/src 522407f — share/man/man3 Makefile pthread_rwlock_timedwrlock.3

pthread_rwlock_clock{rd,wr}lock(3): document

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+43-19share/man/man3/pthread_rwlock_timedwrlock.3
+43-19share/man/man3/pthread_rwlock_timedrdlock.3
+2-0share/man/man3/Makefile
+88-383 files

FreeBSD/src 2949557 — share/man/man3 pthread_cond_timedwait.3

pthread_cond_timedwait.3: list pthread_cond_clockwait as .Nm

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+2-1share/man/man3/pthread_cond_timedwait.3
+2-11 files

FreeBSD/src b3a205c — share/man/man3 pthread_cond_timedwait.3

pthread_cond_timedwait.3: split STANDARDS and HISTORY

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+5-2share/man/man3/pthread_cond_timedwait.3
+5-21 files

FreeBSD/src a9b82d6 — share/man/man3 pthread_rwlock_timedwrlock.3 pthread_rwlock_timedrdlock.3

pthread_*_timed*lock.3: switch to .Fo/Fc

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+4-1share/man/man3/pthread_rwlock_timedwrlock.3
+4-1share/man/man3/pthread_rwlock_timedrdlock.3
+4-1share/man/man3/pthread_mutex_timedlock.3
+12-33 files

FreeBSD/src be90f23 — contrib/netbsd-tests/lib/libpthread t_mutex.c

libthr: libpthread/t_mutex.c tests should expect EDEADLK

to follow the POSIX specification.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+6-4contrib/netbsd-tests/lib/libpthread/t_mutex.c
+6-41 files

FreeBSD/src 1c08e2b — share/man/man3 Makefile pthread_mutex_timedlock.3

pthread_mutex_clocklock.3: document

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+58-12share/man/man3/pthread_mutex_timedlock.3
+1-0share/man/man3/Makefile
+59-122 files

FreeBSD/src 083b44d — lib/libthr/tests Makefile pthread_rwlock_clocklock_test.c

libthr: add tests for pthread_rwlock_clock{rd,wr}lock(3)

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+528-0lib/libthr/tests/pthread_rwlock_clocklock_test.c
+1-0lib/libthr/tests/Makefile
+529-02 files

FreeBSD/src 7689242 — lib/libthr/tests Makefile pthread_mutex_clocklock_test.c

libthr: add tests for pthread_mutex_clocklock(3)

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+489-0lib/libthr/tests/pthread_mutex_clocklock_test.c
+1-0lib/libthr/tests/Makefile
+490-02 files

FreeBSD/src 5577567 — include pthread.h, lib/libthr pthread.map

libthr: add pthread_rwlock_clock{rd,wr}lock(3)

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+34-8lib/libthr/thread/thr_rwlock.c
+8-6lib/libthr/thread/thr_umtx.c
+10-0include/pthread.h
+4-4lib/libthr/thread/thr_umtx.h
+2-0lib/libthr/pthread.map
+58-185 files

FreeBSD/src 701ac0b — lib/libsys _umtx_op.2

_umtx_op.2: correct the description of the valid _clockid for _umtx_time

And remove the duplicated list from the description of the condition
variable.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+38-33lib/libsys/_umtx_op.2
+38-331 files

FreeBSD/src 62e5351 — lib/libthr/thread thr_private.h

lib/libthr: add helper to check valid clockid to use with _umtx_op(2)

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+28-0lib/libthr/thread/thr_private.h
+28-01 files

FreeBSD/src 8c13acc — sys/kern kern_umtx.c

umtxq_sleep(): do not wait forever for zero absolute timeouts

For msleep(), zero sbt means no timeout. If the timeout was specified as
absolute {0, 0} on MONOTONIC/UPTIME clocks, consider the call timed out
immediately, instead of sleeping until a signal is delivered.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+9-0sys/kern/kern_umtx.c
+9-01 files

FreeBSD/src e81badc — lib/libthr/thread thr_cond.c

libthr cond_wait_user(): do not loop forever on clock error

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+1-1lib/libthr/thread/thr_cond.c
+1-11 files

FreeBSD/src 8331d5a — lib/libthr/thread thr_cond.c

pthread_cond_clockwait(3): explicitly reject unacceptable clockids

Otherwise they are rejected by kernel in do_wait(), reached through
_thr_sleep()/UMTX_OP_WAIT_UINT_PRIVATE on the user-mode path. Then,
since cond_wait_user() only leaves its loop on a wakeup, a cancellation
or ETIMEDOUT, the EINVAL from do_wait() results in a loop.

If hit, this indicates a bug in user code, but the system library
must be resilient to such misuse.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+2-0lib/libthr/thread/thr_cond.c
+2-01 files

FreeBSD/src bf2939e — lib/libthr/thread thr_mutex.c, share/man/man3 pthread_mutex_timedlock.3

pthread_mutex_timedlock(3): return EDEADLK on detected recursion attempt

for ERRORCHECK and ADAPTIVE_NP mutexes, instead of ETIMEDOUT. This is
explicitly specified by POSIX.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+5-17lib/libthr/thread/thr_mutex.c
+1-1share/man/man3/pthread_mutex_timedlock.3
+6-182 files

FreeBSD/src 524f1bf — sys/kern kern_umtx.c, sys/sys umtxvar.h

kern_umtx.c: validate clockid used for _umtx_op(2) timeouts

Only allow clocks that make sense for the umtx_sleep().

While there, do not ignore errors from kern_clock_gettime(). The invalid
clock ids are filtered, but if the clock can't be read (CLOCK_TAI before
the TAI-UTC offset is known), the functions operate on uninitialized
memory.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+106-43sys/kern/kern_umtx.c
+1-1sys/sys/umtxvar.h
+107-442 files

FreeBSD/src b7c2db4 — include pthread.h, lib/libthr pthread.map

libthr: add pthread_mutex_clocklock(3)

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61253
DeltaFile
+28-14lib/libthr/thread/thr_mutex.c
+3-3lib/libthr/thread/thr_umtx.c
+5-0include/pthread.h
+2-2lib/libthr/thread/thr_umtx.h
+1-0lib/libthr/pthread.map
+39-195 files

FreeBSD/src eff19ac — lib/libthr/thread thr_pshared.c

libthr: explain why pshared lock bumps locklevel

Reviewed by:    markj, aokblast
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61343
DeltaFile
+10-0lib/libthr/thread/thr_pshared.c
+10-01 files

FreeBSD/src e55d439 — lib/libthr/thread thr_pshared.c

libthr: fix __thr_pshared_offpage() to not use cancellable close()

__thr_pshared_offpage() is used by pthread functions that must not be
cancellation points according to POSIX.  Use direct __sys_close() instead
of interposed close() there.

Fixes:  1bdbd705993e ("Implement process-shared locks support ...")
Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61343
DeltaFile
+1-1lib/libthr/thread/thr_pshared.c
+1-11 files

FreeBSD/src 922eaa6 — sys/sys namei.h

namei(9): allow NDINIT_ATVP() lookups in capability mode

NDINIT_ATVP() initializes dirfd to AT_FDCWD, which is denied for a
process already in cap mode.  Since NDINIT_ATVP() is a special lookup
operation performed by the kernel, it should be allowed to proceed for
the paths beneath vp.

Fabricate a pseudo dirfd value that is an unused placeholder,
which fails the AT_FDCWD comparison and allows the lookup to proceed in
cap mode.

Note that failed cap-mode NDINIT_ATVP lookup returned ECAPMODE without
releasing the caller reference on ni_startdir, which is fixed by this
change.

Reported by:    ivy
Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61315
DeltaFile
+2-1sys/sys/namei.h
+2-11 files

FreeBSD/src 2f3d64f — sys/kern vfs_lookup.c, sys/sys namei.h

namei(9): fix restart for NDINIT_ATVP

namei() might restart for altroot or for ERESTART from
nameicap_tracker_add().

vfs_lookup() consumes the reference on ni_startdir and clears it, so
a restarted NDINIT_ATVP() lookup started from the current directory
instead of the vnode passed by the caller.

Save the starting vnode in a local variable, hold it while the lookup
can be restarted, and reference it before the restarted pass. Do not
assert NAMEI_DBG_HADSTARTDIR on the internal restart.

Noted and reviewed by:  markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61315
DeltaFile
+26-1sys/kern/vfs_lookup.c
+7-3sys/sys/namei.h
+33-42 files

FreeBSD/src ad8f475 — sys/kern link_elf.c

link_elf: bounds-check the DT_HASH offset

parse_dynamic() builds the symbol hash table at ef->address + d_ptr
without checking that d_ptr lies within the mapped image, so a crafted
DT_HASH entry causes an out-of-bounds read of the hash header.  Reject
the object with ENOEXEC when the header does not fit in the image.

Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D61323
DeltaFile
+8-1sys/kern/link_elf.c
+8-11 files