DragonFly BSD
DragonFly kernel List (threaded) for 2004-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Q: chroot(9) returning EFAULT


From: Paul Herman <pherman@xxxxxxxxxxxxxxx>
Date: Mon, 15 Mar 2004 17:36:29 -0800 (PST)

Hey guys,

I'm working on a syscall that has a chroot in it, and for the life
of me, I can't figure out why chroot(9) keeps returning EFAULT.  I
took the lead from jail(2) in kern_jail.c and I basically have
something like this:

int
my_syscall(struct my_syscall_args *uap)
{
       struct chroot_args ca;

       MALLOC(ca.path, const char *, MAXPATHLEN , M_TEMP, M_WAITOK);
       error = copystr(someotherpath, ca.path, MAXPATHLEN, 0);
       if (error)
               return (error);
       error = chroot(&ca);
       if (error)
                return (error);
       FREE(ca.path, M_TEMP);
}

Where someotherpath was allocated by another thread but still
exists in kernel space.  However, even if ca.path points to a
char[MAXPATHLEN] on the stack it still returns EFAULT.  Help!  I'm
definately missing something here and I don't see it.  Any ideas?

-Paul.



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]