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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECF13C433EF for ; Wed, 10 Nov 2021 01:49:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 95051611CC for ; Wed, 10 Nov 2021 01:49:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 95051611CC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1CF776B0071; Tue, 9 Nov 2021 20:49:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 182FF6B0072; Tue, 9 Nov 2021 20:49:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 020986B0073; Tue, 9 Nov 2021 20:49:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id E36616B0071 for ; Tue, 9 Nov 2021 20:49:17 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 95B86824C454 for ; Wed, 10 Nov 2021 01:49:17 +0000 (UTC) X-FDA: 78791337954.28.3254331 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf15.hostedemail.com (Postfix) with ESMTP id 5526BD0014E4 for ; Wed, 10 Nov 2021 01:49:04 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id gf14-20020a17090ac7ce00b001a7a2a0b5c3so241832pjb.5 for ; Tue, 09 Nov 2021 17:49:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=Q1Ic7kOOPETyhFj1cyuEbcKYl8I2Bp4M76inzkMgFYw=; b=JcAnLtwIyMNf+NQlLdTltzTN9P1vrtht48UYiVP+F3KKoXsfKMUrO9NfTaeljph4Of Vzlb/zeuw+bEjm6OT7k5Yn0baMAKCdyYJhOA/vwx/B7B8X27L9USKYnxUvmF5u957/tu bbbko4KszdScfVbNQupYSbrum8MHOlaGjSl+mXwhXma85vfySda772H3NqgYBCDrRz1r xGVR4RBFSw7GPbrvT6KMIYrbv/6h/t3Xt0VA9Q+5IA27yfD5wUYlHVIB6U0ASiuU41OO XrHz/MCfrgyc3J0JS/AqoHpj16VPyLlV07JzclV9mMxKn0a9W0oWHoZ++TMTv9eG6/ci emug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=Q1Ic7kOOPETyhFj1cyuEbcKYl8I2Bp4M76inzkMgFYw=; b=YtTYeAM+kVtCRvSAZZlVXeDVn5PO5wz8kcnCuesDlLkmUXLrmme8inCODugyMWqJKd OyFKqtZMnqvzMMDvlsMsBPZOz+Yi6t3JTirU3LArueaHI115Fqy/RwOUjLbR2iSN+SU8 QO+IKmIq96Wat694wYbhRl4CnDfzE2U43SISgEEFWpeEflBWEqR5uEHwyYQw/Y6UzBbP rCuzgWmAA4UgEIpohwL8zlIc9vHXDDraH94QFpUzJWN1PvH7XL15S/kC9/qN6hkaOzkG s3LqNhGJiSpRAxVvgwhXJ48xaHtCsDoHy3BVBvEB3nKCr3d2BG7bUtpU2EO43YmmJIsZ JK0g== X-Gm-Message-State: AOAM531BzCmefIpV4gvh/b5Cyy85bwOkI8zXmbp31m1dtN72CKds4aQL enN2FBKbGCGKFevAITxLJbLiXg== X-Google-Smtp-Source: ABdhPJywsEcL1jsUSgZb/S9gKVQtVO/v+FSrb8WQK3KYJE9KG+KL5Zqq+J57CUAmXi9vSqcMhFS5JA== X-Received: by 2002:a17:902:784c:b0:138:f4e5:9df8 with SMTP id e12-20020a170902784c00b00138f4e59df8mr12132125pln.14.1636508956033; Tue, 09 Nov 2021 17:49:16 -0800 (PST) Received: from [2620:15c:17:3:9e39:3ebd:7991:6639] ([2620:15c:17:3:9e39:3ebd:7991:6639]) by smtp.gmail.com with ESMTPSA id u9sm12051146pfi.23.2021.11.09.17.49.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 17:49:15 -0800 (PST) Date: Tue, 9 Nov 2021 17:49:14 -0800 (PST) From: David Rientjes To: Marco Elver cc: Andrew Morton , Christoph Lameter , Pekka Enberg , Joonsoo Kim , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dmitry Vyukov , Alexander Potapenko , kasan-dev@googlegroups.com, Ingo Molnar Subject: Re: [PATCH] mm/slab_common: use WARN() if cache still has objects on destroy In-Reply-To: <20211102170733.648216-1-elver@google.com> Message-ID: <146e59b4-76c-69e4-969-ce8a75ccfe5d@google.com> References: <20211102170733.648216-1-elver@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5526BD0014E4 X-Stat-Signature: qje77c5t53nfx1ux9u8kktampdun5tb7 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=JcAnLtwI; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf15.hostedemail.com: domain of rientjes@google.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=rientjes@google.com X-HE-Tag: 1636508944-963473 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: On Tue, 2 Nov 2021, Marco Elver wrote: > Calling kmem_cache_destroy() while the cache still has objects allocated > is a kernel bug, and will usually result in the entire cache being > leaked. While the message in kmem_cache_destroy() resembles a warning, > it is currently not implemented using a real WARN(). > > This is problematic for infrastructure testing the kernel, all of which > rely on the specific format of WARN()s to pick up on bugs. > > Some 13 years ago this used to be a simple WARN_ON() in slub, but > d629d8195793 ("slub: improve kmem_cache_destroy() error message") > changed it into an open-coded warning to avoid confusion with a bug in > slub itself. > > Instead, turn the open-coded warning into a real WARN() with the message > preserved, so that test systems can actually identify these issues, and > we get all the other benefits of using a normal WARN(). The warning > message is extended with "when called from " to make it even > clearer where the fault lies. > > For most configurations this is only a cosmetic change, however, note > that WARN() here will now also respect panic_on_warn. > > Signed-off-by: Marco Elver Acked-by: David Rientjes Thanks Marco!