Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151680888
D30456.id89830.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
D30456.id89830.diff
View Options
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -106,6 +106,7 @@
linker_file_t linker_kernel_file;
static struct sx kld_sx; /* kernel linker lock */
+static bool kld_busy;
/*
* Load counter used by clients to determine if a linker file has been
@@ -1086,6 +1087,13 @@
}
sx_xlock(&kld_sx);
+ while (kld_busy) {
+ error = sx_sleep(&kld_busy, &kld_sx, PCATCH, "kldser1", 0);
+ if (error != 0)
+ goto unlock;
+ }
+ kld_busy = true;
+
error = linker_load_module(kldname, modname, NULL, NULL, &lf);
if (error) {
sx_xunlock(&kld_sx);
@@ -1094,9 +1102,12 @@
lf->userrefs++;
if (fileid != NULL)
*fileid = lf->id;
- sx_xunlock(&kld_sx);
done:
+ kld_busy = false;
+ wakeup(&kld_busy);
+unlock:
+ sx_xunlock(&kld_sx);
CURVNET_RESTORE();
return (error);
}
@@ -1134,6 +1145,13 @@
CURVNET_SET(TD_TO_VNET(td));
sx_xlock(&kld_sx);
+ while (kld_busy) {
+ error = sx_sleep(&kld_busy, &kld_sx, PCATCH, "kldser2", 0);
+ if (error != 0)
+ goto unlock;
+ }
+ kld_busy = true;
+
lf = linker_find_file_by_id(fileid);
if (lf) {
KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs));
@@ -1153,6 +1171,9 @@
}
} else
error = ENOENT;
+ kld_busy = false;
+ wakeup(&kld_busy);
+unlock:
sx_xunlock(&kld_sx);
CURVNET_RESTORE();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 10, 11:44 PM (7 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31254367
Default Alt Text
D30456.id89830.diff (1 KB)
Attached To
Mode
D30456: kern linker: do not allow more than one kldload and kldunload syscalls simultaneously
Attached
Detach File
Event Timeline
Log In to Comment