From patchwork Mon Oct 14 02:56:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sabyrzhan Tasbolatov X-Patchwork-Id: 13834112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5F35CF259F for ; Mon, 14 Oct 2024 02:56:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BB366B0089; Sun, 13 Oct 2024 22:56:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 69AA36B008A; Sun, 13 Oct 2024 22:56:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 559A76B008C; Sun, 13 Oct 2024 22:56:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 388806B0089 for ; Sun, 13 Oct 2024 22:56:05 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 74299A9FB1 for ; Mon, 14 Oct 2024 02:55:50 +0000 (UTC) X-FDA: 82670693364.18.D473AD3 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by imf19.hostedemail.com (Postfix) with ESMTP id 0C0081A0005 for ; Mon, 14 Oct 2024 02:55:55 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="hxoeFB/i"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of snovitoll@gmail.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=snovitoll@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728874458; a=rsa-sha256; cv=none; b=o2owIUnYo4b2j386AnMEuQxD/cxYUNIWgUqRyPSRRwYrxgeEqciT6e8r0UxE2R/A9biVNA d2U9vsv1stDzyfHcHmogPoOxGCJZ8da7OSWQZbCpn+EF/ZME4iFezCFOIypVr9JSXrChsz v5QqAuZJ1UxjYCPXNm4yYfAHqAg0C5c= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="hxoeFB/i"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of snovitoll@gmail.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=snovitoll@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728874458; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=K7Dhocqjb276k2G2J0MeGRjVha2Bmm+qWInnAWrlt1Q=; b=YAtUYRz5QM6JlsncmM6iGOrPXk/Vpbd4LIJwEMhvumSzsl0zAMKkAAhKztuvpvvcXyase8 XWyoDwngefCvVeeLczYYSmQYZt0bNf+FP+z/LSp7xYOvJdpK1AxNt9AU7+lbWnj3+aF8eO NLrrMPf/A0TYL7LPPY8MC32MqLu8IEM= Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a9a16b310f5so17239966b.0 for ; Sun, 13 Oct 2024 19:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728874561; x=1729479361; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K7Dhocqjb276k2G2J0MeGRjVha2Bmm+qWInnAWrlt1Q=; b=hxoeFB/iZEW/+dLiBU7cel31R3Cs2knNWOzCEcDMBF9342FnjducEqb7lY3RkLHvCG uvCGV9R4OqLnZ4xQPX6DaPk/BeJI4nhciwPxJuNbxwyI/LYj3AjdM8P0tdN/9yVUHnnS PEgsvZZkhkxD5aoqAAmrEvVIgcXn/o/gL+cTDrjYsab8v6r0vcUorQFlpKGQKHm8Js7E 951q9KUu0qoYNjQ1mdWkBjZ4ru8oCRb40dg5cczpEQdUohgv38qti6StBnqlxmZ0ZlVC 7mqDFjCjr1aSrRvnUiCDgajdioZgSFmw0ROQ2QAlhrdKmDfqzTdyYGSFcsEbxyQMOJI5 MSEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728874561; x=1729479361; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K7Dhocqjb276k2G2J0MeGRjVha2Bmm+qWInnAWrlt1Q=; b=nCI+O9hFFOtObrjfSL9uMsfg/X5vBygNhhUQ0Buwu658/UvJVmYhW2LHQ3hzWv1I3u fClEOMW3J0GhM2j1VaAiBzpyyky52InhOMLz1wycNW2JRSZ6WuJ9u1LHZBlwOBPH4AE6 0qOYg6rbPcvxY1ydlIdZK5eGqP3xLVWgBvjQHepDSF9mf0sNmjliqZxeOYGB+xVS1xK8 r/rHqv/191fITAlAk15qcFXc+k1Ls0bx7Vg1fNDv4t8pqRvLOeu6cn/y5+K1VwpuDL1y RbxaXmu4aylUDLQ/MuIMljSwPG1S11ihvCI/gwwG+4xAAi7+v+y2ldFkSV/6popktQnI sNvg== X-Forwarded-Encrypted: i=1; AJvYcCX5LA2hLOUqrIckS47FYBxM3N5QS4/WOaQ++29M9WKwwzRwYhhTRLFhHhPsXKgTWqdA0do9f2yHGA==@kvack.org X-Gm-Message-State: AOJu0YxVveTOHpuRDw9gkMn9ZG0n4ksrNiNa0BZt6PCGwgDx5u6X+S7r OvBRYabQWoyamB29cO4BU0JAFgE1TPWGnWpWWxKuyfJIu8nY+mes X-Google-Smtp-Source: AGHT+IGE2RbCl116shOFEFRChGbBgS2YV7zDKqpNZIfMEb70LXwFCrg+DOxy37i0KpwC0h1ZeLHRgw== X-Received: by 2002:a17:907:6d02:b0:a99:422a:dee5 with SMTP id a640c23a62f3a-a99b970d0a7mr852403666b.57.1728874561232; Sun, 13 Oct 2024 19:56:01 -0700 (PDT) Received: from work.. (2.133.25.254.dynamic.telecom.kz. [2.133.25.254]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99ebdfbff1sm270501366b.39.2024.10.13.19.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 19:56:00 -0700 (PDT) From: Sabyrzhan Tasbolatov To: andreyknvl@gmail.com Cc: 2023002089@link.tyut.edu.cn, akpm@linux-foundation.org, alexs@kernel.org, corbet@lwn.net, dvyukov@google.com, elver@google.com, glider@google.com, kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ryabinin.a.a@gmail.com, siyanteng@loongson.cn, snovitoll@gmail.com, vincenzo.frascino@arm.com, workflows@vger.kernel.org Subject: [PATCH RESEND v3 0/3] kasan: migrate the last module test to kunit Date: Mon, 14 Oct 2024 07:56:58 +0500 Message-Id: <20241014025701.3096253-1-snovitoll@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 0C0081A0005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ecnibspozkjcfai1pjsz9gx5h1juw1wn X-HE-Tag: 1728874555-150361 X-HE-Meta: U2FsdGVkX19HqMYO4nOQO/gL5x6Li5fGLpyFMygLyR0orBPz8OAzPkc3R+GHz9Xn5/7xznqNHqTQZZlO5oe++ztrvwQwhSs37OAZTMtZWesW4NZk3/k8QCU0rSPkh6qjC/zpGESW7UTyROAuylSQIbweqvv/CEXv90MR/5bvHzRzOZCEulPUx1cGwif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auGIBXWSBI2JUGnBIf4ht1vSZji7uVI+INg2d0ZFoaT/jhp810aFL5gryKxleTZc9ZLhEe7kiEqoy33lRzmyEBnVLHS6FQicdvkcNfGhIlQAB3iw4ffw7JJwZ8O8FagvOaw5mkE505je8m5DJx07N4ipD3hNM2tWZJon3V1T6gVMqkI3lDsboN/i X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: copy_user_test() is the last KUnit-incompatible test with CONFIG_KASAN_MODULE_TEST requirement, which we are going to migrate to KUnit framework and delete the former test and Kconfig as well. In this patch series: - [1/3] move kasan_check_write() and check_object_size() to do_strncpy_from_user() to cover with KASAN checks with multiple conditions in strncpy_from_user(). - [2/3] migrated copy_user_test() to KUnit, where we can also test strncpy_from_user() due to [1/4]. KUnits have been tested on: - x86_64 with CONFIG_KASAN_GENERIC. Passed - arm64 with CONFIG_KASAN_SW_TAGS. 1 fail. See [1] - arm64 with CONFIG_KASAN_HW_TAGS. 1 fail. See [1] [1] https://lore.kernel.org/linux-mm/CACzwLxj21h7nCcS2-KA_q7ybe+5pxH0uCDwu64q_9pPsydneWQ@mail.gmail.com/ - [3/3] delete CONFIG_KASAN_MODULE_TEST and documentation occurrences. Changes v2 -> v3: - added in [1/3] Reviewed-by: Andrey Konovalov. - added a long string in usermem for strncpy_from_user. Suggested by Andrey. - applied Andrey's patch to modify further kasan.rst. Changes v1 -> v2: - moved the sanitization to do_strncpy_from_user and as the separate commit per Andrey's review. - deleted corresponding entries of kasan_test_module.o in Makefile - deleted CONFIG_KASAN_MODULE_TEST at all with the documentation in separate commit. - added Documentation maintainers in CC. Sabyrzhan Tasbolatov (3): kasan: move checks to do_strncpy_from_user kasan: migrate copy_user_test to kunit kasan: delete CONFIG_KASAN_MODULE_TEST Documentation/dev-tools/kasan.rst | 9 +-- .../translations/zh_CN/dev-tools/kasan.rst | 6 +- .../translations/zh_TW/dev-tools/kasan.rst | 6 +- lib/Kconfig.kasan | 7 -- lib/strncpy_from_user.c | 5 +- mm/kasan/Makefile | 2 - mm/kasan/kasan.h | 2 +- mm/kasan/kasan_test_c.c | 39 +++++++++ mm/kasan/kasan_test_module.c | 81 ------------------- mm/kasan/report.c | 2 +- 10 files changed, 48 insertions(+), 111 deletions(-) delete mode 100644 mm/kasan/kasan_test_module.c