diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2012-05-08 14:32:02 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2012-05-08 14:32:02 +0000 |
commit | 8385ca12ee0d3c5d5645a10859e58a130ac44893 (patch) | |
tree | 81a08b3c58ae85ad769f63afa6d72fb52d04de0c /libexec/ld.so/library_mquery.c | |
parent | de5b58e5c86c2904247fc25e56831ca184a68889 (diff) |
Refuse to load ELF objects that contain a PT_TLS program header.
Otherwise the binary assumes that the requested TLS storage has been
allocated and will happily use it, resulting in unwanted memory corruption.
ok guenther@
Diffstat (limited to 'libexec/ld.so/library_mquery.c')
-rw-r--r-- | libexec/ld.so/library_mquery.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c index 08e4d7075c4..a396200b1c3 100644 --- a/libexec/ld.so/library_mquery.c +++ b/libexec/ld.so/library_mquery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library_mquery.c,v 1.40 2012/01/09 17:01:22 ariane Exp $ */ +/* $OpenBSD: library_mquery.c,v 1.41 2012/05/08 14:32:01 jsing Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -184,6 +184,12 @@ _dl_tryload_shlib(const char *libname, int type, int flags) case PT_DYNAMIC: dynp = (Elf_Dyn *)phdp->p_vaddr; break; + case PT_TLS: + _dl_printf("%s: unsupported TLS program header in %s\n", + _dl_progname, libname); + _dl_close(libfile); + _dl_errno = DL_CANT_LOAD_OBJ; + return(0); default: break; } |