]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add nosuid,noexec and nodev where appropriate when remounting
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 13 Jun 2024 18:30:31 +0000 (20:30 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 13 Jun 2024 19:57:38 +0000 (21:57 +0200)
If not we get permission errors if the host mount uses nosuid,noexec
or nodev.

Fixes #2776

mkosi/__init__.py

index 0405f56c3c5ee5bc758746f9f70748622392a822..7c081113d64b5a92f42ce79ffd0bcfed5a2c5453 100644 (file)
@@ -4609,7 +4609,8 @@ def run_build(args: Args, config: Config, *, resources: Path) -> None:
 
     for d in remount:
         if Path(d).exists():
-            run(["mount", "--rbind", d, d, "--options", "ro"])
+            options = "ro" if d in ("/usr", "/opt") else "ro,nosuid,nodev,noexec"
+            run(["mount", "--rbind", d, d, "--options", options])
 
     with (
         complete_step(f"Building {config.name()} image"),