From 2d688630038d9184c996e705100009e203f57a8f Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Tue, 21 Jul 2020 11:24:02 +0200 Subject: [PATCH] symlink /bin to /usr/bin If the content of the appimage contains $out/bin/sh, then /bin/sh exists and system() works. --- AppRun.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AppRun.c b/AppRun.c index 190e41f..24cb1fd 100644 --- a/AppRun.c +++ b/AppRun.c @@ -207,6 +207,11 @@ int main(int argc, char *argv[]) { err_exit("mount(%s, %s)", usrdir, path_buf); } + snprintf(path_buf, sizeof(path_buf), "%s/bin", rootdir); + if (symlink("/usr/bin", path_buf) < 0) { + err_exit("symlink(/usr/bin, %s)", path_buf); + } + // fixes issue #1 where writing to /proc/self/gid_map fails // see user_namespaces(7) for more documentation int fd_setgroups = open("/proc/self/setgroups", O_WRONLY);