Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Feb 2013 00:36:01 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r246448 - head/sys/kern
Message-ID:  <201302070036.r170a1dY029157@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Thu Feb  7 00:36:00 2013
New Revision: 246448
URL: http://svnweb.freebsd.org/changeset/base/246448

Log:
  Audit sockaddr argument for bind(2), connect(2), accept(2), sendto(2) and
  recvfrom(2) syscalls.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==============================================================================
--- head/sys/kern/uipc_syscalls.c	Thu Feb  7 00:27:11 2013	(r246447)
+++ head/sys/kern/uipc_syscalls.c	Thu Feb  7 00:36:00 2013	(r246448)
@@ -238,6 +238,7 @@ kern_bind(td, fd, sa)
 	int error;
 
 	AUDIT_ARG_FD(fd);
+	AUDIT_ARG_SOCKADDR(td, sa);
 	error = getsock_cap(td->td_proc->p_fd, fd, CAP_BIND, &fp, NULL);
 	if (error)
 		return (error);
@@ -452,6 +453,7 @@ kern_accept(struct thread *td, int s, st
 			*namelen = 0;
 		goto done;
 	}
+	AUDIT_ARG_SOCKADDR(td, sa);
 	if (name) {
 		/* check sa_len before it is destroyed */
 		if (*namelen > sa->sa_len)
@@ -547,6 +549,7 @@ kern_connect(td, fd, sa)
 	int interrupted = 0;
 
 	AUDIT_ARG_FD(fd);
+	AUDIT_ARG_SOCKADDR(td, sa);
 	error = getsock_cap(td->td_proc->p_fd, fd, CAP_CONNECT, &fp, NULL);
 	if (error)
 		return (error);
@@ -763,8 +766,10 @@ kern_sendit(td, s, mp, flags, control, s
 
 	AUDIT_ARG_FD(s);
 	rights = CAP_WRITE;
-	if (mp->msg_name != NULL)
+	if (mp->msg_name != NULL) {
+		AUDIT_ARG_SOCKADDR(td, mp->msg_name);
 		rights |= CAP_CONNECT;
+	}
 	error = getsock_cap(td->td_proc->p_fd, s, rights, &fp, NULL);
 	if (error)
 		return (error);
@@ -1009,6 +1014,8 @@ kern_recvit(td, s, mp, fromseg, controlp
 		    error == EINTR || error == EWOULDBLOCK))
 			error = 0;
 	}
+	if (fromsa != NULL)
+		AUDIT_ARG_SOCKADDR(td, fromsa);
 #ifdef KTRACE
 	if (ktruio != NULL) {
 		ktruio->uio_resid = len - auio.uio_resid;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302070036.r170a1dY029157>