aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2013-11-26 19:47:09 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2013-11-26 19:47:09 +0000
commit80c3af4e8051c00b781aeee059bda088f33ade3f (patch)
treea52493ff0976a3625200eae1a8ffafad6464b126 /sys/kern/kern_proc.c
parent291bfc8d24f8d246afdf48d22088e8ef31eb9172 (diff)
downloadsrc-80c3af4e8051c00b781aeee059bda088f33ade3f.tar.gz
src-80c3af4e8051c00b781aeee059bda088f33ade3f.zip
Notes
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index b8195de24d9e..3dc1a584d854 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -2631,6 +2631,60 @@ errout:
return (error);
}
+static int
+sysctl_kern_proc_sigtramp(SYSCTL_HANDLER_ARGS)
+{
+ int *name = (int *)arg1;
+ u_int namelen = arg2;
+ struct proc *p;
+ struct kinfo_sigtramp kst;
+ const struct sysentvec *sv;
+ int error;
+#ifdef COMPAT_FREEBSD32
+ struct kinfo_sigtramp32 kst32;
+#endif
+
+ if (namelen != 1)
+ return (EINVAL);
+
+ error = pget((pid_t)name[0], PGET_CANDEBUG, &p);
+ if (error != 0)
+ return (error);
+ sv = p->p_sysent;
+#ifdef COMPAT_FREEBSD32
+ if ((req->flags & SCTL_MASK32) != 0) {
+ bzero(&kst32, sizeof(kst32));
+ if (SV_PROC_FLAG(p, SV_ILP32)) {
+ if (sv->sv_sigcode_base != 0) {
+ kst32.ksigtramp_start = sv->sv_sigcode_base;
+ kst32.ksigtramp_end = sv->sv_sigcode_base +
+ *sv->sv_szsigcode;
+ } else {
+ kst32.ksigtramp_start = sv->sv_psstrings -
+ *sv->sv_szsigcode;
+ kst32.ksigtramp_end = sv->sv_psstrings;
+ }
+ }
+ PROC_UNLOCK(p);
+ error = SYSCTL_OUT(req, &kst32, sizeof(kst32));
+ return (error);
+ }
+#endif
+ bzero(&kst, sizeof(kst));
+ if (sv->sv_sigcode_base != 0) {
+ kst.ksigtramp_start = (char *)sv->sv_sigcode_base;
+ kst.ksigtramp_end = (char *)sv->sv_sigcode_base +
+ *sv->sv_szsigcode;
+ } else {
+ kst.ksigtramp_start = (char *)sv->sv_psstrings -
+ *sv->sv_szsigcode;
+ kst.ksigtramp_end = (char *)sv->sv_psstrings;
+ }
+ PROC_UNLOCK(p);
+ error = SYSCTL_OUT(req, &kst, sizeof(kst));
+ return (error);
+}
+
SYSCTL_NODE(_kern, KERN_PROC, proc, CTLFLAG_RD, 0, "Process table");
SYSCTL_PROC(_kern_proc, KERN_PROC_ALL, all, CTLFLAG_RD|CTLTYPE_STRUCT|
@@ -2739,3 +2793,7 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC_UMASK, umask, CTLFLAG_RD |
static SYSCTL_NODE(_kern_proc, KERN_PROC_OSREL, osrel, CTLFLAG_RW |
CTLFLAG_ANYBODY | CTLFLAG_MPSAFE, sysctl_kern_proc_osrel,
"Process binary osreldate");
+
+static SYSCTL_NODE(_kern_proc, KERN_PROC_SIGTRAMP, sigtramp, CTLFLAG_RD |
+ CTLFLAG_MPSAFE, sysctl_kern_proc_sigtramp,
+ "Process signal trampoline location");