Date: Wed, 9 May 2018 10:30:56 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333398 - head/libexec/rtld-elf Message-ID: <201805091030.w49AUuMi061447@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Wed May 9 10:30:56 2018 New Revision: 333398 URL: https://svnweb.freebsd.org/changeset/base/333398 Log: Make rtld use libc_nossp_pic.a. Remove SSP shims. Submitted by: Luis Pires Reviewed by: brooks Differential revision: https://reviews.freebsd.org/D15341 Modified: head/libexec/rtld-elf/Makefile head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Wed May 9 10:28:24 2018 (r333397) +++ head/libexec/rtld-elf/Makefile Wed May 9 10:30:56 2018 (r333398) @@ -51,7 +51,7 @@ CFLAGS+= -fvisibility=hidden CFLAGS.reloc.c+=-fno-jump-tables .endif LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -LIBADD= c_pic +LIBADD= c_nossp_pic .if ${MK_TOOLCHAIN} == "no" LDFLAGS+= -L${LIBCDIR} .endif Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Wed May 9 10:28:24 2018 (r333397) +++ head/libexec/rtld-elf/rtld.c Wed May 9 10:30:56 2018 (r333398) @@ -238,8 +238,6 @@ void _rtld_error(const char *, ...) __exported; int npagesizes, osreldate; size_t *pagesizes; -long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - static int stack_prot = PROT_READ | PROT_WRITE | RTLD_DEFAULT_STACK_EXEC; static int max_stack_flags; @@ -360,8 +358,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr char **argv, *argv0, **env, **envp, *kexecpath, *library_path_rpath; caddr_t imgentry; char buf[MAXPATHLEN]; - int argc, fd, i, mib[2], phnum, rtld_argc; - size_t len; + int argc, fd, i, phnum, rtld_argc; bool dir_enable, explicit_fd, search_in_path; /* @@ -399,27 +396,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr main_argc = argc; main_argv = argv; - if (aux_info[AT_CANARY] != NULL && - aux_info[AT_CANARY]->a_un.a_ptr != NULL) { - i = aux_info[AT_CANARYLEN]->a_un.a_val; - if (i > sizeof(__stack_chk_guard)) - i = sizeof(__stack_chk_guard); - memcpy(__stack_chk_guard, aux_info[AT_CANARY]->a_un.a_ptr, i); - } else { - mib[0] = CTL_KERN; - mib[1] = KERN_ARND; - - len = sizeof(__stack_chk_guard); - if (sysctl(mib, 2, __stack_chk_guard, &len, NULL, 0) == -1 || - len != sizeof(__stack_chk_guard)) { - /* If sysctl was unsuccessful, use the "terminator canary". */ - ((unsigned char *)(void *)__stack_chk_guard)[0] = 0; - ((unsigned char *)(void *)__stack_chk_guard)[1] = 0; - ((unsigned char *)(void *)__stack_chk_guard)[2] = '\n'; - ((unsigned char *)(void *)__stack_chk_guard)[3] = 255; - } - } - trust = !issetugid(); md_abi_variant_hook(aux_info); @@ -5535,23 +5511,6 @@ int _thread_autoinit_dummy_decl = 1; void __pthread_cxa_finalize(struct dl_phdr_info *a) { -} - -void -__stack_chk_fail(void) -{ - - _rtld_error("stack overflow detected; terminated"); - rtld_die(); -} -__weak_reference(__stack_chk_fail, __stack_chk_fail_local); - -void -__chk_fail(void) -{ - - _rtld_error("buffer overflow detected; terminated"); - rtld_die(); } const char *
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805091030.w49AUuMi061447>