panic on close of /dev/xen/evtchn

Steven Hartland killing at multiplay.co.uk
Sat Oct 19 00:04:33 UTC 2013


Having a quick look I believe this device shouldn't even
be initialised unless its running under xen so I believe
the correct fix is:-

svn diff sys/xen/evtchn/evtchn_dev.c
Index: sys/xen/evtchn/evtchn_dev.c
===================================================================
--- sys/xen/evtchn/evtchn_dev.c (revision 256554)
+++ sys/xen/evtchn/evtchn_dev.c (working copy)
@@ -325,23 +325,23 @@
        .d_name =       "evtchn",
 };

-
 /* XXX  - if this device is ever supposed to support use by more than one process
  * this global static will have to go away
  */
 static struct cdev *evtchn_dev;

-
-
-static int
+static void
 evtchn_dev_init(void *dummy __unused)
 {
+       if (!is_running_on_xen())
+               return;
+
        /* XXX I believe we don't need these leaving them here for now until we
         * have some semblance of it working
         */
        mtx_init(&upcall_lock, "evtchup", NULL, MTX_DEF);

-       /* (DEVFS) create '/dev/misc/evtchn'. */
+       /* (DEVFS) create '/dev/xen/evtchn'. */
        evtchn_dev = make_dev(&evtchn_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "xen/evtchn");

        mtx_init(&lock, "evch", NULL, MTX_SPIN | MTX_NOWITNESS);
@@ -351,8 +351,6 @@

        if (bootverbose)
                printf("Event-channel device installed.\n");
-
-       return 0;
 }

 SYSINIT(evtchn_dev_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, evtchn_dev_init, NULL);

Yes / No?

    Regards
    Steve
----- Original Message ----- 
From: "Steven Hartland" <killing at multiplay.co.uk>
To: <hackers at freebsd.org>
Sent: Friday, October 18, 2013 4:33 PM
Subject: panic on close of /dev/xen/evtchn


> Just had my test box panic while doing a:
> find / -print0 | xargs -0 cat
>
> Ignoring the fact thats a silly command to run, the
> panic appears to be when it ran:
> cat /dev/xen/evtchn
>
> On the session it then printed:
> cat: /dev/xen/evtchn: Interrupted system call
>
> At this point the system paniced.
>
> Panic transcribed from screen is:
>
> Stopped at evtchn_close:0x67:   lock bts| %ebx,0xa00(%rax)
>
> db> bt
> Tracing pdi 1533 tid 100370 td 0xfffff8000796e920
> evtchn_close() at evtchn_close+0x67/frame ...
> devfs_close() at devs_close+0x188/frame ...
> VOP_CLOSE_APV() at VOP_CLOSE_APV+0x139/frame ...
> vn_close() at vn_close+0x139/frame ...
> vn_closefile() at vn_closefile+0x48/frame ...
> _fdrop() at _fdrop+0x29/frame ...
> closef() at closef+0x1d1/frame ...
> closefp() at closefp+0xa0/frame ...
> amd64_syscall() at amd64_syscall+0x265/frame ...
> Xfast_syscall() at Xfast_syscall+0xfb/frame ...
> --- syscall (6, FreeBSD ELF64, sys_close), rip = 0x80094a9ea, rsp = 0x7ffffffb8e28, rbp -= 0x7ffffffb8f70 ---
>
>    Regards
>    Steve
>
> ================================================
> This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the 
> event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any 
> information contained in it.
> In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337
> or return the E.mail to postmaster at multiplay.co.uk.
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
> 


================================================
This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. 

In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337
or return the E.mail to postmaster at multiplay.co.uk.



More information about the freebsd-hackers mailing list