From 7d11fc36e6dfd21c97b488fbc423867b363d59f9 Mon Sep 17 00:00:00 2001 From: Steven Cahail <scahail@codeaurora.org> Date: Fri, 17 Apr 2015 16:28:59 -0600 Subject: [PATCH] ipc_logging: Handle corrupted log page headers When parsing IPC logs, sometimes a bogus log page header is present which overwrites the bit used to discern whether or not the log page is version 0. This causes the script to read the version as being 1 or greater, and the script then asserts after failing to find a log context for the page. In general, header corruption like this may cause other issues that could lead to the context not being found, which currently aborts the script. Modify the script to continue parsing the logs as logs of an unknown version in this case. If the header is valid, the proper version will be parsed from it, allowing parsing to continue normally. Change-Id: I02ae617980f817705224b7b02926a9f576dd88e6 --- ipc_logging/ipc_logging.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ipc_logging/ipc_logging.py b/ipc_logging/ipc_logging.py index 885fe8a..ee88d6d 100644 --- a/ipc_logging/ipc_logging.py +++ b/ipc_logging/ipc_logging.py @@ -1441,8 +1441,17 @@ def cmdParse(options): if page.unpack(data): if versionIsOneOrGreater: if not page.log_id in dictContexts: - context = get_context(start_of_page, fIn, page, - dictContexts, lstFiles, fileCount) + try: + context = get_context(start_of_page, fIn, page, + dictContexts, lstFiles, fileCount) + except: + msg = "Context not found - skipping page " + \ + "and trying to " + \ + "continue with unknown log page version" + logging.debug(msg) + page = LogPageVersionUnknown() + continue + else: context = dictContexts[page.log_id] page.setContext(context) -- GitLab