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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76C06C02181 for ; Wed, 22 Jan 2025 03:25:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 511366B0082; Tue, 21 Jan 2025 22:25:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C0B56B0083; Tue, 21 Jan 2025 22:25:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3886A6B0085; Tue, 21 Jan 2025 22:25:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 180766B0082 for ; Tue, 21 Jan 2025 22:25:39 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7B3B5120983 for ; Wed, 22 Jan 2025 03:25:38 +0000 (UTC) X-FDA: 83033647956.22.A3088F1 Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) by imf02.hostedemail.com (Postfix) with ESMTP id 9BBE380008 for ; Wed, 22 Jan 2025 03:25:36 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=pQq4ep5V; spf=pass (imf02.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.179 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737516336; h=from:from:sender: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:dkim-signature; bh=WqCfGsA3H8C7eNmf1VcJ0V/ARphQuwcuycsMP7Eq7+s=; b=bTdrT1Qzt60Q6mcasBFcumrKqEYHmzhTipS3sPIXQP31/vw3FoVXD5qdIcjgHGC7ElgYq0 254m+Lr995jxSy/HhIautveU3fCpC91lOyku4mvH8GV5dunXpwhc44ZXtOlDtiUB1KeUUv SgSgIkqbGhPXElvG1ezCkOdB8pjLrIw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737516336; a=rsa-sha256; cv=none; b=D0RdZojJp1RZbZKATyEgwYxFWG8+dBowggz6PtAiz/XhUOksm98YYDzlKJO9xfGW0DL9cm QMf2yFQxuVKRedAurSqTv0bIz9N0/glQEHEhhsfnAIL130oO02CVzezpQaRfAJK8OBXHm5 2jjletLSDZhOUK94Kmm0QANgyFHQUEs= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=pQq4ep5V; spf=pass (imf02.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.179 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=pass (policy=none) header.from=linux.dev 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 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 X-Stat-Signature: zsr4xu5n9uxaw9poa71pm1mtedj3ckxp X-Rspam-User: X-Rspamd-Queue-Id: 9BBE380008 X-Rspamd-Server: rspam03 X-HE-Tag: 1737516336-857870 X-HE-Meta: U2FsdGVkX19R+TT8QjiToXRZUOj7+Tvxn1rcYsIDYBwKVDrwAYhzMIbtDECrWh5sjnBw0y9zzylI69xzYc/r4rekEHAvgLsVIj7lq56g7jaLYt2w73s72zWyZkdmIFfrg//PTwI+Mt9vusgkkN8tmRrRxENSl6MSItdvOF/VxAanfHoEECYkIQv9srR//LQcdZou8A1qCfC4VNtWo+UpPkT7XRupGD2Y7yHSbnPlkTXlHLdsEzsDm3pbVpNjl/ahAadlVDpArCW9EOPotUgXcIyhpJPDVZ6Y7mXIVawCmpoko6NsLFXV5b62CU4ijgLhOlv87eV3IVJSQT46yR4tx2D9wJA2z1MxaNoTu/UbbhFpZ00i7LkAB0siusl3NwKfMxn4CDuazNB4IYiARbBYB8lTbp5zh5FJ9SRUVSJhY4DrXXmUaw7vpoOtkrBnqOBef273Z7DYYN5DeluLHM8HCKnRGWL2NjQ0h9/iicJcedcHLYUoc1vAqlEvjU49sotAslBGcA/7UeCk8YLBx8rl+K8q1XPWJUqjzkvgEeBM32ALvlXul8N4HXWOHBAfK/8Y+tLoqNP4eG1wuKjVcr/XnP6aSCM4/chpykm01xV4iz15sMiYzxg3bdBs7nPnZJzY2imrTy/FDy88+5x6+wTwulbbeXAkg8vpWKplYoiyVES1h3QhKAZT8WkDCCet17vLkgbFtv9KNbS0g8lQ3cOhT2RsVGv/FYHXpBAIHHrhEiQS5IGGrLcwClnC2PB8OHOXawr5meIrfsl+JUXPW2gbM3JfSnCMxBfXf8o1Bxu+une0X8vmipHBR4hs9qvK008pqXInoDgtq3KxV+3BUwfp4qJ0iHiI/It7gRil25XN6khrtZROPzfrBP7LesBKv0S+p5UZr05Exn0EEM9d1Sx1Fz+vpHSZWd58y3AuR6nSxj+zEaDHK7p/W6RNzIpfbc5pOzAyv7cLENafKULIZH8 uRNXOYEe vNs5mFLXLbL2aHPOOM385NcnpE8Y3WFb/APW8wiALuBENhto0rGSrSlcgGq4h5UG3i+6S5I6U+IVjGiPNLooq5us0rutXcqwnxZVhe6YTBQt08RtVE5ckd+icwYM6qKqrWywHSwN9okPJvrrul3dLdO2nh0R4awuTse1DMXoouGE1JR3xrWl5SxBoz1aBc2Boi8FPESO69CpWMNLlIplTm2doNwtINwO01dGj0smAStsog4kbNhBT9+2VLoavpClXo2olDk2LxNvvqjl7tewgGBRX2RPIKEGPmeDouW2mPj24UEvUUZO1WbW0fK3SCXwt5cfm5wK7FENRlZslVC8D80Iw7qHAMGCZoiG03hk6ZLxRSqDUiwFwYf0k7A== 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: List-Subscribe: List-Unsubscribe: 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 >>