Subject: kern/26661: bug in VM causes segfaul
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <Christoph_Egger@gmx.de>
List: netbsd-bugs
Date: 08/14/2004 12:51:06
>Number:         26661
>Category:       kern
>Synopsis:       bug in VM causes segfaul
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 14 15:16:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Christoph Egger
>Release:        NetBSD 2.0_BETA (netbsd-2-0 branch)
>Organization:
>Environment:
System: NetBSD phoenix.eggernet.de 2.0_BETA NetBSD 2.0_BETA (GENERIC) #0: Sat Jul 31 14:12:00 CEST 2004 root@phoenix.eggernet.de:/usr/objdir.sparc64/sys/arch/sparc64/compile/GENERIC sparc64
Architecture: sparc64
Machine: sparc64



>Description:


Hi!


All applications that do the following crashes on the sparc64
port (I don't know, if the crash happens on other ports, too):


#include <stdio.h>


struct foo_t {
        int a;
        unsigned char buf[8192];
};

struct bar_t {
        int i1;
        int i2;

        double d1;
        double d2;
};


int main(void)
{
        int a = 0;
        struct foo_t f;
        struct bar_t *b;

        memset(&f, 0, sizeof(f));
        f.buf[2] = 2;

        b = (struct bar_t *)(f.buf + 2);
        a = b->i2;  // <-- accessing b causes segfault

        printf("a: %i\n", a);
        return 0;
}


I have tested it on other OS's (Darwin/ppc32, Solaris/sparc64)
and this small app does NOT crash there.

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted: