From patchwork Tue Oct 22 16:07:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 13845901 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 2E44DD2CDFA for ; Tue, 22 Oct 2024 16:07:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 850566B0083; Tue, 22 Oct 2024 12:07:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D8C36B0085; Tue, 22 Oct 2024 12:07:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C7306B0089; Tue, 22 Oct 2024 12:07:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4BF416B0083 for ; Tue, 22 Oct 2024 12:07:18 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2164BAA379 for ; Tue, 22 Oct 2024 16:06:45 +0000 (UTC) X-FDA: 82701717336.15.106ACFB Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) by imf30.hostedemail.com (Postfix) with ESMTP id 5B0068001B for ; Tue, 22 Oct 2024 16:06:45 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uChcW7Dq; spf=pass (imf30.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.186 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729613159; a=rsa-sha256; cv=none; b=xb/7ykkyYvdQXQGAr8RG2dLzlFroz71OVM3pDnrRVYFbCQuP6uPYDB0y0rWz9FHhYxM3rW Y6lYFuXJl8Bm17mz+BQtXIG2/OM/Y1opQ/9s642JZvqALmTfLlSxdQDA5vmXkAY6lPKU7t 0mgTSLCiNgqCDP4uMPTc1w1JtVNc12Q= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uChcW7Dq; spf=pass (imf30.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.186 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729613159; 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:references:dkim-signature; bh=n52RayRNzRsyQEiYVNwVsqKfALVoNrkzsm4wddplA60=; b=3rttGWUE7UJODnZuNZGlwZ0VkeVqa36bYj0cJ00k/7oEGEyg+gaXIKf9IWQk/AwONK/mP0 rjlU/2uoqzYsx1+o2EAsyHki20+2DzNzXtyooe80JIPhgBZ5BaDDYEj47i0IbhzszfVyrZ WZfQV5Zz63Wa27fvQYFUsG4jc5o8Xg8= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1729613233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=n52RayRNzRsyQEiYVNwVsqKfALVoNrkzsm4wddplA60=; b=uChcW7DqZ1Lp6aDNkqr2H6rWhe1k6hGZEIkci5asTlmZiCDzsHYkmEQiVR5qaZXB1YnAbK SBlextf1R1Hn/0YUD1qCQcT01YlHyYtRNFhSTKZOAkmKKt+DFjYo++cewFIuNJzbcfHZvI uJ9WtBwIRziAZ3/sqhiZ9WIY0WMxlQY= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Samuel Holland , Sabyrzhan Tasbolatov Subject: [PATCH] kasan: remove vmalloc_percpu test Date: Tue, 22 Oct 2024 18:07:06 +0200 Message-Id: <20241022160706.38943-1-andrey.konovalov@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Stat-Signature: yttxnfkgacjc79nxp6xhqtzrmnmd4m55 X-Rspamd-Queue-Id: 5B0068001B X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1729613205-309384 X-HE-Meta: U2FsdGVkX19Eb8+Hwao2Ur9WB7n7sDE3KC4CLk4gwtj2guh4oqAPtGWEpQEvJymTSV0JAGGn3Cuz9+TtrdRnAI62x7jbncg6jXZKVleQ1INr+NSmW4Mz286++z+D6dijxLWmTWsicv8PCoPZGjW5LTyrbmi+xFrY2N6hTU8RwPyA1c/TusSaeGC6u1JmsPoLhXsPYXxGAspJdfD2DWSflhQLH0WJItAanTO4ME0s2/FEavAGEI1uBKotqapTUwqvvGZGtXp0/2FIkstVRQabkV+Btj0S9mBn3E5I1kpZU1uEwzKrSjzfLhEeMfNSYCenMe3lXYkc6k44u7Sv+57rST6YnyvNr8yjYzJkOYhShYN2VFe5cZ2fJcpY1qFjKghyeGiCb5KcE4AGezVWaMjA0sP5WyWUIgN/kBdW8lLPMzjsmq6jw8DTC8B+rK3/x/1Dhzuv/7SJDjedFNuaZLNSgCQD0rp36DSsCH7/BUJ/ugYeACrHI3czMEbIqb1Jr5ebIlco4IaWh7kBKJxIw+l9/9auWFhSPaBHlM32EIeWaze7H3hja6cOjBdYeK/P3+5vPf55HAD5EiJJeSCIp393Bkuh3bjlbncOWRElbd654INWoUL8Kc+SA625lwFle3b84LyqZ/BHJ5RWaUofr13GpTvx/nwAksPbvWYmBoRSSSR8KIfDXlcHhPTxLHYqjfBrDZ6IlknZfP+L4p9u56+B+ffKeF46P7mo7JkJuT5gAmgJ98MI4VN/kno0Ky1yR2Mf7VIuregaP7Vic6Wnd3CIm0i+hTSm01aB8ndz2dCTQh+tR/yLHZCykCUNhAUCIxFgFCkAUoySSq7miMtxda53t8a2K4f+o+zI6NJhoQg6tNfvV2dDaHo8KPluBCPLYD1RXsl71TbC5jGz1j64c4g3iErFa8Bz52W9OTdIymrd88cN2QQA+snMYi1pWOc9+l5XAY/2RQQZ43cFgXEWzRy FK1a5oJJ 9d1YT7UxU9vdiy2nrHB0wjwMvLqy5r/+I1sM/WD8J8vYocyNwuRyejXuZTZyUD2TTva/bJVKnZM4p08aQGxzpXjiscVZFnlaJcLzNSW7GxbmQ53qlVwum9dk6DFS0dJh/RWYjKwZY6wH/8j7Eu7ZC7creEAS5+PvrZLLf/RCW+y8RB3wfwjSTlFsBdcEs9rx5kSoMOGydKm0V/rSscMLdqWaYEp9vgntegJbCowXcJsgbuBE1bobGRA59NLA3VmaAcfTZF00hOFXPk3hgyMfo8DoEt5htAnBMW3uVeoSzt5Om0crOsfskLB3PbTd1bJUPUuMhq8Q3Sq9F6U2nQY4rmNDQFlIe9P5SfHfKhWgoUTkifc4= 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: From: Andrey Konovalov Commit 1a2473f0cbc0 ("kasan: improve vmalloc tests") added the vmalloc_percpu KASAN test with the assumption that __alloc_percpu always uses vmalloc internally, which is tagged by KASAN. However, __alloc_percpu might allocate memory from the first per-CPU chunk, which is not allocated via vmalloc(). As a result, the test might fail. Remove the test until proper KASAN annotation for the per-CPU allocated are added; tracked in https://bugzilla.kernel.org/show_bug.cgi?id=215019. Fixes: 1a2473f0cbc0 ("kasan: improve vmalloc tests") Reported-by: Samuel Holland Link: https://lore.kernel.org/all/4a245fff-cc46-44d1-a5f9-fd2f1c3764ae@sifive.com/ Reported-by: Sabyrzhan Tasbolatov Link: https://lore.kernel.org/all/CACzwLxiWzNqPBp4C1VkaXZ2wDwvY3yZeetCi1TLGFipKW77drA@mail.gmail.com/ Signed-off-by: Andrey Konovalov --- mm/kasan/kasan_test_c.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/mm/kasan/kasan_test_c.c b/mm/kasan/kasan_test_c.c index a181e4780d9d3..d8fb281e439d5 100644 --- a/mm/kasan/kasan_test_c.c +++ b/mm/kasan/kasan_test_c.c @@ -1810,32 +1810,6 @@ static void vm_map_ram_tags(struct kunit *test) free_pages((unsigned long)p_ptr, 1); } -static void vmalloc_percpu(struct kunit *test) -{ - char __percpu *ptr; - int cpu; - - /* - * This test is specifically crafted for the software tag-based mode, - * the only tag-based mode that poisons percpu mappings. - */ - KASAN_TEST_NEEDS_CONFIG_ON(test, CONFIG_KASAN_SW_TAGS); - - ptr = __alloc_percpu(PAGE_SIZE, PAGE_SIZE); - - for_each_possible_cpu(cpu) { - char *c_ptr = per_cpu_ptr(ptr, cpu); - - KUNIT_EXPECT_GE(test, (u8)get_tag(c_ptr), (u8)KASAN_TAG_MIN); - KUNIT_EXPECT_LT(test, (u8)get_tag(c_ptr), (u8)KASAN_TAG_KERNEL); - - /* Make sure that in-bounds accesses don't crash the kernel. */ - *c_ptr = 0; - } - - free_percpu(ptr); -} - /* * Check that the assigned pointer tag falls within the [KASAN_TAG_MIN, * KASAN_TAG_KERNEL) range (note: excluding the match-all tag) for tag-based @@ -2023,7 +1997,6 @@ static struct kunit_case kasan_kunit_test_cases[] = { KUNIT_CASE(vmalloc_oob), KUNIT_CASE(vmap_tags), KUNIT_CASE(vm_map_ram_tags), - KUNIT_CASE(vmalloc_percpu), KUNIT_CASE(match_all_not_assigned), KUNIT_CASE(match_all_ptr_tag), KUNIT_CASE(match_all_mem_tag),