Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Aug 2002 17:51:49 +0100
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        arch@FreeBSD.ORG
Subject:   Re: Solving the stack gap issue 
Message-ID:   <200208181751.aa29455@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Sun, 18 Aug 2002 07:19:07 %2B1000." <20020818055951.N12475-100000@gamplex.bde.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200208181751.aa29455>