Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143119426
D45161.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D45161.diff
View Options
diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c
--- a/stand/common/load_elf_obj.c
+++ b/stand/common/load_elf_obj.c
@@ -263,6 +263,7 @@
#endif
case SHT_INIT_ARRAY:
case SHT_FINI_ARRAY:
+ case SHT_NOTE:
if ((shdr[i].sh_flags & SHF_ALLOC) == 0)
break;
lastaddr = roundup(lastaddr, shdr[i].sh_addralign);
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
@@ -79,6 +79,8 @@
const int kld_off_filename = offsetof(struct linker_file, filename);
const int kld_off_pathname = offsetof(struct linker_file, pathname);
const int kld_off_next = offsetof(struct linker_file, link.tqe_next);
+const int kld_off_uuid_addr = offsetof(struct linker_file, uuid_addr);
+const int kld_off_uuid_size = offsetof(struct linker_file, uuid_size);
/*
* static char *linker_search_path(const char *name, struct mod_depend
@@ -669,6 +671,8 @@
lf->ndeps = 0;
lf->deps = NULL;
lf->loadcnt = ++loadcnt;
+ lf->uuid_addr = NULL;
+ lf->uuid_size = 0;
#ifdef __arm__
lf->exidx_addr = 0;
lf->exidx_size = 0;
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -603,6 +603,13 @@
ef->relatab[ra].sec = shdr[i].sh_info;
ra++;
break;
+ case SHT_NOTE:
+ if (strcmp(ef->shstrtab + shdr[i].sh_name,
+ ".note.gnu.build-id"))
+ break;
+ lf->uuid_addr = (caddr_t)shdr[i].sh_addr;
+ lf->uuid_size = shdr[i].sh_size;
+ break;
}
}
if (pb != ef->nprogtab) {
@@ -1206,6 +1213,23 @@
}
ra++;
break;
+ case SHT_NOTE:
+ if (strcmp(ef->shstrtab + shdr[i].sh_name,
+ ".note.gnu.build-id"))
+ break;
+ lf->uuid_addr = malloc(shdr[i].sh_size, M_LINKER,
+ M_WAITOK);
+ lf->uuid_size = shdr[i].sh_size;
+ error = vn_rdwr(UIO_READ, nd->ni_vp, lf->uuid_addr,
+ shdr[i].sh_size, shdr[i].sh_offset, UIO_SYSSPACE,
+ IO_NODELOCKED, td->td_ucred, NOCRED, &resid, td);
+ if (error)
+ goto out;
+ if (resid != 0) {
+ error = EINVAL;
+ goto out;
+ }
+ break;
}
}
if (pb != ef->nprogtab) {
diff --git a/sys/sys/linker.h b/sys/sys/linker.h
--- a/sys/sys/linker.h
+++ b/sys/sys/linker.h
@@ -82,6 +82,8 @@
size_t size; /* size of file */
caddr_t ctors_addr; /* address of .ctors/.init_array */
size_t ctors_size; /* size of .ctors/.init_array */
+ caddr_t uuid_addr;
+ size_t uuid_size;
enum {
LF_NONE = 0,
LF_CTORS,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 27, 5:34 AM (4 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28051063
Default Alt Text
D45161.diff (2 KB)
Attached To
Mode
D45161: Add uuid for module to prevent incompetable coredump loaded by debugger
Attached
Detach File
Event Timeline
Log In to Comment