From d6d36639c6a5dffbcdb77e947aafd1e858bbb714 Mon Sep 17 00:00:00 2001 From: Leonid Lisovskiy Date: Tue, 26 Jan 2016 20:12:57 +0300 Subject: ldso: Fix fail of $ORIGIN expansion in case of RTLD_NOLOAD $ORIGIN expansion in search_for_named_library() wrongly takes into account all bits of rflags. Signed-off-by: Leonid Lisovskiy Signed-off-by: Waldemar Brodkorb --- ldso/ldso/dl-elf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 01b29da29..5b8572a8f 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -162,7 +162,9 @@ search_for_named_library(const char *name, unsigned rflags, const char *path_lis if (plen >= 7 && _dl_memcmp(p, "$ORIGIN", 7) == 0) { int olen; - if (rflags && plen != 7) + /* $ORIGIN is not expanded for SUID/GUID programs + (except if it is $ORIGIN alone) */ + if ((rflags & DL_RESOLVE_SECURE) && plen != 7) continue; if (origin == NULL) continue; -- cgit v1.2.3