diff options
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 44 |
1 files changed, 5 insertions, 39 deletions
@@ -51,17 +51,13 @@ | |||
51 | #include <linux/audit.h> | 51 | #include <linux/audit.h> |
52 | #include <linux/tracehook.h> | 52 | #include <linux/tracehook.h> |
53 | #include <linux/kmod.h> | 53 | #include <linux/kmod.h> |
54 | #include <linux/fsnotify.h> | ||
54 | 55 | ||
55 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
56 | #include <asm/mmu_context.h> | 57 | #include <asm/mmu_context.h> |
57 | #include <asm/tlb.h> | 58 | #include <asm/tlb.h> |
58 | #include "internal.h" | 59 | #include "internal.h" |
59 | 60 | ||
60 | #ifdef __alpha__ | ||
61 | /* for /sbin/loader handling in search_binary_handler() */ | ||
62 | #include <linux/a.out.h> | ||
63 | #endif | ||
64 | |||
65 | int core_uses_pid; | 61 | int core_uses_pid; |
66 | char core_pattern[CORENAME_MAX_SIZE] = "core"; | 62 | char core_pattern[CORENAME_MAX_SIZE] = "core"; |
67 | int suid_dumpable = 0; | 63 | int suid_dumpable = 0; |
@@ -137,6 +133,8 @@ asmlinkage long sys_uselib(const char __user * library) | |||
137 | if (IS_ERR(file)) | 133 | if (IS_ERR(file)) |
138 | goto out; | 134 | goto out; |
139 | 135 | ||
136 | fsnotify_open(file->f_path.dentry); | ||
137 | |||
140 | error = -ENOEXEC; | 138 | error = -ENOEXEC; |
141 | if(file->f_op) { | 139 | if(file->f_op) { |
142 | struct linux_binfmt * fmt; | 140 | struct linux_binfmt * fmt; |
@@ -689,6 +687,8 @@ struct file *open_exec(const char *name) | |||
689 | if (IS_ERR(file)) | 687 | if (IS_ERR(file)) |
690 | return file; | 688 | return file; |
691 | 689 | ||
690 | fsnotify_open(file->f_path.dentry); | ||
691 | |||
692 | err = deny_write_access(file); | 692 | err = deny_write_access(file); |
693 | if (err) { | 693 | if (err) { |
694 | fput(file); | 694 | fput(file); |
@@ -1172,41 +1172,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1172 | unsigned int depth = bprm->recursion_depth; | 1172 | unsigned int depth = bprm->recursion_depth; |
1173 | int try,retval; | 1173 | int try,retval; |
1174 | struct linux_binfmt *fmt; | 1174 | struct linux_binfmt *fmt; |
1175 | #ifdef __alpha__ | ||
1176 | /* handle /sbin/loader.. */ | ||
1177 | { | ||
1178 | struct exec * eh = (struct exec *) bprm->buf; | ||
1179 | |||
1180 | if (!bprm->loader && eh->fh.f_magic == 0x183 && | ||
1181 | (eh->fh.f_flags & 0x3000) == 0x3000) | ||
1182 | { | ||
1183 | struct file * file; | ||
1184 | unsigned long loader; | ||
1185 | 1175 | ||
1186 | allow_write_access(bprm->file); | ||
1187 | fput(bprm->file); | ||
1188 | bprm->file = NULL; | ||
1189 | |||
1190 | loader = bprm->vma->vm_end - sizeof(void *); | ||
1191 | |||
1192 | file = open_exec("/sbin/loader"); | ||
1193 | retval = PTR_ERR(file); | ||
1194 | if (IS_ERR(file)) | ||
1195 | return retval; | ||
1196 | |||
1197 | /* Remember if the application is TASO. */ | ||
1198 | bprm->taso = eh->ah.entry < 0x100000000UL; | ||
1199 | |||
1200 | bprm->file = file; | ||
1201 | bprm->loader = loader; | ||
1202 | retval = prepare_binprm(bprm); | ||
1203 | if (retval<0) | ||
1204 | return retval; | ||
1205 | /* should call search_binary_handler recursively here, | ||
1206 | but it does not matter */ | ||
1207 | } | ||
1208 | } | ||
1209 | #endif | ||
1210 | retval = security_bprm_check(bprm); | 1176 | retval = security_bprm_check(bprm); |
1211 | if (retval) | 1177 | if (retval) |
1212 | return retval; | 1178 | return retval; |