aa-genprof: crash in is_known_rule
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
AppArmor |
New
|
Undecided
|
Unassigned |
Bug Description
Details are as follows.
Could it be a problem with python installation?
I have this same bug in work and at home.
KeyError
Python 3.4.5: /usr/bin/python3.4
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
/usr/lib/
100
101 profile_filename = apparmor.
102 if os.path.
103 apparmor.
104 else:
105 apparmor.
106 apparmor.
107
108 if apparmor.
109 apparmor.
apparmor = <module 'apparmor.aa' from '/usr/lib64/
apparmor.autodep = <function autodep>
program = '/usr/sbin/tcpdump'
/usr/lib64/
647 pname = bin_full
648 read_inactive_
649 profile_data = get_profile(pname)
650 # Create a new profile if no existing profile
651 if not profile_data:
652 profile_data = create_
653 file = get_profile_
654 profile_
655 attach_
656 attach_
profile_data = None
global create_new_profile = <function create_new_profile>
pname = '/usr/sbin/tcpdump'
/usr/lib64/
493
494 handle_
495 else:
496 local_profile[
497
498 handle_
499 # Add required hats to the profile if they match the localfile
500 for hatglob in cfg['required_
501 if re.search(hatglob, localfile):
502 for hat in sorted(
global handle_binfmt = <function handle_binfmt>
local_profile = defaultdict(
localfile = '/usr/sbin/tcpdump'
/usr/lib64/
392 reqs += get_reqs(library)
393 reqs_processed[
394
395 library_rule = FileRule(library, 'mr', None, FileRule.ALL, owner=False, log_event=True)
396
397 if not is_known_
398 globbed_library = glob_common(
399 if globbed_library:
400 # glob_common returns a list, just use the first element (typically '/lib/libfoo.so.*')
401 library_rule = FileRule(
global is_known_rule = <function is_known_rule>
profile = defaultdict(
library_rule = <FileRule> /lib64/
/usr/lib64/
3448 checked.
3449
3450 if os.path.
3451 includelist += include_
3452 else:
3453 if include[
3454 if include[
3455 return True
3456
3457 for childinc in include[
global include = {}
incname = 'abstractions/base'
].get undefined
rule_type = 'file'
KeyError: 'abstractions/base'
__cause__ = None
__class__ = <class 'KeyError'>
__context__ = None
__delattr__ = <method-wrapper '__delattr__' of KeyError object>
__dict__ = {}
__dir__ = <built-in method __dir__ of KeyError object>
__doc__ = 'Mapping key not found.'
__eq__ = <method-wrapper '__eq__' of KeyError object>
__format__ = <built-in method __format__ of KeyError object>
__ge__ = <method-wrapper '__ge__' of KeyError object>
__getattrib
__gt__ = <method-wrapper '__gt__' of KeyError object>
__hash__ = <method-wrapper '__hash__' of KeyError object>
__init__ = <method-wrapper '__init__' of KeyError object>
__le__ = <method-wrapper '__le__' of KeyError object>
__lt__ = <method-wrapper '__lt__' of KeyError object>
__ne__ = <method-wrapper '__ne__' of KeyError object>
__new__ = <built-in method __new__ of type object>
__reduce__ = <built-in method __reduce__ of KeyError object>
__reduce_ex__ = <built-in method __reduce_ex__ of KeyError object>
__repr__ = <method-wrapper '__repr__' of KeyError object>
__setattr__ = <method-wrapper '__setattr__' of KeyError object>
__setstate__ = <built-in method __setstate__ of KeyError object>
__sizeof__ = <built-in method __sizeof__ of KeyError object>
__str__ = <method-wrapper '__str__' of KeyError object>
__subclassh
__suppress_
__traceback__ = <traceback object>
args = ('abstractions/
with_traceback = <built-in method with_traceback of KeyError object>
The above is a description of an error in a Python program. Here is
the original traceback:
Traceback (most recent call last):
File "/usr/lib/
apparmor.
File "/usr/lib64/
profile_data = create_
File "/usr/lib64/
handle_
File "/usr/lib64/
if not is_known_
File "/usr/lib64/
if include[
KeyError: 'abstractions/base'
That looks like you don't have an abstractions/base file (actually you don't seem to have any abstractions/* file), which would be very unusual.
Can you please exist if /etc/apparmor. d/abstractions/ base exists on your system?
The bug itsself is easy to explain - create_ new_profile( ) blindly assumes abstractions/base exists and adds it to the profile. It's not surprising that this explodes later - checking something in a non-existing file rarely works ;-)