tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: netbsd-5: panic: ureadc: non-positive resid



On Sun, Oct 11, 2009 at 01:18:33AM -0400, Matthew Mondor wrote:
> Under some circumstances, the following panic occurs:
> panic: ureadc: non-positive resid
> 
> Interestingly, I've been able to reproduce it in the following peculiar
> way.
...
>       iov[0].iov_base = buffer;
>       iov[0].iov_len = 0;
>       preadv(0, iov, 1, 0);

> which of course, normally fails with EINVAL.

I've finally found out why it doesn't always panic!

If you do a read on a 'normal' device open, the code goes through
spec_read() - which contains: if (uio->uio_resid == 0) return 0;
(I'm not sure why/where this gets converted to EINVAL though!)

However if you go through the 'fdesc' code, or the 'pty' code
I can't find a check - which means that the tty line discipline
code (which doesn't contain a check) explodes in ureadc().

The pty master side also looks buggy....

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index