-Index: linux-2.6.4-51.0/fs/exec.c
+ fs/exec.c | 18 +++++++---
+ fs/namei.c | 86 +++++++++++++++++++++++++++++++++++++++++++++----
+ fs/namespace.c | 2 +
+ fs/nfs/dir.c | 4 +-
+ fs/open.c | 62 +++++++++++++++++++++++------------
+ fs/stat.c | 24 ++++++++++---
+ include/linux/dcache.h | 3 +
+ include/linux/fs.h | 8 ++++
+ include/linux/namei.h | 56 ++++++++++++++++++++++++++-----
+ kernel/ksyms.c | 8 ++++
+ 10 files changed, 222 insertions(+), 49 deletions(-)
+
+Index: uml-2.6.3/fs/exec.c
===================================================================
---- linux-2.6.4-51.0.orig/fs/exec.c 2004-04-05 12:41:59.000000000 -0400
-+++ linux-2.6.4-51.0/fs/exec.c 2004-04-05 17:36:42.000000000 -0400
-@@ -122,8 +122,11 @@
+--- uml-2.6.3.orig/fs/exec.c 2004-02-20 15:00:48.000000000 +0800
++++ uml-2.6.3/fs/exec.c 2004-02-21 00:15:14.154506296 +0800
+@@ -120,8 +120,11 @@
struct file * file;
struct nameidata nd;
int error;
error = __user_walk(library, LOOKUP_FOLLOW|LOOKUP_OPEN, &nd);
if (error)
goto out;
-@@ -136,7 +139,7 @@
+@@ -134,7 +137,7 @@
if (error)
goto exit;
error = PTR_ERR(file);
if (IS_ERR(file))
goto out;
-@@ -485,8 +488,9 @@
+@@ -474,8 +477,9 @@
int err;
struct file *file;
file = ERR_PTR(err);
if (!err) {
-@@ -499,7 +503,7 @@
+@@ -488,7 +492,7 @@
err = -EACCES;
file = ERR_PTR(err);
if (!err) {
if (!IS_ERR(file)) {
err = deny_write_access(file);
if (err) {
-Index: linux-2.6.4-51.0/fs/namei.c
+Index: uml-2.6.3/fs/namei.c
===================================================================
---- linux-2.6.4-51.0.orig/fs/namei.c 2004-04-05 12:41:59.000000000 -0400
-+++ linux-2.6.4-51.0/fs/namei.c 2004-04-05 17:36:42.000000000 -0400
-@@ -269,8 +269,19 @@
+--- uml-2.6.3.orig/fs/namei.c 2004-02-20 15:01:27.000000000 +0800
++++ uml-2.6.3/fs/namei.c 2004-02-20 23:59:00.678497144 +0800
+@@ -268,8 +268,19 @@
return 0;
}
dput(nd->dentry);
mntput(nd->mnt);
}
-@@ -347,7 +358,10 @@
+@@ -346,7 +357,10 @@
{
struct dentry * result;
struct inode *dir = parent->d_inode;
down(&dir->i_sem);
/*
* First re-do the cached lookup just in case it was created
-@@ -386,7 +400,10 @@
+@@ -385,7 +399,10 @@
if (result->d_op && result->d_op->d_revalidate) {
if (!result->d_op->d_revalidate(result, nd) && !d_invalidate(result)) {
dput(result);
}
}
return result;
-@@ -563,6 +580,33 @@
+@@ -562,6 +579,31 @@
return PTR_ERR(dentry);
}
+ if ((err = permission(dentry->d_parent->d_inode, MAY_EXEC,nd)))
+ return err;
+ new = real_lookup(dentry->d_parent, &dentry->d_name, nd);
-+ if (IS_ERR(new))
-+ return PTR_ERR(new);
+ d_invalidate(dentry);
+ dput(dentry);
+ nd->dentry = dentry = new;
/*
* Name resolution.
*
-@@ -663,7 +705,9 @@
+@@ -662,7 +704,9 @@
if (inode->i_op->follow_link) {
mntget(next.mnt);
dput(next.dentry);
mntput(next.mnt);
if (err)
-@@ -702,14 +746,29 @@
+@@ -701,6 +745,11 @@
inode = nd->dentry->d_inode;
/* fallthrough */
case 1:
+ nd->flags |= LOOKUP_LAST;
+ err = revalidate_special(nd);
+ nd->flags &= ~LOOKUP_LAST;
-+ if (err)
++ if (err)
+ break;
goto return_reval;
}
-+
-+ if (err) {
-+ if (!nd->dentry->d_inode)
-+ err = -ENOENT;
-+
-+ goto return_err;
-+ }
-+
if (nd->dentry->d_op && nd->dentry->d_op->d_hash) {
- err = nd->dentry->d_op->d_hash(nd->dentry, &this);
+@@ -708,7 +757,9 @@
if (err < 0)
break;
}
if (err)
break;
follow_mount(&next.mnt, &next.dentry);
-@@ -935,7 +994,7 @@
+@@ -934,7 +985,7 @@
}
/* SMP-safe */
{
unsigned long hash;
struct qstr this;
-@@ -955,11 +1014,16 @@
+@@ -954,11 +1005,16 @@
}
this.hash = end_name_hash(hash);
/*
* namei()
*
-@@ -971,7 +1035,7 @@
+@@ -970,11 +1026,12 @@
* that namei follows links, while lnamei does not.
* SMP-safe
*/
--int fastcall __user_walk(const char __user *name, unsigned flags, struct nameidata *nd)
-+int fastcall __user_walk_it(const char __user *name, unsigned flags, struct nameidata *nd)
+-int __user_walk(const char __user *name, unsigned flags, struct nameidata *nd)
++int __user_walk_it(const char __user *name, unsigned flags, struct nameidata *nd)
{
char *tmp = getname(name);
int err = PTR_ERR(tmp);
-@@ -983,6 +1047,12 @@
+
++
+ if (!IS_ERR(tmp)) {
+ err = path_lookup(tmp, flags, nd);
+ putname(tmp);
+@@ -982,6 +1039,12 @@
return err;
}
/*
* It's inline, so penalty for filesystems that don't use sticky bit is
* minimal.
-@@ -1255,8 +1325,8 @@
+@@ -1254,8 +1317,8 @@
acc_mode |= MAY_APPEND;
/* Fill in the open() intent data */
/*
* The simplest case - just a plain lookup.
-@@ -1271,6 +1341,7 @@
+@@ -1270,6 +1333,7 @@
/*
* Create - we need to know the parent.
*/
error = path_lookup(pathname, LOOKUP_PARENT|LOOKUP_OPEN|LOOKUP_CREATE, nd);
if (error)
return error;
-@@ -1287,7 +1358,9 @@
+@@ -1286,7 +1350,9 @@
dir = nd->dentry;
nd->flags &= ~LOOKUP_PARENT;
down(&dir->d_inode->i_sem);
do_last:
error = PTR_ERR(dentry);
-@@ -1392,7 +1465,9 @@
+@@ -1391,7 +1457,9 @@
}
dir = nd->dentry;
down(&dir->d_inode->i_sem);
putname(nd->last.name);
goto do_last;
}
-@@ -2154,7 +2229,9 @@
+@@ -2153,7 +2221,9 @@
__vfs_follow_link(struct nameidata *nd, const char *link)
{
int res = 0;
if (IS_ERR(link))
goto fail;
-@@ -2164,6 +2241,10 @@
+@@ -2163,6 +2233,10 @@
/* weird __emul_prefix() stuff did it */
goto out;
}
res = link_path_walk(link, nd);
out:
if (current->link_count || res || nd->last_type!=LAST_NORM)
-Index: linux-2.6.4-51.0/fs/namespace.c
+Index: uml-2.6.3/fs/namespace.c
===================================================================
---- linux-2.6.4-51.0.orig/fs/namespace.c 2004-04-05 12:41:59.000000000 -0400
-+++ linux-2.6.4-51.0/fs/namespace.c 2004-04-07 13:28:23.000000000 -0400
-@@ -107,6 +107,7 @@
-
- static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd)
- {
-+ memset(old_nd, 0, sizeof(*old_nd));
- old_nd->dentry = mnt->mnt_mountpoint;
- old_nd->mnt = mnt->mnt_parent;
- mnt->mnt_parent = mnt;
-@@ -748,6 +749,7 @@
+--- uml-2.6.3.orig/fs/namespace.c 2004-02-20 15:01:27.000000000 +0800
++++ uml-2.6.3/fs/namespace.c 2004-02-20 23:59:00.745486960 +0800
+@@ -744,6 +744,7 @@
int retval = 0;
int mnt_flags = 0;
/* Discard magic */
if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
flags &= ~MS_MGC_MSK;
-Index: linux-2.6.4-51.0/fs/open.c
+Index: uml-2.6.3/fs/open.c
===================================================================
---- linux-2.6.4-51.0.orig/fs/open.c 2004-04-05 12:41:59.000000000 -0400
-+++ linux-2.6.4-51.0/fs/open.c 2004-04-05 17:36:42.000000000 -0400
-@@ -211,7 +211,7 @@
+--- uml-2.6.3.orig/fs/open.c 2004-02-20 15:00:48.000000000 +0800
++++ uml-2.6.3/fs/open.c 2004-02-20 23:59:00.812476776 +0800
+@@ -202,7 +202,7 @@
struct nameidata nd;
struct inode * inode;
int error;
error = -EINVAL;
if (length < 0) /* sorry, but loff_t says... */
goto out;
-@@ -470,6 +470,7 @@
+@@ -461,6 +461,7 @@
int old_fsuid, old_fsgid;
kernel_cap_t old_cap;
int res;
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
-@@ -501,6 +502,7 @@
+@@ -492,6 +493,7 @@
if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
&& !special_file(nd.dentry->d_inode->i_mode))
res = -EROFS;
path_release(&nd);
}
-@@ -515,6 +517,7 @@
+@@ -506,6 +508,7 @@
{
struct nameidata nd;
int error;
error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
if (error)
-@@ -566,6 +569,7 @@
+@@ -557,6 +560,7 @@
{
struct nameidata nd;
int error;
error = __user_walk(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
if (error)
-@@ -638,7 +642,7 @@
+@@ -629,7 +633,7 @@
error = -EROFS;
if (IS_RDONLY(inode))
goto dput_and_out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto dput_and_out;
-@@ -746,27 +750,8 @@
+@@ -737,27 +741,8 @@
* for the internal routines (ie open_namei()/follow_link() etc). 00 is
* used by symlinks.
*/
{
struct file * f;
struct inode *inode;
-@@ -778,6 +763,7 @@
+@@ -769,6 +754,7 @@
goto cleanup_dentry;
f->f_flags = flags;
f->f_mode = (flags+1) & O_ACCMODE;
inode = dentry->d_inode;
if (f->f_mode & FMODE_WRITE) {
error = get_write_access(inode);
-@@ -797,6 +783,7 @@
+@@ -788,6 +774,7 @@
error = f->f_op->open(inode,f);
if (error)
goto cleanup_all;
}
f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
-@@ -821,6 +808,7 @@
+@@ -812,6 +799,7 @@
cleanup_file:
put_filp(f);
cleanup_dentry:
dput(dentry);
mntput(mnt);
return ERR_PTR(error);
-@@ -828,6 +816,36 @@
+@@ -819,6 +807,36 @@
EXPORT_SYMBOL(dentry_open);
/*
* Find an empty file descriptor entry, and mark it busy.
*/
-Index: linux-2.6.4-51.0/fs/stat.c
+Index: uml-2.6.3/fs/stat.c
===================================================================
---- linux-2.6.4-51.0.orig/fs/stat.c 2004-04-05 12:41:59.000000000 -0400
-+++ linux-2.6.4-51.0/fs/stat.c 2004-04-05 17:36:42.000000000 -0400
+--- uml-2.6.3.orig/fs/stat.c 2004-02-20 15:00:48.000000000 +0800
++++ uml-2.6.3/fs/stat.c 2004-02-20 23:59:00.878466744 +0800
@@ -36,7 +36,7 @@
EXPORT_SYMBOL(generic_fillattr);
fput(f);
}
return error;
-Index: linux-2.6.4-51.0/fs/nfs/dir.c
+Index: uml-2.6.3/fs/nfs/dir.c
===================================================================
---- linux-2.6.4-51.0.orig/fs/nfs/dir.c 2004-04-05 12:41:59.000000000 -0400
-+++ linux-2.6.4-51.0/fs/nfs/dir.c 2004-04-07 13:27:47.000000000 -0400
-@@ -709,7 +709,7 @@
+--- uml-2.6.3.orig/fs/nfs/dir.c 2004-02-20 15:01:27.000000000 +0800
++++ uml-2.6.3/fs/nfs/dir.c 2004-02-20 23:59:00.880466440 +0800
+@@ -672,7 +672,7 @@
return 0;
if (!nd || (nd->flags & LOOKUP_CONTINUE) || !(nd->flags & LOOKUP_CREATE))
return 0;
}
static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
-@@ -1026,7 +1026,7 @@
+@@ -960,7 +960,7 @@
attr.ia_valid = ATTR_MODE;
if (nd && (nd->flags & LOOKUP_CREATE))
/*
* The 0 argument passed into the create function should one day
-Index: linux-2.6.4-51.0/fs/inode.c
+Index: uml-2.6.3/fs/inode.c
===================================================================
---- linux-2.6.4-51.0.orig/fs/inode.c 2004-04-05 12:41:59.000000000 -0400
-+++ linux-2.6.4-51.0/fs/inode.c 2004-04-05 17:36:43.000000000 -0400
-@@ -221,6 +221,7 @@
+--- uml-2.6.3.orig/fs/inode.c 2004-01-09 15:00:12.000000000 +0800
++++ uml-2.6.3/fs/inode.c 2004-02-20 23:59:00.951455648 +0800
+@@ -223,6 +223,7 @@
inodes_stat.nr_unused--;
}
/**
* clear_inode - clear an inode
* @inode: inode to clear
-Index: linux-2.6.4-51.0/fs/super.c
+Index: uml-2.6.3/fs/super.c
===================================================================
---- linux-2.6.4-51.0.orig/fs/super.c 2004-04-05 12:41:59.000000000 -0400
-+++ linux-2.6.4-51.0/fs/super.c 2004-04-05 17:36:43.000000000 -0400
-@@ -787,6 +787,8 @@
+--- uml-2.6.3.orig/fs/super.c 2004-02-20 15:01:27.000000000 +0800
++++ uml-2.6.3/fs/super.c 2004-02-20 23:59:01.024444552 +0800
+@@ -757,6 +757,8 @@
return (struct vfsmount *)sb;
}
struct vfsmount *kern_mount(struct file_system_type *type)
{
return do_kern_mount(type->name, 0, type->name, NULL);
-Index: linux-2.6.4-51.0/include/linux/dcache.h
+Index: uml-2.6.3/include/linux/dcache.h
===================================================================
---- linux-2.6.4-51.0.orig/include/linux/dcache.h 2004-04-05 12:42:07.000000000 -0400
-+++ linux-2.6.4-51.0/include/linux/dcache.h 2004-04-05 17:36:43.000000000 -0400
+--- uml-2.6.3.orig/include/linux/dcache.h 2004-02-20 15:00:57.000000000 +0800
++++ uml-2.6.3/include/linux/dcache.h 2004-02-20 23:59:01.025444400 +0800
@@ -4,6 +4,7 @@
#ifdef __KERNEL__
struct dentry_stat_t {
int nr_dentry;
int nr_unused;
-Index: linux-2.6.4-51.0/include/linux/fs.h
+Index: uml-2.6.3/include/linux/fs.h
===================================================================
---- linux-2.6.4-51.0.orig/include/linux/fs.h 2004-04-05 12:42:07.000000000 -0400
-+++ linux-2.6.4-51.0/include/linux/fs.h 2004-04-05 17:36:43.000000000 -0400
-@@ -249,6 +249,8 @@
+--- uml-2.6.3.orig/include/linux/fs.h 2004-02-20 15:01:28.000000000 +0800
++++ uml-2.6.3/include/linux/fs.h 2004-02-20 23:59:01.100433000 +0800
+@@ -243,6 +243,8 @@
#define ATTR_ATTR_FLAG 1024
#define ATTR_KILL_SUID 2048
#define ATTR_KILL_SGID 4096
/*
* This is the Inode Attributes structure, used for notify_change(). It
-@@ -422,6 +424,7 @@
+@@ -408,6 +410,7 @@
struct block_device *i_bdev;
struct cdev *i_cdev;
int i_cindex;
unsigned long i_dnotify_mask; /* Directory notify events */
struct dnotify_struct *i_dnotify; /* for directory notifications */
-@@ -554,6 +557,7 @@
+@@ -538,6 +541,7 @@
spinlock_t f_ep_lock;
#endif /* #ifdef CONFIG_EPOLL */
struct address_space *f_mapping;
};
extern spinlock_t files_lock;
#define file_list_lock() spin_lock(&files_lock);
-@@ -874,7 +878,9 @@
+@@ -843,7 +847,9 @@
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int, struct nameidata *);
int (*setattr) (struct dentry *, struct iattr *);
int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
ssize_t (*listxattr) (struct dentry *, char *, size_t);
-@@ -1101,6 +1107,7 @@
+@@ -1056,6 +1062,7 @@
extern int unregister_filesystem(struct file_system_type *);
extern struct vfsmount *kern_mount(struct file_system_type *);
extern int may_umount(struct vfsmount *);
extern long do_mount(char *, char *, char *, unsigned long, void *);
extern int vfs_statfs(struct super_block *, struct kstatfs *);
-@@ -1165,6 +1172,7 @@
- extern int do_truncate(struct dentry *, loff_t start);
+@@ -1123,6 +1130,7 @@
+
extern struct file *filp_open(const char *, int, int);
extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
+extern struct file * dentry_open_it(struct dentry *, struct vfsmount *, int, struct lookup_intent *);
extern int filp_close(struct file *, fl_owner_t id);
extern char * getname(const char __user *);
-Index: linux-2.6.4-51.0/include/linux/namei.h
+Index: uml-2.6.3/include/linux/namei.h
===================================================================
---- linux-2.6.4-51.0.orig/include/linux/namei.h 2004-04-05 12:42:07.000000000 -0400
-+++ linux-2.6.4-51.0/include/linux/namei.h 2004-04-05 17:36:43.000000000 -0400
+--- uml-2.6.3.orig/include/linux/namei.h 2004-01-09 14:59:19.000000000 +0800
++++ uml-2.6.3/include/linux/namei.h 2004-02-20 23:59:01.174421752 +0800
@@ -2,25 +2,55 @@
#define _LINUX_NAMEI_H
extern int follow_down(struct vfsmount **, struct dentry **);
extern int follow_up(struct vfsmount **, struct dentry **);
-Index: linux-2.6.4-51.0/kernel/exit.c
+Index: uml-2.6.3/kernel/exit.c
===================================================================
---- linux-2.6.4-51.0.orig/kernel/exit.c 2004-04-05 12:42:08.000000000 -0400
-+++ linux-2.6.4-51.0/kernel/exit.c 2004-04-05 17:36:43.000000000 -0400
-@@ -259,6 +259,8 @@
+--- uml-2.6.3.orig/kernel/exit.c 2004-02-20 15:00:58.000000000 +0800
++++ uml-2.6.3/kernel/exit.c 2004-02-20 23:59:01.176421448 +0800
+@@ -255,6 +255,8 @@
write_unlock_irq(&tasklist_lock);
}
void __set_special_pids(pid_t session, pid_t pgrp)
{
struct task_struct *curr = current;
-@@ -428,6 +430,8 @@
+@@ -422,6 +424,8 @@
__exit_files(tsk);
}