Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp97968pxm; Tue, 22 Feb 2022 17:45:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXi8tcw3ScrirSX2pzfuxwZ7UJOhwImKS5w25323c+r7d989oudiY37x0OUY1zWVC/Cv+i X-Received: by 2002:a17:907:6218:b0:6d1:c74:1507 with SMTP id ms24-20020a170907621800b006d10c741507mr12965285ejc.670.1645580714110; Tue, 22 Feb 2022 17:45:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645580714; cv=none; d=google.com; s=arc-20160816; b=gWx7kx6VzGj5Teay1SE7mBqbvaLC5+h9c7EN5IT79VxWJU5B2Z2hnZQL7Bx8MODchi huphSOXgtyf11hhXZrmAZRnDBljnCE/2cdwCXBC8/zw827w+tpPqKtfH0YdMnxVN7jxG 6RtpH00af7VAKBbWtOz05EYVQg1zJPqGtw45kPvqAtzHdHhaiErerC4F4PLNNSOX/FFv 4DzXp1QkCMyW1Eo6tJrNW3xUSeEGikPb61ma3gQ5mRVH1Ak9aQbUmx1ACvy9KY1R6lvO EvlLrbjk7ApcPnhB5oafWKaODEDXREAptiFwF8eKTAq40pwG5BsXrexQ/u0dbYsRwdAD wkaw== 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:cc:to:from:dkim-signature; bh=Lb/QQb5DmP2LHrXtHDNMk4U8p312LQBN/82u4kQO66g=; b=BRBRy9fhiH6ZOaqpTncF2oa5p0v9VZ3ZAdv8aAt8AbTH4cunfoHVKIHHJOPKoBjtff zFVoGxNmbnKPxHy/rDCJyZWIL0Jka5cp0xRlnq+3MxPCfpY/MfPGWp0elKGIQ3fLDZWv 5Bh9wOmek43KhtzMpzhIRft2yAtmyA9gYidwmlXTuLt1Go0dH4wFZk6JMtGKnakeQV7K jFpH4MiGOPska3ojtCJV6iTGbtqQWZVST0fnHOZnvs5K+bfiL8oxfrvUuctIT0zV1Tq4 HfdfoP+Zm2sZcfyXDYYJ6jTsDEx3S/PQw+5oNxbzbb/LbqLJhIz+vS4Wq8Mv7wlOkwC4 I2qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=l7Bx2GUk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v9si14314536edx.608.2022.02.22.17.44.51; Tue, 22 Feb 2022 17:45:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=l7Bx2GUk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234962AbiBVS1D (ORCPT + 99 others); Tue, 22 Feb 2022 13:27:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232949AbiBVS1C (ORCPT ); Tue, 22 Feb 2022 13:27:02 -0500 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4794E0D7 for ; Tue, 22 Feb 2022 10:26:34 -0800 (PST) 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=1645554393; 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=Lb/QQb5DmP2LHrXtHDNMk4U8p312LQBN/82u4kQO66g=; b=l7Bx2GUkm3Dq5StqRmciyqB+5cGjfC3M+543snV01fvLP9JXoAN2fRqX4tMOUJ6OxvkRec tZ8EDfLFptIHP30shsd5HMLexP/s1MF7F3/neYZyZsZ4OuyQ3K/1o6qF9Sv3BeH8czNEcZ 9niRTJULEML6baoeydk560SQ4PRbwLU= 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, Andrey Konovalov , kernel test robot Subject: [PATCH mm v2] another fix for "kasan: improve vmalloc tests" Date: Tue, 22 Feb 2022 19:26:28 +0100 Message-Id: <019ac41602e0c4a7dfe96dc8158a95097c2b2ebd.1645554036.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov set_memory_rw/ro() are not exported to be used in modules and thus cannot be used in KUnit-compatible KASAN tests. Do the checks that rely on these functions only when the tests are built-in. Reported-by: kernel test robot Signed-off-by: Andrey Konovalov --- Changes v1->v2: - Hide checks under #if instead of dropping. --- lib/test_kasan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index ef99d81fe8b3..c4b7eb2bad77 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -1083,11 +1083,13 @@ static void vmalloc_helpers_tags(struct kunit *test) KUNIT_ASSERT_TRUE(test, is_vmalloc_addr(ptr)); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vmalloc_to_page(ptr)); +#if !IS_MODULE(CONFIG_KASAN_KUNIT_TEST) /* Make sure vmalloc'ed memory permissions can be changed. */ rv = set_memory_ro((unsigned long)ptr, 1); KUNIT_ASSERT_GE(test, rv, 0); rv = set_memory_rw((unsigned long)ptr, 1); KUNIT_ASSERT_GE(test, rv, 0); +#endif vfree(ptr); } -- 2.25.1