summaryrefslogtreecommitdiffstats
path: root/sys/kern/link_elf.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-06-21 20:42:08 +0000
committerjhb <jhb@FreeBSD.org>2006-06-21 20:42:08 +0000
commit777260528c74c6ef4f6fa7b2dd66e24c5cb893d3 (patch)
tree376c80ddfea4a0dea3d63af58ac39c477e221d70 /sys/kern/link_elf.c
parent23612f402831f02c9df3657debaf96cb2c718ed7 (diff)
downloadFreeBSD-src-777260528c74c6ef4f6fa7b2dd66e24c5cb893d3.zip
FreeBSD-src-777260528c74c6ef4f6fa7b2dd66e24c5cb893d3.tar.gz
Replace the kld_mtx mutex with a kld_sx sx lock and expand it's scope to
protect all linker-related data structures including the contents of linker file objects and the any linker class data as well. Considering how rarely the linker is used I just went with the simple solution of single-threading the whole thing rather than expending a lot of effor on something more fine-grained and complex. Giant is still explicitly acquired while registering and deregistering sysctl's as well as in the elf linker class while calling kmupetext(). The rest of the linker runs without Giant unless it has to acquire Giant while loading files from a non-MPSAFE filesystem.
Diffstat (limited to 'sys/kern/link_elf.c')
-rw-r--r--sys/kern/link_elf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index 14b9c2e..ac3fa99 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -559,8 +559,6 @@ link_elf_load_file(linker_class_t cls, const char* filename,
int strcnt;
int vfslocked;
- GIANT_REQUIRED;
-
shdr = NULL;
lf = NULL;
@@ -761,8 +759,10 @@ link_elf_load_file(linker_class_t cls, const char* filename,
#ifdef GPROF
/* Update profiling information with the new text segment. */
+ mtx_lock(&Giant);
kmupetext((uintfptr_t)(mapbase + segs[0]->p_vaddr - base_vaddr +
segs[0]->p_memsz));
+ mtx_unlock(&Giant);
#endif
ef->dynamic = (Elf_Dyn *) (mapbase + phdyn->p_vaddr - base_vaddr);
OpenPOWER on IntegriCloud