>From 841dd4e075040e2aeb01adea8ef5e2f7c0fc006a Mon Sep 17 00:00:00 2001 From: Markus Wichmann Date: Wed, 6 Feb 2019 21:13:05 +0100 Subject: [PATCH 7/7] Initialize deps on non-directly loaded libs. As pointed out by Alexey Izbyshev, having the deps member be zero opens dlopen() and dlsym() up to malfunctions, if a library was previously loaded as dependency and is then dlopen()ed. Therefore, we now set the deps member of the dso descriptor to the sentry value in all libs loaded as dependencies. --- ldso/dynlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 6ffeca85..f8346c54 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -1158,8 +1158,8 @@ static void load_deps(struct dso *p) *deps = tmp; } } + if (!p->deps) p->deps = (struct dso**)&nodeps_dummy; } - if (!*deps) *deps = (struct dso **)&nodeps_dummy; } static void load_preload(char *s) -- 2.20.1