Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156525237
D43450.id132739.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
D43450.id132739.diff
View Options
diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c
--- a/sys/kern/kern_condvar.c
+++ b/sys/kern/kern_condvar.c
@@ -43,8 +43,9 @@
#include <sys/sleepqueue.h>
#include <sys/resourcevar.h>
#ifdef KTRACE
-#include <sys/uio.h>
#include <sys/ktrace.h>
+#include <sys/uio.h>
+#include <sys/user.h>
#endif
/*
@@ -107,6 +108,9 @@
_cv_wait(struct cv *cvp, struct lock_object *lock)
{
WITNESS_SAVE_DECL(lock_witness);
+#ifdef KTRACE
+ char wmesg[WMESGLEN + 1];
+#endif
struct lock_class *class;
struct thread *td;
uintptr_t lock_state;
@@ -114,8 +118,12 @@
td = curthread;
lock_state = 0;
#ifdef KTRACE
- if (KTRPOINT(td, KTR_CSW))
- ktrcsw(1, 0, cv_wmesg(cvp));
+ if (KTRPOINT(td, KTR_CSW)) {
+ strlcpy(wmesg, cv_wmesg(cvp), sizeof(wmesg));
+ ktrcsw(1, 0, wmesg);
+ } else {
+ wmesg[0] = '\0';
+ }
#endif
CV_ASSERT(cvp, lock, td);
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock,
@@ -145,7 +153,7 @@
#ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
- ktrcsw(0, 0, cv_wmesg(cvp));
+ ktrcsw(0, 0, wmesg);
#endif
PICKUP_GIANT();
if (lock != &Giant.lock_object) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 15, 10:15 AM (13 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33080224
Default Alt Text
D43450.id132739.diff (1 KB)
Attached To
Mode
D43450: condvar: Fix a user-after-free in _cv_wait() when ktrace is enabled
Attached
Detach File
Event Timeline
Log In to Comment