Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't dump task struct in a.out core-dumps

akiphie points out that a.out core-dumps have that odd task struct
dumping that was never used and was never really a good idea (it goes
back into the mists of history, probably the original core-dumping
code). Just remove it.

Also do the access_ok() check on dump_write(). It probably doesn't
matter (since normal filesystems all seem to do it anyway), but he
points out that it's normally done by the VFS layer, so ...

[ I suspect that we should possibly do "vfs_write()" instead of
calling ->write directly. That also does the whole fsnotify and write
statistics thing, which may or may not be a good idea. ]

And just to be anal, do this all for the x86-64 32-bit a.out emulation
code too, even though it's not enabled (and won't currently even
compile)

Reported-by: akiphie <akiphie@lavabit.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+6 -22
+5 -17
arch/x86/ia32/ia32_aout.c
··· 34 34 #include <asm/ia32.h> 35 35 36 36 #undef WARN_OLD 37 - #undef CORE_DUMP /* probably broken */ 37 + #undef CORE_DUMP /* definitely broken */ 38 38 39 39 static int load_aout_binary(struct linux_binprm *, struct pt_regs *regs); 40 40 static int load_aout_library(struct file *); ··· 131 131 * macros to write out all the necessary info. 132 132 */ 133 133 134 - static int dump_write(struct file *file, const void *addr, int nr) 135 - { 136 - return file->f_op->write(file, addr, nr, &file->f_pos) == nr; 137 - } 134 + #include <linux/coredump.h> 138 135 139 136 #define DUMP_WRITE(addr, nr) \ 140 137 if (!dump_write(file, (void *)(addr), (nr))) \ 141 138 goto end_coredump; 142 139 143 - #define DUMP_SEEK(offset) \ 144 - if (file->f_op->llseek) { \ 145 - if (file->f_op->llseek(file, (offset), 0) != (offset)) \ 146 - goto end_coredump; \ 147 - } else \ 148 - file->f_pos = (offset) 140 + #define DUMP_SEEK(offset) \ 141 + if (!dump_seek(file, offset)) \ 142 + goto end_coredump; 149 143 150 144 #define START_DATA() (u.u_tsize << PAGE_SHIFT) 151 145 #define START_STACK(u) (u.start_stack) ··· 211 217 dump_size = dump.u_ssize << PAGE_SHIFT; 212 218 DUMP_WRITE(dump_start, dump_size); 213 219 } 214 - /* 215 - * Finally dump the task struct. Not be used by gdb, but 216 - * could be useful 217 - */ 218 - set_fs(KERNEL_DS); 219 - DUMP_WRITE(current, sizeof(*current)); 220 220 end_coredump: 221 221 set_fs(fs); 222 222 return has_dumped;
-4
fs/binfmt_aout.c
··· 134 134 if (!dump_write(file, dump_start, dump_size)) 135 135 goto end_coredump; 136 136 } 137 - /* Finally dump the task struct. Not be used by gdb, but could be useful */ 138 - set_fs(KERNEL_DS); 139 - if (!dump_write(file, current, sizeof(*current))) 140 - goto end_coredump; 141 137 end_coredump: 142 138 set_fs(fs); 143 139 return has_dumped;
+1 -1
include/linux/coredump.h
··· 11 11 */ 12 12 static inline int dump_write(struct file *file, const void *addr, int nr) 13 13 { 14 - return file->f_op->write(file, addr, nr, &file->f_pos) == nr; 14 + return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, addr, nr, &file->f_pos) == nr; 15 15 } 16 16 17 17 static inline int dump_seek(struct file *file, loff_t off)