kern: Add debug.crashme.null_jump.
This commit is contained in:
parent
3b20c708cc
commit
553095485e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_crashme.c,v 1.4 2021/09/07 11:00:13 riastradh Exp $ */
|
||||
/* $NetBSD: kern_crashme.c,v 1.5 2021/11/27 14:11:14 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018, 2019 Matthew R. Green
|
||||
|
@ -59,6 +59,7 @@ static int crashme_sysctl_forwarder(SYSCTLFN_PROTO);
|
|||
|
||||
static int crashme_panic(int);
|
||||
static int crashme_null_deref(int);
|
||||
static int crashme_null_jump(int);
|
||||
#ifdef DDB
|
||||
static int crashme_ddb(int);
|
||||
#endif
|
||||
|
@ -73,6 +74,7 @@ static int crashme_ddb(int);
|
|||
static crashme_node nodes[] = {
|
||||
CMNODE("panic", "plain old panic", crashme_panic),
|
||||
CMNODE("null_deref", "null dereference", crashme_null_deref),
|
||||
CMNODE("null_jump", "jump to null", crashme_null_jump),
|
||||
#ifdef DDB
|
||||
CMNODE("ddb", "enter ddb directly", crashme_ddb),
|
||||
#endif
|
||||
|
@ -249,6 +251,16 @@ crashme_null_deref(int flags)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
crashme_null_jump(int flags)
|
||||
{
|
||||
void (*volatile f)(int) = NULL;
|
||||
|
||||
(*f)(flags);
|
||||
/* make sure to have a nontrivial return address here */
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef DDB
|
||||
static int
|
||||
crashme_ddb(int flags)
|
||||
|
|
Loading…
Reference in New Issue