put Proper patches back in since they are probably not the cause of the kernel crashes
authorMark Huang <mlhuang@cs.princeton.edu>
Sun, 19 Dec 2004 04:27:18 +0000 (04:27 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Sun, 19 Dec 2004 04:27:18 +0000 (04:27 +0000)
Makefile
fs/ioctl.c
fs/namei.c
include/linux/vserver/inode.h
kernel/vserver/inode.c
scripts/kernel-2.6-planetlab.spec

index f43c736..4d94580 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 8
-EXTRAVERSION = -1.521.2.4.planetlab
+EXTRAVERSION = -1.521.2.5.planetlab
 NAME=Zonked Quokka
 
 # *DOCUMENTATION*
index 96a1b60..6404b0c 100644 (file)
@@ -173,6 +173,19 @@ asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
                                error = vx_proc_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
                        break;
 #endif
+               case FIOC_SETIATTR:
+               case FIOC_GETIATTR:
+                       /*
+                        * Verify that this filp is a file object,
+                        * not (say) a socket.
+                        */
+                       error = -ENOTTY;
+                       if (S_ISREG(filp->f_dentry->d_inode->i_mode) ||
+                           S_ISDIR(filp->f_dentry->d_inode->i_mode))
+                               error = vc_iattr_ioctl(filp->f_dentry,
+                                                      cmd, arg);
+                       break;
+
                default:
                        error = -ENOTTY;
                        if (S_ISREG(filp->f_dentry->d_inode->i_mode))
index 4b3e1ca..656430d 100644 (file)
@@ -214,20 +214,6 @@ int vfs_permission(struct inode * inode, int mask)
        return -EACCES;
 }
 
-static inline int xid_permission(struct inode *inode, int mask, struct nameidata *nd)
-{
-       if (inode->i_xid == 0)
-               return 0;
-       if (vx_check(inode->i_xid, VX_ADMIN|VX_WATCH|VX_IDENT))
-               return 0;
-/*
-       printk("VSW: xid=%d denied access to %p[#%d,%lu] »%*s«.\n",
-               vx_current_xid(), inode, inode->i_xid, inode->i_ino,
-               nd->dentry->d_name.len, nd->dentry->d_name.name);
-*/
-       return -EACCES;
-}
-
 int permission(struct inode * inode,int mask, struct nameidata *nd)
 {
        int retval;
@@ -241,8 +227,6 @@ int permission(struct inode * inode,int mask, struct nameidata *nd)
                (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
                return -EROFS;
 
-       if ((retval = xid_permission(inode, mask, nd)))
-               return retval;
        if (inode->i_op && inode->i_op->permission)
                retval = inode->i_op->permission(inode, submask, nd);
        else
index fc49aba..e19632d 100644 (file)
@@ -57,6 +57,10 @@ extern int vc_set_iattr_v0(uint32_t, void __user *);
 extern int vc_get_iattr(uint32_t, void __user *);
 extern int vc_set_iattr(uint32_t, void __user *);
 
+extern int vc_iattr_ioctl(struct dentry *de,
+                         unsigned int cmd,
+                         unsigned long arg);
+
 #endif /* __KERNEL__ */
 
 /* inode ioctls */
@@ -64,4 +68,7 @@ extern int vc_set_iattr(uint32_t, void __user *);
 #define FIOC_GETXFLG   _IOR('x', 5, long)
 #define FIOC_SETXFLG   _IOW('x', 6, long)
 
+#define FIOC_GETIATTR   _IOR('x', 7, long)
+#define FIOC_SETIATTR   _IOR('x', 8, long)
+
 #endif /* _VX_INODE_H */
index dda8818..3e8120b 100644 (file)
@@ -170,6 +170,37 @@ int vc_set_iattr(uint32_t id, void __user *data)
        return ret;
 }
 
+int vc_iattr_ioctl(struct dentry *de, unsigned int cmd, unsigned long arg)
+{
+       void __user *data = (void __user *)arg;
+       struct vcmd_ctx_iattr_v1 vc_data;
+       int ret;
+
+       /*
+        * I don't think we need any dget/dput pairs in here as long as
+        * this function is always called from sys_ioctl i.e., de is
+         * a field of a struct file that is guaranteed not to be freed.
+        */
+       if (cmd == FIOC_SETIATTR) {
+               if (!capable(CAP_SYS_ADMIN) || !capable(CAP_LINUX_IMMUTABLE))
+                       return -EPERM;
+               if (copy_from_user (&vc_data, data, sizeof(vc_data)))
+                       return -EFAULT;
+               ret = __vc_set_iattr(de,
+                       &vc_data.xid, &vc_data.flags, &vc_data.mask);
+       }
+       else {
+               if (!vx_check(0, VX_ADMIN))
+                       return -ENOSYS;
+               ret = __vc_get_iattr(de->d_inode,
+                       &vc_data.xid, &vc_data.flags, &vc_data.mask);
+       }
+
+       if (!ret && copy_to_user (data, &vc_data, sizeof(vc_data)))
+               ret = -EFAULT;
+       return ret;
+}
+
 
 #ifdef CONFIG_VSERVER_LEGACY           
 #include <linux/proc_fs.h>
index f961ec1..72d0603 100644 (file)
@@ -22,7 +22,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 %define kversion 2.6.%{sublevel}
 %define rpmversion 2.6.%{sublevel}
 %define rhbsys  %([ -r /etc/beehive-root ] && echo  || echo .`whoami`)
-%define release 1.521.2.4.planetlab%{?date:.%{date}}
+%define release 1.521.2.5.planetlab%{?date:.%{date}}
 %define signmodules 0
 
 %define KVERREL %{PACKAGE_VERSION}-%{PACKAGE_RELEASE}