aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/fshim/ipc/shim
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-12-06 04:25:33 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-12-06 04:25:33 +0900
commitb3ef53b193bdf764d8f04e19ea47901b71eec10b (patch)
treef842120ed936715340e4fe48a8913766c65d7581 /cmd/fshim/ipc/shim
parent8d0573405a8a58a57c39b008150d75d3be2894c2 (diff)
app: integrate security-context-v1
Should be able to get rid of XDG_RUNTIME_DIR share after this. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'cmd/fshim/ipc/shim')
-rw-r--r--cmd/fshim/ipc/shim/shim.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/cmd/fshim/ipc/shim/shim.go b/cmd/fshim/ipc/shim/shim.go
index db4a9b09..d01d02e8 100644
--- a/cmd/fshim/ipc/shim/shim.go
+++ b/cmd/fshim/ipc/shim/shim.go
@@ -39,14 +39,12 @@ type Shim struct {
abortOnce sync.Once
// fallback exit notifier with error returned killing the process
killFallback chan error
- // wayland mediation, nil if disabled
- wl *shim0.Wayland
// shim setup payload
payload *shim0.Payload
}
-func New(uid uint32, aid string, supp []string, socket string, wl *shim0.Wayland, payload *shim0.Payload) *Shim {
- return &Shim{uid: uid, aid: aid, supp: supp, socket: socket, wl: wl, payload: payload}
+func New(uid uint32, aid string, supp []string, socket string, payload *shim0.Payload) *Shim {
+ return &Shim{uid: uid, aid: aid, supp: supp, socket: socket, payload: payload}
}
func (s *Shim) String() string {
@@ -112,6 +110,14 @@ func (s *Shim) Start() (*time.Time, error) {
}
s.cmd.Stdin, s.cmd.Stdout, s.cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
s.cmd.Dir = "/"
+
+ // pass sync fd if set
+ if s.payload.Bwrap.Sync() != nil {
+ fd := uintptr(3 + len(s.cmd.ExtraFiles))
+ s.payload.Sync = &fd
+ s.cmd.ExtraFiles = append(s.cmd.ExtraFiles, s.payload.Bwrap.Sync())
+ }
+
fmsg.VPrintln("starting shim via fsu:", s.cmd)
fmsg.Suspend() // withhold messages to stderr
if err := s.cmd.Start(); err != nil {
@@ -172,9 +178,9 @@ func (s *Shim) Start() (*time.Time, error) {
return &startTime, err
}
- // serve payload and wayland fd if enabled
+ // serve payload
// this also closes the connection
- err := s.payload.Serve(conn, s.wl)
+ err := s.payload.Serve(conn)
if err == nil {
killShim = func() {}
}