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 5005DC433EF for ; Mon, 27 Sep 2021 02:47:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C96F160F92 for ; Mon, 27 Sep 2021 02:47:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C96F160F92 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 096C76B0071; Sun, 26 Sep 2021 22:47:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 046866B0072; Sun, 26 Sep 2021 22:47:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E78FB6B0073; Sun, 26 Sep 2021 22:47:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id D30976B0071 for ; Sun, 26 Sep 2021 22:47:25 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7F2402FDE9 for ; Mon, 27 Sep 2021 02:47:25 +0000 (UTC) X-FDA: 78631817250.20.E9FC3D2 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf04.hostedemail.com (Postfix) with ESMTP id 0032950000A8 for ; Mon, 27 Sep 2021 02:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=k2A/LhTENoKqHIRa0xasZJjq7PMzUxcVqZzt/hWLzM8=; b=dJxBsmBHzkymd2Ilgqzsco8vCt B/riiHML9ZO2O6Cbe5omNO+vNqrXyBd4GZUEu1/2IHfSTt1zjiD2c9iPMClQNN+A0gDb9ZrptnOuq ykjzwt1PJMQLmaHNWiLkl89I6lGCrhkeuDvIRVfzWzBWmcEHlvXKGe3P8cXEKbrUQMtK4p7eZSac6 onHyXgWXL0ptj4mzK9Ndlr+LHygMxesSXO83acSN5QFz8i+wG/0VKGGLAFYc0TsOhmQOtwxwEf9Hf H2ee+o6jSc+zvy40kikUBP0BTTc/3HlC/tbAgkYCr9sWgbFKMajIYWc22wRowf0R8UVrwxXyb21jC Y98XKi1Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUgan-009Mwc-Pd; Mon, 27 Sep 2021 02:44:47 +0000 Date: Mon, 27 Sep 2021 03:42:09 +0100 From: Matthew Wilcox To: Kefeng Wang Cc: shakeelb@google.com, vbabka@suse.cz, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH resend] slub: Add back check for free nonslab objects Message-ID: References: <20210927021538.155991-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210927021538.155991-1-wangkefeng.wang@huawei.com> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0032950000A8 X-Stat-Signature: 6c38rd99cdpmygqcsy6xzfphigfr7z3r Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=dJxBsmBH; dmarc=none; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1632710784-346045 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 Mon, Sep 27, 2021 at 10:15:38AM +0800, Kefeng Wang wrote: > Commit ("0937502af7c9 slub: Add check for kfree() of non slab objects.") > add the ability, which should be needed in any configs to catch the > invalid free, they even could be potential issue, eg, memory corruption, > use after free and double-free, so replace VM_BUG_ON_PAGE to WARN_ON, and > add dump_page() to help use to debug the issue. Is dump_page() really the best way to catch such a thing? I would have thought that printing the address of 'object' would be more helpful. > @@ -3522,7 +3522,8 @@ static inline void free_nonslab_page(struct page *page, void *object) > { > unsigned int order = compound_order(page); > > - VM_BUG_ON_PAGE(!PageCompound(page), page); > + if (WARN_ON(!PageCompound(page))) > + dump_page(page, "invalid free nonslab page");