From owner-cvs-all Sun Jul 23 15:57:28 2000 Delivered-To: cvs-all@freebsd.org Received: from localhost (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 32BCF37BB01; Sun, 23 Jul 2000 15:56:54 -0700 (PDT) (envelope-from green@FreeBSD.org) Date: Sun, 23 Jul 2000 18:56:25 -0400 (EDT) From: Brian Fundakowski Feldman X-Sender: green@green.dyndns.org To: Marcel Moolenaar Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/i386/linux linux_misc.c linux_util.c linux_util.h In-Reply-To: <200007231654.JAA35253@freefall.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 23 Jul 2000, Marcel Moolenaar wrote: > marcel 2000/07/23 09:54:19 PDT > > Modified files: > sys/i386/linux linux_misc.c linux_util.c linux_util.h > Log: > Add bounds checking to stackgap_alloc. Previously it was possible > to construct a path that was long enough (ie longer than > SPARE_USRSPACE bytes) and trash the stack. > > Note that SPARE_USRSPACE is much smaller than MAXPATHLEN so that > the Linuxulator will now return ENAMETOOLONG even if the path > is smaller than MAXPATHLEN. Have you thought about simply doing a simple allocation (vm_mmap() will do) of a block of data, creating a linux_emuldata to point the proc.p_emuldata to, sticking a reference to the vm_object there, mapping that page into kmem_map (and keeping an easy-to-use reference address to the userland address, of course) and using it instead of the stackgap? You'd have to do it per-process, even for LinuxThreads, and an idiot user could unmap it (but that would just cause namei() to EFAULT) and shoot themselves in the foot... You lose a page of memory (wired :-/) per Linux process, but you gain better code and the ability to properly use the entire size of a path for the Linux code. Another possibility is to use the upages, which makes it pretty simple, too :) In any case, let's find a better solution than using stackgap at all. -- Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! / green@FreeBSD.org `------------------------------' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message