Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp804313lqj; Mon, 3 Jun 2024 00:46:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWAcjxEgoOtjkF+AMshWp25b0FLBI9OfcYsDWz19xCRsmFcTruauvzqiIhUJXQNwyiPOTdTDyVPWhCODJuwyUcaaVPnK8yJyUygaKYx9g== X-Google-Smtp-Source: AGHT+IGGgpie+G3xDH7MiwjaUo7CmjunRmRAQbpsAc7GL29WWa6g1Cwz1GLOAzL+nkiFhmQ5L1LJ X-Received: by 2002:a05:620a:4626:b0:792:c660:e5a9 with SMTP id af79cd13be357-794f5ed4092mr1137091985a.74.1717400776048; Mon, 03 Jun 2024 00:46:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717400776; cv=pass; d=google.com; s=arc-20160816; b=wklVj5B9qDLRnkTt1B4+DNeVsykrxzuilzyfnw8BSocdFcy/dg5mi1qNzbo1awAGcY nWIs0GuQ1TBZj0HTzxjWB8EW7b19EYjDWwl3sa212+C5ryNPt9Pac51Ds4eqL7aQACI2 yfHrAEFhfu9RZkwks8Ow34LkNlkrOKX2DPwp0d8EfMRHEYwtx+mwQI9KNwY4XXRyCm/p d0jtMhzmLMbd/uFEeVaCKlsXXec7fwGYMfmso9i5Bf8Xs4+xMQoEls4gD8ejahaUP4tT xk3OJ5q8PdUg30h2ibgPojtjB5xR6H8XP61yjsWA/KF7wuvigJsJ+5mH1b3IoMwCOrav qk8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=ppjcw+ey9UBAAWa6TUuEs/1kMnYQaEpiNxwsiWo2PPg=; fh=546hdm+AaUZdXI9cBcSn13oX3TMQ1kkiDmpAO9bjs1E=; b=rscLRC3NSNhrsHPFRJVczzdnemSlHq32piQ2pZ6vIyaOnQ6W09bMPFqcZBnPGqFkDm cV2Y+A2TxtXRUCnlPV6zS5BY8Ady1ChOAUlaN4weRk7l75ekv85W96V4lRbPUMCikVC6 osxeEcNt7+ggozv8DN7yS6EPJy1Mqn1OImOXn4b+b/E3u93wlrdQ4WRMIXU3lAh507Gf oUfxxB+6DivOMuJyb8rf5OMb2+QoJl0Fmp386phylXn+MPJ1WxQtCd93dsRT7GnJNZfX Dwp5POXPrlPzEIraWRS3Ks0OSMtWmJVdPr54Y/2g40hzydUDMPBqmvlp3ju/MqjDn0PE zs6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=t25W15xE; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=t25W15xE; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-198734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198734-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794f32a2e14si785879085a.553.2024.06.03.00.46.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 00:46:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=t25W15xE; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=t25W15xE; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-198734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198734-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id ACF591C21B1B for ; Mon, 3 Jun 2024 07:46:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D69484AED1; Mon, 3 Jun 2024 07:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="t25W15xE"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="T+be8l7H"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="t25W15xE"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="T+be8l7H" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B34415E88 for ; Mon, 3 Jun 2024 07:46:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717400768; cv=none; b=JrjjbzgLLSIyYIZWd1SlgSN2LROdbkrbNSKmXkLEFLCb41gamGye83I1kfPtk2HbecbbGgCog/Z8yRKS4RCsQSWYgdZ5GggmrQHBk9AIsa2IkG4+FhznczZLLbGA1YZa9Z6V4+e1srfiDX7GmbFDX16637MMbucwZOFo7lsUfQ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717400768; c=relaxed/simple; bh=mFDXlpiMEJYXovW6Of1ONYiod4w13y59ry15qm4tAyY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=swTqKTxg/RK0Ko8brtE9q5coGBA95JWBMOOXAvyD38CiU+0atlb741GXKi5+7PVYf3u9rIewIEyRhSPZozuBqITw0vTO2vh188cwcivdOlWJpNfwDTWp6WeVYba1pSLlAdb5Nal7nIVHPsiUCt6nFuU4jIfzMG/BeaY8on6T2Ns= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=t25W15xE; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=T+be8l7H; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=t25W15xE; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=T+be8l7H; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5C20522196; Mon, 3 Jun 2024 07:46:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1717400763; h=from:from:reply-to: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:autocrypt:autocrypt; bh=ppjcw+ey9UBAAWa6TUuEs/1kMnYQaEpiNxwsiWo2PPg=; b=t25W15xEW3ID4KWRgnM3+SMY43dWJxhiHe/yMP4eaV0xupcaZBE44g6mxnUz74OiEOQFGg w8hfZ1d1l/lbGYq1zY9XtRLyRLUV40pLlQ2VC3cWXiwEP4MZHWRFDP5nTUuEKInEsKzCAu +VaWoNdB/8uYlmCK0Y68hwvrMzOvmTM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1717400763; h=from:from:reply-to: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:autocrypt:autocrypt; bh=ppjcw+ey9UBAAWa6TUuEs/1kMnYQaEpiNxwsiWo2PPg=; b=T+be8l7HJtjZsshSs1YB++h6HHENRFrfLr3DOttTfA4+sTYCriWkGzhE/oYHbCcJ/N0v+I sp40xEa9P31TZPDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1717400763; h=from:from:reply-to: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:autocrypt:autocrypt; bh=ppjcw+ey9UBAAWa6TUuEs/1kMnYQaEpiNxwsiWo2PPg=; b=t25W15xEW3ID4KWRgnM3+SMY43dWJxhiHe/yMP4eaV0xupcaZBE44g6mxnUz74OiEOQFGg w8hfZ1d1l/lbGYq1zY9XtRLyRLUV40pLlQ2VC3cWXiwEP4MZHWRFDP5nTUuEKInEsKzCAu +VaWoNdB/8uYlmCK0Y68hwvrMzOvmTM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1717400763; h=from:from:reply-to: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:autocrypt:autocrypt; bh=ppjcw+ey9UBAAWa6TUuEs/1kMnYQaEpiNxwsiWo2PPg=; b=T+be8l7HJtjZsshSs1YB++h6HHENRFrfLr3DOttTfA4+sTYCriWkGzhE/oYHbCcJ/N0v+I sp40xEa9P31TZPDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3F726139CB; Mon, 3 Jun 2024 07:46:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id eRkHD7t0XWa5XgAAD6G6ig (envelope-from ); Mon, 03 Jun 2024 07:46:03 +0000 Message-ID: <2ff52c5e-4b6b-4b3d-9047-f00967315d3e@suse.cz> Date: Mon, 3 Jun 2024 09:46:02 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] slab: check the return value of check_bytes_and_report() To: Chengming Zhou , "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> Content-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DRjyo+ol59j0FViYysjQQeobXBDDE31t5SBg++veI6tXfpco/UiKEsDswL1WAr tEAZaruo7254TyH+gydURl2wJuzo/aZ7Y7PpqaODbYv727Dvm5eX64HCyyAH0s6sOCyGF5/p eIhrOn24oBf67KtdAN3H9JoFNUVTYJc1VJU3R1JtVdgwEdr+NEciEfYl0O19VpLE/PZxP4wX PWnhf5WjdoNI1Xec+RcJ5p/pSel0jnvBX8L2cmniYnmI883NhtGZsEWj++wyKiS4NranDFlA HdDM3b4lUth1pTtABKQ1YuTvehj7EfoWD3bv9kuGZGPrAeFNiHPdOT7DaXKeHpW9homgtBxj 8aX/UkSvEGJKUEbFL9cVa5tzyialGkSiZJNkWgeHe+jEcfRT6pJZOJidSCdzvJpbdJmm+eED w9XOLH1IIWh7RURU7G1iOfEfmImFeC3cbbS73LQEFGe1urxvIH5K/7vX+FkNcr9ujwWuPE9b 1C2o4i/yZPLXIVy387EjA6GZMqvQUFuSTs/GeBcv0NjIQi8867H3uLjz+mQy63fAitsDwLmR EP+ylKVEKb0Q2A== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Spamd-Result: default: False [-2.79 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; RCVD_COUNT_TWO(0.00)[2]; TAGGED_RCPT(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_CC(0.00)[kernel.org,google.com,lge.com,linux-foundation.org,linux.dev,gmail.com,intel.com,kvack.org,vger.kernel.org,bytedance.com]; RCPT_COUNT_TWELVE(0.00)[12]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[] X-Spam-Score: -2.79 X-Spam-Flag: NO 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? > Thanks.