Date: Thu, 11 May 2017 00:13:15 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-toolchain@FreeBSD.org Subject: [Bug 219153] head, stable/11, release/11.0.1: libkvm (& more?) not updated to handle powerpc/powerpc64 ET_DYN based vmcore.* 's and such Message-ID: <bug-219153-29464-2pzrB9DGJx@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-219153-29464@https.bugs.freebsd.org/bugzilla/> References: <bug-219153-29464@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D219153 --- Comment #9 from Mark Millard <markmi@dsl-only.net> --- (In reply to John Baldwin from comment #5) As for ps -M /var/crash/vmcore.7 listing no processes: main uses kvm_getprocs, which in turn eventually does: if (KREAD(kd, nl[0].n_value, &nprocs)) { _kvm_err(kd, kd->program, "can't read nproc= s"); return (0); } but that ends up with: (gdb) print nprocs $2 =3D 12873340 (I checked the code and "info reg" and the value matched.) So things are already well messed up here. That in turn ends up used in: size =3D nprocs * sizeof(struct kinfo_proc); kd->procbase =3D (struct kinfo_proc *)_kvm_malloc(k= d, size); if (kd->procbase =3D=3D NULL) return (0); which succeeds but later there is: nprocs =3D kvm_deadprocs(kd, op, arg, nl[1].n_value, nl[2].n_value, nprocs); if (nprocs <=3D 0) { _kvm_freeprocs(kd); nprocs =3D 0; } which in kvm_deadprocs gets to: if (KREAD(kd, a_allproc, &p)) { _kvm_err(kd, kd->program, "cannot read allproc"); return (-1); } acnt =3D kvm_proclist(kd, what, arg, p, bp, maxcnt); if (acnt < 0) return (acnt); where: static int kvm_proclist(kvm_t *kd, int what, int arg, struct proc *p, struct kinfo_proc *bp, int maxcnt) { int cnt =3D 0; . . . is used via: kvm_proclist (kd=3D0x41e14000, what=3D5, arg=3D0, p=3D0x0, bp=3D0x42000000, maxcnt=3D12873340) and the internal kvm_proclist loop no-ops because of p: for (; cnt < maxcnt && p !=3D NULL; p =3D LIST_NEXT(&proc, = p_list)) { So no process is listed. After the loop is: return (cnt); } And that means: nprocs =3D kvm_deadprocs(kd, op, arg, nl[1].n_value, nl[2].n_value, nprocs); if (nprocs <=3D 0) { _kvm_freeprocs(kd); nprocs =3D 0; } ends up with nprocs=3D=3D0 and kd is freed, hopefully including kd->procbase being freed (I did not look). But overall: at least one KREAD gets back a junk figure. And with that I think I will stop for this note. --=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-219153-29464-2pzrB9DGJx>