[lkml]   [2020]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC PATCH 2/2] KUnit: KASAN Integration
On Thu, Feb 27, 2020 at 3:44 AM 'Patricia Alfonso' via kasan-dev
<> wrote:
> Integrate KASAN into KUnit testing framework.
> - Fail tests when KASAN reports an error that is not expected
> - Use KUNIT_EXPECT_KASAN_FAIL to expect a KASAN error in KASAN tests
> - KUnit struct added to current task to keep track of the current test
> from KASAN code
> - Booleans representing if a KASAN report is expected and if a KASAN
> report is found added to kunit struct
> - This prints "line# has passed" or "line# has failed"
> Signed-off-by: Patricia Alfonso <>
> ---
> If anyone has any suggestions on how best to print the failure
> messages, please share!
> One issue I have found while testing this is the allocation fails in
> kmalloc_pagealloc_oob_right() sometimes, but not consistently. This
> does cause the test to fail on the KUnit side, as expected, but it
> seems to skip all the tests before this one because the output starts
> with this failure instead of with the first test, kmalloc_oob_right().

I don't follow this... we don't check output in any way, so how does
output affect execution?...

> --- a/tools/testing/kunit/
> +++ b/tools/testing/kunit/
> @@ -141,7 +141,7 @@ class LinuxSourceTree(object):
> return True
> def run_kernel(self, args=[], timeout=None, build_dir=''):
> - args.extend(['mem=256M'])
> + args.extend(['mem=256M', 'kasan_multi_shot'])

This is better done somewhere else (different default value if
KASAN_TEST is enabled or something). Or overridden in the KASAN tests.
Not everybody uses tools/testing/kunit/ and this seems
to be a mandatory part now. This means people will always hit this, be
confused, figure out they need to flip the value, and only then be
able to run kunit+kasan.

> process = self._ops.linux_bin(args, timeout, build_dir)
> with open(os.path.join(build_dir, 'test.log'), 'w') as f:
> for line in process.stdout:

 \ /
  Last update: 2020-02-27 15:43    [W:0.373 / U:5.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site