aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <cifs.adm@hostme.bitkeeper.com>2004-07-23 18:39:01 -0700
committerSteve French <cifs.adm@hostme.bitkeeper.com>2004-07-23 18:39:01 -0700
commit3f2b1a8d484e02a85b5a969e310e0e94a9345f0b (patch)
tree4b14a1a7a46d2f98285ac90fe54cc7c37750c207 /fs
parent4e9d02f560b188d384592ed02796f3843cef506b (diff)
parent1172fbd0e871e80da88f8b6136b45326d352e9c2 (diff)
downloadhistory-3f2b1a8d484e02a85b5a969e310e0e94a9345f0b.tar.gz
Merge bk://linux.bkbits.net/linux-2.5
into hostme.bitkeeper.com:/repos/c/cifs/linux-2.5cifs
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_elf.c9
-rw-r--r--fs/namespace.c24
2 files changed, 17 insertions, 16 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 24f057772f430c..55082e5ecaeddb 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -492,7 +492,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
struct exec interp_ex;
char passed_fileno[6];
struct files_struct *files;
- int executable_stack = EXSTACK_DEFAULT;
+ int have_pt_gnu_stack, executable_stack = EXSTACK_DEFAULT;
unsigned long def_flags = 0;
/* Get the exec-header */
@@ -627,10 +627,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
executable_stack = EXSTACK_DISABLE_X;
break;
}
-#ifdef LEGACY_BINARIES
- if (i == elf_ex.e_phnum)
- current->personality |= READ_IMPLIES_EXEC;
-#endif
+ have_pt_gnu_stack = (i < elf_ex.e_phnum);
/* Some simple consistency checks for the interpreter */
if (elf_interpreter) {
@@ -703,6 +700,8 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
/* Do this immediately, since STACK_TOP as used in setup_arg_pages
may depend on the personality. */
SET_PERSONALITY(elf_ex, ibcs2_interpreter);
+ if (elf_read_implies_exec(elf_ex, have_pt_gnu_stack))
+ current->personality |= READ_IMPLIES_EXEC;
/* Do this so that we can load the interpreter, if need be. We will
change some of these later */
diff --git a/fs/namespace.c b/fs/namespace.c
index a8d4d0092e15d5..9e8350d458f25b 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1037,6 +1037,7 @@ int copy_namespace(int flags, struct task_struct *tsk)
struct namespace *new_ns;
struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL;
struct fs_struct *fs = tsk->fs;
+ struct vfsmount *p, *q;
if (!namespace)
return 0;
@@ -1071,14 +1072,16 @@ int copy_namespace(int flags, struct task_struct *tsk)
list_add_tail(&new_ns->list, &new_ns->root->mnt_list);
spin_unlock(&vfsmount_lock);
- /* Second pass: switch the tsk->fs->* elements */
- if (fs) {
- struct vfsmount *p, *q;
- write_lock(&fs->lock);
-
- p = namespace->root;
- q = new_ns->root;
- while (p) {
+ /*
+ * Second pass: switch the tsk->fs->* elements and mark new vfsmounts
+ * as belonging to new namespace. We have already acquired a private
+ * fs_struct, so tsk->fs->lock is not needed.
+ */
+ p = namespace->root;
+ q = new_ns->root;
+ while (p) {
+ q->mnt_namespace = new_ns;
+ if (fs) {
if (p == fs->rootmnt) {
rootmnt = p;
fs->rootmnt = mntget(q);
@@ -1091,10 +1094,9 @@ int copy_namespace(int flags, struct task_struct *tsk)
altrootmnt = p;
fs->altrootmnt = mntget(q);
}
- p = next_mnt(p, namespace->root);
- q = next_mnt(q, new_ns->root);
}
- write_unlock(&fs->lock);
+ p = next_mnt(p, namespace->root);
+ q = next_mnt(q, new_ns->root);
}
up_write(&tsk->namespace->sem);