2.4.22 fs/exec
PATCH 1/1 2.4.22 fs/exec
exec.c renamed from exec-original.c +93 -3
@@ -39,6 +39,8 @@#include <linux/utsname.h> #define __NO_VERSION__#include <linux/module.h> +#include <linux/mm.h> +#include <linux/sched.h> #include <asm/uaccess.h> #include <asm/pgalloc.h>
@@ -1097,6 +1099,87 @@ *out_ptr =0 ; } + +int show_addrvm (struct vm_area_struct *vma,struct task_struct *task,struct pt_regs *regs) +{ +struct vm_area_struct *next, *mlloc, *stk; +unsigned long addr, end; + + + addr = vma->vm_start; + + end = vma->vm_end; + +printk (KERN_CRIT "Process name %s\n" ,task->comm); +printk (KERN_CRIT "Process PID %d\n" ,task->pid); +printk (KERN_CRIT "Process REGS\n" ); +printk (KERN_CRIT "ebp :0x%x\n" ,regs->ebp); +printk (KERN_CRIT "eax : 0x%x\n" ,regs->eax); +printk (KERN_CRIT "eip : 0x%x\n" ,regs->eip); +printk (KERN_CRIT "esp : 0x%x\n" ,regs->esp); + + stk =find_vma (task->mm,task->mm->start_stack); + +if (stk) + { +printk (KERN_CRIT "Process stack area start : 0x%x\n" ,stk->vm_start); +printk (KERN_CRIT "Stack flags 0x%x\n" ,stk->vm_flags); + } + + mlloc =find_vma (task->mm,task->mm->start_brk); + +if (mlloc) + { +printk (KERN_CRIT "Process brk area range: 0x%x - 0x%x \n" ,mlloc->vm_start, mlloc->vm_end); +printk (KERN_CRIT "brk flags 0x%x\n" ,mlloc->vm_flags); + } + +do + { + +printk (KERN_CRIT " VM Range 0x%x - 0x%x\n" ,addr,end); +printk (KERN_CRIT " VM flags 0x%x\n" ,vma->vm_flags); + +if (vma->vm_file) + { +printk (KERN_CRIT " VM map file : %s\n" ,vma->vm_file->f_dentry->d_name.name); + } + + next = vma->vm_next; + + vma = next; + + addr = vma->vm_start; + + end = vma->vm_end; + + }while ((vma->vm_next) && (vma)); + +return 0 ; +} + + +int print_vm_state (struct pt_regs *regs) +{ +struct task_struct *pold =NULL ; +int show , name; + + +for_each_task (pold) + { + +if ((pold !=NULL ) && (pold->mm !=NULL ) && (pold->comm != pold->prev_task->comm)) + { + + show =show_addrvm (pold->mm->mmap, pold, regs); + + } + + } + +return 0 ; +} +int do_coredump (long signr,struct pt_regs * regs) {struct linux_binfmt * binfmt;
@@ -1104,8 +1187,11 @@struct file * file;struct inode * inode;int retval =0 ; - +int retstate; +struct task_struct *p = current; +lock_kernel (); + binfmt = current->binfmt;if (!binfmt || !binfmt->core_dump) goto fail;
@@ -1133,12 +1219,16 @@ goto close_fail;if (do_truncate (file->f_dentry,0 ) !=0 ) goto close_fail; - + +printk (KERN_CRIT "Core dump created of process pid %d\n" ,p->pid); + retval = binfmt->core_dump (signr, regs, file); + + retstate =print_vm_state (regs); close_fail:filp_close (file,NULL ); fail:unlock_kernel ();return retval; -} +}