maintainer-feedback requested: [Bug 278204] x11/xkeyboard-config: allow non-root to write into /var/lib/xkb

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 06 Apr 2024 20:52:04 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-x11 (Nobody)
<x11@FreeBSD.org> for maintainer-feedback:
Bug 278204: x11/xkeyboard-config: allow non-root to write into /var/lib/xkb
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278204



--- Description ---
Only Xorg has setuid bit (bug 273161), so can write in root-owned directories.

Before:

  $ truss Xwayland :9 |& fgrep /var/lib/xkb
  access("/var/lib/xkb/",X_OK|W_OK)		   ERR#13 'Permission denied'
  access("/var/lib/xkb/",X_OK|W_OK)		   ERR#13 'Permission denied'
  access("/var/lib/xkb/",X_OK|W_OK)		   ERR#13 'Permission denied'
  access("/var/lib/xkb/",X_OK|W_OK)		   ERR#13 'Permission denied'

After:

  $ truss Xwayland :9 |& fgrep /var/lib/xkb
  access("/var/lib/xkb/",X_OK|W_OK)		   = 0 (0x0)
  access("/var/lib/xkb/",X_OK|W_OK)		   = 0 (0x0)
  open("/var/lib/xkb/server-9.xkm",O_RDONLY,0666)  = 10 (0xa)
  unlink("/var/lib/xkb/server-9.xkm")		   = 0 (0x0)
  access("/var/lib/xkb/",X_OK|W_OK)		   = 0 (0x0)
  access("/var/lib/xkb/",X_OK|W_OK)		   = 0 (0x0)
  open("/var/lib/xkb/server-9.xkm",O_RDONLY,0666)  = 12 (0xc)
  unlink("/var/lib/xkb/server-9.xkm")		   = 0 (0x0)