touch-packages team mailing list archive
-
touch-packages team
-
Mailing list archive
-
Message #37484
[Bug 1310598] Re: AppArmor python tools fail to parse mounts with UTF-8 non-ascii characters
After some months where it didn't seem to crash -or at least apport
didn't report anything-, now this is crashing again with the same stack
trace about reading my UTF-8/non-ascii mounts.
I'm sending new apports automatic crash reports.
Although, Christian, I would find it normal that it crashes with
LANG=C aa-status
... because that defaults to english/ASCII, and then you should NOT have
non-ascii mounts.
If I do
aa-status (implied with my locale fr_FR.UTF-8) it works fine and says:
apparmor module is loaded.
22 profiles are loaded.
22 profiles are in enforce mode.
/sbin/dhclient
/usr/bin/evince
/usr/bin/evince-previewer
/usr/bin/evince-previewer//sanitized_helper
/usr/bin/evince-thumbnailer
/usr/bin/evince-thumbnailer//sanitized_helper
/usr/bin/evince//sanitized_helper
/usr/bin/vidalia
/usr/lib/NetworkManager/nm-dhcp-client.action
/usr/lib/connman/scripts/dhclient-script
/usr/lib/cups/backend/cups-pdf
/usr/lib/lightdm/lightdm-guest-session
/usr/lib/lightdm/lightdm-guest-session//chromium
/usr/lib/telepathy/mission-control-5
/usr/lib/telepathy/telepathy-*
/usr/lib/telepathy/telepathy-*//pxgsettings
/usr/lib/telepathy/telepathy-*//sanitized_helper
/usr/lib/telepathy/telepathy-ofono
/usr/sbin/cups-browsed
/usr/sbin/cupsd
/usr/sbin/tcpdump
system_tor
0 profiles are in complain mode.
4 processes have profiles defined.
4 processes are in enforce mode.
/sbin/dhclient (1375)
/usr/lib/telepathy/mission-control-5 (2551)
/usr/sbin/cups-browsed (1371)
/usr/sbin/cupsd (2606)
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.
Thus, although there is a crash reported at startup, it seems that I still have app-armor up an running.
The bug might then be at startup. Could be that when aa is run at
startup the language is not yet defined, thus it is running with default
LANG=C and failing (which is then kind of "normal situation" as the
mounts can use any encoding they see fit!).
I'll try to investigate a little bit more around that idea.
--
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/1310598
Title:
AppArmor python tools fail to parse mounts with UTF-8 non-ascii
characters
Status in AppArmor Linux application security framework:
Triaged
Status in “apparmor” package in Ubuntu:
Triaged
Bug description:
Version:
14.04 Fresh Install.
$ uname -a
Linux alain-Desktop 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
AppArmor crashes with this stack trace:
PythonArgs: ['/usr/sbin/aa-status']
Traceback:
Traceback (most recent call last):
File "/usr/sbin/aa-status", line 194, in <module>
commands[cmd]()
File "/usr/sbin/aa-status", line 17, in cmd_enabled
if get_profiles() == {}:
File "/usr/sbin/aa-status", line 82, in get_profiles
apparmorfs = find_apparmorfs()
File "/usr/sbin/aa-status", line 137, in find_apparmorfs
for p in open("/proc/mounts").readlines():
File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1200: ordinal not in range(128)
That is because I have a UTF-8 non-Ascii character in one of my mounts:
$ mount
/dev/sdb1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
(...)
/dev/sda6 on /home/alain/Vidéos type ext4 (rw,relatime,errors=remount-ro)
(...)
The Python code of aastatus near line 135 shows:
def find_apparmorfs():
'''Finds AppArmor mount point'''
for p in open("/proc/mounts").readlines():
if p.split()[2] == "securityfs" and \
os.path.exists(os.path.join(p.split()[1], "apparmor")):
return os.path.join(p.split()[1], "apparmor")
return False
So if I do:
$ cat /proc/mounts
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
(...)
/dev/sda6 /home/alain/Vidéos ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
(...)
There is indeed a line with a 'é'
UTF-8 code of the 'é' is 0xC3 0xA9
But apparently the call to .readlines() is set as ASCII and hence does
NOT support the 0xC3 (first byte of the 'é' in UTF-8) and then it
crashes.
I assume the solution could be to correctly read as UTF-8 as there are
some non-Americans/English out there!
Sorry my knowledge of Python is just enough to understand the bug, and
not enough to submit a patch.
Regards.
Alain
To manage notifications about this bug go to:
https://bugs.launchpad.net/apparmor/+bug/1310598/+subscriptions