From aa17829f23bf3c53a359350425831a8f9a22ad18 Mon Sep 17 00:00:00 2001 From: Tianjia Zhang Date: Wed, 24 Jun 2020 16:22:01 +0800 Subject: [PATCH] rune/libcontainer: Supports more paths for LD_LIBRARY_PATH Current path for LD_LIBRARY_PATH is used for centos. This patches adds the support for more Linux distributions . Signed-off-by: Tianjia Zhang --- rune/libcontainer/nsenter/loader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rune/libcontainer/nsenter/loader.c b/rune/libcontainer/nsenter/loader.c index 950d2f0..5f687c8 100644 --- a/rune/libcontainer/nsenter/loader.c +++ b/rune/libcontainer/nsenter/loader.c @@ -77,7 +77,8 @@ int load_enclave_runtime(void) return -ENOSPC; } snprintf(sofile, sizeof(sofile), "%s/%s", rootfs, file); - snprintf(ldpath, sizeof(ldpath), "%s/lib64", rootfs); + snprintf(ldpath, sizeof(ldpath), "%s/usr/lib:%s/usr/lib64:%s/lib:%s/lib64", + rootfs, rootfs, rootfs, rootfs); env_ldpath = getenv("LD_LIBRARY_PATH"); if (env_ldpath && *env_ldpath != '\0') { @@ -99,6 +100,8 @@ int load_enclave_runtime(void) if (dl == NULL) { write_log(DEBUG, "dlopen(): %s", dlerror()); + /* set errno correctly, make bail() work better */ + errno = ENOEXEC; return -ENOEXEC; } -- GitLab