# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/uname
@{att} = /att/uname/
profile uname /{,usr/}bin/uname flags=(attach_disconnected,attach_disconnected.path=@{att}) {
  include <abstractions/attached/base>
  include <abstractions/attached/consoles>

  @{exec_path} mr,

  @{att}/dev/tty@{u8} rw,

  /dev/pts/[0-9]* rwk,

  # Steam's pressure-vessel container runtime
  /var/pressure-vessel/ldso/ld.so.cache r,

  # Steam LD_PRELOADs its overlay into every child it spawns, even trivial uname calls
  owner @{steam_share_dirs}/**/gameoverlayrenderer.so r,

  # Flatpak host-compat bind-mounts host libs under /run/host; /usr/lib64 is the RPM multilib path

  @{run}/host/usr/lib64/libc.so.6 mr,

  # File Inherit
  deny network,
  deny owner @{user_share_dirs}/gvfs-metadata/* r,
  deny owner @{user_share_dirs}/zed/**/data.mdb rw,

  include if exists <local/uname>
}

# vim:syntax=apparmor
