Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp673626pxb; Thu, 15 Apr 2021 04:02:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXcxCqku/xdbx33LU79JD4p+qIK0x63f8k8+SnGF0Jk9SbTLBpPyusX21LwqAQrg6KVE1O X-Received: by 2002:aa7:c2d9:: with SMTP id m25mr1857878edp.188.1618484578838; Thu, 15 Apr 2021 04:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618484578; cv=none; d=google.com; s=arc-20160816; b=X0geiCAZRFfVNDo50ZYL/BKzQhFIR9LmHedskRUQrSgea0B4hHjJYL3kv3BDMWi+/I an7Aj79n8S6cvGWPew+xxaPfQUGbGjq+bVuU4Psn1yD7vUWAFuyYmJZpaii1aEoSfWpo n4FT88t17gx0oEcM85p91ys4OwgMHQB4eaaC91b8Qt1QLSq31dGmKE73AN/KOk9cX2qc CnAmf6BqFHacqSoGD3gmxmE6fBXmKA+XBvjWjLOBSrwrFoqGpgoSNPSF/6UJs73QMnbf VwX0GlX4QHFNVxz7HkaJYZ3A6/ju7bdMQ1s1pxeexsA4DQ8UoQXoWALVhVUyG+4cUQg+ rBSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=IFP44EoHv+xxG03nkNR4GHUNpt/BWmDmChQZTykWcJM=; b=coLyx78S51w98MkSuoy7d5ka7N3HwdkXVlNE7D3rVav5+EgQWoDgloYyAxzLaOLoAb ISuPmzE+5yjCDOwYi56xc9W6yZ8ys/vsmSiEO2akqq90L/ojI89c3gcjci67Dxhod/J4 FLxKE7P2j3snsapRHFfNvGPk0F4WuKXVOleCy0DcLnP09JblFuAFdbMDlhSZ+N2wZ4N3 HHO9cTTTSHROxHAiw1puFR6sPMAkqklgD0ZtDVl+sQhHqROBFrQDfsvJ0k9ZAXYyDBZ/ R/r8QzC2nc0Q5dGI8zS1vmKz27pAIeH4M2kIdaLFAAilI13ZjvMqIOJ6IdSYbCBUrbZ9 jT8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=I1EYyJfY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d11si1938068ejm.20.2021.04.15.04.02.34; Thu, 15 Apr 2021 04:02:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=I1EYyJfY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbhDOLB6 (ORCPT + 99 others); Thu, 15 Apr 2021 07:01:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231771AbhDOLB5 (ORCPT ); Thu, 15 Apr 2021 07:01:57 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B453DC061756 for ; Thu, 15 Apr 2021 04:01:33 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id w21-20020a9d63950000b02901ce7b8c45b4so22172803otk.5 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=pEPTxK1dfCgsnSss/Nfvjm3oHv6rd3k3/HkXqITbx2JrBh7ulVI1rPpNHbaRVrnFcb TVNMVdzNHu6fPIGrUUI7EZIqWQv/2AbuUp+GsOjBk9tl6SmCFz1DYLVY2j7VBmWNm+yg aa8DR8kjIaDpyYQMUASxmQvIpOuVmy6gm98zMQ5d1j7sED5GSNuMfwwIKlz2MxdiuNJG IZ5W3CfBCV1uwYuPQnuggcExOxmA3WBEkgi7ISHw0clsOxqEF6gQlLjvurpaim2WTzoI XtjF9bxwvJxaQu0k/V+iiaSYCpv8djG/sQG9xMa21BERpFnj9CT0mtcE4wFTYOPBqV+q FtXQ== X-Gm-Message-State: AOAM532y+2vZrrN8mY2cv7FO3MKCM5J4Ma+8YTNnQhxsfqITaoVNHJQn KyW0ktjGFf03m5JSMYq6h4k//pTBEJzDbD/Xrh3qzQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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