5 #define IS_SYS_CALL(regs) (((regs).orig_eax>=0) && \
6 ((regs).eax == -ERESTARTNOHAND || \
7 (regs).eax == -ERESTARTSYS || \
8 (regs).eax == -ERESTARTNOINTR) )
11 #define IS_FD_NAMED(fdes) ((fdes)->f_dentry->d_name.name)
16 void dump_header_struct(struct file
*, struct task_struct
*, int);
17 void dump_registers(struct file
*, struct task_struct
*, struct pt_regs
*, int);
18 void dump_memory_struct(struct file
*, struct task_struct
*);
19 void dump_segments(struct file
*, struct mm_struct
*, int);
20 void dump_vm_areas(struct file
*, struct task_struct
*);
21 int get_file_cnt(struct task_struct
*, struct files_struct
*);
22 int dump_open_files(struct file
*, struct task_struct
*,
23 struct files_struct
*, int *);
24 void dump_cwd(struct file
*, struct task_struct
*, int *);
25 void dump_signal(struct file
*, struct task_struct
*, int *);
27 void write_end(struct file
*);
30 struct header
* restore_header_struct(struct file
*);
31 struct pt_regs
* get_registers(struct file
*);
32 void restore_memory_struct(struct file
*, struct header
*);
33 unsigned long restore_vm_areas(struct file
*, int, int);
34 int restore_open_files(struct file
*);
35 void restore_cwd(struct file
*);
36 void restore_signal(struct file
*);
40 char *get_kernel_address(struct task_struct
*,
41 struct vm_area_struct
*,
43 struct file
*open_private_file(int, const char *, int, int);
47 * Extracts flags from vm_flags value.
49 static inline unsigned long get_mmap_flags(unsigned short vm_flags
)
53 (vm_flags
& VM_MAYSHARE
? MAP_SHARED
: MAP_PRIVATE
) |
54 (vm_flags
& VM_GROWSDOWN
) |
55 (vm_flags
& VM_DENYWRITE
) |
56 (vm_flags
& VM_EXECUTABLE
);
61 static inline int inside(unsigned long a
,
65 return (c
<= b
) && (c
>= a
);
69 static inline int valid_memory_segment(struct pt_regs
*regs
,
71 struct vm_area_struct
*vma
)
73 if (inside(mm
->start_code
, mm
->end_code
, vma
->vm_start
))
75 else if (inside(mm
->end_code
, mm
->end_data
, vma
->vm_start
))
77 else if (inside(mm
->end_data
, mm
->brk
, vma
->vm_start
))
79 else if (inside(mm
->start_stack
, 0xC0000000, vma
->vm_start
))
81 else if (inside(vma
->vm_start
, vma
->vm_end
, regs
->sp
))
87 static char prot_char
[] = {'r', 'w', 'x'};
88 static inline void print_prot(uint32_t prot
)
95 printk("%c", prot_char
[i
]);
103 static inline void print_flags(uint32_t flags
)
107 if (get_mmap_flags(flags
) & MAP_SHARED
)
112 if (flags
& MAP_FIXED
)
113 printk("MAP_FIXED ");
114 if (flags
& MAP_ANONYMOUS
)
115 printk("MAP_ANONYMOUS ");
118 if (flags
& MAP_GROWSDOWN
)
119 printk("MAP_GROWSDOWN ");
120 if (flags
& MAP_DENYWRITE
)
121 printk("MAP_DENYWRITE ");
122 if (flags
& MAP_EXECUTABLE
)
123 printk("MAP_EXECUTABLE ");
124 if (flags
& MAP_LOCKED
)
125 printk("MAP_LOCKED ");
126 if (flags
& MAP_POPULATE
)
127 printk("MAP_POPULATE ");
128 if (flags
& MAP_NONBLOCK
)
129 printk("MAP_NONBLOCK ");