From patchwork Sun Oct 13 13:02:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sabyrzhan Tasbolatov X-Patchwork-Id: 13833403 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 4632BCF2576 for ; Sun, 13 Oct 2024 13:01:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2444A6B0082; Sun, 13 Oct 2024 09:01:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F3936B0083; Sun, 13 Oct 2024 09:01:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0944C6B0085; Sun, 13 Oct 2024 09:01:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DF95A6B0082 for ; Sun, 13 Oct 2024 09:01:21 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A22B91A080A for ; Sun, 13 Oct 2024 13:01:09 +0000 (UTC) X-FDA: 82668589710.17.41BB67E Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by imf20.hostedemail.com (Postfix) with ESMTP id A5CCA1C002E for ; Sun, 13 Oct 2024 13:01:13 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fLDLJ2gH; spf=pass (imf20.hostedemail.com: domain of snovitoll@gmail.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=snovitoll@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728824433; 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=PnmJ9PN1MwOJi0VN46gDmOuqLJjC2HT4OQkYN0N47z8=; b=JQ5A5fX6B6iGfach+be4V78/xZ4n8bZH7lyaJQNkZtu0taPXG92ggJoPrDwvQugltudlmf KgCCQ/TbhYxGsxWOs7TWTDD5YeUcuj9jaA+Q886TRFXCyYKqKCAwvu/ruFREj0JiEmMrTa FKwEy2GZ/BDdJlw1MKnIX8oZenowgFw= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fLDLJ2gH; spf=pass (imf20.hostedemail.com: domain of snovitoll@gmail.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=snovitoll@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728824433; a=rsa-sha256; cv=none; b=ZJ4BYLONYBqzCAkjY6kzW8YdcWdBlnNG+ZADXX9Vbwz9JSAmkN37t0x3R4Gmqs3tSvMRRr EZNmOHGTcK74F92IaYXamALELxCK61Mm/kRc4D0WoCdwrvDRsZ/lAxlqUzSroMnZww8NAR qlDkXzoeIBasFqt08gN9CxLKLWSpv0Q= Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a994ecf79e7so551900766b.0 for ; Sun, 13 Oct 2024 06:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728824478; x=1729429278; 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=PnmJ9PN1MwOJi0VN46gDmOuqLJjC2HT4OQkYN0N47z8=; b=fLDLJ2gH8gxWAhlrLpcS42W03Ooq2qoEc+8izivRnniSu0Y/O5n4AARCYnOphjeIWw UPhkuB702oadWzp/RAnYtoSTyTjbFjtwVE1thIA6WEqU98LEy747zYR7wExcX9II2+91 4GoM0oG8PV0p8wSAWuAyCco36Qz8+pSNWpD4RyVagdcpgjC/fu9Q3oogUR9bZ+lfSnTD mIytEmmYs03rN07tkcRD96Li0KLe/JAqAnskcUL67InHu3dAg0BJWy+6KMVSzeoQKiaQ yshBAUExGpYGeMVGgidfDHJytGxGSV81tLqaqJwuYcO/3wakPcwxzkgNEeOsmKILRS+y 1xFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728824478; x=1729429278; 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=PnmJ9PN1MwOJi0VN46gDmOuqLJjC2HT4OQkYN0N47z8=; b=pTvj/lO+9TVUf6rOp6Yf16Nn2hQkRQHhaUsJ3gRYToI0YwhBt3tC1Y20Ro4hOrkt// yXQFeEFghjiMpSAGVtVUrjclNxvSxPn7v9AS1ca0Cy88NXx2WHORnaQR7dXRBodulPUW v38no2xeG4Gk+EMTtmF4gY4e9OErheMCeoznM4xlCdVPOUaAronEY9UFTA+ULxIpKq8N MW7oMyrR87qMwuEpbAK2bnx+XAxiZRLDHVzHnSUwPEfB/ZHix2I5Y1chD7to2ynylX/g N176KGm4RSPFytoUOxX+KdmJErze1twapz4liXxEX23ik/fUDlM6bcUTG14GO5oRcWgC mCgw== X-Forwarded-Encrypted: i=1; AJvYcCXq1Np9P1JD10v4bWQkEV+8YoEMlQiyc6ghgt6zNXaq3sPcHlz91qF68c974xw3B55E4eEJd3clEQ==@kvack.org X-Gm-Message-State: AOJu0Yz/jh+7JuaDR4O/LPC2l2+MA4yHKTGAh4Co00dBOo0a8SQPh0+Y 1NjnnQUECWQZd9zZ0IriHuFIVDwSRgfVg6Rl8rc0wu2GiXmyfb02 X-Google-Smtp-Source: AGHT+IHXdVRsJajrbxhYVhpri5+mS+Hg+hbAd/CFrQh2ABK8/018Uy8GEmA0GGHi1h4YJtX3MXXJvQ== X-Received: by 2002:a17:907:1c08:b0:a9a:b4e:b9eb with SMTP id a640c23a62f3a-a9a0b4ecbbamr74879866b.46.1728824477537; Sun, 13 Oct 2024 06:01:17 -0700 (PDT) Received: from work.. (2.133.25.254.dynamic.telecom.kz. [2.133.25.254]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a0d9de967sm19209666b.139.2024.10.13.06.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 06:01:16 -0700 (PDT) From: Sabyrzhan Tasbolatov To: andreyknvl@gmail.com Cc: akpm@linux-foundation.org, dvyukov@google.com, glider@google.com, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ryabinin.a.a@gmail.com, snovitoll@gmail.com, vincenzo.frascino@arm.com, elver@google.com, corbet@lwn.net, alexs@kernel.org, siyanteng@loongson.cn, 2023002089@link.tyut.edu.cn, workflows@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v2 0/3] kasan: migrate the last module test to kunit Date: Sun, 13 Oct 2024 18:02:08 +0500 Message-Id: <20241013130211.3067196-1-snovitoll@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: px8b6anrc7s35irer8honjki6p4ybmpj X-Rspamd-Queue-Id: A5CCA1C002E X-Rspamd-Server: rspam11 X-HE-Tag: 1728824473-256793 X-HE-Meta: U2FsdGVkX18FW4wGJvt+e2FCbB8xIu61zFPE/RJiErhtMg5Px3RXohkuiCIZiSingPkh4nt9isRTIDB4iATC4rQL827Qj5I/KINq72ad+QQD/kSP9WuhY1UXXwVexRRdxC8bVXv9UJbFP5PBuG0m2HWcEJqA4SeHh2UNoTXDM7XFBMdfclhwc8tCROnzZAHOHO243tKy3K47HnK3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yFhLD5ZccPPCPgnlciEI2MYmtX4ggjeO6RBe7JwcdbVO0kC4nx9kd5PnJPJb1Ol7Z627nZcT20uVXQTWhW//jwNwdlSXZyt1RmJGJpsY6Rtm+8ES8ZyS3v24NMXTdtkUeNpObdkWKdgQr6YjFLqQC0TphZYnfIaiQjoduBU5m3AqRqkVfY X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, 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 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