diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2023-12-15 15:12:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2023-12-15 15:12:09 +0000 |
commit | 670aa14eff25f3008f3c35956bbb3319c48fe1b5 (patch) | |
tree | bd417af902f4950ae003d9a6dc1d8d4bee1876d3 /sys/kern | |
parent | 86d71518fa309dad1834f3c13e4029a8dd419fa3 (diff) |
provide the pieces for ktrace/kdump to observe pinsyscall violations.
(not used yet, because the pinsyscall changes are still being worked on)
ok kettenis
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_ktrace.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 9d88075f44a..620e68365f4 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_ktrace.c,v 1.113 2023/12/12 15:30:55 deraadt Exp $ */ +/* $OpenBSD: kern_ktrace.c,v 1.114 2023/12/15 15:12:08 deraadt Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */ /* @@ -401,6 +401,24 @@ ktrpledge(struct proc *p, int error, uint64_t code, int syscall) atomic_clearbits_int(&p->p_flag, P_INKTR); } +void +ktrpinsyscall(struct proc *p, int error, int syscall, vaddr_t addr) +{ + struct ktr_header kth; + struct ktr_pinsyscall kp; + + atomic_setbits_int(&p->p_flag, P_INKTR); + ktrinitheader(&kth, p, KTR_PINSYSCALL); + kp.error = error; + kp.syscall = syscall; + kp.addr = addr; + + KERNEL_LOCK(); + ktrwrite(p, &kth, &kp, sizeof(kp)); + KERNEL_UNLOCK(); + atomic_clearbits_int(&p->p_flag, P_INKTR); +} + /* Interface and common routines */ int |