From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD6E6C433B4 for ; Thu, 15 Apr 2021 10:38:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 66924613A9 for ; Thu, 15 Apr 2021 10:38:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66924613A9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id ED68A6B0036; Thu, 15 Apr 2021 06:38:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E86F36B006C; Thu, 15 Apr 2021 06:38:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D27316B0070; Thu, 15 Apr 2021 06:38:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id B9E2F6B0036 for ; Thu, 15 Apr 2021 06:38:22 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 781A15823 for ; Thu, 15 Apr 2021 10:38:22 +0000 (UTC) X-FDA: 78034252044.30.D86AD2E Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf10.hostedemail.com (Postfix) with ESMTP id 4777E40002C1 for ; Thu, 15 Apr 2021 10:38:16 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id BDB0CAD09; Thu, 15 Apr 2021 10:38:20 +0000 (UTC) To: Oliver Glitta , Marco Elver Cc: Brendan Higgins , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , LKML , "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development , Linux Memory Management List , Daniel Latypov References: <20210413100747.4921-1-glittao@gmail.com> <20210413100747.4921-2-glittao@gmail.com> From: Vlastimil Babka Subject: Re: [PATCH v4 2/3] mm/slub, kunit: add a KUnit test for SLUB debugging functionality Message-ID: <23e27bc2-2f12-d65a-b3ac-8ecb7a37a8c1@suse.cz> Date: Thu, 15 Apr 2021 12:38:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4777E40002C1 X-Stat-Signature: d6rbi9mtderd4f175r1xktt7xruod7hj Received-SPF: none (suse.cz>: No applicable sender policy available) receiver=imf10; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1618483096-234710 Content-Transfer-Encoding: quoted-printable 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: On 4/15/21 12:10 PM, Oliver Glitta wrote: > ut 13. 4. 2021 o 15:54 Marco Elver nap=C3=ADsal(a): >> >> On Tue, 13 Apr 2021 at 12:07, wrote: >> > From: Oliver Glitta >> > >> > SLUB has resiliency_test() function which is hidden behind #ifdef >> > SLUB_RESILIENCY_TEST that is not part of Kconfig, so nobody >> > runs it. KUnit should be a proper replacement for it. >> > >> > Try changing byte in redzone after allocation and changing >> > pointer to next free node, first byte, 50th byte and redzone >> > byte. Check if validation finds errors. >> > >> > There are several differences from the original resiliency test: >> > Tests create own caches with known state instead of corrupting >> > shared kmalloc caches. >> > >> > The corruption of freepointer uses correct offset, the original >> > resiliency test got broken with freepointer changes. >> > >> > Scratch changing random byte test, because it does not have >> > meaning in this form where we need deterministic results. >> > >> > Add new option CONFIG_SLUB_KUNIT_TEST in Kconfig. >> > Because the test deliberatly modifies non-allocated objects, it depe= nds on >> > !KASAN which would have otherwise prevented that. >> >> Hmm, did the test fail with KASAN? Is it possible to skip the tests >> and still run a subset of tests with KASAN? It'd be nice if we could >> run some of these tests with KASAN as well. >> >> > Use kunit_resource to count errors in cache and silence bug reports. >> > Count error whenever slab_bug() or slab_fix() is called or when >> > the count of pages is wrong. >> > >> > Signed-off-by: Oliver Glitta >> >> Reviewed-by: Marco Elver >> >=20 > Thank you. >=20 >> Thanks, this all looks good to me. But perhaps do test what works with >> KASAN, to see if you need the !KASAN constraint for all cases. >=20 > I tried to run tests with KASAN functionality disabled with function > kasan_disable_current() and three of the tests failed with wrong > errors counts. > So I add the !KASAN constraint for all tests, because the merge window > is coming, we want to know if this version is stable and without other > mistakes. > We will take a closer look at that in the follow-up patch. Agreed. In this context, KASAN is essentially a different implementation = of the same checks that SLUB_DEBUG offers (and also does other checks) and we ex= cercise these SLUB_DEBUG checks by deliberately causing the corruption that they = detect - so instead, KASAN detects it, as it should. I assume that once somebody= opts for a full KASAN kernel build, they don't need the SLUB_DEBUG functionali= ty at that point, as KASAN is more extensive (On the other hand SLUB_DEBUG kern= els can be (and are) shipped as production distro kernels where specific targette= d debugging can be enabled to help find bugs in production with minimal dis= ruption). So trying to make both cooperate can work only to some extent and for now= we've chosen the safer way.