From f8e00d7d74088cac7dac24c49b8d6e2c80f8db96 Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 20 Apr 2017 15:21:51 +0000 Subject: [PATCH] only 32 bits of the pledgecode were passed up via ktrace from Anton Lindqvist ok semarie --- sys/kern/kern_pledge.c | 4 ++-- sys/sys/ktrace.h | 8 ++++---- sys/sys/pledge.h | 4 ++-- sys/sys/syscall_mi.h | 5 +++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_pledge.c b/sys/kern/kern_pledge.c index b1c5bbcfe13..d99a60d2a1e 100644 --- a/sys/kern/kern_pledge.c +++ b/sys/kern/kern_pledge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_pledge.c,v 1.204 2017/04/17 20:22:14 deraadt Exp $ */ +/* $OpenBSD: kern_pledge.c,v 1.205 2017/04/20 15:21:53 deraadt Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -545,7 +545,7 @@ sys_pledge(struct proc *p, void *v, register_t *retval) } int -pledge_syscall(struct proc *p, int code, int *tval) +pledge_syscall(struct proc *p, int code, uint64_t *tval) { p->p_pledge_syscall = code; *tval = 0; diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h index c6c7ec5c763..cf47809242c 100644 --- a/sys/sys/ktrace.h +++ b/sys/sys/ktrace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ktrace.h,v 1.33 2016/10/08 02:16:43 guenther Exp $ */ +/* $OpenBSD: ktrace.h,v 1.34 2017/04/20 15:21:51 deraadt Exp $ */ /* $NetBSD: ktrace.h,v 1.12 1996/02/04 02:12:29 christos Exp $ */ /* @@ -158,9 +158,9 @@ struct ktr_user { */ #define KTR_PLEDGE 12 struct ktr_pledge { - int error; - int syscall; - int64_t code; + int error; + int syscall; + uint64_t code; }; /* diff --git a/sys/sys/pledge.h b/sys/sys/pledge.h index ca815f316e1..8ced3ae3cb0 100644 --- a/sys/sys/pledge.h +++ b/sys/sys/pledge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pledge.h,v 1.30 2017/01/23 04:25:05 deraadt Exp $ */ +/* $OpenBSD: pledge.h,v 1.31 2017/04/20 15:21:51 deraadt Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -111,7 +111,7 @@ static struct { #ifdef _KERNEL -int pledge_syscall(struct proc *, int, int *); +int pledge_syscall(struct proc *, int, uint64_t *); int pledge_fail(struct proc *, int, uint64_t); struct mbuf; diff --git a/sys/sys/syscall_mi.h b/sys/sys/syscall_mi.h index 24521bdaa2f..bf0a0fff6a6 100644 --- a/sys/sys/syscall_mi.h +++ b/sys/sys/syscall_mi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall_mi.h,v 1.17 2017/02/14 10:31:15 mpi Exp $ */ +/* $OpenBSD: syscall_mi.h,v 1.18 2017/04/20 15:21:51 deraadt Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -45,8 +45,9 @@ static inline int mi_syscall(struct proc *p, register_t code, const struct sysent *callp, register_t *argp, register_t retval[2]) { + uint64_t tval; int lock = !(callp->sy_flags & SY_NOLOCK); - int error, pledged, tval; + int error, pledged; /* refresh the thread's cache of the process's creds */ refreshcreds(p); -- 2.20.1