PROC_COW_CHANGECOUNT(td, p) evaluates p->p_cowgen - td->td_cowgen, which
is only meaningful when td is a thread of p. Otherwise it subtracts two
unrelated copy-on-write generations, as the kern.proc.rlimit remote
update path did before it was fixed. Assert td->td_proc == p to catch
such a caller on INVARIANTS kernels.
Suggested by: mjg
MFC after: 2 weeks
Assisted-by: Claude Opus 4.8