Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp311610pxm; Tue, 22 Feb 2022 11:09:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMjW26+HVeinSi8MCtxVKWbvsh1dryrW7zMrXV0eXOBE8oK/1pqhJvrAKanOEK2SnPqFns X-Received: by 2002:a62:7c11:0:b0:4e1:7ede:9ca9 with SMTP id x17-20020a627c11000000b004e17ede9ca9mr26250166pfc.84.1645556998564; Tue, 22 Feb 2022 11:09:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645556998; cv=none; d=google.com; s=arc-20160816; b=MmSuwC6w8efjDL0HIOgF4ErXczBXxRISFjQuNoy+q1WL6VA+tZ/ORP3gdAMHwasHrQ L63Adrj+we+BdJdlsrkPWdkKd+iaMxz3ETc3r1144JSeuZx5sOdZ6aQG5ZCgOuaHSUtx Po6GmBsi5ub16dlJr80e3yCry0QRULf+9ysiivYZReGpVZR6yY57Qxx0HZ0QsuANDE+i rkqWPeN6bsRHdYqjkyOQplq2wnkwBOVI7O9r1VZUmnediIL03s/7ga/gfz5BpntKMAi5 WpVfW1ZenKbfK1evJE/fsfNkd7hG1F/mSpF7bUbuRWKpQr2jsklrRJZDQij7nk+/ZHUH pFWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oObgooNlIOOo2XH59U0uuMMQ0kQeglBbkBAVHE8QeMY=; b=K114bIi9V1zsFGafr3+AkVrX0BeNGT3vjgpzfBkWk5H2xVqE4NY3Hjzh4TvlrV7uXM eL5iSafVYxXc6MBYIRWpoBi1ap3YGN0MvecoiD6MTiQ+8J7dQG+lbZnsUBOSNBgiFB/q JgaXelC+U9jA5Hr403PdqHJQT6Y7D3pBhGY16m7yQTDEROk5D4kaoLQVYMU2irjJBYRr Z2zXmKeAKqvBp1tju+BzKXGaklIv66id762CIUmDWnze6mtBUwy8//hgeD1Ps9zyGrep TMadQZKqqjbfr6RzUJVjoLd9CRyTf7iQS8XInhkTDKpy0hCs54qUjcBIJt6ynbHAjkLk 1Xag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=X1llFE4v; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 126si20104231pga.866.2022.02.22.11.09.19; Tue, 22 Feb 2022 11:09:58 -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=@gmail.com header.s=20210112 header.b=X1llFE4v; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234933AbiBVS2A (ORCPT + 99 others); Tue, 22 Feb 2022 13:28:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234977AbiBVS17 (ORCPT ); Tue, 22 Feb 2022 13:27:59 -0500 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AAFEEDF18 for ; Tue, 22 Feb 2022 10:27:33 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id s1so21284359iob.9 for ; Tue, 22 Feb 2022 10:27:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oObgooNlIOOo2XH59U0uuMMQ0kQeglBbkBAVHE8QeMY=; b=X1llFE4v/VRY2AuGSXbi23JXDtqqNaDh8fsyxisBfmcm7wEEv4bWP72G2JYWO6xIzm SeGiigJk+ptFVCouzFfg3QnP+4I0eLjF8kaTLVDdxTZOZxMvLR6QyZPhd6fYSMQM145L PSnL+n5akM1CZs6QQjmwCu/NWE4cckJNyfw8u4Po0NmGPCC1qOJ+gKj3SWYdgh4jmfDd zF+aEAirtu+m2K3aF1ZOfPZJQhmUgKCnfYceLtv83Kujk3tL25Rvc2IJWPp1j1e/rmyY B7JNBRDn8IwZ3tirtUqsUPQvIFKa9XpxRvBZiKn1gTxymYRFJGdm9yqjK3sO9qBieHye TYYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oObgooNlIOOo2XH59U0uuMMQ0kQeglBbkBAVHE8QeMY=; b=jRVQZhO8PFikPuZUV6gQeg8dIChmGvfaGOxjS40RDXcNcnTilUhBfRJaXD27D2p7x6 Ps0Tl7ENv5c+bNi7yGsLYijJXvbaqwV+vrxH0xJEElLVI6VPg41/Ro1D3RxiXTLuKTCR 9UvDgszuFnPUIAM74NGufA9Hoyt2UEDG2/gy5JLKCmb24g0hETzO79sibmkFeRnoRrsQ TYyJZPJ4smGRgTg4txGDpMr/XKhtW0mvyN8PmRvQQ4sQOZyhjXP+zG5S9ApXGSbZrHr7 L1sfg5f7IlXjkpj5cPofGE8EMMDqwzSnzQOQUHPeFCDXoFR5XlcgqbzaRn+U2wTGJC9V BKTA== X-Gm-Message-State: AOAM530Lr7URtGkxsIWmJUcv+iJw34feoXizcV3QDMQRMNKRhBn4WCht DlRvxd6MfPlGnTwqmAnGRcrfVdB9AnTwlIRcMow= X-Received: by 2002:a05:6638:10b:b0:314:ef3d:bfe4 with SMTP id x11-20020a056638010b00b00314ef3dbfe4mr6978543jao.218.1645554452615; Tue, 22 Feb 2022 10:27:32 -0800 (PST) MIME-Version: 1.0 References: <2d44632c4067be35491b58b147a4d1329fdfcf16.1645549750.git.andreyknvl@google.com> In-Reply-To: From: Andrey Konovalov Date: Tue, 22 Feb 2022 19:27:21 +0100 Message-ID: Subject: Re: [PATCH mm] another fix for "kasan: improve vmalloc tests" To: Marco Elver Cc: andrey.konovalov@linux.dev, Andrew Morton , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , Linux Memory Management List , LKML , Andrey Konovalov , kernel test robot Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Tue, Feb 22, 2022 at 7:11 PM Marco Elver wrote: > > On Tue, 22 Feb 2022 at 19:08, Andrey Konovalov wrote: > > > > On Tue, Feb 22, 2022 at 6:50 PM Marco Elver wrote: > > > > > > On Tue, 22 Feb 2022 at 18:10, wrote: > > > > > > > > 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. > > > > > > > > Drop the checks that rely on these functions. > > > > > > > > Reported-by: kernel test robot > > > > Signed-off-by: Andrey Konovalov > > > > --- > > > > lib/test_kasan.c | 6 ------ > > > > 1 file changed, 6 deletions(-) > > > > > > > > diff --git a/lib/test_kasan.c b/lib/test_kasan.c > > > > index ef99d81fe8b3..448194bbc41d 100644 > > > > --- a/lib/test_kasan.c > > > > +++ b/lib/test_kasan.c > > > > @@ -1083,12 +1083,6 @@ 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)); > > > > > > > > - /* 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); > > > > > > You can still test it by checking 'ifdef MODULE'. You could add a > > > separate test which is skipped if MODULE is defined. Does that work? > > > > Yes, putting it under ifdef will work. I thought that having a > > discrepancy between built-in and module tests is weird, but I see the > > kprobes tests doing this, so maybe it's not such a bad idea. Will do > > in v2. > > Additionally you could have the test skip with kunit_skip(), so it's > at least visible. The code itself has to be #ifdef'd I guess because > set_memory_*() aren't even declared ifdef MODULE (I think?). I sent v2 with the simplest approach without an additional test. I hope that's OK with you.