]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: add support for sparc64 1of3
authorKris Van Hees <kris.van.hees@oracle.com>
Mon, 22 Dec 2014 21:56:13 +0000 (16:56 -0500)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:29:48 +0000 (15:29 +0100)
This commit is the 1st of 3 commits to add DTrace support to the sparc64
kernel.  This particular commit covers the sparc64-specific kernel code
changes.

- Set ARCH_SUPPORTS_DTRACE for SPARC64.

- Add DIE_PAGE_FAULT to be used in the (new) notifier call in the
  do_kernel_fault() function to allow DTrace to report failed memory
  accesses from probe recipes as an error rather than causing a kernel
  OOPS.

- Add support for the dtrace_no_pf() functionality to ignore page faults
  on request when trying to access userspace.

- Add support for the waitfd syscall.

Orabug: 19005031

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
arch/sparc/Kconfig
arch/sparc/include/asm/kdebug_64.h
arch/sparc/include/uapi/asm/unistd.h
arch/sparc/kernel/systbls_64.S
arch/sparc/mm/fault_64.c

index e49502acbab401669f4197b005cffcebbf2e8060..24d07458c5a7749b4e84c2cf229be65aa9065b21 100644 (file)
@@ -150,6 +150,9 @@ config PGTABLE_LEVELS
        default 4 if 64BIT
        default 3
 
+config ARCH_SUPPORTS_DTRACE
+       def_bool y if SPARC64
+
 source "init/Kconfig"
 
 source "kernel/Kconfig.freezer"
index 04465de8f3b52b5255c863f462fe437fbd2f7063..d5b482dd1847ad4c11a51c68e6242b9115fa1538 100644 (file)
@@ -16,6 +16,8 @@ enum die_val {
        DIE_CALL,
        DIE_NMI,
        DIE_NMIWATCHDOG,
+       DIE_GPF,
+       DIE_PAGE_FAULT,
 };
 
 #endif
index 6f35f4df17f281f5aa52c31381a6b781629bbbb0..9149cc8742b03488c50719713ae2e123b86e18ae 100644 (file)
 #define __NR_memfd_create      348
 #define __NR_bpf               349
 #define __NR_execveat          350
+#define __NR_waitfd            351
 
 #define NR_syscalls            351
 
index d72f76ae70eba5a7418630c7e1890a6e239675cd..8aee6e2d8e56dcf9ac945acb1739fd2a42e8a0f1 100644 (file)
@@ -168,4 +168,4 @@ sys_call_table:
        .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
 /*340*/        .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
        .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
-/*350*/        .word sys64_execveat
+/*350*/        .word sys64_execveat, sys_waitfd
index 4798232494294a7ece0bef232216dd4a26408d88..698ad91b1078728f1ff4bfdda5886a4222a97333 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/kdebug.h>
 #include <linux/percpu.h>
 #include <linux/context_tracking.h>
+#include <linux/dtrace_os.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -264,7 +265,9 @@ static void __kprobes do_kernel_fault(struct pt_regs *regs, int si_code,
        }
 
 cannot_handle:
-       unhandled_fault (address, current, regs);
+       if (notify_die(DIE_PAGE_FAULT, "page fault", regs, fault_code, 14,
+                      SIGKILL) != NOTIFY_STOP)
+               unhandled_fault (address, current, regs);
 }
 
 static void noinline __kprobes bogus_32bit_fault_tpc(struct pt_regs *regs)
@@ -326,6 +329,12 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
        } else
                flags |= FAULT_FLAG_USER;
 
+       /*
+        * DTrace may want the page fault ignored...
+        */
+       if (unlikely(dtrace_no_pf(regs)))
+               return;
+
        /*
         * If we're in an interrupt or have no user
         * context, we must not take the fault..