diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-17 13:24:17 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-17 13:24:17 +0900 |
| commit | 3ae2ab652e9cd1d6250dbde8ae0f9b9fe90afc72 (patch) | |
| tree | 52b0cf50658f4a7ea8606db3174d4f250e6a3cad /internal/app | |
| parent | db71fbe22bea41e92b9a037a2b608a3350097f5f (diff) | |
system/wayland: sync file at caller specified address
Storing this in sys is incredibly ugly: sys should be stateless and Ops must keep track of their state.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app')
| -rw-r--r-- | internal/app/app_pd_test.go | 4 | ||||
| -rw-r--r-- | internal/app/share.go | 2 | ||||
| -rw-r--r-- | internal/app/start.go | 2 | ||||
| -rw-r--r-- | internal/app/system.go | 4 |
4 files changed, 9 insertions, 3 deletions
diff --git a/internal/app/app_pd_test.go b/internal/app/app_pd_test.go index 4d90d7fc..b5cf46bf 100644 --- a/internal/app/app_pd_test.go +++ b/internal/app/app_pd_test.go @@ -1,6 +1,8 @@ package app_test import ( + "os" + "git.gensokyo.uk/security/fortify/acl" "git.gensokyo.uk/security/fortify/dbus" "git.gensokyo.uk/security/fortify/fst" @@ -217,7 +219,7 @@ var testCasesPd = []sealTestCase{ Ensure("/run/user/1971", 0700).UpdatePermType(system.User, "/run/user/1971", acl.Execute). // this is ordered as is because the previous Ensure only calls mkdir if XDG_RUNTIME_DIR is unset Ephemeral(system.Process, "/run/user/1971/fortify/ebf083d1b175911782d413369b64ce7c", 0700).UpdatePermType(system.Process, "/run/user/1971/fortify/ebf083d1b175911782d413369b64ce7c", acl.Execute). Ensure("/tmp/fortify.1971/wayland", 0711). - Wayland("/tmp/fortify.1971/wayland/ebf083d1b175911782d413369b64ce7c", "/run/user/1971/wayland-0", "org.chromium.Chromium", "ebf083d1b175911782d413369b64ce7c"). + Wayland(new(*os.File), "/tmp/fortify.1971/wayland/ebf083d1b175911782d413369b64ce7c", "/run/user/1971/wayland-0", "org.chromium.Chromium", "ebf083d1b175911782d413369b64ce7c"). Link("/run/user/1971/pulse/native", "/run/user/1971/fortify/ebf083d1b175911782d413369b64ce7c/pulse"). CopyFile(new([]byte), "/home/ophestra/xdg/config/pulse/cookie", 256, 256). MustProxyDBus("/tmp/fortify.1971/ebf083d1b175911782d413369b64ce7c/bus", &dbus.Config{ diff --git a/internal/app/share.go b/internal/app/share.go index 1862fb2b..beed4f0e 100644 --- a/internal/app/share.go +++ b/internal/app/share.go @@ -163,7 +163,7 @@ func (seal *appSeal) setupShares(bus [2]*dbus.Config, os linux.System) error { // use instance ID in case app id is not set appID = "uk.gensokyo.fortify." + seal.id } - seal.sys.Wayland(outerPath, socketPath, appID, seal.id) + seal.sys.Wayland(&seal.sys.sp, outerPath, socketPath, appID, seal.id) seal.sys.bwrap.Bind(outerPath, innerPath) } else { // bind mount wayland socket (insecure) fmsg.Verbose("direct wayland access, PROCEED WITH CAUTION") diff --git a/internal/app/start.go b/internal/app/start.go index 467735e1..8390b6be 100644 --- a/internal/app/start.go +++ b/internal/app/start.go @@ -58,7 +58,7 @@ func (a *app) Run(ctx context.Context, rs *RunState) error { if startTime, err := a.shim.Start( a.seal.sys.user.as, a.seal.sys.user.supp, - a.seal.sys.Sync(), + a.seal.sys.sp, ); err != nil { return err } else { diff --git a/internal/app/system.go b/internal/app/system.go index 241eafa5..f11efc86 100644 --- a/internal/app/system.go +++ b/internal/app/system.go @@ -1,6 +1,8 @@ package app import ( + "os" + "git.gensokyo.uk/security/fortify/helper/bwrap" "git.gensokyo.uk/security/fortify/internal/system" ) @@ -8,6 +10,8 @@ import ( // appSealSys encapsulates app seal behaviour with OS interactions type appSealSys struct { bwrap *bwrap.Config + // bwrap sync fd + sp *os.File // paths to override by mounting tmpfs over them override []string |
