From 2b890a430990fb2018700ea9fcafeaf39b8b9c58 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 16 Feb 2005 11:18:39 +0000 Subject: [PATCH] 2005-01-07 Jakub Jelinek [BZ #738] * elf/dl-load.c (open_path): If rtld_search_dirs is in RELRO segment, avoid writing to it if none of the standard search directories exist. --- elf/dl-load.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/elf/dl-load.c b/elf/dl-load.c index eb1a7919fb8..3da3df7346b 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1788,7 +1788,12 @@ open_path (const char *name, size_t namelen, int preloaded, must not be freed using the general free() in libc. */ if (sps->malloced) free (sps->dirs); - sps->dirs = (void *) -1; +#ifdef HAVE_Z_RELRO + /* rtld_search_dirs is attribute_relro, therefore avoid writing + into it. */ + if (sps != &rtld_search_dirs) +#endif + sps->dirs = (void *) -1; } return -1; -- 2.47.2