Subject: kern/26661: bug in VM causes segfaul
To: None <>
From: None <>
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
>Originator:     Christoph Egger
>Release:        NetBSD 2.0_BETA (netbsd-2-0 branch)
System: NetBSD 2.0_BETA NetBSD 2.0_BETA (GENERIC) #0: Sat Jul 31 14:12:00 CEST 2004 sparc64
Architecture: sparc64
Machine: sparc64



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.