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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 D77B9C433C1 for ; Tue, 23 Mar 2021 00:02:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 587EC619A3 for ; Tue, 23 Mar 2021 00:02:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 587EC619A3 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 D9EDC6B0108; Mon, 22 Mar 2021 20:02:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4EBC6B010C; Mon, 22 Mar 2021 20:02:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF0A16B0115; Mon, 22 Mar 2021 20:02:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id A0BCF6B0108 for ; Mon, 22 Mar 2021 20:02:42 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5A7EA824999B for ; Tue, 23 Mar 2021 00:02:42 +0000 (UTC) X-FDA: 77949187764.36.7E3CC6A Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf10.hostedemail.com (Postfix) with ESMTP id E5D114080F50 for ; Tue, 23 Mar 2021 00:02:40 +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 3C969ADF1; Tue, 23 Mar 2021 00:02:40 +0000 (UTC) To: David Rientjes Cc: kernel test robot , glittao@gmail.com, 0day robot , LKML , lkp@lists.01.org, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, shuah@kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org References: <20210317083612.GD22345@xsang-OptiPlex-9020> From: Vlastimil Babka Subject: Re: [selftests] e48d82b67a: BUG_TestSlub_RZ_alloc(Not_tainted):Redzone_overwritten Message-ID: <7789b386-bddd-37ba-fccd-370f1340e698@suse.cz> Date: Tue, 23 Mar 2021 01:02:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Stat-Signature: yydurzyuupxkknaz8bb67fzfqrz7s5fh X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E5D114080F50 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: 1616457760-233637 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 3/17/21 7:53 PM, David Rientjes wrote: > On Wed, 17 Mar 2021, Vlastimil Babka wrote: >> >=20 >> > [ 22.154049] random: get_random_u32 called from __kmem_cache_creat= e+0x23/0x3e0 with crng_init=3D0=20 >> > [ 22.154070] random: get_random_u32 called from cache_random_seq_c= reate+0x7c/0x140 with crng_init=3D0=20 >> > [ 22.154167] random: get_random_u32 called from allocate_slab+0x15= 5/0x5e0 with crng_init=3D0=20 >> > [ 22.154690] test_slub: 1. kmem_cache: Clobber Redzone 0x12->0x(pt= rval) >> > [ 22.164499] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D >> > [ 22.166629] BUG TestSlub_RZ_alloc (Not tainted): Redzone overwrit= ten >> > [ 22.168179] -----------------------------------------------------= ------------------------ >> > [ 22.168179] >> > [ 22.168372] Disabling lock debugging due to kernel taint >> > [ 22.168372] INFO: 0x(ptrval)-0x(ptrval) @offset=3D1064. First byt= e 0x12 instead of 0xcc >> > [ 22.168372] INFO: Allocated in resiliency_test+0x47/0x1be age=3D3= cpu=3D0 pid=3D1=20 >> > [ 22.168372] __slab_alloc+0x57/0x80=20 >> > [ 22.168372] kmem_cache_alloc (kbuild/src/consumer/mm/slub.c:2871 = kbuild/src/consumer/mm/slub.c:2915 kbuild/src/consumer/mm/slub.c:2920)=20 >> > [ 22.168372] resiliency_test (kbuild/src/consumer/lib/test_slub.c:= 34 kbuild/src/consumer/lib/test_slub.c:107)=20 >> > [ 22.168372] test_slub_init (kbuild/src/consumer/lib/test_slub.c:1= 24)=20 >> > [ 22.168372] do_one_initcall (kbuild/src/consumer/init/main.c:1226= )=20 >> > [ 22.168372] kernel_init_freeable (kbuild/src/consumer/init/main.c= :1298 kbuild/src/consumer/init/main.c:1315 kbuild/src/consumer/init/main.= c:1335 kbuild/src/consumer/init/main.c:1537)=20 >> > [ 22.168372] kernel_init (kbuild/src/consumer/init/main.c:1426)=20 >> > [ 22.168372] ret_from_fork (kbuild/src/consumer/arch/x86/entry/ent= ry_32.S:856)=20 >> > [ 22.168372] INFO: Slab 0x(ptrval) objects=3D16 used=3D1 fp=3D0x(p= trval) flags=3D0x40000201 >> > [ 22.168372] INFO: Object 0x(ptrval) @offset=3D1000 fp=3D0x(ptrval= ) >> > [ 22.168372] >> > [ 22.168372] Redzone (ptrval): cc cc cc cc cc cc cc cc = ........ >> > [ 22.168372] Object (ptrval): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b = 6b 6b 6b 6b kkkkkkkkkkkkkkkk >> > [ 22.168372] Object (ptrval): 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b = 6b 6b 6b a5 kkkkkkkkkkkkkkk. >> > [ 22.168372] Redzone (ptrval): 12 cc cc cc = .... >> > [ 22.168372] Padding (ptrval): 5a 5a 5a 5a 5a 5a 5a 5a = ZZZZZZZZ >> > [ 22.168372] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G B = 5.12.0-rc2-00001-ge48d82b67a2b #1 >> > [ 22.168372] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)= , BIOS 1.12.0-1 04/01/2014 >> > [ 22.168372] Call Trace: >> > [ 22.168372] dump_stack (kbuild/src/consumer/lib/dump_stack.c:122)= =20 >> > [ 22.168372] print_trailer (kbuild/src/consumer/mm/slub.c:737)=20 >> > [ 22.168372] check_bytes_and_report.cold (kbuild/src/consumer/mm/s= lub.c:807)=20 >> > [ 22.168372] check_object (kbuild/src/consumer/mm/slub.c:914)=20 >> > [ 22.168372] validate_slab (kbuild/src/consumer/mm/slub.c:4635)=20 >>=20 >> Hm but in this case the output means the tested functionality (slub de= bugging) >> is working as intended. So what can we do? Indicate/teach somehow to t= he bot >> that this is OK? Does kselftest have some support for this? Or silence= the >> validation output for testing purposes? (I would prefer not to) >>=20 >=20 > Unless you're familiar with everything that CONFIG_TEST_SLUB does, mayb= e=20 > this could be inferred as an actual issue that the test has uncovered t= hat=20 > is unexpected? >=20 > I don't have a good way of silencing the check_bytes_and_report() outpu= t=20 > other than a big hammer: implement {disable,enable}_slub_warnings() tha= t=20 > the resiliency test could call into before triggering these checks. So Oliver has implemented this, but now I got a different idea that shoul= d be much cleaner IMHO. We could add a per-cache flag SLAB_SILENT_ERRORS (simi= lar to SLAB_RED_ZONE etc) instead of a global bool. The test would just create t= he caches with this flag. The flag should be added to the SLAB_NEVER_MERGE, SLAB_DEBUG_FLAGS, SLAB_FLAGS_PERMITTED macros as well. A similar suggestion is that adding the errors counter parameter to all validate_slab_cache() and relevant functions is tedious - there are more = that had to be modified like this than initially expected. Instead the error counter can be added to SLUB's struct kmem_cache defini= tion, incremented by the various checks and the tests can look at that after va= lidation. Thanks, Vlastimil