FreeBSD/src 733ea4einclude inttypes.h

libc: Add <inttypes.h> C23 feature test macro

Define __STDC_VERSION_INTTYPES_H__ now that the header fully
conforms to C23.

Reviewed by:    fuz
Approved by:    fuz (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59382
DeltaFile
+6-0include/inttypes.h
+6-01 files

FreeBSD/src 5aeedafsys/powerpc/aim aim_machdep.c, sys/powerpc/booke booke_machdep.c

powerpc/ddb: Dump more state in `show pcpu`

Add a new CPU-family `show pcpu` handler, cpu_db_show_mdpcpu() to dump
CPU-specific PCPU data.  Only Book-E is populated for now, but AIM may
be populated later.

These new field prints: save areas, TLB miss nesting, the new critical
stack pointer.  All of them have been very useful for debugging very
esoteric bugs, so make them easier to see from DDB, instead of having to
rummage through hex dumps.
DeltaFile
+48-0sys/powerpc/booke/booke_machdep.c
+7-0sys/powerpc/powerpc/db_interface.c
+7-0sys/powerpc/aim/aim_machdep.c
+5-0sys/powerpc/include/md_var.h
+67-04 files

FreeBSD/src d8f9d33sys/powerpc/booke pmap_32.c pmap.c

powerpc/pmap(booke): Allocate 64-bit roots from DMAP

When a TLB miss exception occurs the exception handler must walk the
page table from the root.  When the root is allocated from KVA the TLB
miss exception may take another exception if the root page(s) aren't in
the TLB.

The 64-bit page table is modeled after the AIM radix page table, with a
64kB root "page", so 16 pages.  This makes regular use of UMA
allocations unable to refer back to the DMAP, which itself is mapped in
TLB1.  Now we take another page from the radix pmap driver and grab
contiguous pages from the VM system, so that we can simply refer
directly to DMAP and avoid more nested TLB misses.  We can still take a
nested miss, though, because the pmap itself may be in KVA, but this
reduces the nesting.
DeltaFile
+45-0sys/powerpc/booke/pmap_64.c
+1-5sys/powerpc/booke/pmap.c
+4-0sys/powerpc/booke/pmap_32.c
+50-53 files

FreeBSD/src eef2607sys/powerpc/booke pmap.c

powerpc/pmap(booke): Rework TID reuse

If a pmap is freed and its memory is reused before its TID reference is
taken, then arbitrary memory will be clobbered.  Avoid this by never
dereferencing the pmap pointer in the tidbusy array, and instead using
it as a compare sentinel.
DeltaFile
+16-12sys/powerpc/booke/pmap.c
+16-121 files

FreeBSD/src 68ecb91sys/powerpc/booke trap_subr.S

powerpc/booke: Reorganize FRAME_LEAVE

There's a small window between when the SRR* registers are restore and
the exception returns, in which a TLB miss exception may be triggered.
Since there are not special SRR* registers for TLB miss exceptions, the
registers from the frame will be ovwritten, and the FRAME_LEAVE block
will effectively be re-entered on exit, leading to a very hard to
diagnose panic or wedge.

Minimize this chance by pushing the SRR* restore to the last possible
moments, caching them in a PCPU save area instead until the end.  This
matches what the AIM side already does.
DeltaFile
+31-11sys/powerpc/booke/trap_subr.S
+31-111 files

FreeBSD/src 564fe16sys/powerpc/booke booke_machdep.c trap_subr.S, sys/powerpc/include pcpu.h

powerpc/booke: Use a dedicated critical exception stack

A critical exception, such as a watchdog, can trigger at any time,
including the middle of a standard exception prologue or epilogue, so
GPRs, including %r1 (the stack pointer) cannot be trusted at all.
Instead, use a private stack pointer for critical interrupts.  Each CPU
now has its own critical exception stack, with the boot stack in the
bss.
DeltaFile
+39-11sys/powerpc/booke/trap_subr.S
+18-0sys/powerpc/booke/booke_machdep.c
+10-2sys/powerpc/include/pcpu.h
+1-0sys/powerpc/powerpc/genassym.c
+68-134 files

FreeBSD/src 42f9049sys/powerpc/booke machdep_e500.c, sys/powerpc/include spr.h

powerpc/watchdog: Make e500 watchdog action tunable

There are 4 options for e500 watchdog timeout, which may be core- or
even SoC- specific.  Add support to tune the behavior via a tunable
(machdep.watchdog_mode).  The tunable value is an integer 0-3.
DeltaFile
+7-2sys/powerpc/booke/machdep_e500.c
+1-0sys/powerpc/include/spr.h
+8-22 files

FreeBSD/src 8ab5624tests/sys/kern Makefile procdesc.c

tests/sys/kern: Skip capsicum procdesc tests when capability mode is unavailable

(cherry picked from commit 3c5c55beee5ef80d8a9526480682cee86cbac584)
DeltaFile
+7-0tests/sys/kern/pdwait.c
+4-0tests/sys/kern/procdesc.c
+2-0tests/sys/kern/Makefile
+13-03 files

FreeBSD/src 2469f84lib/libc/gen exterr_cat_filenames.h, sys/kern tty.c

kern/tty.c: Exterrorize returns

(cherry picked from commit 62ccaec3dba6272590d97cc0aa0df28fd3d08d1c)
DeltaFile
+27-22sys/kern/tty.c
+1-0sys/sys/exterr_cat.h
+1-0lib/libc/gen/exterr_cat_filenames.h
+29-223 files

FreeBSD/src c41e308sys/kern tty_pts.c tty.c, sys/sys tty.h

tty: gracefully handle proctree_lock locking

(cherry picked from commit 420428718da769ea72d3f18ed8eba7c3d998b1c8)
DeltaFile
+209-172sys/kern/tty.c
+3-0sys/sys/tty.h
+3-0sys/kern/tty_pts.c
+215-1723 files

FreeBSD/src 5362192sys/kern tty_ttydisc.c tty.c, sys/sys tty.h

tty: make tty_wait_background() aware of proctree_lock ownership

(cherry picked from commit 824f934bf9d5fcb34dd6c97d650a26823158abf1)
DeltaFile
+11-5sys/kern/tty.c
+8-4sys/kern/tty_ttydisc.c
+2-1sys/sys/tty.h
+21-103 files

FreeBSD/src a585570sys/kern tty.c

tty: add tty_wait_proctree(9)

(cherry picked from commit 9bd3fe5712217ef8ae4cebba8be82c45be0c72e6)
DeltaFile
+39-0sys/kern/tty.c
+39-01 files

FreeBSD/src 124ccedshare/man/man9 condvar.9

condvar.9: document cv_wait_sig_unblock(9)

(cherry picked from commit a15c71254afa25ce008334d63fb6feecd68605f8)
DeltaFile
+10-1share/man/man9/condvar.9
+10-11 files

FreeBSD/src 3867241sys/kern kern_condvar.c, sys/sys condvar.h

condvars(9): add cv_wait_sig_unlock()

(cherry picked from commit 0cc6c442964d6294b796537522d9e462656bf16f)
DeltaFile
+55-0sys/kern/kern_condvar.c
+3-0sys/sys/condvar.h
+58-02 files

FreeBSD/src 5b10e1ctests/sys/kern procdesc.c

tests/sys/kern/procdesc.c: mark grandchild var in pdopenpid_capmode() as volatile

(cherry picked from commit b3734c1386dd2b0ade1a7f20d9ebf5f62c01819e)
DeltaFile
+2-1tests/sys/kern/procdesc.c
+2-11 files

FreeBSD/src 2fbb853tests/sys/kern procdesc.c

sys/tests/kern/pdopenpid: pdopenpid(2) is allowed in cap mode

(cherry picked from commit ddf62c83fc0aca39a1bfd8346ad6e925bfb2290e)
DeltaFile
+34-4tests/sys/kern/procdesc.c
+34-41 files

FreeBSD/src fe56ee2sys/kern sys_process.c

ptrace(2): allow ptrace(PT_TRACE_ME) in cap mode

(cherry picked from commit c8f8d00c2422bf7eca71b7b41e9d586ca25c4b8a)
DeltaFile
+2-0sys/kern/sys_process.c
+2-01 files

FreeBSD/src 665a5f0sys/compat/freebsd32 freebsd32_sysent.c, sys/kern init_sysent.c

Regen
DeltaFile
+3-3sys/kern/init_sysent.c
+3-3sys/compat/freebsd32/freebsd32_sysent.c
+6-62 files

FreeBSD/src 201fd5blib/libsys ptrace.2 pdfork.2

pdfork.2: document cap mode, namely pdopenpid(2) and pdptrace(2) errors

(cherry picked from commit 1ac08a43cf657564ebc2e036434e89552a6d3829)
DeltaFile
+33-0lib/libsys/pdfork.2
+10-0lib/libsys/ptrace.2
+43-02 files

FreeBSD/src 74145b2sys/kern syscalls.master sys_procdesc.c

pdopenpid(2): allow in capability mode with restrictions

(cherry picked from commit 73c92a978ccef5e1683914510ea35e6e338646d1)
DeltaFile
+6-0sys/kern/sys_procdesc.c
+1-1sys/kern/syscalls.master
+7-12 files

FreeBSD/src c09ee2fsys/kern sys_procdesc.c

pdopenpid(2): in cap mode, translate all errors from pdopenpid1() to ECAPMODE

(cherry picked from commit 326ab530dcabe70ab48728cad0465f35b30dbf60)
DeltaFile
+3-0sys/kern/sys_procdesc.c
+3-01 files

FreeBSD/src 5e9d42fsys/kern sys_process.c kern_prot.c, sys/sys ptrace.h proc.h

kern: add p_canopen()

(cherry picked from commit 68d4b311270ecca80bbb887a5e502e2caacebc98)
DeltaFile
+26-2sys/kern/kern_prot.c
+5-0sys/kern/sys_process.c
+1-0sys/sys/ptrace.h
+1-0sys/sys/proc.h
+33-24 files

FreeBSD/src 1cab7e2sys/compat/freebsd32 freebsd32_misc.c, sys/kern syscalls.master sys_process.c

pdptrace(2): allow debugging in capability mode

(cherry picked from commit 7006cb7bd22d07d2ce30b0fb7ebfe58771b2a32f)
DeltaFile
+22-4sys/kern/sys_process.c
+2-2sys/kern/syscalls.master
+0-3sys/compat/freebsd32/freebsd32_misc.c
+24-93 files

FreeBSD/src 547bce6lib/libsys ptrace.2

ptrace.2: document PT_GET_ABI_NAME

(cherry picked from commit 3dfd63b58463e8982af2e45fc6dc1d5b03a88535)
DeltaFile
+11-0lib/libsys/ptrace.2
+11-01 files

FreeBSD/src 39321b7sys/compat/freebsd32 freebsd32_misc.c, sys/kern sys_process.c

ptrace(2): add PT_GET_ABI_NAME request

(cherry picked from commit 6b9ef5dfc903c29e1d23bb6369b762251f2608f7)
DeltaFile
+19-1sys/kern/sys_process.c
+12-0sys/compat/freebsd32/freebsd32_misc.c
+1-0sys/sys/ptrace.h
+32-13 files

FreeBSD/src bba959ftests/sys/kern pdwait.c

tests/sys/kern/pdwait: adjust test for the addition of CAP_PTRACE

(cherry picked from commit 5f5910ba3826435391d3e5b9ba9155376ec0b39d)
DeltaFile
+1-1tests/sys/kern/pdwait.c
+1-11 files

FreeBSD/src 48e709blib/libsys ptrace.2 pdfork.2, share/man/man4 rights.4

pdfork.2, rights.4: document pdptrace(2), CAP_PTRACE, and pdfork(PD_PTRACE_CAP)

(cherry picked from commit 45633600acade39cccc3b8daace7b3aeeb1f5b07)
DeltaFile
+48-3lib/libsys/pdfork.2
+3-0share/man/man4/rights.4
+1-0lib/libsys/ptrace.2
+52-33 files

FreeBSD/src c3d0110sys/compat/freebsd32 freebsd32_proto.h freebsd32_systrace_args.c, sys/kern systrace_args.c

Regen
DeltaFile
+38-0sys/kern/systrace_args.c
+38-0sys/compat/freebsd32/freebsd32_systrace_args.c
+9-0sys/sys/sysproto.h
+9-0sys/compat/freebsd32/freebsd32_proto.h
+2-1sys/sys/syscall.mk
+2-1sys/sys/syscall.h
+98-27 files not shown
+108-313 files

FreeBSD/src fbf7d16lib/libsys Symbol.sys.map, sys/sys procdesc.h

lib/libsys: export pdptrace(2)

(cherry picked from commit 6d17a04fc61c63182809dd41515e6a2c4aa0de63)
DeltaFile
+1-0sys/sys/procdesc.h
+1-0lib/libsys/Symbol.sys.map
+2-02 files

FreeBSD/src 73e3e21sys/kern sys_procdesc.c kern_fork.c, sys/sys procdesc.h

pdfork(2): add PD_PTRACE_CAP flag

(cherry picked from commit e8c313204887e7ba47b5c349acbe37d64a3162a1)
DeltaFile
+14-0sys/kern/kern_fork.c
+6-1sys/kern/sys_procdesc.c
+4-2sys/sys/procdesc.h
+24-33 files