Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 0 additions & 105 deletions patches/libfuse/mount.c.diff

This file was deleted.

1 change: 0 additions & 1 deletion scripts/chroot/chroot_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ cd -
#############################################

sudo cp -r "$repo_root_dir"/src miniroot/src
sudo cp -r "$repo_root_dir"/patches miniroot/patches

sudo mount -o bind /dev miniroot/dev
sudo mount -t proc none miniroot/proc
Expand Down
5 changes: 0 additions & 5 deletions scripts/common/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@ cleanup() {
}
trap cleanup EXIT

# store current file's path
# needed to determine the path of the patches
this_dir="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"

cd "$tmpdir"

wget https://github.com/libfuse/libfuse/releases/download/fuse-3.15.0/fuse-3.15.0.tar.xz
echo "70589cfd5e1cff7ccd6ac91c86c01be340b227285c5e200baa284e401eea2ca0 fuse-3.15.0.tar.xz" | sha256sum -c -
tar xf fuse-3.*.tar.xz
pushd fuse-3*/
patch -p1 < "$this_dir"/../../patches/libfuse/mount.c.diff
mkdir build
cd build
meson setup --prefix=/usr ..
Expand Down
1 change: 0 additions & 1 deletion scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ RUN apk add --no-cache \
zstd-dev zstd-static zlib-dev zlib-static clang musl-dev mimalloc-dev

COPY scripts/common/install-dependencies.sh /tmp/scripts/common/install-dependencies.sh
COPY patches/ /tmp/patches/

WORKDIR /tmp
RUN bash scripts/common/install-dependencies.sh
118 changes: 0 additions & 118 deletions src/runtime/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ extern int sqfs_opt_proc(void* data, const char* arg, int key, struct fuse_args*
#include <sys/mman.h>
#include <stdint.h>
#include <libgen.h>
#include <dirent.h>
#include <ctype.h>

const char* fusermountPath = NULL;

typedef struct {
uint32_t lo;
Expand Down Expand Up @@ -414,106 +410,6 @@ int appimage_print_binary(char* fname, unsigned long offset, unsigned long lengt
return 0;
}

char* find_fusermount(bool verbose) {
char* fusermount_base = "fusermount";

char* fusermount_path = getenv("PATH");
if (fusermount_path == NULL) {
return NULL;
}

char* path_copy = strdup(fusermount_path);
char* dir = strtok(path_copy, ":");

while (dir != NULL) {
DIR* dir_ptr = opendir(dir);
if (dir_ptr == NULL) {
dir = strtok(NULL, ":");
continue;
}

struct dirent* entry;
while ((entry = readdir(dir_ptr)) != NULL) {
// Check if the entry starts with "fusermount"
if (strncmp(entry->d_name, fusermount_base, 10) == 0) {
// Check if the rest of the entry is a digit
char* suffix = entry->d_name + 10;
int j = 0;
while (suffix[j] != '\0' && isdigit(suffix[j])) {
j++;
}

if (suffix[j] == '\0') {
// Construct the full path of the entry
char* fusermount_full_path = malloc(strlen(dir) + strlen(entry->d_name) + 2);
sprintf(fusermount_full_path, "%s/%s", dir, entry->d_name);

// Check if the binary is setuid root
struct stat sb;
if (stat(fusermount_full_path, &sb) == -1) {
perror("stat");
free(fusermount_full_path);
continue;
}

if (sb.st_uid != 0 || (sb.st_mode & S_ISUID) == 0) {
if (verbose) {
printf("Not setuid root, skipping...\n");
}
free(fusermount_full_path);
continue;
}

if (verbose) {
printf("Found setuid root executable: %s\n", fusermount_full_path);
}

pid_t pid = fork();
if (pid == -1) {
perror("fork");
free(fusermount_full_path);
continue;
}

if (pid == 0) {
// Child process

// close stdout and stderr if not in verbose mode
if (!verbose) {
close(1);
close(2);
}

char* args[] = {fusermount_full_path, "--version", NULL};
execvp(fusermount_full_path, args);
// If execvp returns, it means the executable was not found
exit(1);
} else {
// Parent process
int status;
waitpid(pid, &status, 0);

if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
// The executable was found and executed successfully
closedir(dir_ptr);
free(path_copy);
return fusermount_full_path;
}

free(fusermount_full_path);
}
}
}
}

closedir(dir_ptr);
dir = strtok(NULL, ":");
}

free(path_copy);
return NULL;
}

/* Exit status to use when launching an AppImage fails.
* For applications that assign meanings to exit status codes (e.g. rsync),
* we avoid "cluttering" pre-defined exit status codes by using 127 which
Expand Down Expand Up @@ -1737,20 +1633,6 @@ int main(int argc, char* argv[]) {
if (pid == 0) {
/* in child */

fusermountPath = getenv("FUSERMOUNT_PROG");
if (fusermountPath == NULL) {
char* new_prog = find_fusermount(verbose);
if (new_prog != NULL) {
setenv("FUSERMOUNT_PROG", new_prog, 1);
if (verbose) {
fprintf(stderr, "FUSERMOUNT_PROG set to %s\n", new_prog);
}
free(new_prog);
} else {
printf("Error: No suitable fusermount binary found on the $PATH\n");
}
}

char* child_argv[5];

/* close read pipe */
Expand Down
Loading