From: guenther Date: Sun, 14 Aug 2016 04:30:39 +0000 (+0000) Subject: Mark the relro/got section as read-only before setting up the environment X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=149e43528a29d3a8d8b0bafa21f64f6d3c8552d3;p=openbsd Mark the relro/got section as read-only before setting up the environment to minimize the amount of code run without it RO. --- diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 06dc2cbab91..6fcff3d62ac 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.164 2016/08/12 20:39:01 deraadt Exp $ */ +/* $OpenBSD: loader.c,v 1.165 2016/08/14 04:30:39 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -389,8 +389,6 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data) Elf_Phdr *ptls = NULL; int align; - _dl_setup_env(argv[0], envp); - if (dl_data[AUX_pagesz] != 0) _dl_pagesz = dl_data[AUX_pagesz]; else @@ -420,6 +418,8 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data) } #endif + _dl_setup_env(argv[0], envp); + DL_DEB(("rtld loading: '%s'\n", __progname)); /* init this in runtime, not statically */