Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp843907ybg; Thu, 19 Mar 2020 09:43:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuvO0ucbbdkYvJVEEt5C4YIKCKb4LV29hZ17QrwAGPnDg9SCy+g0z3MceZPdMgg1iraegw3 X-Received: by 2002:a05:6830:19ce:: with SMTP id p14mr2979251otp.362.1584636196828; Thu, 19 Mar 2020 09:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584636196; cv=none; d=google.com; s=arc-20160816; b=xUFS6xfMaoCVVDHL472GuGkTUvLS9EwVn5nqQ3kV+kU4Z55HRmTdRhDicRKZMnY/yI rWwBAjfP3Y/uzodE5FoD+z7g775B1yz2c739n6BM0x2+2TwOcgbdb6I8UaB0m6bd8spG WMviVwe+S+zKXKEsqXODw/PdohhuQANqDr9JN0Fzna1k0n1PDwC1QtHT9bNOPXCoamfF lDOI2gjADBlidJ+rpyFndqaKee5LlAoKKTbfM3Swbjprei/HBRSD5abjmwzk1pBK3wce 4wXZkQIhAfXQh2k+ACxYBlfv2jVOnZvqc+PoWqR0nBp0Rsf561zAxOJCXxG98oAVsrVU gqQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=Dz7alAscI1YvV+X2ok1ND7NhQJcsBO33MSW+QX9MTto=; b=ZmQApxTgEIyyTiO9/CAWBV56S7NabTYPLC8P3fO+kNtesb7hJGFVNdWOn9fPywKEG9 HVnGlnxKUO8CvqENdj7Q30YbyF1k3XW83FWx3Wvqah3hTl+gGwqsVOXnk3/h3beWgbV9 6HNVaCQcUQepm5ib/jFt7QtnQmkTnLWOAstTltDpQyv9Qd3Zm6K6sIhrMrKv+9S+1Vuh JQc9W5oPJQUDG/F0YIFDP17pfU4lGq/pyd6ElR/mN3iTPLY3bBa2wVQrNv4HE3wZ4iyJ Gbk/jojaqOc4HVHmttWOUtiXoMztFxUUeEnd0n49pYnUKFcwxQShoDrOk10B2DXHrubp 0kGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OYcIxAhV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q25si1509544ota.36.2020.03.19.09.43.03; Thu, 19 Mar 2020 09:43:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OYcIxAhV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728391AbgCSQmm (ORCPT + 99 others); Thu, 19 Mar 2020 12:42:42 -0400 Received: from mail-yb1-f202.google.com ([209.85.219.202]:39147 "EHLO mail-yb1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727772AbgCSQmm (ORCPT ); Thu, 19 Mar 2020 12:42:42 -0400 Received: by mail-yb1-f202.google.com with SMTP id h66so1074402yba.6 for ; Thu, 19 Mar 2020 09:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=Dz7alAscI1YvV+X2ok1ND7NhQJcsBO33MSW+QX9MTto=; b=OYcIxAhVB7TkVa6WZyRwxfsKV9lKaUsk0UijSeFRvD9xTLr5/CX3x3kHaQhyHaqy1C APv2OCbdhn8rHtXnR1dE+KyIY0eMy//e5p9Dfw6LR8UInTfIuwqCnJHflNpvHpJ+4ScF A0zL74CzffXi1OhRsrWxgUDnMuKxnHz4ZSXxNmeWLaOP2UCKBFTkqc2iNvQPyv911Pcd 3YydHB74C/AYS6D3kFPMyT9ZwGrVV8SjJK85KnmEGjHDu6ixzV4QyexmMYugujIR6ivt t/AZ82O8U9Q3PvPyb9qPhA+5phKUy6IsLwHdqkgzGr/p0J9/gQWBxj84w/RxveZKhhaX QfQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=Dz7alAscI1YvV+X2ok1ND7NhQJcsBO33MSW+QX9MTto=; b=GYYyqIF8Kpxdehd5NPAvISxK+hQ8WalMwZdLYFeG4M65awA8ns81zmpJM5FU3IVHui QjRO3dYQyxcePEWYrhAN8MpHFaE5QfBeSkJGzl3YXo9PAzDpp6EbZLpiw/4ai/CsxM32 SSvhYs2Al4Z/4479ndjmhJ2JnwUa3Z2mprGU14U5RZg8aKhh3O966Y5pZiuWNwO9TBOB 79ZkZohFSHGqOXTrjvkTjpOIG1EQOg6g/7dUcyyGi1o6mcST0vbNgoFM+/RRYoZ/5ApT /I/9b3gQzrChHv+QUIkK8HEVQi/yRG+OOaeqKWphbSy7Yrw6qg8J5VwQzQbSr5XyPz4n KMpQ== X-Gm-Message-State: ANhLgQ33WKEz6xGiDG7zc/buM5TBPkB5bJB60zpNy1nug+xAZFtF/zO9 tNK7TNM7WIAQZqWvs4XpEDmO50E8i0ZYyP2mh3Q= X-Received: by 2002:a25:a281:: with SMTP id c1mr5753816ybi.327.1584636161413; Thu, 19 Mar 2020 09:42:41 -0700 (PDT) Date: Thu, 19 Mar 2020 09:42:24 -0700 Message-Id: <20200319164227.87419-1-trishalfonso@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.25.1.696.g5e7596f4ac-goog Subject: [RFC PATCH v2 0/3] KASAN/KUnit Integration From: Patricia Alfonso To: davidgow@google.com, brendanhiggins@google.com, aryabinin@virtuozzo.com, dvyukov@google.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Cc: linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, Patricia Alfonso Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset contains everything needed to integrate KASAN and KUnit. KUnit will be able to: (1) Fail tests when an unexpected KASAN error occurs (2) Pass tests when an expected KASAN error occurs KASAN Tests have been converted to KUnit with the exception of copy_user_test because KUnit is unable to test those. I am working on documentation on how to use these new tests to be included in the next version of this patchset. Changes since v1: - Make use of Alan Maguire's suggestion to use his patch that allows static resources for integration instead of adding a new attribute to the kunit struct - All KUNIT_EXPECT_KASAN_FAIL statements are local to each test - The definition of KUNIT_EXPECT_KASAN_FAIL is local to the test_kasan.c file since it seems this is the only place this will be used. - Integration relies on KUnit being builtin - copy_user_test has been separated into its own file since KUnit is unable to test these. This can be run as a module just as before, using CONFIG_TEST_KASAN_USER - The addition to the current task has been separated into its own patch as this is a significant enough change to be on its own. Patricia Alfonso (3): Add KUnit Struct to Current Task KUnit: KASAN Integration KASAN: Port KASAN Tests to KUnit include/kunit/test.h | 10 + include/linux/sched.h | 4 + lib/Kconfig.kasan | 13 +- lib/Makefile | 1 + lib/kunit/test.c | 10 +- lib/test_kasan.c | 639 +++++++++++++++---------------------- lib/test_kasan_copy_user.c | 75 +++++ mm/kasan/report.c | 33 ++ 8 files changed, 400 insertions(+), 385 deletions(-) create mode 100644 lib/test_kasan_copy_user.c -- 2.25.1.696.g5e7596f4ac-goog