core: verify WorkingDirectory= is outside of API VFS only under mount namespacing
The purpose of the check is to prevent leaking API VFS fds from host into a mount namespace/container. When mountns is not used at all, the check is pointless and causes inconvenience. E.g. file managers might need to be spawned under those directories, and they surely won't run in mountns. Suggested in https://github.com/systemd/systemd/pull/33454#issuecomment-2186351467 Fixes #33361
This commit is contained in:
@@ -2799,10 +2799,6 @@ int bus_exec_context_set_transient_property(
|
||||
if (!path_is_normalized(simplified))
|
||||
return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS,
|
||||
"WorkingDirectory= expects a normalized path or '~'");
|
||||
|
||||
if (path_below_api_vfs(simplified))
|
||||
return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS,
|
||||
"WorkingDirectory= may not be below /proc/, /sys/ or /dev/");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user