From owner-freebsd-bugs Mon Dec 7 07:38:37 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA09532 for freebsd-bugs-outgoing; Mon, 7 Dec 1998 07:38:37 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from ns1.yes.no (ns1.yes.no [195.204.136.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA09522 for ; Mon, 7 Dec 1998 07:38:36 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.9.1a/8.9.1) with ESMTP id QAA19839; Mon, 7 Dec 1998 16:38:29 +0100 (CET) Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id QAA19995; Mon, 7 Dec 1998 16:38:22 +0100 (MET) Message-ID: <19981207163821.K13839@follo.net> Date: Mon, 7 Dec 1998 16:38:21 +0100 From: Eivind Eklund To: dg@root.com, Dmitrij Tejblum Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: mmap of large files References: <199812020021.DAA00861@tejblum.dnttm.rssi.ru> <199812020545.VAA03985@root.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2i In-Reply-To: <199812020545.VAA03985@root.com>; from David Greenman on Tue, Dec 01, 1998 at 09:45:42PM -0800 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Tue, Dec 01, 1998 at 09:45:42PM -0800, David Greenman wrote: > >Does the test > > if ((pos + size > (vm_offset_t)-PAGE_SIZE) || > >in the mmap syscall have any purpose, other than break mmap with > >pos > 4GB? > > I think the code is wrong. I think it should be (addr + size) and comparing > against -PAGE_SIZE is probably also wrong - careful attention needs to be > paid to rounding and overflow issues here. Needs more analysis. if ((pos > (vm_offset_t)-PAGE_SIZE || size > (vm_offset_t)-PAGE_SIZE - pos) || Overflow problem solved, assuming pos and size are unsigned (as they should be). Whether ignoring just the last page (ie, comparing against -PAGE_SIZE) is correct or not is up to someone else. Eivind. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message