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=-10.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 3763DC433E3 for ; Fri, 14 Aug 2020 07:47:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9839620708 for ; Fri, 14 Aug 2020 07:47:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9839620708 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=de.adit-jv.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E90936B0002; Fri, 14 Aug 2020 03:46:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E40DD6B0003; Fri, 14 Aug 2020 03:46:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D57716B0005; Fri, 14 Aug 2020 03:46:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id C21256B0002 for ; Fri, 14 Aug 2020 03:46:59 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 84C64585F for ; Fri, 14 Aug 2020 07:46:59 +0000 (UTC) X-FDA: 77148392958.28.crush90_46064f826ffb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 5E3CC6C1D for ; Fri, 14 Aug 2020 07:46:59 +0000 (UTC) X-HE-Tag: crush90_46064f826ffb X-Filterd-Recvd-Size: 4061 Received: from smtp1.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Fri, 14 Aug 2020 07:46:58 +0000 (UTC) Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id 1802E3C04C1; Fri, 14 Aug 2020 09:46:56 +0200 (CEST) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TMQkkEkhmfli; Fri, 14 Aug 2020 09:46:50 +0200 (CEST) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id 764EA3C009D; Fri, 14 Aug 2020 09:46:50 +0200 (CEST) Received: from lxhi-065.adit-jv.com (10.72.94.32) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.487.0; Fri, 14 Aug 2020 09:46:49 +0200 Date: Fri, 14 Aug 2020 09:46:44 +0200 From: Eugeniu Rosca To: Dongli Zhang CC: Eugeniu Rosca , Andrew Morton , , , Eugeniu Rosca Subject: Re: [PATCH] mm: slub: fix conversion of freelist_corrupted() Message-ID: <20200814074644.GA7943@lxhi-065.adit-jv.com> References: <20200811124656.10308-1-erosca@de.adit-jv.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.72.94.32] X-Rspamd-Queue-Id: 5E3CC6C1D X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: Hello Dongli, On Thu, Aug 13, 2020 at 11:57:51PM -0700, Dongli Zhang wrote: > On 8/11/20 5:46 AM, Eugeniu Rosca wrote: > > Commit 52f23478081ae0 ("mm/slub.c: fix corrupted freechain in > > deactivate_slab()") suffered an update when picked up from LKML [1]. > > > > Specifically, relocating 'freelist = NULL' into 'freelist_corrupted()' > > created a no-op statement. Fix it by sticking to the behavior intended > > in the original patch [1]. Prefer the lowest-line-count solution. > > > > [1] https://lore.kernel.org/linux-mm/20200331031450.12182-1-dongli.zhang@oracle.com/ > > > > Fixes: 52f23478081ae0 ("mm/slub.c: fix corrupted freechain in deactivate_slab()") > > Cc: Andrew Morton > > Cc: Dongli Zhang > > Cc: > > Signed-off-by: Eugeniu Rosca > > --- > > mm/slub.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/mm/slub.c b/mm/slub.c > > index 68c02b2eecd9..9a3e963b02a3 100644 > > --- a/mm/slub.c > > +++ b/mm/slub.c > > @@ -677,7 +677,6 @@ static bool freelist_corrupted(struct kmem_cache *s, struct page *page, > > if ((s->flags & SLAB_CONSISTENCY_CHECKS) && > > !check_valid_pointer(s, page, nextfree)) { > > object_err(s, page, freelist, "Freechain corrupt"); > > - freelist = NULL; > > slab_fix(s, "Isolate corrupted freechain"); > > return true; > > } > > @@ -2184,8 +2183,10 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page, > > * 'freelist' is already corrupted. So isolate all objects > > * starting at 'freelist'. > > */ > > - if (freelist_corrupted(s, page, freelist, nextfree)) > > + if (freelist_corrupted(s, page, freelist, nextfree)) { > > + freelist = NULL; > > This is good to me. > > However, this would confuse people when CONFIG_SLUB_DEBUG is not defined. > > While reading the source code, people may be curious why to reset freelist when > CONFIG_SLUB_DEBUG is even not defined. This is a fair point. To address it, the `freelist = NULL` assignment should be then moved into the body of freelist_corrupted(). If no concerns on that, I will soon push a v2 implementing this proposal. -- Best regards, Eugeniu Rosca