Merge lp:~brian-murray/apport/system-slice into lp:~ubuntu-core-dev/ubuntu/hirsute/apport/ubuntu

Proposed by Brian Murray
Status: Merged
Merged at revision: 2829
Proposed branch: lp:~brian-murray/apport/system-slice
Merge into: lp:~ubuntu-core-dev/ubuntu/hirsute/apport/ubuntu
Diff against target: 77 lines (+48/-0)
3 files modified
data/apport (+12/-0)
debian/changelog (+8/-0)
test/test_signal_crashes.py (+28/-0)
To merge this branch: bzr merge lp:~brian-murray/apport/system-slice
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+393269@code.launchpad.net
To post a comment you must log in.
lp:~brian-murray/apport/system-slice updated
2830. By Brian Murray

remove extra comment

2831. By Brian Murray

switch from using grep to opening the cgroup file

Revision history for this message
Brian Murray (brian-murray) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/apport'
--- data/apport 2020-10-12 20:44:02 +0000
+++ data/apport 2020-11-04 18:59:12 +0000
@@ -355,6 +355,18 @@
355 else:355 else:
356 raise356 raise
357357
358 # check to see if the process is part of the system.slice (LP: #1870060)
359 if os.path.exists('/proc/%s/cgroup' % pid):
360
361 global proc_pid_fd
362 proc_pid_fd = os.open('/proc/%s' % pid, os.O_RDONLY | os.O_PATH | os.O_DIRECTORY)
363
364 with open('cgroup', opener=proc_pid_opener) as cgroup:
365 for line in cgroup:
366 fields = line.split(':')
367 if fields[-1].startswith('/system.slice'):
368 return True
369
358 return False370 return False
359371
360372
361373
=== modified file 'debian/changelog'
--- debian/changelog 2020-10-12 21:43:36 +0000
+++ debian/changelog 2020-11-04 18:59:12 +0000
@@ -1,3 +1,11 @@
1apport (2.20.11-0ubuntu51) UNRELEASED; urgency=medium
2
3 * data/apport: Modify the check for whether or not a process is running in
4 the same namespace so that crashes from processes running protected in the
5 system.slice are considered as being from the same namespace. (LP: #1870060)
6
7 -- Brian Murray <brian@ubuntu.com> Tue, 03 Nov 2020 09:01:34 -0800
8
1apport (2.20.11-0ubuntu50) groovy; urgency=medium9apport (2.20.11-0ubuntu50) groovy; urgency=medium
210
3 * etc/apport/crashdb.conf: Disable Launchpad crash reports for 20.1011 * etc/apport/crashdb.conf: Disable Launchpad crash reports for 20.10
412
=== modified file 'test/test_signal_crashes.py'
--- test/test_signal_crashes.py 2020-06-24 16:15:42 +0000
+++ test/test_signal_crashes.py 2020-11-04 18:59:12 +0000
@@ -626,6 +626,34 @@
626 self.do_crash(False, command=myexe, expect_corefile=False, uid=8)626 self.do_crash(False, command=myexe, expect_corefile=False, uid=8)
627 self.assertEqual(apport.fileutils.get_all_reports(), [])627 self.assertEqual(apport.fileutils.get_all_reports(), [])
628628
629 @unittest.skipIf(os.geteuid() != 0, 'this test needs to be run as root')
630 def test_crash_system_slice(self):
631 '''report generation for a protected process running in the system slice'''
632
633 self.create_test_process(command='/usr/bin/systemd-run',
634 args=['-t', '-q', '--slice=system.slice',
635 '-p', 'ProtectSystem=true',
636 '/usr/bin/yes'])
637 yes_pid = int(subprocess.check_output(['pidof',
638 '/usr/bin/yes']).strip())
639 os.kill(yes_pid, signal.SIGSEGV)
640
641 # wait max 10 seconds for apport to finish
642 timeout = 50
643 while timeout >= 0:
644 pidof = subprocess.Popen(['pidof', '-x', 'apport'],
645 stdout=subprocess.PIPE)
646 pidof.communicate()
647 if pidof.returncode != 0:
648 break
649 time.sleep(0.2)
650 timeout -= 1
651
652 # check crash report
653 reports = apport.fileutils.get_all_reports()
654 self.assertEqual(len(reports), 1)
655 self.assertEqual(reports[0], '/var/crash/_usr_bin_yes.0.crash')
656
629 @unittest.skipUnless(os.path.exists('/bin/ping'), 'this test needs /bin/ping')657 @unittest.skipUnless(os.path.exists('/bin/ping'), 'this test needs /bin/ping')
630 @unittest.skipIf(os.geteuid() != 0, 'this test needs to be run as root')658 @unittest.skipIf(os.geteuid() != 0, 'this test needs to be run as root')
631 def test_crash_setuid_drop(self):659 def test_crash_setuid_drop(self):

Subscribers

People subscribed via source and target branches