Re: Use `ps_mtx' mutex(9) to protect `ps_ucred' and unlock setuid(2), ...

2022-12-28 Thread Vitaliy Makkoveev
The latest diff iteration after guenther@'s feedback. - The lock grabbing in ddb(4) is wrong, so don't grab it within db_show_all_procs(). - In the dorefreshcreds() grab the lock only if uc != pr->ps_ucred. Also move crfree() out of the lock. - In the pgsigio() store call CANSIGIO() with

Re: Use `ps_mtx' mutex(9) to protect `ps_ucred' and unlock setuid(2), ...

2022-12-17 Thread Vitaliy Makkoveev
On Sat, Dec 03, 2022 at 08:45:52PM +0300, Vitaliy Makkoveev wrote: > On Thu, Dec 01, 2022 at 10:50:03PM +0300, Vitaliy Makkoveev wrote: > > On Thu, Dec 01, 2022 at 11:28:59AM -0800, Philip Guenther wrote: > > > On Thu, Dec 1, 2022 at 10:31 AM Vitaliy Makkoveev > > > wrote: > > > ... > > > > > >

Re: Use `ps_mtx' mutex(9) to protect `ps_ucred' and unlock setuid(2), ...

2022-12-03 Thread Vitaliy Makkoveev
On Thu, Dec 01, 2022 at 10:50:03PM +0300, Vitaliy Makkoveev wrote: > On Thu, Dec 01, 2022 at 11:28:59AM -0800, Philip Guenther wrote: > > On Thu, Dec 1, 2022 at 10:31 AM Vitaliy Makkoveev wrote: > > ... > > > > > --- sys/sys/sysctl.h7 Nov 2022 14:25:44 - 1.231 > > > +++

Re: Use `ps_mtx' mutex(9) to protect `ps_ucred' and unlock setuid(2), ...

2022-12-01 Thread Vitaliy Makkoveev
On Thu, Dec 01, 2022 at 11:28:59AM -0800, Philip Guenther wrote: > On Thu, Dec 1, 2022 at 10:31 AM Vitaliy Makkoveev wrote: > ... > > > --- sys/sys/sysctl.h7 Nov 2022 14:25:44 - 1.231 > > +++ sys/sys/sysctl.h1 Dec 2022 18:15:06 - > > @@ -587,7 +587,7 @@ struct kinfo_vmentry

Re: Use `ps_mtx' mutex(9) to protect `ps_ucred' and unlock setuid(2), ...

2022-12-01 Thread Philip Guenther
On Thu, Dec 1, 2022 at 10:31 AM Vitaliy Makkoveev wrote: ... > --- sys/sys/sysctl.h7 Nov 2022 14:25:44 - 1.231 > +++ sys/sys/sysctl.h1 Dec 2022 18:15:06 - > @@ -587,7 +587,7 @@ struct kinfo_vmentry { > > #define_FILL_KPROC_MIN(a,b) (((a)<(b))?(a):(b)) > > -#define

Use `ps_mtx' mutex(9) to protect `ps_ucred' and unlock setuid(2), ...

2022-12-01 Thread Vitaliy Makkoveev
..., setgid(2), setgroups(2), setreuid(2), setregid(2), sys_setegid(2), sys_seteuid(2), setresuid(2), setresgid(2). These syscalls do the same: they overwrite `ps_ucred' by newly allocated credentials structure, so unlock them all. Unlocked chgproccnt() call is safe, because `uidinfolk'