Hi,

Revision 1.81 from kern_pledge.c still doesn't solve the issue, miblen should be changed to 2 since machine.c from top(1) code is:

268     } else {
269         int cp_time_mib[] = {CTL_KERN, KERN_CPTIME};
270         long cp_time_tmp[CPUSTATES];
271
272         size = sizeof(cp_time_tmp);
273         if (sysctl(cp_time_mib, 2, cp_time_tmp, &size, NULL, 0) < 0)
274             warn("sysctl kern.cp_time failed");

By applying the patch below top(1) works again:

Index: kern_pledge.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_pledge.c,v
retrieving revision 1.81
diff -u -p -u -r1.81 kern_pledge.c
--- kern_pledge.c       28 Oct 2015 02:12:54 -0000      1.81
+++ kern_pledge.c       28 Oct 2015 07:44:20 -0000
@@ -908,7 +908,7 @@ pledge_sysctl_check(struct proc *p, int
                if (miblen == 2 &&                      /* kern.loadavg */
                    mib[0] == CTL_VM && mib[1] == VM_LOADAVG)
                        return (0);
-               if (miblen == 3 &&                      /* kern.cptime */
+               if (miblen == 2 &&                      /* kern.cptime */
                    mib[0] == CTL_KERN && mib[1] == KERN_CPTIME)
                        return (0);
                if (miblen == 3 &&                      /* kern.cptime2 */

Best regards,
Ricardo Mestre

On 27/10/2015 19:37, Ricardo Mestre wrote:
Hi people,

I can confirm this regress, just updated the kernel and top and had the same issue, but this diff seems to solve it, I just don't know if it's the right place to put it or not:

Index: kern_pledge.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_pledge.c,v
retrieving revision 1.80
diff -u -p -u -r1.80 kern_pledge.c
--- kern_pledge.c       26 Oct 2015 17:52:19 -0000      1.80
+++ kern_pledge.c       27 Oct 2015 19:32:09 -0000
@@ -911,6 +911,9 @@ pledge_sysctl_check(struct proc *p, int
if (miblen == 3 && /* kern.cptime2 */
                    mib[0] == CTL_KERN && mib[1] == KERN_CPTIME2)
                        return (0);
+               if (miblen == 2 &&          /* kern.cp_time */
+                       mib[0] == CTL_KERN && mib[1] == KERN_CPTIME)
+                       return (0);
        }

        if ((p->p_p->ps_pledge & PLEDGE_PS)) {

Best regards,
Ricardo Mestre

On 27/10/2015 19:00, Mike wrote:
OpenBSD 5.8-current (GENERIC) #1: Tue Oct 27 12:31:10 EDT 2015
m...@otest.24cl.home:/usr/src/sys/arch/amd64/compile/GENERIC


I didn't see anything in current.html that may affect this.

I downloaded the Oct 20 snapshot.  Then I updated the source to current
this morning.  After the build, top crashes immediately upon invocation.

# top
Abort (core dumped)


In messages.log, I see two lines:

Oct 27 14:52:22 otest /bsd: top(12603): sysctl 2: 1 40 -2129088583 -1
981777920 -255

Oct 27 14:52:22 otest /bsd: top(12603): syscall 202 "stdio"


which looks like it may be pledge output.

If I need to do something else to track this let me know.  I can make
the core dump available to download, if needed.

thx.


Reply via email to