The --landlock-rule option is used to allow operations through the
restriction introduced by a --landlock-access option. Specifying
--landlock-rule without specifying the corresponding --landlock-access
is always a user error, so produce an error message when that happens.
Signed-off-by: Skye Soss <skye@soss.website>
struct list_head *entry;
int fd, ret;
+ list_for_each(entry, &opts->rules) {
+ rule = list_entry(entry, struct landlock_rule_entry, head);
+ if (rule->rule_type == LANDLOCK_RULE_PATH_BENEATH && !opts->access_fs) {
+ errx(EXIT_FAILURE,
+ _("landlock path-beneath rule requires a filesystem access restriction (--landlock-access fs)"));
+ }
+ }
+
if (!opts->access_fs)
return;