Browse Source

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 <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Leonid Lisovskiy 8 years ago
parent
commit
d6d36639c6
1 changed files with 3 additions and 1 deletions
  1. 3 1
      ldso/ldso/dl-elf.c

+ 3 - 1
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;