[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
This bug was fixed in the package apport - 2.20.11-0ubuntu82 --- apport (2.20.11-0ubuntu82) jammy; urgency=medium * whoopsie-upload-all: - Catch zlib.error when decoding CoreDump from crash file (LP: #1947800) - Catch FileNotFoundError during process_report (LP: #1867204) -- Benjamin Drung Wed, 13 Apr 2022 22:20:41 +0200 ** Changed in: apport (Ubuntu Jammy) Status: Confirmed => Fix Released -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
Reproduction Part 2 === I used divide-by-zero from chaos-marmosets to create a crash file and deleted parts of CoreDump. Then I used following snippet to test the modified crash file: ```python import sys, apport report = sys.argv[1] r = apport.Report() with open(report, 'rb') as f: r.load(f, binary='compressed') r.add_gdb_info() ``` I only got these three types of call traces: ``` EOFError: Compressed file ended before the end-of-stream marker was reached binascii.Error: Incorrect padding binascii.Error: Invalid base64-encoded string: number of data characters (21189) cannot be 1 more than a multiple of 4 ``` Chaning one character in CoreDump triggered a different error message: ``` gzip.BadGzipFile: CRC check failed 0xfb18ba58 != 0x7f1b4388 ``` So it is unclear to me how to produce a faulty CoreDump entry in the crash report. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
** Tags added: patch -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
Let's catch the zlib.error exception the same way as the other exceptions are caught. ** Patch added: "apport_2.20.11-0ubuntu82.debdiff" https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+attachment/5580506/+files/apport_2.20.11-0ubuntu82.debdiff -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
Bug analysis whoopsie-upload-all reads the *.crash files (to upload them): ``` r = apport.Report() with open(report, 'rb') as f: r.load(f, binary='compressed') ``` ProblemReport.load reads the encoded data and keeps in compressed: ```python block = base64.b64decode(line) if value.gzipvalue == b'' and not block.startswith(b'\037\213\010'): value.legacy_zlib = True value.gzipvalue += block ``` Derived from the code path, `legacy_zlib` is set to `False` in this case. Then `Report.gdb_command` tries to decompress the CoreDump field and write it into a temporary file. The relevant part from `problem_report.py` from apport 2.20.11-0ubuntu71 (line 73): ```python gz = gzip.GzipFile(fileobj=BytesIO(self.gzipvalue)) while True: block = gz.read(1048576) if not block: break file.write(block) ``` So the only two reasons that I can see why decompressing the byte object `gzipvalue`: 1. The content of the CoreDump field in the .crash file is malformed. 2. `legacy_zlib` is set to `False` instead of `True`. Reproduction I tried to reproduce the `zlib.error` by feeding it with wrong data: ``` In [1]: import gzip In [2]: from io import BytesIO In [3]: gzip.GzipFile(fileobj=BytesIO(None)).read(1048576) Out[3]: b'' In [4]: gzip.GzipFile(fileobj=BytesIO(b"")).read(1048576) Out[4]: b'' In [5]: gzip.GzipFile(fileobj=BytesIO(b"bogus")).read(1048576) [...] BadGzipFile: Not a gzipped file (b'bo') ``` -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
** Tags added: jammy -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
** Description changed: The Ubuntu Error Tracker has been receiving reports about a problem regarding apport. This problem was most recently seen with package version 2.20.11-0ubuntu70, the problem page at https://errors.ubuntu.com/problem/7120f8aebdf09e9dca39196d035eec234071e800 contains more details, including versions of packages affected, stacktrace or traceback, and individual crash reports. If you do not have access to the Ubuntu Error Tracker and are a software developer, you can request it at http://forms.canonical.com/reports/. + + Traceback (most recent call last): + File "/usr/share/apport/whoopsie-upload-all", line 196, in + stamps = collect_info() + File "/usr/share/apport/whoopsie-upload-all", line 146, in collect_info + res = process_report(r) + File "/usr/share/apport/whoopsie-upload-all", line 103, in process_report + r.add_gdb_info() + File "/usr/lib/python3/dist-packages/apport/report.py", line 786, in add_gdb_info + gdb_cmd, environ = self.gdb_command(rootdir, gdb_sandbox) + File "/usr/lib/python3/dist-packages/apport/report.py", line 1706, in gdb_command + self['CoreDump'].write(f) + File "/usr/lib/python3/dist-packages/problem_report.py", line 75, in write + block = gz.read(1048576) + File "/usr/lib/python3.9/gzip.py", line 300, in read + return self._buffer.read(size) + File "/usr/lib/python3.9/_compression.py", line 68, in readinto + data = self.read(len(byte_view)) + File "/usr/lib/python3.9/gzip.py", line 495, in read + uncompress = self._decompressor.decompress(buf, size) + zlib.error: Error -3 while decompressing data: invalid code lengths set -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
** Changed in: apport (Ubuntu Jammy) Importance: Undecided => High ** Changed in: apport (Ubuntu Impish) Importance: Undecided => High -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
Status changed to 'Confirmed' because the bug affects multiple users. ** Changed in: apport (Ubuntu Impish) Status: New => Confirmed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
Status changed to 'Confirmed' because the bug affects multiple users. ** Changed in: apport (Ubuntu) Status: New => Confirmed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
** Also affects: apport (Ubuntu Jammy) Importance: Undecided Status: New ** Also affects: apport (Ubuntu Impish) Importance: Undecided Status: New ** Tags removed: rls-ii-incoming -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
** Tags added: fr-1816 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1947800] Re: /usr/share/apport/whoopsie-upload-all:zlib.error:/usr/share/apport/whoopsie-upload-all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read
** Tags added: rls-ii-incoming -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1947800 Title: /usr/share/apport/whoopsie-upload- all:zlib.error:/usr/share/apport/whoopsie-upload- all@196:collect_info:process_report:add_gdb_info:gdb_command:write:read:readinto:read To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1947800/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs