Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171476521
D58057.id.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
D58057.id.diff
View Options
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -76,6 +76,10 @@
#include <sys/ktrace.h>
#endif
+#ifdef __CHERI__
+#include <cheri/cheric.h>
+#endif
+
#include <security/audit/audit.h>
/*
@@ -2252,6 +2256,22 @@
ue->src_line = td->td_kexterr.src_line;
ue->p1 = td->td_kexterr.p1;
ue->p2 = td->td_kexterr.p2;
+#ifdef __CHERI__
+ /*
+ * Check for tags on p1 and p2 and set a flag if they are.
+ *
+ * Also clear the tags here so we don't risk leaking valid capabilities
+ * into user-space.
+ */
+ if (cheri_tag_get(ue->p1)) {
+ ue->flag |= UEXTERROR_FLAG_P1_TAGGED;
+ ue->p1 = cheri_tag_clear(ue->p1);
+ }
+ if (cheri_tag_get(ue->p2) {
+ ue->flag |= UEXTERROR_FLAG_P2_TAGGED;
+ ue->p2 = cheri_tag_clear(ue->p2);
+ }
+#endif
if (td->td_kexterr.msg != NULL)
strlcpy(ue->msg, td->td_kexterr.msg, sizeof(ue->msg));
return (0);
diff --git a/sys/sys/exterrvar.h b/sys/sys/exterrvar.h
--- a/sys/sys/exterrvar.h
+++ b/sys/sys/exterrvar.h
@@ -19,6 +19,9 @@
#define UEXTERROR_VER 0x10010002
+#define UEXTERROR_FLAG_P1_TAGGED 0x1
+#define UEXTERROR_FLAG_P2_TAGGED 0x2
+
#define EXTERRCTL_ENABLE 1
#define EXTERRCTL_DISABLE 2
#define EXTERRCTL_UD 3
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 12, 8:23 AM (11 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38779509
Default Alt Text
D58057.id.diff (1 KB)
Attached To
Mode
D58057: exterr: clear tags from arguments on CHERI targets
Attached
Detach File
Event Timeline
Log In to Comment