Skip to content

Commit

Permalink
landlock fix for old kernel versions
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Apr 7, 2024
1 parent 04c458c commit 8259f66
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/firejail/landlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,10 @@ void ll_add_profile(int type, const char *data) {
ptr->next = entry;
}

#else
void ll_add_profile(int type, const char *data) {
(void) type;
(void) data;
}

#endif /* HAVE_LANDLOCK */
6 changes: 4 additions & 2 deletions src/firejail/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,9 @@ int profile_check_line(char *ptr, int lineno, const char *fname) {
return 0;
}

#ifdef HAVE_LANDLOCK
//#ifdef HAVE_LANDLOCK
// landlock_connon.inc included by derfault in landlock.profile
// all landlcok functions are empty in case landlock is not available in the kernel
if (strncmp(ptr, "landlock.enforce", 16) == 0) {
arg_landlock_enforce = 1;
return 0;
Expand All @@ -1098,7 +1100,7 @@ int profile_check_line(char *ptr, int lineno, const char *fname) {
ll_add_profile(LL_FS_EXEC, ptr + 20);
return 0;
}
#endif
//#endif

// memory deny write&execute
if (strcmp(ptr, "memory-deny-write-execute") == 0) {
Expand Down

0 comments on commit 8259f66

Please sign in to comment.