From owner-freebsd-arch Sun Aug 18 9:51:57 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 018B237B400 for ; Sun, 18 Aug 2002 09:51:55 -0700 (PDT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id CDD4A43E75 for ; Sun, 18 Aug 2002 09:51:53 -0700 (PDT) (envelope-from iedowse@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 18 Aug 2002 17:51:52 +0100 (BST) To: Bruce Evans Cc: arch@FreeBSD.ORG Subject: Re: Solving the stack gap issue In-Reply-To: Your message of "Sun, 18 Aug 2002 07:19:07 +1000." <20020818055951.N12475-100000@gamplex.bde.org> Date: Sun, 18 Aug 2002 17:51:49 +0100 From: Ian Dowse Message-ID: <200208181751.aa29455@salmon.maths.tcd.ie> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <20020818055951.N12475-100000@gamplex.bde.org>, Bruce Evans writes: >enough compat code). Some compat code doesn't know this very well and >causes panics by accessing the stack gap directly. Non-broken code >would require lots more copyins and copyouts to avoid direct accesses: Yes, I noticed a lot of places where the Linux emulation code was accessing stack gap data without using copyin/copyout. Is there a disabled check for this somewhere in the vm_fault code? I seem to remember it being discussed somewhere but I can't find any references in the code. >> open(struct thread *td, struct open_args *uap) > >I would prefer this to be named something like xxx_open() and in a >translation layer between Xsyscall() and open(), with the translation >layer as null as possible. >> int sys_open(struct thread *td, char *path, enum uio_seg pathseg, >> int flags, int mode); > >I would prefer this to be named open() and take the same args as open(2). >Passing around td args seems to just lead to pessimizations and bugs, >since syscalls especially almost require td == curthread to work... The only issue with naming things this way is that all other callers of the system call (mainly other compat modules) need to be changed one way or another at the same time. I just did it this way so that syscalls could be changed over one at a time without touching their callers for now. If there is agreement on the td vs. curthread issue, then that would obviously be easy to change. Note that many system calls are not as simple as open(2), so having the same arguments for the user and kernel versions is not always practical. For example when there is a combination of user-supplied structures and buffers, the overhead of copying everything into the kernel by the compat module would be too high. For *ctl() sysctls, it may require duplicating much of the logic of the kernel syscall in the wrapper. A copyin/copyout function that takes a UIO_*SPACE argument might help. Ian (Apologies for the duplicated chunk in the previous mail BTW - I somehow didn't notice before sending that it had double-pasted.) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message