Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jul 2020 15:45:46 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 248070] kernel panic sysctl -a
Message-ID:  <bug-248070-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D248070

            Bug ID: 248070
           Summary: kernel panic sysctl -a
           Product: Base System
           Version: 12.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: lampa@fit.vutbr.cz

uname -a
FreeBSD xxx 12.1-STABLE FreeBSD 12.1-STABLE r363310 xxxx  amd64

sysctl -a
kern.ostype: FreeBSD
kern.osrelease: 12.1-STABLE
kern.osrevision: 199506
kern.version: FreeBSD 12.1-STABLE r363310 VOJEN

kern.maxvnodes: 620153
kern.maxproc: 38036
kern.maxfiles: 1044518
kern.argmax: 524288
kern.securelevel: -1
kern.hostname: xxx
kern.hostid: 2119532645
kern.clockrate: { hz =3D 1000, tick =3D 1000, profhz =3D 8128, stathz =3D 1=
27 }
<<<---- panic at eip 0x20:0xfffffff8058946b

bt
pget() at pget+0x200/frame 0xfffffe009f4987e0
sysctl_kern_proc_kstack() at sysctl_kern_proc_kstack+0x27
sysctl_root_handler_locked() at sysctl_root_handler_locked+0x7d
sysctl_root() at sysctl_root+0x192
userland_sysctl() ...

Source of panic is mismerge of kern_proc.c in 363038 at line 413, original =
was:

         } else {
               if (pid <=3D PID_MAX) {
...
               } else if ((flags & PGET_NOTID) =3D=3D 0) {
                        p =3D pfind_tid_locked(pid);
               } else {
                        p =3D NULL;
               }

revision 363038:

         } else {
               if (pid <=3D PID_MAX) {
...
               } else if ((flags & PGET_NOTID) =3D=3D 0) {
                        td1 =3D tdfind(pid, -1);
                        if (td1 !=3D NULL)
                                p =3D td1->td_proc;
               }

If tdfind() fails, p is not reset to NULL and also NOTID case was lost. Mer=
ge
missed assignment p =3D NULL before if (pid <=3D PID_MAX):

         } else {
               p =3D NULL;   /* THIS STATEMENT IS IN HEAD, NOT IN STABLE */
               if (pid <=3D PID_MAX) {
...
               } else if ((flags & PGET_NOTID) =3D=3D 0) {
                        td1 =3D tdfind(pid, -1);
                        if (td1 !=3D NULL)
                                p =3D td1->td_proc;
               }

With this change, sysctl -a no longer panics.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-248070-227>