2013-11-04 10:00:36 +01:00
|
|
|
# kernel message checker module
|
|
|
|
#
|
|
|
|
# Copyright (c) 2013, Intel Corporation
|
|
|
|
#
|
|
|
|
# Author: Johannes Berg <johannes@sipsolutions.net>
|
|
|
|
#
|
|
|
|
# This software may be distributed under the terms of the BSD license.
|
|
|
|
# See README for more details.
|
|
|
|
#
|
|
|
|
"""
|
|
|
|
Tests for kernel messages to find if there were any issues in them.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
2013-11-18 16:38:06 +01:00
|
|
|
lockdep_messages = [
|
|
|
|
'possible circular locking dependency',
|
|
|
|
'.*-safe -> .*unsafe lock order detected',
|
|
|
|
'possible recursive locking detected',
|
|
|
|
'inconsistent lock state',
|
|
|
|
'possible irq lock inversion dependency',
|
|
|
|
'suspicious RCU usage',
|
|
|
|
]
|
2017-05-30 16:29:50 +02:00
|
|
|
lockdep = r'(\[\s*)?(INFO|WARNING): (%s)|\*\*\* DEADLOCK \*\*\*' % ('|'.join(lockdep_messages), )
|
2022-08-17 09:17:31 +02:00
|
|
|
issue = re.compile('(\[[0-9 .]*\] )?(WARNING:|BUG:|UBSAN:|%s|RTNL: assertion failed).*' % lockdep)
|
2013-11-04 10:00:36 +01:00
|
|
|
|
|
|
|
def check_kernel(logfile):
|
|
|
|
for line in open(logfile, 'r'):
|
|
|
|
if issue.match(line):
|
|
|
|
return False
|
|
|
|
return True
|