Re: cvs commit: src/sys/alpha/linux linux_sysvec.c src/sys/alpha/osf1 imgact_osf1.c osf1_sysvec.c src/sys/amd64/linux32 linux32_sysvec.c src/sys/compat/ia32 ia32_sysvec.c src/sys/compat/pecoff imgact_pecoff.c src/sys/compat/svr4 imgact_svr4.c svr4_sysvec.c ...

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 1 Feb 2005 16:12:09 -0500
On Tuesday 01 February 2005 11:28 am, John Baldwin wrote:
> On Tuesday 01 February 2005 10:26 am, Maxim Sobolev wrote:
> > John Baldwin wrote:
> > > On Monday 31 January 2005 06:10 pm, Maxim Sobolev wrote:
> > >>John Baldwin wrote:
> > >>>On Saturday 29 January 2005 06:12 pm, Maxim Sobolev wrote:
> > >>>>sobomax     2005-01-29 23:12:00 UTC
> > >>>>
> > >>>> FreeBSD src repository
> > >>>>
> > >>>> Modified files:
> > >>>>   sys/alpha/linux      linux_sysvec.c
> > >>>>   sys/alpha/osf1       imgact_osf1.c osf1_sysvec.c
> > >>>>   sys/amd64/linux32    linux32_sysvec.c
> > >>>>   sys/compat/ia32      ia32_sysvec.c
> > >>>>   sys/compat/pecoff    imgact_pecoff.c
> > >>>>   sys/compat/svr4      imgact_svr4.c svr4_sysvec.c
> > >>>>   sys/i386/ibcs2       ibcs2_sysvec.c imgact_coff.c
> > >>>>   sys/i386/linux       imgact_linux.c linux_sysvec.c
> > >>>>                        linux_machdep.c
> > >>>>   sys/kern             imgact_aout.c imgact_elf.c imgact_gzip.c
> > >>>>                        imgact_shell.c kern_exec.c kern_kse.c
> > >>>>   sys/modules          Makefile
> > >>>>   sys/sys              imgact.h syscallsubr.h
> > >>>> Log:
> > >>>> o Split out kernel part of execve(2) syscall into two parts: one
> > >>>> that copies arguments into the kernel space and one that operates
> > >>>> completely in the kernel space;
> > >>>>
> > >>>> o use kernel-only version of execve(2) to kill another stackgap in
> > >>>>   linuxlator/i386.
> > >>>>
> > >>>> Obtained from:  DragonFlyBSD (partially)
> > >>>> MFC after:      2 weeks
> > >>>
> > >>>Cool, this had been on my anti-stackgap todo list as well.
> > >>>
> > >>:-)
> > >>
> > >>We have been tolerating this stackgap hack for too long.
> > >>
> > >>Right now linuxlator/i386 is almost stackgap-free. The only remaining
> > >>stackgap is in semctl(2) syscal, which in my opinion it is very
> > >>over/under engineered API, so that there is no a good clean way to do
> > >>the split. At the same time, it's not the one used oftenly, so that  I
> > >>can wait when I (or somebody else) is in the right mood to do the
> > >>remaining work.
> > >>
> > >>Other arches/emulation layers are awaiting for somebody (maintainers?)
> > >>to do the work, which will be very easy one, since most popular kernel
> > >>interfaces that work on userland structures/buffers have been split.
> > >
> > > That's not the only one.  All the filesystem system calls use the
> > > stackgap to handle the /compat/linux namespace.  Fixing that will not
> > > be trivial, as it will involve teaching namei() to retrieve filenames
> > > using a uio or some such so that names can either be in user space or
> > > in kernel space.  Either that or we add native support for prefixes
> > > like /compat/foo to namei() by sticking a pointer to a prefix in struct
> > > sysent or some such.
> >
> > Hmm, are you 100% sure? As long as I can see they all use LCONVPATH()
> > macros, which in turn uses linux_emul_convpath() function from
> > linux_util.c. The latter function is stackgap-free. The only
> > commonly-used function "infected" with stackgap in linuxlator is
> > linux_emul_find (and so that CHECKALT*() macroses that use it). My plan
> > was to remove that function entirely, but apparently it is still used in
> > non-i386 versions of linuxlator, so that it can be done yet.
>
> Ah, someone fixed this already while I wasn't looking.  Now we should just
> genericize linux_emul_convpath() (to take a prefix argument) and fix all
> the ABIs to use that instead.  I can add that to my todo list I guess. 
> There are also other stackgap uses in other ABIs that need to be worked on
> besides just Linux/i386, but those are already on my todo.

In fact, I'm currently working on this.  Watch this space. :)

-- 
John Baldwin <jhb_at_FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Received on Tue Feb 01 2005 - 21:21:41 UTC