Subject: Re: port-xen/29887: sysctl kern.consdev coredumps
To: None <port-xen-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Andrew Brown <atatat@atatdot.net>
List: netbsd-bugs
Date: 04/07/2005 13:07:01
The following reply was made to PR port-xen/29887; it has been noted by GNATS.

From: Andrew Brown <atatat@atatdot.net>
To: Christos Zoulas <christos@zoulas.com>
Cc: Manuel Bouyer <bouyer@antioche.eu.org>, gnats-bugs@NetBSD.org,
	port-xen-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org
Subject: Re: port-xen/29887: sysctl kern.consdev coredumps
Date: Thu, 7 Apr 2005 09:06:38 -0400

 On Wed, Apr 06, 2005 at 04:33:42PM -0400, Christos Zoulas wrote:
 >On Apr 6,  9:23pm, bouyer@antioche.eu.org (Manuel Bouyer) wrote:
 >-- Subject: Re: port-xen/29887: sysctl kern.consdev coredumps
 >
 >| On Tue, Apr 05, 2005 at 03:21:00AM +0000, juan@xtraeme.nopcode.org wrote:
 >| > 
 >| > 	Running sysctl kern.consdev in a domU results in a coredump:
 >| > 
 >| > 	[juan@XenU_0][~]> sysctl kern.consdev          
 >| > 	zsh: segmentation fault (core dumped)  sysctl kern.consdev
 >| > 	[juan@XenU_0][~]>
 >| 
 >| Hi,
 >| Can you check if this is fixed by
 >| cd /dev
 >| sh MAKEDEV xencons
 >| 
 >| The default install doesn't create /dev/xencons, I have a patch to fix this.
 >
 >This should be assigned to atatat@netbsd.org. It should not coredump anyway.
 
 indeed!  can someone explain this:
 
      % cat > foo.c <<EOF
      #include <stdio.h>
 
      int
      main(int argc, char *argv[])
      {
 	     const void *v;
 	     const char *c;
 	     v = c = NULL;
 
 	     printf("%p\n", NULL);
 	     printf("%p\n", v);
 	     printf("%p\n", c);
 	     printf("%s\n", NULL);
 	     printf("%s\n", v);
 	     printf("%s\n", c);
 
 	     return (0);
      }
      EOF
      % cc -O2 foo.c
      % ./a.out
      0x0
      0x0
      0x0
      (null)
      (null)
      Segmentation fault (core dumped)
      % cc -O1 foo.c
      % ./a.out
      0x0
      0x0
      0x0
      (null)
      (null)
      Segmentation fault (core dumped)
      % cc -O0 foo.c
      % ./a.out
      0x0
      0x0
      0x0
      (null)
      (null)
      (null)
 
 -- 
 |-----< "CODE WARRIOR" >-----|
 codewarrior@daemon.org             * "ah!  i see you have the internet
 twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
 werdna@squooshy.com       * "information is power -- share the wealth."