github.com/bugraaydogar/snapd@v0.0.0-20210315170335-8c70bb858939/interfaces/builtin/io_ports_control.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2016-2017 Canonical Ltd 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 3 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package builtin 21 22 const ioPortsControlSummary = `allows access to all I/O ports` 23 24 const ioPortsControlBaseDeclarationSlots = ` 25 io-ports-control: 26 allow-installation: 27 slot-snap-type: 28 - core 29 deny-auto-connection: true 30 ` 31 32 const ioPortsControlConnectedPlugAppArmor = ` 33 # Description: Allow write access to all I/O ports. 34 # See 'man 4 mem' for details. 35 36 capability sys_rawio, # required by iopl 37 38 /dev/port rw, 39 ` 40 41 const ioPortsControlConnectedPlugSecComp = ` 42 # Description: Allow changes to the I/O port permissions and 43 # privilege level of the calling process. In addition to granting 44 # unrestricted I/O port access, running at a higher I/O privilege 45 # level also allows the process to disable interrupts. This will 46 # probably crash the system, and is not recommended. 47 ioperm 48 iopl 49 ` 50 51 var ioPortsControlConnectedPlugUDev = []string{`KERNEL=="port"`} 52 53 func init() { 54 registerIface(&commonInterface{ 55 name: "io-ports-control", 56 summary: ioPortsControlSummary, 57 implicitOnCore: true, 58 implicitOnClassic: true, 59 baseDeclarationSlots: ioPortsControlBaseDeclarationSlots, 60 connectedPlugAppArmor: ioPortsControlConnectedPlugAppArmor, 61 connectedPlugSecComp: ioPortsControlConnectedPlugSecComp, 62 connectedPlugUDev: ioPortsControlConnectedPlugUDev, 63 }) 64 }