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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 C6AE5C433B4 for ; Thu, 15 Apr 2021 11:01:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 773A461158 for ; Thu, 15 Apr 2021 11:01:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 773A461158 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EBDBA6B0036; Thu, 15 Apr 2021 07:01:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E93E06B006C; Thu, 15 Apr 2021 07:01:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D34D26B0070; Thu, 15 Apr 2021 07:01:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BB11E6B0036 for ; Thu, 15 Apr 2021 07:01:34 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 69A318248D7C for ; Thu, 15 Apr 2021 11:01:34 +0000 (UTC) X-FDA: 78034310508.23.D52E2A0 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by imf23.hostedemail.com (Postfix) with ESMTP id 2B879A0003A2 for ; Thu, 15 Apr 2021 11:01:32 +0000 (UTC) Received: by mail-ot1-f45.google.com with SMTP id k14-20020a9d7dce0000b02901b866632f29so22200008otn.1 for ; Thu, 15 Apr 2021 04:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=IFP44EoHv+xxG03nkNR4GHUNpt/BWmDmChQZTykWcJM=; b=I1EYyJfYWiaNNE76vfMp+ymJJsb+kgNA5IUfXSmMKhD0UgFtNun9i2+Yt7VraR4v1Y xyCGU3ruhru3JhXF/E7AJZuwW6FyU0whukie3r9ccNC8UFdoqvaHe+8gKdSD56D5GcJE w+jRhEzsDJr+bKuEElT3oCoKtJBauTK48QaqgBPly8aKEBbWOX2UVE7gZ78UTXYeAdGV vPPAc4deRxfrDHDf6GJE1tIs9XhzU9BVVDiRpWcpY1JvrH/1Hv7aEASkzyAFzq+6IPSg bjE/JqXcCWwqyX9wlGLsed8a1jC9aP0LgE7cDFHGeC5BoKbMxCQxQBYnKVY28z0SD4/Q 4CzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=IFP44EoHv+xxG03nkNR4GHUNpt/BWmDmChQZTykWcJM=; b=VjnRqD7YE55wrA7JF5iuZHpYcIpv0tHTL3CYyMhP44uEOfl4FIU7m493IudNBmQ4f3 z2L7yCGXlog7yh8r8GrcTUZgFvy67YqKz9F4Wrbqp7wRJpDDedaWEQmtwOjFgOGsgEaH a6ojhmpYO3f+oQBh1VoVDREO6ovLeS3O2J5/8uZ75GaAHFjNXr91rftL3E8IV3/90tTm NQPWpkHVwiwrS/uNV7RhqOsuJiGJ82jM1AK9vaPBSB30YbSH4gMmP50AKxKFfN8+G5NB QSoSLSKtlD072i5qkdEFX5968KNX0BT1QfAHVJg/weuY3Qu9orSXc0P8lqHzvIeBgVkM qhvA== X-Gm-Message-State: AOAM531dlBqx2FUlFn22/GhJfg7G+I0zH5ALDxbWw5Tbwseh8+kvFJ6z NGjXM0LVdDnTAodurDzBtu6GdqHaW2gjdaLx9+KUzg== X-Google-Smtp-Source: ABdhPJxosqBAzdRMrnAL2d6JoX9t4Hd36XsCoJp3rPmD5a+tT4/RPNgNrwhWjFD0usJNPoXQzSMbCBz6CuOlykdLwXA= X-Received: by 2002:a05:6830:241b:: with SMTP id j27mr2282851ots.17.1618484492855; Thu, 15 Apr 2021 04:01:32 -0700 (PDT) MIME-Version: 1.0 References: <20210413100747.4921-1-glittao@gmail.com> <20210413100747.4921-2-glittao@gmail.com> <23e27bc2-2f12-d65a-b3ac-8ecb7a37a8c1@suse.cz> In-Reply-To: <23e27bc2-2f12-d65a-b3ac-8ecb7a37a8c1@suse.cz> From: Marco Elver Date: Thu, 15 Apr 2021 13:01:21 +0200 Message-ID: Subject: Re: [PATCH v4 2/3] mm/slub, kunit: add a KUnit test for SLUB debugging functionality To: Vlastimil Babka Cc: Oliver Glitta , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2B879A0003A2 X-Stat-Signature: 81i5wqthpuud5kiguoitwjit3jzyi715 Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf23; identity=mailfrom; envelope-from=""; helo=mail-ot1-f45.google.com; client-ip=209.85.210.45 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618484492-357401 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 Thu, 15 Apr 2021 at 12:38, Vlastimil Babka wrote: > > 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 > >> > > > > Thank you. > > > >> 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. > > > > 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. Sounds reasonable. In any case, I'm fine with this version to land and my Reviewed-by above remains valid. :-) Thanks, -- Marco