Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jan 2000 20:57:29 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        "Scott Hess" <scott@avantgo.com>
Cc:        <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: aio_read crashing certain kernels.
Message-ID:  <200001270457.UAA18887@apollo.backplane.com>
References:  <01b301bf6824$46e928a0$1e80000a@avantgo.com> <200001262330.PAA16635@apollo.backplane.com> <066e01bf6877$02deb550$1e80000a@avantgo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

:The simplest program imaginable causes the problem (see included file for
:an example).  Another item came to mind - SMP.  The boxes with the crashes
:are SMP, the box without the crashes is not.  Since rfork(RFMEM) doesn't
:work with SMP, and aio_read seems to be implemented by sharing memory with
:an aiod process, perhaps it's the same issue?  [If so, perhaps it needs to
:be returning an ENOTSUPP from aio_read :-).]
:
:void main( void)
:{
:    int fd=open( "/tmp/myfile", O_RDONLY);
:    char buf[ 1024];
:    struct aiocb iocb;
:    iocb.aio_fildes=fd;
:    iocb.aio_offset=0;
:    iocb.aio_buf=buf;
:    iocb.aio_nbytes=sizeof( buf);
:    iocb.aio_sigevent.sigev_notify=SIGEV_SIGNAL;
:    iocb.aio_sigevent.sigev_signo=SIGIO;
:    aio_read( &iocb);
:}
:
:Thanks,
:scott

    This is an incredibly scary program! It's sending an iocb to aio_read 
    and then pops the stack and exits.  The act of exiting could very well
    scribble all over the iocb structure while the I/O is in progress and, 
    of course, then the program invalidates the stack and exits.

    I haven't been able to reproduce the crash on my 3.4 test box yet,
    I've tried both SMP and non-SMP builds (it's a duel-cpu box).

    I would like you to make some modifications to your program ... please
    bzero() the iocb structure before you initialize it, and see if the
    problem still occurs.

    If it does, then try putting a sleep(5) after the aio_read() and
    see if the problem still occurs.

    You could be right about the SMP build --- the aio code is indeed 
    doing a fork with RFMEM and that *WILL* break under SMP.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001270457.UAA18887>