[Touch-packages] [Bug 1780227] Re: locking sockets broken due to missing AppArmor socket mediation patches

2018-07-30 Thread Wolfgang Bumiller
Can confirm that the patch seems to work on 4.15. No "denied"
"file_lock" log-spam when starting ArchLinux containers anymore, and
they seem to be behaving as expected again.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to apparmor in Ubuntu.
https://bugs.launchpad.net/bugs/1780227

Title:
  locking sockets broken due to missing AppArmor socket mediation
  patches

Status in apparmor package in Ubuntu:
  Invalid
Status in linux package in Ubuntu:
  Triaged
Status in apparmor source package in Xenial:
  Invalid
Status in linux source package in Xenial:
  Triaged
Status in apparmor source package in Bionic:
  Invalid
Status in linux source package in Bionic:
  Triaged

Bug description:
  Hey,

  Newer systemd makes use of locks placed on AF_UNIX sockets created
  with the socketpair() syscall to synchronize various bits and pieces
  when isolating services. On kernels prior to 4.18 that do not have
  backported the AppArmor socket mediation patchset this will cause the
  locks to be denied with EACCESS. This causes systemd to be broken in
  LXC and LXD containers that do not run unconfined which is a pretty
  big deal. We have seen various bug reports related to this. See for
  example [1] and [2].

  If feasible it would be excellent if we could backport the socket
  mediation patchset to all LTS kernels. Afaict, this should be 4.4 and
  4.15. This will unbreak a whole range of use-cases.

  The socket mediation patchset is available here:
  
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=80a17a5f501ea048d86f81d629c94062b76610d4

  
  [1]: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1575779
  [2]: https://github.com/systemd/systemd/issues/9493

  Thanks!
  Christian

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1780227/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 1575779] Re: hostnamectl fails under lxd unpriv container

2018-07-05 Thread Wolfgang Bumiller
For completeness here's a minimal test case not requiring systemd:

/*
# apparmor_parser -r /etc/apparmor.d/bug-profile
# (tested without the flags here as well btw.)
profile bug-profile flags=(attach_disconnected,mediate_deleted) {
   network,
   file,
   unix,
}

# gcc this.c
# ./a.out
lock = 2 (Success)
# aa-exec -p bug-profile ./a.out
lock = 2 (Permission denied)

kernel: audit: type=1400 audit(1530774919.510:93): apparmor="DENIED" 
operation="file_lock" profile="bug-profile" pid=21788 comm="a.out" 
family="unix" sock_type="dgram" protocol=0 addr=none
*/

#include 
#include 
#include 
#include 
#include 
#include 

int
main(int argc, char **argv)
{
int sp[2];
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sp) != 0) {
perror("socketpair");
exit(1);
}
int rc = flock(sp[0], LOCK_EX);
printf("lock = %i (%m)\n");

close(sp[0]);
close(sp[1]);
return 0;
}

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to apparmor in Ubuntu.
https://bugs.launchpad.net/bugs/1575779

Title:
  hostnamectl fails under lxd unpriv container

Status in apparmor package in Ubuntu:
  Confirmed

Bug description:
  1.  % lsb_release -rd
  Description:  Ubuntu 16.04 LTS
  Release:  16.04

  2.  % apt-cache policy apparmor
  apparmor:
Installed: 2.10.95-0ubuntu2
Candidate: 2.10.95-0ubuntu2
Version table:
   *** 2.10.95-0ubuntu2 500
  500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
  100 /var/lib/dpkg/status
  % apt-cache policy lxd
  lxd:
Installed: 2.0.0-0ubuntu4
Candidate: 2.0.0-0ubuntu4
Version table:
   *** 2.0.0-0ubuntu4 500
  500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
  100 /var/lib/dpkg/status

  3. lxc launch ubuntu-daily:xenial x1
  lxc exec x1 /bin/bash

  root@x1:~# hostnamectl status 
 Static hostname: x1
   Icon name: computer-container
 Chassis: container
  Machine ID: 833b8548c7ce4118b4c9c5c3ae4f133d
 Boot ID: 9d5fbb053cf7494589c0863a0a4cf0ca
  Virtualization: lxc
Operating System: Ubuntu 16.04 LTS
  Kernel: Linux 4.4.0-18-generic
Architecture: x86-64

  
  4. hostnamectl status hangs indefinitely

  On the host, there are some audit messages for each invocation of
  hostnamectl

  [411617.032274] audit: type=1400 audit(1461695563.731:100):
  apparmor="DENIED" operation="file_lock" profile="lxd-
  x1_" pid=17100 comm="(ostnamed)" family="unix"
  sock_type="dgram" protocol=0 addr=none

  It's related to socket activation.  One can workaround this by running
  systemd-hostnamed in the background first

  root@x1:~# /lib/systemd/systemd-hostnamed & 
  [1] 2462
  root@x1:~# hostnamectl status 
 Static hostname: x1
   Icon name: computer-container
 Chassis: container
  Machine ID: 833b8548c7ce4118b4c9c5c3ae4f133d
 Boot ID: 9d5fbb053cf7494589c0863a0a4cf0ca
  Virtualization: lxc
Operating System: Ubuntu 16.04 LTS
  Kernel: Linux 4.4.0-18-generic
Architecture: x86-64

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: apparmor 2.10.95-0ubuntu2
  ProcVersionSignature: Ubuntu 4.4.0-18.34-generic 4.4.6
  Uname: Linux 4.4.0-18-generic x86_64
  NonfreeKernelModules: zfs zunicode zcommon znvpair zavl
  ApportVersion: 2.20.1-0ubuntu2
  Architecture: amd64
  CurrentDesktop: GNOME-Flashback:GNOME
  Date: Wed Apr 27 11:19:27 2016
  InstallationDate: Installed on 2016-01-01 (117 days ago)
  InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Alpha amd64 (20151209)
  ProcKernelCmdline: BOOT_IMAGE=/boot/vmlinuz-4.4.0-18-generic 
root=UUID=e0b8b294-f364-4ef5-aa70-1916cdd37192 ro quiet splash vt.handoff=7
  SourcePackage: apparmor
  Syslog:
   
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1575779/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp