Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp302098lqh; Fri, 31 May 2024 01:32:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXe3c2K9oO4oyFcxqk2/FOBrpaTw24bttEprAoFenpqUoGCzDqYGrdxTjNa6c1HcKQj0jE/Z7K+7uTxD3iWLxeQqtzzfVfcMQC8JBbY/Q== X-Google-Smtp-Source: AGHT+IEWC94cPE901i+KfAtFfzF7JkwdV1UaIfd87boaARVsYkbpRtHcaXKOsEfhvVrbnizy4TTm X-Received: by 2002:a81:4ed1:0:b0:617:cb98:f9b2 with SMTP id 00721157ae682-62c79824345mr11381887b3.43.1717144332883; Fri, 31 May 2024 01:32:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717144332; cv=pass; d=google.com; s=arc-20160816; b=zD70YsXvvH1yKOijSsLrM0K0Prq4V3uSEvMkoTo6zPMZWZCZJFE/7FIOZLlTtgpP+Y aGrEwMp8xoQs1AhOTgg0hEQ4fgQ9S3VsjZXUeRrv7DH/mSNO4H6S5eENgww7z+dAO/Fi G1YAOv7+wdEC60MHiwHi/HreJAgvxFPhEb13mMbDAB09Cl+ioKML6MdK511cvGe86Beg 2qiAXqC5aNqLiBZfSHhjSMd8JZayj5W3a7+D7HS5O5nlFXSCJ9Mh/nxgflt6JEr3Ikb+ FRiIp04t0gxwsXWiOpTctLNtqWCiWFoluSFj7XjmL4RAZod31OQmXF8o2gZbpJQMW/PT QaiQ== 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=mHgLHUhxCEeWxCNJSXHptpDk0n+7D3OisdJ7k6oe/I0=; fh=xb2vgmcQp/R0AmwsB3ADhcZrgUZrWEyVOnF3TSb0o7A=; b=IvgbFyglunxm08wxDIV4DV6TkPdOgxpl8jWgFdz5SQLSOmbba5YFLOBFkL4ht6Wa+D Iv+6UjlgTYNNFpkQOs+3uxRQYeQvg9+xrrxw9SWYNE6CBosXTWMpfHbdNCAI3Uv+Oizy 39ZrraTRkkGQDbLa6yZDqrkmPBrW3tOF60zQsfUo/4LZsZM+4ircKRPQ/o/Ku+j+QW1g A1pOdIgEyugjRZJnoOv8wVdAcbERAQuy02tnlMyrVDFfzZe4TwC91fWxhwXqnS7/3h8e agzOl6axaJlBQ8KSRJl3eXiNbirrFYAJoHrGq9gLhln8G6TYx+1+5jqYIXgw53AzThNg 55fQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=soJ2cCCU; 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-196472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196472-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b402189si15152826d6.205.2024.05.31.01.32.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 01:32:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=soJ2cCCU; 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-196472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196472-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9968A1C20FBC for ; Fri, 31 May 2024 08:32:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14BDB14F9F2; Fri, 31 May 2024 08:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="soJ2cCCU" Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (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 DEBB314F9DB for ; Fri, 31 May 2024 08:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717144326; cv=none; b=IQq4pI77DalOostTA+ZAMufK32+3IlZ0eU85NXBDTpjhV9M9o7/zypXc7rZoHQPHE4aYUUlkz1qaWnvOyLrlPgclyrByz09DdxAvNkufjl9n2zBxODxWW8OhH9qDZ3HsqeXurdjf/ohczHYLlTcgIls8UsK5rrHJcibTDxxbti4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717144326; c=relaxed/simple; bh=x58qvahiLWJ9l42qtXAob9nZ9sSWGTIY+wsTwkiQ6Pk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hqtjSdzOUlzCcnQfHuFfal6lyQzkSd6Gxt01RitMAP9T0hBesQFAElVnWXlOM4AYfvVYslR8t+H9wA1cTbiyA2zvM9pbnuKf0gv9uaUUiGyKpMGoKD28ZrinE+7/ZnQuTYpZRE73MRZwLYeaA2ZY+9IWhCACE0wL1treGs3OvUU= 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=soJ2cCCU; arc=none smtp.client-ip=91.218.175.189 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: cl@gentwo.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717144322; 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=mHgLHUhxCEeWxCNJSXHptpDk0n+7D3OisdJ7k6oe/I0=; b=soJ2cCCUVPJxQoiCy/lPzeERw1gF34QVlNZzGq+cIC/9svcXTzgyuArdQ4wWeyQ8WPCD1B fH83u9/bQNfenATiqU1AT5HQ87YSBVl64atkNJ6aLKw84sNpYBERWwdvkfYNyKu7we4xfh 17w/oYT+wOiNx4PQwdHcyxUmt1owLls= 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: vbabka@suse.cz 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: Date: Fri, 31 May 2024 16:31:31 +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: "Christoph Lameter (Ampere)" Cc: Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , 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> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <4e4d45b5-c684-2d93-49d2-b179a088c2d5@gentwo.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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. Thanks.