DBPRINTF("val = %ld, data = 0x%X", val, (unsigned int) data);
- if (args->regs == NULL || user_mode_vm(args->regs))
+ if (args->regs == NULL || swap_user_mode(args->regs))
return ret;
DBPRINTF("switch (val) %lu %d %d", val, DIE_INT3, DIE_TRAP);
#define KPROBES_TRAMP_LEN MAX_INSN_SIZE
#define KPROBES_TRAMP_INSN_IDX 0
+static inline int swap_user_mode(struct pt_regs *regs)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
+ return user_mode(regs);
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) */
+ return user_mode_vm(regs);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) */
+}
+
static inline unsigned long arch_get_task_pc(struct task_struct *p)
{
/* FIXME: Not implemented yet */
IMP_MOD_DEP_WRAPPER(in_gate_area, task, addr)
#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) */
#else /*__HAVE_ARCH_GATE_AREA */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
+ struct mm_struct *mm;
+
+ if (task == NULL)
+ return 0;
+
+ mm = task->mm;
+ return in_gate_area(mm, addr);
+#else
return in_gate_area(task, addr);
+#endif
#endif/*__HAVE_ARCH_GATE_AREA */
}
for (vma = task->mm->mmap; vma; vma = vma->vm_next) {
if (vma->vm_file && vma->vm_flags & VM_EXEC
- && vma->vm_file->f_dentry == ld_info->dentry) {
+ && vma->vm_file->f_path.dentry == ld_info->dentry) {
ls_put_linker_info(ld_info);
return vma;
}
if (!file)
return 0;
- dentry = file->f_dentry;
+ dentry = file->f_path.dentry;
if (dentry == NULL)
return 0;
/* jump only if caller is instumented and it is not a system lib -
* this leads to some errors */
if (cvma != NULL && cvma->vm_file != NULL &&
- cvma->vm_file->f_dentry != NULL) {
+ cvma->vm_file->f_path.dentry != NULL) {
- struct dentry *dentry = cvma->vm_file->f_dentry;
+ struct dentry *dentry = cvma->vm_file->f_path.dentry;
struct pd_t *pd = lpd_get_parent_pd(hd);
if (!pc_check_dentry_is_ignored(dentry) &&
put_online_cpus();
}
-static int __cpuinit swap_cpu_notify(struct notifier_block *self,
+static int swap_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
{
long cpu = (long) hcpu;
struct die_args *args = (struct die_args *)data;
int ret = NOTIFY_DONE;
- if (args->regs == NULL || !user_mode_vm(args->regs))
+ if (args->regs == NULL || !swap_user_mode(args->regs))
return ret;
switch (val) {