From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 810EB61FF2 for ; Wed, 22 Jan 2025 03:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737516339; cv=none; b=EqfitrXZ0WWNyygs11GnKSkra/MA1BD7EUQDux4v3ErVJIl2ZQumKyeXymmm09as/UbPHOpNFYiCKLzxr2HfhbnMYcRRmQR+LUjzX1WZdO9P1vFIA5HeDLdloVRqp5vlLb4Nxjy8c4QO4MjHpvkvzeHsjK3SQ/G/uuylHWOf6w4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737516339; c=relaxed/simple; bh=7L0XLahvPR3GH6W+gR2azsm4XwFxIhLtSlsE2kiRWlU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CtpQ1ERNb9cNIgYgviw76273WZ2rbGbzuxzNE1jo+SY8n/4+oVDkx7ZrPpIvXSMIFkBPhApb+IMdUXXMWwP7/5MZJybn+UDpBZ8+KG/ZII01q6zNFZ393LPwmu1qEPIqM7SG4L+PSBgptKhDyRjZuXD6xKDHV2HyUnxKD6PHfFg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=pQq4ep5V; arc=none smtp.client-ip=95.215.58.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pQq4ep5V" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1737516334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WqCfGsA3H8C7eNmf1VcJ0V/ARphQuwcuycsMP7Eq7+s=; b=pQq4ep5VVnlPNg9rOiAtEV/FpHGmrtzubelx5YMkMaqnI6wYA8rcrDHC/iQzbYMGNG/ocU loteXAZ/4hG2tAGW7vHFy0BkzCTh6Amzd7LcowFCx/KzBz1jCNoVYfFAPBoGvG/YmV+5J3 69qG4ibaPZIjPdYaRSbx7HgC0pC5q20= Date: Wed, 22 Jan 2025 11:25:15 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] mm: slub: Print the broken data before restoring slub. To: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Hyesoo Yu Cc: janghyuck.kim@samsung.com, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20250120083023.4162932-1-hyesoo.yu@samsung.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 2025/1/21 21:35, Hyeonggon Yoo wrote: > On Mon, Jan 20, 2025 at 5:31 PM Hyesoo Yu wrote: > > Let's add Chengming, the author of the commit, to Cc, > as he might have some opinions about it. Thanks! > >> Previously, the restore occured after printing the object in slub. >> After commit 47d911b ("slab: make check_object() more consistent"), > > at least 12 characters of the commit hash should be used to refer to a commit. > Documentation/process/submitting-patches.rst states that: > You should also be sure to use at least the first twelve > characters of the SHA-1 ID. > The kernel repository holds a lot of objects, making collisions > with shorter IDs a real > possibility. Bear in mind that, even if there is no collision with > your six-character ID > now, that condition may change five years from now. > >> the bytes are printed after the restore. This information about the bytes Yes, object will be dumped once we found one error and abort checking before this commit, which changed to check all sections of the object and dump the object at last, then corrupted section has been restored. >> before the restore is highly valuable for debugging purpose. >> For instance, in a event of cache issue, it displays byte patterns >> by breaking them down into 64-bytes units. Without this information, Actually, we already print the error message of corrupted section in check_bytes_and_report() of each section checking, but it's not enough for your case. So you add print_section(), which makes sense to me. >> we can only speculate on how it was broken. Hence the corrupted regions >> are printed prior to the restoration process. > > Probably this should be considered for -stable releases. What do you think? > [1] https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html I'm not sure since it's not bug, just the printed message is not enough in this usecase. > >> diff --git a/mm/slub.c b/mm/slub.c >> index c2151c9fee22..48cefc969480 100644 >> --- a/mm/slub.c >> +++ b/mm/slub.c >> @@ -1207,6 +1207,7 @@ check_bytes_and_report(struct kmem_cache *s, struct slab *slab, >> fault[0], value); >> >> skip_bug_print: >> + print_section(KERN_ERR, "Corrupt ", fault, end - fault); > > I don't think it's supposed to report an error here, per the name of > the label "skip_bug_print". Agree, I think print_section() should be above skip_bug_print, which means we should skip printing bug message when kunit testing. Here you just print the "Corrupt" part of this section, another choice is just print this whole section, not sure which way is better. > > Maybe move print_trailer() and add_taint() back to > check_bytes_and_report(), and report an error > only once and skip reporting if it's already reported? Here is the dicussion[1]. [1] https://lore.kernel.org/all/20240528-b4-slab-debug-v1-1-8694ef4802df@linux.dev/ Thanks. > > Best, > Hyeonggon > >> restore_bytes(s, what, value, fault, end); >> return 0; >> } >> -- >> 2.48.0 >>