aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_aout.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_aout.c')
-rw-r--r--fs/binfmt_aout.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index d146e181d10d..0e7a6f81ae36 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -32,31 +32,8 @@
32 32
33static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); 33static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
34static int load_aout_library(struct file*); 34static int load_aout_library(struct file*);
35static int aout_core_dump(struct coredump_params *cprm);
36
37static struct linux_binfmt aout_format = {
38 .module = THIS_MODULE,
39 .load_binary = load_aout_binary,
40 .load_shlib = load_aout_library,
41 .core_dump = aout_core_dump,
42 .min_coredump = PAGE_SIZE
43};
44
45#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
46
47static int set_brk(unsigned long start, unsigned long end)
48{
49 start = PAGE_ALIGN(start);
50 end = PAGE_ALIGN(end);
51 if (end > start) {
52 unsigned long addr;
53 addr = vm_brk(start, end - start);
54 if (BAD_ADDR(addr))
55 return addr;
56 }
57 return 0;
58}
59 35
36#ifdef CONFIG_COREDUMP
60/* 37/*
61 * Routine writes a core dump image in the current directory. 38 * Routine writes a core dump image in the current directory.
62 * Currently only a stub-function. 39 * Currently only a stub-function.
@@ -66,7 +43,6 @@ static int set_brk(unsigned long start, unsigned long end)
66 * field, which also makes sure the core-dumps won't be recursive if the 43 * field, which also makes sure the core-dumps won't be recursive if the
67 * dumping of the process results in another error.. 44 * dumping of the process results in another error..
68 */ 45 */
69
70static int aout_core_dump(struct coredump_params *cprm) 46static int aout_core_dump(struct coredump_params *cprm)
71{ 47{
72 struct file *file = cprm->file; 48 struct file *file = cprm->file;
@@ -89,7 +65,7 @@ static int aout_core_dump(struct coredump_params *cprm)
89 current->flags |= PF_DUMPCORE; 65 current->flags |= PF_DUMPCORE;
90 strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm)); 66 strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm));
91 dump.u_ar0 = offsetof(struct user, regs); 67 dump.u_ar0 = offsetof(struct user, regs);
92 dump.signal = cprm->signr; 68 dump.signal = cprm->siginfo->si_signo;
93 aout_dump_thread(cprm->regs, &dump); 69 aout_dump_thread(cprm->regs, &dump);
94 70
95/* If the size of the dump file exceeds the rlimit, then see what would happen 71/* If the size of the dump file exceeds the rlimit, then see what would happen
@@ -135,6 +111,32 @@ end_coredump:
135 set_fs(fs); 111 set_fs(fs);
136 return has_dumped; 112 return has_dumped;
137} 113}
114#else
115#define aout_core_dump NULL
116#endif
117
118static struct linux_binfmt aout_format = {
119 .module = THIS_MODULE,
120 .load_binary = load_aout_binary,
121 .load_shlib = load_aout_library,
122 .core_dump = aout_core_dump,
123 .min_coredump = PAGE_SIZE
124};
125
126#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
127
128static int set_brk(unsigned long start, unsigned long end)
129{
130 start = PAGE_ALIGN(start);
131 end = PAGE_ALIGN(end);
132 if (end > start) {
133 unsigned long addr;
134 addr = vm_brk(start, end - start);
135 if (BAD_ADDR(addr))
136 return addr;
137 }
138 return 0;
139}
138 140
139/* 141/*
140 * create_aout_tables() parses the env- and arg-strings in new user 142 * create_aout_tables() parses the env- and arg-strings in new user