On Thu, Dec 1, 2022 at 10:31 AM Vitaliy Makkoveev <m...@openbsd.org> wrote: ...
> --- sys/sys/sysctl.h 7 Nov 2022 14:25:44 -0000 1.231 > +++ sys/sys/sysctl.h 1 Dec 2022 18:15:06 -0000 > @@ -587,7 +587,7 @@ struct kinfo_vmentry { > > #define _FILL_KPROC_MIN(a,b) (((a)<(b))?(a):(b)) > > -#define FILL_KPROC(kp, copy_str, p, pr, uc, pg, paddr, \ > +#define FILL_KPROC(kp, copy_str, p, pr, pg, paddr, \ > praddr, sess, vm, lim, sa, isthread, show_addresses) \ > ... > - (kp)->p_svgid = (uc)->cr_svgid; \ > + PR_LOCK(pr); \ > + (kp)->p_uid = (pr)->ps_ucred->cr_uid; \ > Nope. As the block comment about this notes, FILL_KPROC() is shared between the kernel and libkvm and takes each structure pointer separately as, for example, pr->ps_ucred has the kva address, not the address of the ucred struct that libkvm has separately read into user memory. Now, you _could_ have libkvm update pr->ps_ucred to point to its user-space copy. However, that would make ucred handling different from the other sub-structures of struct proc and MOST of those we need the real kva for the show_address functionality. Not sure if this is the yak-shave you want right now... (libkvm will obviously also need no-op #defines for PR_LOCK() etc) Philip