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

abi <abi/4.0>,

include <tunables/global>

@{config_dirs} = @{user_config_dirs}/chromium

@{exec_path} = @{lib}/chromium/chrome_crashpad_handler
profile chromium-crashpad-handler @{exec_path} {
  include <abstractions/base>

  capability sys_ptrace,

  ptrace peer=chromium,
  signal (send) peer=chromium,

  @{exec_path} mrix,

  owner "@{config_dirs}/Crash Reports/**" rwk,

        @{PROC}/sys/kernel/yama/ptrace_scope r,
  owner @{PROC}/@{pid}/fd/ r,
  owner @{PROC}/@{pids}/mem r,
  owner @{PROC}/@{pids}/stat r,
  owner @{PROC}/@{pids}/task/ r,

  @{sys}/devices/system/cpu/cpufreq/policy@{int}/scaling_cur_freq r,
  @{sys}/devices/system/cpu/cpufreq/policy@{int}/scaling_max_freq r,

  include if exists <local/chromium-crashpad-handler>
}

# vim:syntax=apparmor
