Module Name:    src
Committed By:   kamil
Date:           Thu Feb  7 00:19:54 UTC 2019

Modified Files:
        src/sys/arch/amd64/include: ptrace.h

Log Message:
Define PTRACE_ILLEGAL_ASM for NetBSD/amd64 in ptrace.h

Use ud2 instruction that is guaranteed to raise an invalid instruction
exception (through SIGILL).

On NetBSD and FreeBSD this instruction raises ILL_PRVOPC, on Linux
ILL_ILLOPN. It's not clear which opion is better "Privileged opcode" vs
"Illegal operand", because ud2 doesn't seem to be a privileged operation
and it doesn't take any operand.

Assume in future changes that this opcode will raise ILL_PRVOPC and keep
it purely for testing purposes of the SIGILL crash type.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/include/ptrace.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/include/ptrace.h
diff -u src/sys/arch/amd64/include/ptrace.h:1.12 src/sys/arch/amd64/include/ptrace.h:1.13
--- src/sys/arch/amd64/include/ptrace.h:1.12	Wed Apr 12 18:17:59 2017
+++ src/sys/arch/amd64/include/ptrace.h	Thu Feb  7 00:19:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.12 2017/04/12 18:17:59 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.13 2019/02/07 00:19:54 kamil Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -63,6 +63,8 @@
 #define PTRACE_REG_SP(r)	(r)->regs[_REG_RSP]
 #define PTRACE_REG_INTRV(r)	(r)->regs[_REG_RAX]
 
+#define PTRACE_ILLEGAL_ASM	__asm __volatile ("ud2" : : : "memory")
+
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xcc })
 #define PTRACE_BREAKPOINT_ASM	__asm __volatile ("int3" : : : "memory")
 #define PTRACE_BREAKPOINT_SIZE	1

Reply via email to