Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp867234lqt; Fri, 7 Jun 2024 00:28:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW4opi2D/+x5+waQpzmVBxx0j4oBI5l6athOfRvhKRkm8x7hbVqUgvG7iMKL0CF1nqODQKm9R7PV5PypMXqFJq1NkH/J3rm/NOAQfOSUA== X-Google-Smtp-Source: AGHT+IFLpmR4IyMzhJIV/gqW0iZL5V7iJtlWoItYZKLViXQaDfcAIrHrG4qJkWp3/SUf9LrXlG8i X-Received: by 2002:a17:906:1305:b0:a68:67e4:7f06 with SMTP id a640c23a62f3a-a6cd5610885mr112334566b.10.1717745305836; Fri, 07 Jun 2024 00:28:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717745305; cv=pass; d=google.com; s=arc-20160816; b=FWZl346z8PR1FECy0sRXN/FPmwZF/kzlwB7Zb1YSrch74mJAqcR7wv9iCkYiZhro+E 3n9rjxGL4FNSEX68Sqygl1+TU/hWSB8wcnpYrxHlzdQ571MBkvjpQtijYQN+l5SC1Ld6 HCoyvoDSTl1/3Qn46RVTXt10eRRvkLsvAmW2jdEw5zmqzThc8kqJ5spMfXoXH0Waq/hl WKJn0bF+5RSk+BHJ8f3kWRnmdJR0AIoQrzvTNs37Unzydtg3+lL1S9xiy7cqijPVg/qx 49XTynPtvnCDrremzL95ezPIjK4N27EzsWoRm4DACkQu0JE9vEewA8noh5mex3oskyZE +6+g== 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=SmIHSLn/WvaJPUCX1Y8vqiV6qDdzhglScQrwFE+kVPs=; fh=wCuBam+/yAQoWCjfHcxG4AiCNRpPJ+xnPoLh1wzwlGo=; b=WHicfaWwzoKpmzCoZbtFu51OYhgxilZi9TaF40w+TyWkdaO4j/cmKbpoIjJPDgYP2N VaP4flX3KWMceUo8kQmUmoEoR0t8LDdVi19KhaEZE/VPLV88Jknc+AEfKFd2MAXGympZ DlR4GjY+AVAFkv3IEijkripJx7LKWO4ghNyuO+EQQUOCS/CpqWJ1uMm4zDV47Fk5ZCF0 x3qO1r/CeWnKdm0f1bC+Du9S0BX5OhEv20/KJ1+qrhVz4KLnWvkteA7rzhR1T/+0TKT0 7dE25FsY2oa9UZC0pPaG9XJ1pel1R+KhKZKOATEyMyK8b4+sInAJMgerQZsACFxH+9xr k8Tg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UOM50Iwh; 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-205525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205525-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 a640c23a62f3a-a6e3835838dsi21668166b.505.2024.06.07.00.28.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 00:28:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205525-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=UOM50Iwh; 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-205525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205525-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 423DE1F2139D for ; Fri, 7 Jun 2024 07:27:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F17B153BC2; Fri, 7 Jun 2024 07:27:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="UOM50Iwh" Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 42B72DDD9 for ; Fri, 7 Jun 2024 07:27:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717745264; cv=none; b=Jbxs5SpJUopotgB9n/AOFqrG1n80ogu1x0u7WAkEL04+CeA618dShTY8Qp9x8+dtIHKQ/kQBcPZk1FrHoaBVvL/TA/7ENxzf0ex1e/fNyTOvBzTh33tPOvt1GbnGZka6LiMIPXchE3hD1KtrmYSXCHeCIUbdYgh9SP+R6PA+9HY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717745264; c=relaxed/simple; bh=qzMe1iYAod/bcIq4XiyzKdjBhHpWZ1NslnzI6+M46Ss=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=n51drBWVPtAnAXTNYla7qzCq8Xxf43GY03VNH4v39ZxmUNbGtJOxfBfk/fFadv54kGbW9UwLrqdVoX99/UYY/25gqwxBO5AiQe7gbH1uDe/YlELdHvc+d+AR+GKea+7kfj+EGX0uJBJeOPRNUF0YJp7xjblux2dlA6Ilg04urrs= 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=UOM50Iwh; arc=none smtp.client-ip=95.215.58.186 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=1717745259; 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=SmIHSLn/WvaJPUCX1Y8vqiV6qDdzhglScQrwFE+kVPs=; b=UOM50Iwh2l1RuKUYUI3XZ8BTN4lzNFetHtCLig3C2tmvfdz/GJoBR+YE+bt1ThDI/irx2P 9sMcu9AaZA4y5SP7GoBS//xnF5LpiiESOog8FLdGWoa1RCqQ4BXI0gTdn21oxq4293Rel/ ty9UTtboEF7wLJDFHmzhMIei3FlPvmo= X-Envelope-To: cl@linux.com 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: <96f13b3c-ec74-4f87-be37-fbf796fe51eb@linux.dev> Date: Fri, 7 Jun 2024 15:26:46 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 1/3] slab: make check_object() more consistent Content-Language: en-US To: Vlastimil Babka , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Feng Tang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com References: <20240605-b4-slab-debug-v2-0-c535b9cd361c@linux.dev> <20240605-b4-slab-debug-v2-1-c535b9cd361c@linux.dev> 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 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2024/6/6 16:28, Vlastimil Babka wrote: > On 6/5/24 9:13 AM, Chengming Zhou wrote: >> Now check_object() calls check_bytes_and_report() multiple times to >> check every section of the object it cares about, like left and right >> redzones, object poison, paddings poison and freepointer. It will >> abort the checking process and return 0 once it finds an error. >> [...] >> - /* Check free pointer validity */ >> - if (!check_valid_pointer(s, slab, get_freepointer(s, p))) { >> + /* >> + * Cannot check freepointer while object is allocated if >> + * object and freepointer overlap. >> + */ >> + if (!freeptr_outside_object(s) && val == SLUB_RED_ACTIVE && > > Seems this condition should have been logically flipped? Ah, right, will fix. > >> + !check_valid_pointer(s, slab, get_freepointer(s, p))) { >> object_err(s, slab, p, "Freepointer corrupt"); >> /* >> * No choice but to zap it and thus lose the remainder >> @@ -1370,9 +1368,14 @@ static int check_object(struct kmem_cache *s, struct slab *slab, >> * another error because the object count is now wrong. >> */ >> set_freepointer(s, p, NULL); >> - return 0; > > Should set ret = 0 here? Yes. > >> } >> - return 1; >> + >> + if (!ret && !slab_add_kunit_errors()) { > > Also 5/6 of slub_kunit tests now fail as we increased the number of recorded My bad, I didn't test with slub_kunit, will test later. > errors vs expected. Either the slab_add_kunit_errors() test above should > have a variant (parameter?) so it will only detect we are in slab-kunit test > (to suppress the printing and taint) but doesn't increase slab_errors (we I think this way is simpler for me, only suppress the printing but doesn't increase slab_errors, will take this way and test again. Thanks! > increased them for the individual issues already), or simply raise the > expectations of the tests so it matches the new implementation. >