diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-03-10 17:03:59 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-03-10 17:03:59 +0000 |
commit | f1b1867fd632732c4a47891d1e19a62b604a02b7 (patch) | |
tree | 84d202c581c5304d0181bf1a3c2e4c7c1d7cea28 /sys/kern/uipc_syscalls.c | |
parent | 479c55f9df94323d2091a03cfd6880515babf5cb (diff) |
The ktrace record for recvmsg/recvfrom could contain extract bits in
msg_flags (they get set internally). Correct the record to only contain
what the caller requested.
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 0b372dec7f3..6edae42b5a9 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.187 2020/09/29 11:48:54 claudio Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.188 2021/03/10 17:03:58 deraadt Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -782,7 +782,7 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp, struct mbuf *from = NULL, *control = NULL; #ifdef KTRACE struct iovec *ktriov = NULL; - int iovlen = 0; + int iovlen = 0, kmsgflags; #endif if ((error = getsock(p, s, &fp)) != 0) @@ -812,6 +812,7 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp, memcpy(ktriov, auio.uio_iov, iovlen); } + kmsgflags = mp->msg_flags; #endif len = auio.uio_resid; if (fp->f_flag & FNONBLOCK) @@ -873,8 +874,14 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp, } error = copyout(mtod(m, caddr_t), cp, i); #ifdef KTRACE - if (KTRPOINT(p, KTR_STRUCT) && error == 0 && i) + if (KTRPOINT(p, KTR_STRUCT) && error == 0 && i) { + /* msg_flags potentially incorrect */ + int rmsgflags = mp->msg_flags; + + mp->msg_flags = kmsgflags; ktrcmsghdr(p, mtod(m, char *), i); + mp->msg_flags = rmsgflags; + } #endif if (m->m_next) i = ALIGN(i); |