Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106170132
D40681.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D40681.diff
View Options
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -104,6 +104,7 @@
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_kern_tls.h"
+#include "opt_ktrace.h"
#include "opt_sctp.h"
#include <sys/param.h>
@@ -522,8 +523,12 @@
MPASS(prp->pr_attach);
- if (IN_CAPABILITY_MODE(td) && (prp->pr_flags & PR_CAPATTACH) == 0)
- return (ECAPMODE);
+ if ((prp->pr_flags & PR_CAPATTACH) == 0) {
+ if (CAP_TRACING(td))
+ ktrcapfail(CAPFAIL_PROTO, &proto);
+ if (IN_CAPABILITY_MODE(td))
+ return (ECAPMODE);
+ }
if (prison_check_af(cred, prp->pr_domain->dom_family) != 0)
return (EPROTONOSUPPORT);
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -654,11 +654,6 @@
struct sockaddr *to;
int error;
-#ifdef CAPABILITY_MODE
- if (IN_CAPABILITY_MODE(td) && (mp->msg_name != NULL))
- return (ECAPMODE);
-#endif
-
if (mp->msg_name != NULL) {
error = getsockaddr(&to, mp->msg_name, mp->msg_namelen);
if (error != 0) {
@@ -666,6 +661,14 @@
goto bad;
}
mp->msg_name = to;
+#ifdef CAPABILITY_MODE
+ if (CAP_TRACING(td))
+ ktrcapfail(CAPFAIL_SOCKADDR, mp->msg_name);
+ if (IN_CAPABILITY_MODE(td)) {
+ error = ECAPMODE;
+ goto bad;
+ }
+#endif
} else {
to = NULL;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 1:15 PM (10 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15614692
Default Alt Text
D40681.diff (1 KB)
Attached To
Mode
D40681: ktrace: Record socket violations with KTR_CAPFAIL
Attached
Detach File
Event Timeline
Log In to Comment