Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp705716pxh; Tue, 9 Nov 2021 17:51:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3qqf3Fw+q6av9iTEw9webEGDlpcJwvnigtgIvzIiOk8eh9vFVAsqaByJR2gp7SBf9TMKh X-Received: by 2002:a17:906:58c6:: with SMTP id e6mr15824709ejs.524.1636509093551; Tue, 09 Nov 2021 17:51:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636509093; cv=none; d=google.com; s=arc-20160816; b=FF8lP+B4JxWO25FSFMqwHEshLfVYmuQ3/GXRDkEeLVemhZjHG+k9m3FK0Ftd+Rk/8C WVYVzhPwjNehXT9aCyPzeYzC+8Dpp6w5Yva2IVu+My8VbrPqKL3T3Mtu4C2O53sAwhiC zK/wA9mnnpie8peGU0xiZ1Gt6Kue1AExALqGQ7IHqiHYDW+tdRrWCesAqWIALvVYn6F+ GPvRYDryNtgGSUln0ibQqFH7fC971EQZmxk2YtDD2cLrlEemlGY2DofTXIH6pbfwrw7k gjmRIp7xbCcQ0xUJIRx11Lb4jEoC5n08SQqJAn99bo9RwsxXRkTYYI8pfphf6QdPKQ/I hC7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=Q1Ic7kOOPETyhFj1cyuEbcKYl8I2Bp4M76inzkMgFYw=; b=l5ZYqRiIV8lxuYcwbXDyhkrbm6oq8Yz0xrEhoJwhd8fR2ML7Qnxj8eCUkNbS5UC+eZ +a4/zmg7E1RmVizgIQQm/V7YeUD2Mnro4nL2uUQV6S4RHDBqkYFXqLx/c1AzjMjuPsUI 3fsMVlHVkwKLoqe2hlTwGsA7yiAbecEay3NqrGwbaicaCixNVNCMszVNR14G1fhRVhnG /LU/O5FjUkupeiRrodfUM3S7YJUbA2jiYbINpXafR3JJgpW9FUQ6MMV3UqeSMip9CtDY mgOOhiMCXsMlIBLWJ2KPlLeZNoZ2HUCj7xmqKR5WURdPqVDYCck3q9WzvRFWYGFSsz9C bL0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=JcAnLtwI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o24si31863928ejd.504.2021.11.09.17.51.02; Tue, 09 Nov 2021 17:51:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=JcAnLtwI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229526AbhKJBwF (ORCPT + 99 others); Tue, 9 Nov 2021 20:52:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbhKJBwD (ORCPT ); Tue, 9 Nov 2021 20:52:03 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C993FC061764 for ; Tue, 9 Nov 2021 17:49:16 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id j6-20020a17090a588600b001a78a5ce46aso399886pji.0 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=DuEjizD3qzYtsZM5EKRzeywE4W4t+DYpSdlNs1qYQm8tB515njP6ASnKdqn7dpveW4 S98VX0hvsjyhH9L558cMfzKydbFHqEN1mrFQvo488eLQa3ClY5bfc7f2Q2vMEXRR/b1n noQVDyXje4cmCmVzJ1/J5gE/I9Sr0E0LmmLcCZdi2prx6eIG+Qjn6Vn7IM2VTHtV+1nx xcutjbhSZKR5WAfIER0vcfIZgSJilJBZNXikX1aEzsu+5QBksdG1PW81J9BCfWT9O9BB pOb64x4hY17uAqyEDMcxfx328AfiVwzRYC+dt533esgr+grXyRrR4KYFU8+ztzNlTIYz 5dag== X-Gm-Message-State: AOAM533ZTIBjAHi9RODiT3cqFendhAzjXxRvJ3m+gQuRsqJ/cAkuG8Zn i6znOOa1eILo4FSEZvFirhQrag== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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!