Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1090075rdb; Sat, 18 Nov 2023 02:43:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHSiz/OA2rIrwhCMu/XtxKXQzrtKdOfelQ9xWWM7Kp6f1RUA3Pno8DtqVnx+kEJjuTcAl50 X-Received: by 2002:a05:6870:b13:b0:1f4:d43a:b349 with SMTP id lh19-20020a0568700b1300b001f4d43ab349mr2462533oab.59.1700304208767; Sat, 18 Nov 2023 02:43:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700304208; cv=none; d=google.com; s=arc-20160816; b=yrUmC4T8+V9fvjtE37of/2rravLzq1V7e4TUCfsu8wlWd/m+3xgne0sg8CxRgzZ4iR Lme66hrqD8lof8KXcMOnFhyyeXaapRoWxJW93kSjaVU6os3R3+tlnczGiWsRhr5AybIK BgHMqj5iJNt2dA2mb7KjCoOXutBz3REq4Gohgvhe+Zylwxx8JbOBDXvXWxDhyphcdPG6 CKMrd8E4WvJyMMpEFEayc4eVYnnsyzo69EBywokK9ZVn66fMPFvY1Ep9g/NwJJicjabR GWonSW0V8tYu/bKlOPkr4T9+JAzyXLI6iz4JANURBZ1/Go0l8ljIQVcn9AfZQ1QBEkye FO6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=w9AROSevqoo1r/l7lSnXWlS3UIuDAcdyWa8DPub7rBs=; fh=cKgRupAwAqvDHHS6VAzGoPs3pyLdUCOVkk/Q20cDUOo=; b=TygztgIMvGAN+2+P9PH00Nz9HdsOhao+qAAfvkYQBhTGwQp0Ix715EyAzpirA7y9t4 ZwIFLTtNi6nvFfFLwJF2Xm3QC0cYtKUWzAJmXc7zJ0G3t3m6q/vPc6YVRnE8DFrLEe+v YqIw5++lcbjJ23PNYJY6cbB1T+BjHE8LnXnpHlWmEfT+dCFz9tcoJLDffOssw0kUjpJW io8iWg0euu3BRq7u1/QFsfAjCDrFxibzdwAE4LYSCYrznHbxGrxFWsuta0w3P1OoDaKo NF3D6rgPwliX89latVBvhhfHFAYKzZNQYpM61Bj/+4hY3YU2LhC1HNVpyytf6stTUdYy 1rsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id q14-20020a17090ac10e00b00274e16f797csi4275499pjt.20.2023.11.18.02.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 02:43:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id CA1E4801CDAB; Sat, 18 Nov 2023 02:43:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232782AbjKRKlp (ORCPT + 99 others); Sat, 18 Nov 2023 05:41:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231782AbjKRKll (ORCPT ); Sat, 18 Nov 2023 05:41:41 -0500 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 031BED75; Sat, 18 Nov 2023 02:41:36 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4SXVgc2NmHz4f3jMP; Sat, 18 Nov 2023 18:41:32 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id CF75C1A0175; Sat, 18 Nov 2023 18:41:33 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.101.107]) by APP1 (Coremail) with SMTP id cCh0CgDn6hDQlFhlQPAFBQ--.58135S4; Sat, 18 Nov 2023 18:41:33 +0800 (CST) From: Zhang Xiaoxu To: zhangxiaoxu5@huawei.com, weiyongjun1@huawei.com, linux-kernel@vger.kernel.org, broonie@kernel.org, rostedt@goodmis.org, mingo@redhat.com, frowand.list@gmail.com, linux-spi@vger.kernel.org Subject: [PATCH -next 00/14] Implement a ligth weight device driver test framework Date: Sat, 18 Nov 2023 18:40:26 +0800 Message-Id: <20231118104040.386381-1-zhangxiaoxu@huaweicloud.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID: cCh0CgDn6hDQlFhlQPAFBQ--.58135S4 X-Coremail-Antispam: 1UD129KBjvJXoWxKry3tw4DWr17WFW3Zr18Zrb_yoWxKF43pF WrJ347Wa1UCF1ftrs5tF4jqFWrXw4kWF4Fkr1IqryxWr93Kr1rCrW2k3WYqF9xua1FqrZ5 Aw109ryUCw1UXaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUgKb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Y z7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zV AF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4l IxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s 0DMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBI daVFxhVjvjDU0xZFpf9x07UWE__UUUUU= X-CM-SenderInfo: x2kd0wp0ld053x6k3tpzhluzxrxghudrp/ X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 18 Nov 2023 02:43:08 -0800 (PST) From: Zhang Xiaoxu Implement a ligth weight device driver test framework, KDDV(Kernel Device Driver Verification). Which using eBPF based bus controllers to mockup device chipsets. The kddv already discover the following issues: fc92d9e3de0b iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw 58143c1ed588 iio: health: afe4403: Fix oob read in afe4403_read_raw 3f4033a811bc iio: filter: admv8818: close potential out-of-bounds read in __admv8818_read_[h|l]pf_freq() 8c9a59939deb Input: raydium_ts_i2c - fix memory leak in raydium_i2c_send() 7485edb2b6ca media: i2c: ov772x: Fix memleak in ov772x_probe() bab76514aca3 regulator: da9121: Fix uninit-value in da9121_assign_chip_model() 9d47e01b9d80 power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() ... Zhang Xiaoxu (14): kddv/core: Implement a ligth weight device driver test framework kddv/core: Allow test case config bpf program kddv/core: Add io fault support to bpf program kddv/core: Check kmsg before return from test case kddv/core: Support kernel memory leak detector kddv/core: Add page and slab fault inject support kddv/cmd: Add command to create/remove mockup device kddv/cmd: Add command to run testcases kddv/core: Add test support for SPI driver kddv/tests: Add support for testing hwmon driver kddv/tests/hwmon: Add test cases for max31722 driver kddv/tests: Add support for testing mtd driver kddv/tests/mtd: Add test cases for mchp23k256 driver kddv: Add document for kddv Documentation/dev-tools/index.rst | 1 + Documentation/dev-tools/kddv.rst | 183 ++++++++ tools/testing/kddv/.gitignore | 3 + tools/testing/kddv/Makefile | 25 ++ tools/testing/kddv/kddv/Makefile | 28 ++ tools/testing/kddv/kddv/__init__.py | 0 tools/testing/kddv/kddv/cmds/__init__.py | 0 tools/testing/kddv/kddv/cmds/mock.py | 105 +++++ tools/testing/kddv/kddv/cmds/test.py | 75 ++++ tools/testing/kddv/kddv/cmds/utils.py | 28 ++ tools/testing/kddv/kddv/core/__init__.py | 13 + .../testing/kddv/kddv/core/buses/__init__.py | 13 + tools/testing/kddv/kddv/core/buses/spi.py | 74 +++ tools/testing/kddv/kddv/core/consts.py | 13 + tools/testing/kddv/kddv/core/ddunit.py | 83 ++++ tools/testing/kddv/kddv/core/device.py | 78 ++++ tools/testing/kddv/kddv/core/dmesg.py | 41 ++ tools/testing/kddv/kddv/core/driver.py | 82 ++++ tools/testing/kddv/kddv/core/environ.py | 65 +++ tools/testing/kddv/kddv/core/failnth.py | 57 +++ tools/testing/kddv/kddv/core/faulter.py | 48 ++ .../testing/kddv/kddv/core/faults/__init__.py | 13 + tools/testing/kddv/kddv/core/faults/fail.py | 86 ++++ tools/testing/kddv/kddv/core/faults/page.py | 40 ++ tools/testing/kddv/kddv/core/faults/slab.py | 36 ++ tools/testing/kddv/kddv/core/memleak.py | 39 ++ tools/testing/kddv/kddv/core/mockup.py | 193 ++++++++ tools/testing/kddv/kddv/core/model.py | 95 ++++ tools/testing/kddv/kddv/data/Makefile | 21 + tools/testing/kddv/kddv/data/bpf/Makefile | 22 + .../kddv/data/bpf/include/bpf-xfer-conf.h | 124 +++++ .../kddv/kddv/data/bpf/mtd/mtd-mchp23k256.c | 72 +++ .../kddv/kddv/data/bpf/spi/spi-xfer-base.h | 99 ++++ .../kddv/kddv/data/bpf/spi/spi-xfer-r1v1.c | 51 +++ .../kddv/kddv/data/bpf/spi/spi-xfer-r1v2.c | 51 +++ .../kddv/kddv/data/bpf/spi/spi-xfer-r1v3.c | 86 ++++ .../kddv/kddv/data/bpf/spi/spi-xfer-r2v1.c | 51 +++ .../kddv/kddv/data/bpf/spi/spi-xfer-r2v2.c | 51 +++ .../kddv/kddv/data/bpf/spi/spi-xfer-r3v1.c | 52 +++ .../kddv/kddv/data/bpf/spi/spi-xfer-r4v4.c | 89 ++++ tools/testing/kddv/kddv/tests/__init__.py | 0 .../testing/kddv/kddv/tests/hwmon/__init__.py | 425 ++++++++++++++++++ .../kddv/kddv/tests/hwmon/test_max31722.py | 40 ++ tools/testing/kddv/kddv/tests/mtd/__init__.py | 63 +++ .../kddv/kddv/tests/mtd/test_mchp23k256.py | 41 ++ 45 files changed, 2855 insertions(+) create mode 100755 Documentation/dev-tools/kddv.rst create mode 100644 tools/testing/kddv/.gitignore create mode 100644 tools/testing/kddv/Makefile create mode 100644 tools/testing/kddv/kddv/Makefile create mode 100755 tools/testing/kddv/kddv/__init__.py create mode 100755 tools/testing/kddv/kddv/cmds/__init__.py create mode 100755 tools/testing/kddv/kddv/cmds/mock.py create mode 100755 tools/testing/kddv/kddv/cmds/test.py create mode 100755 tools/testing/kddv/kddv/cmds/utils.py create mode 100755 tools/testing/kddv/kddv/core/__init__.py create mode 100755 tools/testing/kddv/kddv/core/buses/__init__.py create mode 100755 tools/testing/kddv/kddv/core/buses/spi.py create mode 100755 tools/testing/kddv/kddv/core/consts.py create mode 100755 tools/testing/kddv/kddv/core/ddunit.py create mode 100755 tools/testing/kddv/kddv/core/device.py create mode 100755 tools/testing/kddv/kddv/core/dmesg.py create mode 100755 tools/testing/kddv/kddv/core/driver.py create mode 100755 tools/testing/kddv/kddv/core/environ.py create mode 100755 tools/testing/kddv/kddv/core/failnth.py create mode 100755 tools/testing/kddv/kddv/core/faulter.py create mode 100755 tools/testing/kddv/kddv/core/faults/__init__.py create mode 100755 tools/testing/kddv/kddv/core/faults/fail.py create mode 100755 tools/testing/kddv/kddv/core/faults/page.py create mode 100755 tools/testing/kddv/kddv/core/faults/slab.py create mode 100755 tools/testing/kddv/kddv/core/memleak.py create mode 100755 tools/testing/kddv/kddv/core/mockup.py create mode 100755 tools/testing/kddv/kddv/core/model.py create mode 100644 tools/testing/kddv/kddv/data/Makefile create mode 100644 tools/testing/kddv/kddv/data/bpf/Makefile create mode 100644 tools/testing/kddv/kddv/data/bpf/include/bpf-xfer-conf.h create mode 100644 tools/testing/kddv/kddv/data/bpf/mtd/mtd-mchp23k256.c create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-base.h create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r1v1.c create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r1v2.c create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r1v3.c create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r2v1.c create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r2v2.c create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r3v1.c create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r4v4.c create mode 100755 tools/testing/kddv/kddv/tests/__init__.py create mode 100755 tools/testing/kddv/kddv/tests/hwmon/__init__.py create mode 100755 tools/testing/kddv/kddv/tests/hwmon/test_max31722.py create mode 100644 tools/testing/kddv/kddv/tests/mtd/__init__.py create mode 100755 tools/testing/kddv/kddv/tests/mtd/test_mchp23k256.py -- 2.34.1