> 
> Hm. The chroot(2) call changes the apparent root to a directory. This
> isn't necessarily the root of a mounted FS. So /dev/root should stay 
> as the root filesystem.

I know - I thought that is all he wanted - perhaps I haven't read his
message carefully enough, i.e. current->fs->root->d_inode->i_dev 

> To get the apparent root, look at /proc/self/root instead.
>                               

I forgot about /proc/self/root :) (btw, shouldn't vfs_readlink() return   
EFAULT if copy_to_user() fails? It acts on userspace buffer and
readlink(2) manpage documents EFAULT if buffer is invalid, cc;d Linus to
confirm and if so, the patch is below)

Regards,
Tigran.
  

--- namei.c.0   Sat Mar 18 08:06:38 2000
+++ namei.c     Sat Mar 18 08:07:08 2000
@@ -1506,7 +1506,8 @@
        len = strlen(link);
        if (len > buflen)
                len = buflen;
-       copy_to_user(buffer, link, len);
+       if(copy_to_user(buffer, link, len))
+               return -EFAULT;
 out:
        return len;
 }

Reply via email to