From owner-freebsd-hackers Fri Nov 15 09:56:59 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA03369 for hackers-outgoing; Fri, 15 Nov 1996 09:56:59 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id JAA03258 for ; Fri, 15 Nov 1996 09:56:20 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.7.6/8.6.9) id EAA20990; Sat, 16 Nov 1996 04:54:32 +1100 Date: Sat, 16 Nov 1996 04:54:32 +1100 From: Bruce Evans Message-Id: <199611151754.EAA20990@godzilla.zeta.org.au> To: bde@zeta.org.au, jgreco@brasil.moneng.mei.com, terry@lambert.org Subject: Re: Sockets question... Cc: hackers@FreeBSD.ORG, jdp@polstra.com, scrappy@ki.net Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk I wrote: >... Short reads are possible even for >normal files because the read might be into a partially invalid >buffer. ffs_read() returns the blocks that are successfully >read instead of unwinding the read and returning an EFAULT error. >Example: > >--- >#include >#include > >#define SIZE 0x10000 > >main() >{ > void *buf; > int n; > > > buf = malloc(0x10000); > n = read(0, buf, 0x10000); > printf("read %d\n", n); >} >--- > >This prints 65536 here. A watertight example can be probably be >constructed using mmap(). Oops, pass the pointy hat. This is a non-example since i forgot to increase the read size and forget to tell you to invoke it with /kernel as stdin. Increasing the read size to 0x20000 gives more interesting behaviour: on system 1 with 32MB RAM: the kernel panics with a double fault on system 2 with 8MB RAM: read returns -1. I have seen a similar panic for writing from a bad address like 0xfffffc00 but I couldn't duplicate the problem and I thought it had something to do with a fixed vm bug. Bruce