diff --git a/RELNOTES b/RELNOTES --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,13 @@ Changes to this file should not be MFCed. +935ffbe06f1d: + ps(1)'s default list of processes now comes from matching its effective + user ID instead of its real user ID with the effective user ID of all + processes, in accordance with POSIX. As ps(1) itself is not installed + setuid, this only affects processes having different real and effective + user IDs that launch ps(1) processes. + f0600c41e754-de701f9bdbe0, bc201841d139: mac_do(4) is now considered production-ready and its functionality has been considerably extended at the price of breaking credentials diff --git a/bin/ps/ps.c b/bin/ps/ps.c --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -503,13 +503,14 @@ */ nselectors = 0; else if (nselectors == 0) { - /* Default is to request our processes only. */ - uidlist.l.ptr = malloc(sizeof(uid_t)); - if (uidlist.l.ptr == NULL) - xo_errx(1, "malloc failed"); + /* + * Default is to request our processes only. As per POSIX, we + * match processes by their effective user IDs and we use our + * effective user ID as our own identity. + */ + expand_list(&uidlist); + uidlist.l.uids[uidlist.count++] = geteuid(); nselectors = 1; - uidlist.count = uidlist.maxcount = 1; - *uidlist.l.uids = getuid(); } /*