Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp811887lqj; Mon, 3 Jun 2024 01:06:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+SNVRsIMOZYoDdycYwGTTjT4aUZBomAOwBrqLEVfd7FccFOX837ZWZ95Vb3tU596tMvjeu0uhZCTEzPTARehSfPJnrS56XSwQHK/2vQ== X-Google-Smtp-Source: AGHT+IGWcg8+CaatKelYC0UTDtbERJlGlkKvXynmvZ3Fm+iNlqvLeKIN2W7G6X4u3s8bdlKF2+EG X-Received: by 2002:a50:9b56:0:b0:57a:2de8:c47d with SMTP id 4fb4d7f45d1cf-57a36406453mr5295120a12.21.1717401984306; Mon, 03 Jun 2024 01:06:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717401984; cv=pass; d=google.com; s=arc-20160816; b=g7vFe8iLC2PTRKivGLPMuDOptB42lhqgJC+1DKOp73k1/FYfHtSRyJbBDsq/dxZJRn gs+zHnU7e75qOs2K+mqPO9ykaIXSinxilm3SjuqvbJsb3UzELCA0sXqxLJ6SfFyMt88o M5OSUeU1ZBAaTDQjYy5adys+C8lVKB0Se+hv8UkEByca9aOr2zOeNQBYFO/JSeES3hHM pezR21B+hJ/wtVTL3nTcBuYjLkcMDpibmomIpNNaWQCpORh+xoQsGRPBIIGyrIwQJkjf 3Q67a9RVL+0FnzOs4bYb+TP9Zv/hXkGt/TN3ZWI8xJe+uTLI7IWv/fAmHH/UvJg/vGBs Gm0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=RzieQJ4BnZ2O+k2Yxxz/okFmp27lskeHqZjRJMv514E=; fh=qtPpHRKzaB+aC3vATE/xTRtx3ZUt30RLjrx8fP3ONoY=; b=Bi+qDJVSj8m/Y2pQ09tvGQtJnTuKD8OFFazyhQaLB5g7ouGo7+3Dh54Dt5B6LpCBXK AeJjlNre3tBRejkMBzwEwrGwFKEVBVRIWlDiHEC7zJIMWMjuCLiw7R/dgnWAot/+itgx /7HQRldng5T3ocWRCOidjecCo1UKZw3X7CrQh8SDvk+zSol2edAUxq82dITE/8EZ8hFf Z4C5DPHphZYC7olk7xRXOk5gd67LJCmJMmjsOyA52WZkVoshIP7svgUPooM2yAv6tPy6 AznbhEEdoycXb9tn49Zbk9pAlNex4qyK8Qx4+owdpBCHkdT++b7++AJEsmLJGtB9g5dm sivA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=FX5i62F8; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-198755-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198755-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c76e3asi3979213a12.395.2024.06.03.01.06.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 01:06:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198755-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=FX5i62F8; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-198755-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198755-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0D43E1F216ED for ; Mon, 3 Jun 2024 08:06:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CBBA53E37; Mon, 3 Jun 2024 08:06:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="FX5i62F8" Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) (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 6505E487BF for ; Mon, 3 Jun 2024 08:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717401977; cv=none; b=Tr9c8yz0Dsg4Xodac2z+dvMYGb/Cifr3AbhRVtAkMR+Rrk85BWD3VK30qzPEIuHvSebprzpO8OPwyref+ydR/Z6H1q3076lQS/A7vpIAOk6leatauhRrepB14nCNUTw+KgM60DVkVkw67yWyPe5jun1ZV6UKkN/qigskYw5eqno= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717401977; c=relaxed/simple; bh=MIF84jAmIzDg4Wz6TnMTbmZnsvgXm/Bb1xUd8UhNtFo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jty/hQEF9YAPYRz6uqbcsLGediqVLs80UDaeZ/8njRYmPY8KUIt87bmF3fL0oXvGlICAy+3dHKgMsnECp0J8LwRy4ts6fzjIAai/1lIlaLMzNH0hnjxKQ7aN8M/Ih9hon/vmwaHwOKTJARyb2WEfipFeFBn5fzKw5VPeE+MbSWY= 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=FX5i62F8; arc=none smtp.client-ip=95.215.58.179 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 X-Envelope-To: vbabka@suse.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717401972; 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=RzieQJ4BnZ2O+k2Yxxz/okFmp27lskeHqZjRJMv514E=; b=FX5i62F8fKahV2di7nQq0WGf6YGLs0O3dOslRmI/ZZJUdPAXnv0U2qwRCaNzwIoGNu+ZAd UeXA0Zrs/2oNq8IYXl5OEO6CwiyTPMfzKHZNYM8Np5dg8QLl0TzjUhlVkW+aUfNkG682Kv eACi2gCe6KmweGHY9JCpbno0ZJzscWI= X-Envelope-To: cl@gentwo.org X-Envelope-To: penberg@kernel.org X-Envelope-To: rientjes@google.com X-Envelope-To: iamjoonsoo.kim@lge.com X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: roman.gushchin@linux.dev X-Envelope-To: 42.hyeyoo@gmail.com X-Envelope-To: feng.tang@intel.com X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: zhouchengming@bytedance.com Message-ID: <0df9277d-6f10-4af6-abd7-50a275489a72@linux.dev> Date: Mon, 3 Jun 2024 16:05:41 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 1/3] slab: check the return value of check_bytes_and_report() Content-Language: en-US To: Vlastimil Babka , "Christoph Lameter (Ampere)" Cc: Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Feng Tang , linux-mm@kvack.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com References: <20240528-b4-slab-debug-v1-0-8694ef4802df@linux.dev> <20240528-b4-slab-debug-v1-1-8694ef4802df@linux.dev> <4e4d45b5-c684-2d93-49d2-b179a088c2d5@gentwo.org> <2ff52c5e-4b6b-4b3d-9047-f00967315d3e@suse.cz> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <2ff52c5e-4b6b-4b3d-9047-f00967315d3e@suse.cz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 2024/6/3 15:46, Vlastimil Babka wrote: > On 5/31/24 10:31 AM, Chengming Zhou wrote: >> On 2024/5/30 23:20, Christoph Lameter (Ampere) wrote: >>> On Tue, 28 May 2024, Chengming Zhou wrote: >>> >>>> diff --git a/mm/slub.c b/mm/slub.c >>>> index 0809760cf789..de57512734ac 100644 >>>> --- a/mm/slub.c >>>> +++ b/mm/slub.c >>>> @@ -1324,9 +1324,10 @@ static int check_object(struct kmem_cache *s, struct slab *slab, >>>>         } >>>>     } else { >>>>         if ((s->flags & SLAB_POISON) && s->object_size < s->inuse) { >>>> -            check_bytes_and_report(s, slab, p, "Alignment padding", >>>> +            if (!check_bytes_and_report(s, slab, p, "Alignment padding", >>>>                 endobject, POISON_INUSE, >>>> -                s->inuse - s->object_size); >>>> +                s->inuse - s->object_size)) >>>> +                return 0; >>>>         } >>>>     } >>> >>> This change means we will then skip the rest of the checks in check_object() such as the poison check. >> >> Yeah, only when this padding checking failed. >> >> Now, we always abort checking and return 0 when the first checking error happens, >> such as redzones checking above. > > Yes your patch will make it consistent. But IMHO it would be better to do > all the checks without skipping, report their specific error findings in > check_bytes_and_report() but not print_trailer(). Once all checks were done, > if any found an error, print the trailer once from check_object(). Thoughts? Ok, it's feasible, will change to this. > >> Thanks. >