Skip to content

Commit

Permalink
fix broken tests and regression on 4530462
Browse files Browse the repository at this point in the history
  • Loading branch information
smitsohu committed Jan 6, 2021
1 parent 18e806c commit 1e3891e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/firejail/fs_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ void fs_private_lib(void) {
// start timetrace
timetrace_start();

// bring in firejail executable libraries in case we are redirected here by a firejail symlink from /usr/local/bin/firejail
fslib_install_list(PATH_FIREJAIL);

// bring in firejail directory
fslib_install_list("firejail");

// copy the libs in the new lib directory for the main exe
if (cfg.original_program_index > 0) {
if (arg_debug || arg_debug_private_lib)
Expand Down Expand Up @@ -374,13 +380,6 @@ void fs_private_lib(void) {
printf("Installing system libraries\n");
fslib_install_system();

// bring in firejail directory for --trace and seccomp post exec
// bring in firejail executable libraries in case we are redirected here by a firejail symlink from /usr/local/bin/firejail
fslib_install_list("/usr/bin/firejail,firejail"); // todo: use the installed path for the executable

// install libraries needed by fcopy
fslib_install_list(PATH_FCOPY);

fmessage("Installed %d %s and %d %s\n", lib_cnt, (lib_cnt == 1)? "library": "libraries",
dir_cnt, (dir_cnt == 1)? "directory": "directories");

Expand Down
7 changes: 6 additions & 1 deletion src/firejail/fs_lib2.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extern void fslib_copy_dir(const char *full_path);
//***************************************************************
// standard libc libraries based on Debian's libc6 package
// selinux seems to be linked in most command line utilities
// libpcre2 is a dependency of selinux
// locale (/usr/lib/locale) - without it, the program will default to "C" locale
typedef struct liblist_t {
const char *name;
Expand All @@ -38,6 +39,7 @@ typedef struct liblist_t {

static LibList libc_list[] = {
{ "libselinux.so.", 0 },
{ "libpcre2-8.so.", 0 },
{ "libapparmor.so.", 0},
{ "ld-linux-x86-64.so.", 0 },
{ "libanl.so.", 0 },
Expand Down Expand Up @@ -104,16 +106,19 @@ static void stdc(const char *dirname) {

void fslib_install_stdc(void) {
// install standard C libraries
timetrace_start();
struct stat s;
char *stdclib = "/lib64"; // CentOS, Fedora, Arch

if (stat("/lib/x86_64-linux-gnu", &s) == 0) { // Debian & friends
// PT_INTERP
fslib_duplicate("/lib64/ld-linux-x86-64.so.2");

mkdir_attr(RUN_LIB_DIR "/x86_64-linux-gnu", 0755, 0, 0);
selinux_relabel_path(RUN_LIB_DIR "/x86_64-linux-gnu", "/lib/x86_64-linux-gnu");
stdclib = "/lib/x86_64-linux-gnu";
}

timetrace_start();
stdc(stdclib);

// install locale
Expand Down

0 comments on commit 1e3891e

Please sign in to comment.