Subject: b17.1: exception STATUS_ACCESS_VIOLATION after fork()
From: [email-masked] (Commandant Sylvestre)

25 Feb 1997 16:59:40 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: Laurent Montaron <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Original-To: [email-masked] (GNU-WIN32 Mailing List)
X-Mailer: ELM [version 2.4ME+ PL19 (25)]
Original-Sender: [email-masked]

Sorry if this is already covered... I didn't find an archive of the mailing
list.

I'm trying to use the b17.1 on Win95 v4.00.950a (DELL Latitude XPI+ P133ST).
Any C code executed after a fork() triggers an exception and the process
immediately aborts.

The following code makes a fork. The child execs ls and the father just exits:

main() {
        int r ;
        r=fork() ;
        if (-1 == r) {
                perror("fork") ;
                exit(1) ;
        }
        if (0 == r) {
                execlp("ls","ls",0) ;
                perror("execlp") ;
                exit(1) ;
        }
        exit(0) ;
}

When executing that I have:
(a.exe 1012) In cygwin_except_handler
(a.exe 1012) Exception trapped!
(a.exe 1012) exception C0000005 at 10001083
(a.exe 1012) exception: ax FFFF1167 bx 286 cx C30AE3C4 dx 0
(a.exe 1012) exception: si 2578408 di 257F490 bp 257F560 sp 257F484
(a.exe 1012) exception is: STATUS_ACCESS_VIOLATION
(a.exe 1012) Stack trace:
(a.exe 1012) frame 0: sp = 0x257F29C, pc = 0x1001282A
(a.exe 1012) frame 1: sp = 0x257F2B8, pc = 0xBFF7663C
(a.exe 1012) frame 2: sp = 0x257F2DC, pc = 0xBFF859D9
(a.exe 1012) frame 3: sp = 0x257F374, pc = 0xFFECBAD7
(a.exe 1012) frame 4: sp = 0x257F560, pc = 0x10018743
(a.exe 1012) frame 5: sp = 0x257F5CC, pc = 0x401034
(a.exe 1012) frame 6: sp = 0x257F5D8, pc = 0x10011BEB
(a.exe 1012) frame 7: sp = 0x257FE14, pc = 0x10011BFF
(a.exe 1012) frame 8: sp = 0x257FE20, pc = 0x4011E4
(a.exe 1012) frame 9: sp = 0x257FE30, pc = 0x401012
(a.exe 1012) frame 10: sp = 0x257FE38, pc = 0xBFF88F75
(a.exe 1012) frame 11: sp = 0x257FF78, pc = 0xBFF88E23
(a.exe 1012) frame 12: sp = 0x257FFF4, pc = 0xBFF8783F
(a.exe 1012) frame 13: sp = 0x815914FC, pc = 0x3
(a.exe 1012) In cygwin_except_handler
(a.exe 1012) Error while dumping state (probably corrupted stack)

Note that the ls is executed properly if I add a sleep(1) ; just after
the fork().

-- 
Laurent Montaron                                    [email-masked]
75005 Paris, France, Europe                         [email-masked]
Planet Earth, Sol III, South-West Milky Way         Le_Chat on IRC/EFnet
Universe E45-A North, Continuum 28                  PGP key available
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".