On 11/3/21 11:13, Konstantin Belousov wrote:
On Wed, Nov 03, 2021 at 11:05:11AM -0400, Michael Butler via freebsd-emulation 
wrote:
On 11/3/21 10:36, Ed Maste wrote:
The kgdb back-trace isn't any more enlightening to me :-(

__curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
55              __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct
pcpu,
(kgdb) bt
#0  __curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
#1  doadump (textdump=<optimized out>) at
/usr/src/sys/kern/kern_shutdown.c:399
#2  0xffffffff808cbac5 in kern_reboot (howto=260) at
/usr/src/sys/kern/kern_shutdown.c:487
#3  0xffffffff808cbedb in vpanic (fmt=<optimized out>,
ap=0xfffffe0129a6a8d0) at /usr/src/sys/kern/kern_shutdown.c:920
#4  0xffffffff808cbd33 in panic (fmt=<unavailable>) at
/usr/src/sys/kern/kern_shutdown.c:844
#5  0xffffffff80ca920c in trap_fatal (frame=frame@entry=0xfffffe0129a6aac0,
eva=0) at /usr/src/sys/amd64/amd64/trap.c:946
#6  0xffffffff80ca95af in trap_pfault (frame=frame@entry=0xfffffe0129a6aac0,
usermode=false, signo=<optimized out>, signo@entry=0x0, ucode=<optimized
out>, ucode@entry=0x0)
     at /usr/src/sys/amd64/include/cpufunc.h:417
#7  0xffffffff80ca89bc in trap (frame=0xfffffe0129a6aac0) at
/usr/src/sys/amd64/amd64/trap.c:443
#8  <signal handler called>
#9  strlen () at /usr/src/sys/amd64/amd64/support.S:751
#10 0xffffffff808b4d79 in sysctl_kern_proc_pathname (oidp=<optimized out>,
arg1=0xfffffe0129a6ad8c, arg2=<optimized out>, req=0xfffffe0129a6acc0) at
/usr/src/sys/kern/kern_proc.c:2330
#11 0xffffffff808dc331 in sysctl_root_handler_locked
(oid=oid@entry=0xffffffff810cf0e0 <sysctl___kern_proc_pathname>,
arg1=arg1@entry=0xfffffe0129a6ad8c, arg2=arg2@entry=1,
     req=0xfffffe0129a6acc0, tracker=tracker@entry=0xfffffe0129a6ac38) at
/usr/src/sys/kern/kern_sysctl.c:185
#12 0xffffffff808db88b in sysctl_root (oidp=<optimized out>,
arg1=0xfffffe0129a6ad8c, arg1@entry=0xfffffe0129a6ad80, arg2=1,
arg2@entry=4, req=req@entry=0xfffffe0129a6acc0)
     at /usr/src/sys/kern/kern_sysctl.c:2305
#13 0xffffffff808dbdf3 in userland_sysctl (td=td@entry=0xfffffe012991a000,
name=name@entry=0xfffffe0129a6ad80, namelen=4, old=<optimized out>,
oldlenp=<optimized out>,
     inkernel=<optimized out>, inkernel@entry=0, new=0x0, newlen=0,
retval=0xfffffe0129a6ade8, flags=0) at /usr/src/sys/kern/kern_sysctl.c:2462
#14 0xffffffff808dbc3c in sys___sysctl (td=0xfffffe012991a000,
uap=0xfffffe012991a3f0) at /usr/src/sys/kern/kern_sysctl.c:2335
#15 0xffffffff80ca9b5c in syscallenter (td=0xfffffe012991a000) at
/usr/src/sys/amd64/amd64/../../kern/subr_syscall.c:189
#16 amd64_syscall (td=0xfffffe012991a000, traced=0) at
/usr/src/sys/amd64/amd64/trap.c:1191
#17 <signal handler called>
#18 0x000000080315a71a in ?? ()
Backtrace stopped: Cannot access memory at address 0x7fffffffc778
(kgdb)


Try this

commit 2d3f95bd1fd4f71769f60b8037c1ff27c75d8258
Author: Konstantin Belousov <k...@freebsd.org>
Date:   Wed Nov 3 17:11:33 2021 +0200

     proc_get_binpath(): return empty string instead of NULL
for strange case where process does not have text. Sponsored by: The FreeBSD Foundation
     MFC after:      3 days

diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 2156c5c465ba..d11f651960c0 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -2252,7 +2252,7 @@ proc_get_binpath(struct proc *p, char *binname, char 
**retbuf,
        vp = p->p_textvp;
        if (vp == NULL) {
                PROC_UNLOCK(p);
-               *retbuf = NULL;
+               *retbuf = "";
                *freebuf = NULL;
                return (0);
        }


Interestingly, when I went to log out of KDE afer applying this patch and rebuilding the kernel, it also paniced without VBox ruuning. The log looks similar but the back-trace points to this possibility .. see frames 8 through 10 .

__curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
55 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu,
(kgdb) #0  __curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
#1  doadump (textdump=<optimized out>)
    at /usr/src/sys/kern/kern_shutdown.c:399
#2  0xffffffff808cbac5 in kern_reboot (howto=260)
    at /usr/src/sys/kern/kern_shutdown.c:487
#3 0xffffffff808cbedb in vpanic (fmt=<optimized out>, ap=0xfffffe011c1858d0)
    at /usr/src/sys/kern/kern_shutdown.c:920
#4  0xffffffff808cbd33 in panic (fmt=<unavailable>)
    at /usr/src/sys/kern/kern_shutdown.c:844
#5  0xffffffff80ca920c in trap_fatal (frame=frame@entry=0xfffffe011c185ac0,
    eva=0) at /usr/src/sys/amd64/amd64/trap.c:946
#6 0xffffffff80ca95af in trap_pfault (frame=frame@entry=0xfffffe011c185ac0,
    usermode=false, signo=<optimized out>, signo@entry=0x0,
    ucode=<optimized out>, ucode@entry=0x0)
    at /usr/src/sys/amd64/include/cpufunc.h:417
#7  0xffffffff80ca89bc in trap (frame=0xfffffe011c185ac0)
    at /usr/src/sys/amd64/amd64/trap.c:443
#8  <signal handler called>
#9  strlen () at /usr/src/sys/amd64/amd64/support.S:751
#10 0xffffffff808b4d79 in sysctl_kern_proc_pathname (oidp=<optimized out>,
    arg1=0xfffffe011c185d8c, arg2=<optimized out>, req=0xfffffe011c185cc0)
    at /usr/src/sys/kern/kern_proc.c:2330
#11 0xffffffff808dc331 in sysctl_root_handler_locked (
    oid=oid@entry=0xffffffff810cf0e0 <sysctl___kern_proc_pathname>,
    arg1=arg1@entry=0xfffffe011c185d8c, arg2=arg2@entry=1,
    req=0xfffffe011c185cc0, tracker=tracker@entry=0xfffffe011c185c38)
    at /usr/src/sys/kern/kern_sysctl.c:185

After rebooting with this patch, I can now run a VBox VM without provoking a panic. Thanks! :-)

        Michael


Reply via email to