From 506213304c638cd4e3f09f1b2d0957f72a3a0fb9 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Fri, 24 Mar 2017 18:07:56 +0100 Subject: [PATCH 1/2] interfaces/mount: add InfoEntry type This patch adds the InfoEntry structure. The structure represents what is found in /proc/$PID/mountinfo, aka the table of mounted things. Signed-off-by: Zygmunt Krynicki --- interfaces/mount/mountinfo.go | 38 ++++++++++++++++++++++++++++++ interfaces/mount/mountinfo_test.go | 30 +++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 interfaces/mount/mountinfo.go create mode 100644 interfaces/mount/mountinfo_test.go diff --git a/interfaces/mount/mountinfo.go b/interfaces/mount/mountinfo.go new file mode 100644 index 00000000000..3732baaa2de --- /dev/null +++ b/interfaces/mount/mountinfo.go @@ -0,0 +1,38 @@ +// -*- Mode: Go; indent-tabs-mode: t -*- + +/* + * Copyright (C) 2017 Canonical Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +package mount + +// InfoEntry contains data from /proc/$PID/mountinfo +// +// For details please refer to mountinfo documentation at +// https://www.kernel.org/doc/Documentation/filesystems/proc.txt +type InfoEntry struct { + MountID int + ParentID int + DevMajor int + DevMinor int + Root string + MountDir string + MountOpts string + OptionalFlds string + FsType string + MountSource string + SuperOpts string +} diff --git a/interfaces/mount/mountinfo_test.go b/interfaces/mount/mountinfo_test.go new file mode 100644 index 00000000000..bb959e93c75 --- /dev/null +++ b/interfaces/mount/mountinfo_test.go @@ -0,0 +1,30 @@ +// -*- Mode: Go; indent-tabs-mode: t -*- + +/* + * Copyright (C) 2017 Canonical Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +package mount_test + +import ( + . "gopkg.in/check.v1" + + _ "github.com/snapcore/snapd/interfaces/mount" +) + +type mountinfoSuite struct{} + +var _ = Suite(&mountinfoSuite{}) From f82c78c07facd73f5ad1a31f26b0b337dc6ce4ce Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Tue, 4 Apr 2017 11:01:04 +0200 Subject: [PATCH 2/2] tests: improve debug output Signed-off-by: Zygmunt Krynicki --- spread.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spread.yaml b/spread.yaml index 5c6b90c73bc..f6d3b8ba24e 100644 --- a/spread.yaml +++ b/spread.yaml @@ -184,8 +184,14 @@ prepare-each: | dmesg -c > /dev/null debug-each: | + echo '# journal messages for snapd' journalctl -u snapd + echo '# apparmor denials ' dmesg | grep DENIED || true + echo '# seccomp denials (kills) ' + dmesg | grep 1326 || true + echo '# snap interfaces' + snap interfaces || true rename: # Move content into a directory, so that deltas computed by repack benefit