Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp654860pxb; Thu, 15 Apr 2021 03:31:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjJ8cHstngNDimd1K4z2vvjDE6Ro4ntcOtXAl/j19sy/FKf4GBLnOgWUUX2XXBncLe6E0N X-Received: by 2002:a17:902:7d86:b029:eb:4d1c:aa9e with SMTP id a6-20020a1709027d86b02900eb4d1caa9emr3054353plm.51.1618482660097; Thu, 15 Apr 2021 03:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618482660; cv=none; d=google.com; s=arc-20160816; b=lIWDXbA6NKXqQ+tf/530CSnSP8iRdnGSm3nNW4ezE8wkGP+hhUOd14abkOoHvNNE8r eDhzWEDYdcM2ujiI6x4/PAwzyugFM54VmpMUZclmjFjh6nGrZnI3yALjzkiDyj6NnbU4 AWmjubH81EdcikqNhqrShXlHVCDs4in3DJ9LRa7AOSJI4ypIwUjQB4x3NKS+TvZTknA4 ZmPTAR+W7n0Xh+QubEkRPWL6G67q4cRvgwy8sqtnqov7YwpwL5ndFVTPdgxhHUL5yfO+ Q+mW+TUffnKfDTuyzoyCMCzq89seVoAb/jVRNevyRp2aP3/lCi64Ef+ELCgUa1pwbYoO o3Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=tEh71/At+AWzcMg1Ji1Nuy1COmLnoizxXl7BPOIGVmA=; b=ZqM/fmeXHzAtQlWUQuxw/gCUn06tnaSLjzBHu14ZaIEX53v+AyMv6bgrfnircBiHvL Bkcq4Ipj7+JZbKCymG3bpmd0zOtMLsK1DaSyUmI+2zkkGhOFYX9IA2S7qxcCC8fwaFi9 e/+C8VlwCAucClxb7FaUTODuVA6rKpE4ZaktvJX126zmXGDBc6qfM9Pg1gq4F9CxbMs2 e/6WsRDJR+URt927C0PGhabT/xDClnsDz0cczwUH9r/ItJyMWsHi/My4B2RXGmYDTA1U Fd1Ba8aLiY+SVNjZ6Drtw5L7Ggn6woS3CJvPO/DXn0fjqF/gLAbKIfd5Zr0SeZ04Fl6z dw7Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay12si2761897plb.357.2021.04.15.03.30.46; Thu, 15 Apr 2021 03:31:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232173AbhDOKae (ORCPT + 99 others); Thu, 15 Apr 2021 06:30:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:43974 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbhDOKac (ORCPT ); Thu, 15 Apr 2021 06:30:32 -0400 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 EB622B1E8; Thu, 15 Apr 2021 10:30:08 +0000 (UTC) Subject: Re: [PATCH v4 2/3] mm/slub, kunit: add a KUnit test for SLUB debugging functionality To: glittao@gmail.com, brendanhiggins@google.com, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-mm@kvack.org, elver@google.com, dlatypov@google.com References: <20210413100747.4921-1-glittao@gmail.com> <20210413100747.4921-2-glittao@gmail.com> From: Vlastimil Babka Message-ID: Date: Thu, 15 Apr 2021 12:30:08 +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: <20210413100747.4921-2-glittao@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/13/21 12:07 PM, glittao@gmail.com 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 depends on > !KASAN which would have otherwise prevented that. > > 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 Acked-by: Vlastimil Babka (again with a disclaimer that I'm the advisor of Oliver's student project)