From patchwork Wed Oct 16 13:17:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sabyrzhan Tasbolatov X-Patchwork-Id: 13838463 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 CBD8ED1AD53 for ; Wed, 16 Oct 2024 13:17:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 421936B0082; Wed, 16 Oct 2024 09:17:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D0BF6B0083; Wed, 16 Oct 2024 09:17:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 271336B0088; Wed, 16 Oct 2024 09:17:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 09BEB6B0082 for ; Wed, 16 Oct 2024 09:17:18 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 68D681C409A for ; Wed, 16 Oct 2024 13:17:06 +0000 (UTC) X-FDA: 82679516346.18.CB978B8 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by imf05.hostedemail.com (Postfix) with ESMTP id 34F0910000A for ; Wed, 16 Oct 2024 13:16:58 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=X9Ccsxp5; spf=pass (imf05.hostedemail.com: domain of snovitoll@gmail.com designates 209.85.167.53 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=1729084490; 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=odeLQxQfk7QzT/fVHpJdy7CnXL/SLaCfPU2fty6lRDo=; b=J2xLvCcvy3cMg6YYM4Cz7yjCtQKNxB4xp3qi4t4YDRYY7ywP1yHCbKcZcoaTgYFUQmvoo1 B4a0Lv265qZfl5o6ZdrxVjCm3PZMcvZkOGAGmv2vhOm0kJ3WlKhzcYh2XMBrJ5viBlKXlj F52kG7u/AwCFVxiEIQUb6Ls/FR6JCts= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729084490; a=rsa-sha256; cv=none; b=2oDJQ4zQo0f+13sNuEammpxxWn1iPBRqaGbkSUCJsszHmBgLeYv+4KMCzqJ0uzoWCuA7do Zqxqk8SV31YqKhAk4kGltqPi9TtdzckaVkFyasKJxSDWhFQk3MJzHsdYmZovXycM7F2qC6 2xQokZEjiKVeCKt/YRwcVuXc/7sUNm8= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=X9Ccsxp5; spf=pass (imf05.hostedemail.com: domain of snovitoll@gmail.com designates 209.85.167.53 as permitted sender) smtp.mailfrom=snovitoll@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-539f72c8fc1so3664836e87.1 for ; Wed, 16 Oct 2024 06:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729084633; x=1729689433; 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=odeLQxQfk7QzT/fVHpJdy7CnXL/SLaCfPU2fty6lRDo=; b=X9Ccsxp5plIhnZjzccqy31xv7ktF1oZh/Dwlwr6XJX/nTZOZ5UpSTaLqqPjCwnkEMv KAkTXrINnDO79d614RWVux8xEk8PLc5qEkc/7p04G6OE3F/Y0hE8YiL6qvLnQnelWaSB bGyqeXIDCaFkdnTo8CNmZONMd7YV+sBFN3jDRXw65+65SsJRp22oRSTGJz+gZoio2MJo Y/TIcy0TlQLNzB707y6WBxWdhGmLrC1/rBRnHoMAxmdFgsgPmY0CVIv3d/qM4ijteU7B E4/ekKJy1RHhPWkj4MZMkdLFBgUonGKfQ08S88LnWkAsO54DdqrlzkQkeEUwidMIRoib z79Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729084633; x=1729689433; 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=odeLQxQfk7QzT/fVHpJdy7CnXL/SLaCfPU2fty6lRDo=; b=JrYtWlUGhUwgraC/sZqSDmSnC559DZQUAi1wJKtCdQ+kgkwGf/pR68rOHGWCg+uVfx MKo8zOhZqiCEyh42FooOzqkltlDRyd8I5Gvcx5CSYhx8g5OgqXAu6SQ5ipwLTzaIviY6 +Q6+FnZ9POSxZVuN7WxbCmpY2GQmxGsxJAt3oieQzV0CDYyHv0SlaR6cU7dNPm+BPq9A LYA+i4kDHxA7WNuIoMnEC8Y8nQiRKD0wWOZzuF/zMfjE6ilOYrOkctEXs+Oe+WjPWRLJ hnOa5M0D3ZCdcNugYqMfTeEJAmEBB6hHB1c5UiLkM5Ob+ztlXI1MM6JJsJbwLXKVo/QC v+dQ== X-Forwarded-Encrypted: i=1; AJvYcCWg7inm4x6Q6gYcwYEAcq2IMJNJCS5LVLZPSPr7dlXwPJsySuYcUGD/yIXnf1+6H5LMEnI8F/utuA==@kvack.org X-Gm-Message-State: AOJu0YxbTpm3qyyBJGVdYGfbSjp0j4cNyXio7v+rtSN73hsCUbH2b3lD Ho5e/5IKI6BpDUWnDqlrjnb5YXr+Bu7CMM/qxhAs8YXBkzf689TQaRKwzDSj X-Google-Smtp-Source: AGHT+IHbAwDtQQ/CePOTLFY1DTPJVEhyXlGJ0iT/Vy6GEFP6uk0rDiPXmfCHhYye2Su8f2pzIuZ2ww== X-Received: by 2002:a05:6512:1090:b0:539:e651:5d97 with SMTP id 2adb3069b0e04-539e6515f25mr7976274e87.50.1729084633262; Wed, 16 Oct 2024 06:17:13 -0700 (PDT) Received: from work.. (2.133.25.254.dynamic.telecom.kz. [2.133.25.254]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f5698aesm49612825e9.11.2024.10.16.06.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 06:17:12 -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 v4 0/3] kasan: migrate the last module test to kunit Date: Wed, 16 Oct 2024 18:17:59 +0500 Message-Id: <20241016131802.3115788-1-snovitoll@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: ixzwy4rt6jpiq5hmyd33u55z96hya8ha X-Rspamd-Queue-Id: 34F0910000A X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1729084618-293174 X-HE-Meta: U2FsdGVkX19FBFDYlK8S/z5swlXzLJTnwUVD/yy8rtsQwVe2N+4tlRYcqkMSHN+QwGaV/0Yqezomv/hhbwBgpYA8LXsxXb1AKIYPVT1Q36k3U5Eal05rO2FAFq30pDoEUlXwS817dOUoisX1HztHDB7dA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Ct+Hr/TTnNGLKADXjgj/Vw18qicalqXVyvYdSF4S/68x6A+C7CWnMAeYRKj+mCxMGFSVXRT76/2EVAn5vXgSjMdBqvjhGhCJRhS2O45Uh/EhUdZczcMWwZppdEIPBAeWlTKW3wbEADx/dnc7BRix4neCgTRBQ43vClNVmoaayCZ4AHY7zG+prXQQLRnrNXAJ025WJcBdhuPS34IJ+aOViFERa+ueXylkDU X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, 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 v3 -> v4: - moved checks from do_strncpy_from_user to strncpy_from_user due to "call to __check_object_size() with UACCESS enabled" warning, during the kernel build. 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