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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 558A7C282E5 for ; Wed, 5 Mar 2025 19:39:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A83928002A; Wed, 5 Mar 2025 14:39:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 557BA280028; Wed, 5 Mar 2025 14:39:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3824528002A; Wed, 5 Mar 2025 14:39:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 17BD7280028 for ; Wed, 5 Mar 2025 14:39:24 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 520B6802BE for ; Wed, 5 Mar 2025 09:03:11 +0000 (UTC) X-FDA: 83186908182.29.9559977 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf15.hostedemail.com (Postfix) with ESMTP id 0CEE3A001B for ; Wed, 5 Mar 2025 09:03:08 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=yct6m6ix; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=cPPdwJMK; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=yct6m6ix; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=cPPdwJMK; dmarc=none; spf=pass (imf15.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741165389; a=rsa-sha256; cv=none; b=PB6yAQo4xg9Gjlo3f13DjnMNyfbk24MFAjFGgGixsH2bJ6JP3BiErFXLyegH0bEvokCC4I KhynuuQW9nxbq8LN/KntbfsZJ0TRzxnY30YsxZFrlh1pw1oFwr+Gc2h07vyZdpfeBVmoRU qI9lxG7r6+9MgA70zts+ShNbN0WVFws= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=yct6m6ix; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=cPPdwJMK; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=yct6m6ix; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=cPPdwJMK; dmarc=none; spf=pass (imf15.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741165389; h=from:from:sender: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:dkim-signature; bh=HMX361twClyWVz6yx4cYlKZtdfzF66KHvY+vbomMQ4g=; b=39CdH9UzQUvHU9S+XRxI2nobVZ0g9nGzH9VvpZrcXPptx+t5dRj3NjXRnf3Pad5cSny1va 6fQR1l8mDHO2Xkk4xoTDEqO5EpoL0XUmzXXeWY4Z5KbJngwDQY+UiX/44kA8wYrYH7YQfv G3ndL/t1xStI0J9yBe208m2ffUoYIdU= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 481BF1F76B; Wed, 5 Mar 2025 09:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1741165387; h=from:from:reply-to: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=HMX361twClyWVz6yx4cYlKZtdfzF66KHvY+vbomMQ4g=; b=yct6m6ix1R0GcYVC5VPbOp9wMhZO2nKxWkpaFmsJtuDzxp/XCrSBmAAwwKi7LXYiyFSyvu 1Ixj5Vl+2QxXOmhruJXbROSkje+EE2M0zRgY0t1Ca+aGPJJS+X6CKiy+vpW3ukky2iadaf PlQFKRjrVSM6Lig392sj2t+djQAspBA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1741165387; h=from:from:reply-to: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=HMX361twClyWVz6yx4cYlKZtdfzF66KHvY+vbomMQ4g=; b=cPPdwJMKIsvs4Vuwq5MzMZaoshKxg1Xj1/RvHUFolHcKspXrPQVHsveHeZwbvZAzGQRL1D sq2IdCFtcCt0vWBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1741165387; h=from:from:reply-to: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=HMX361twClyWVz6yx4cYlKZtdfzF66KHvY+vbomMQ4g=; b=yct6m6ix1R0GcYVC5VPbOp9wMhZO2nKxWkpaFmsJtuDzxp/XCrSBmAAwwKi7LXYiyFSyvu 1Ixj5Vl+2QxXOmhruJXbROSkje+EE2M0zRgY0t1Ca+aGPJJS+X6CKiy+vpW3ukky2iadaf PlQFKRjrVSM6Lig392sj2t+djQAspBA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1741165387; h=from:from:reply-to: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=HMX361twClyWVz6yx4cYlKZtdfzF66KHvY+vbomMQ4g=; b=cPPdwJMKIsvs4Vuwq5MzMZaoshKxg1Xj1/RvHUFolHcKspXrPQVHsveHeZwbvZAzGQRL1D sq2IdCFtcCt0vWBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2BC3813939; Wed, 5 Mar 2025 09:03:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cYdcCksTyGctZAAAD6G6ig (envelope-from ); Wed, 05 Mar 2025 09:03:07 +0000 Message-ID: <2f4fd116-1e1d-4800-9351-c625ecd0d2bd@suse.cz> Date: Wed, 5 Mar 2025 10:03:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] slab: Mark large folios for debugging purposes Content-Language: en-US To: Harry Yoo , "Matthew Wilcox (Oracle)" Cc: linux-mm@kvack.org, Roman Gushchin , Andrew Morton , Joonsoo Kim , David Rientjes , Pekka Enberg , Christoph Lameter , Hannes Reinecke References: <20250303172807.3187600-1-willy@infradead.org> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Action: no action X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0CEE3A001B X-Stat-Signature: yu6ddu6upriie9of4sdijsocp7smm4nn X-HE-Tag: 1741165388-627009 X-HE-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YkR4LOzHDgC9OqgH32Fnx7cPfdy4ahQtyVidG74gR78fduQc47wSMOBKLwgPFm2oQWOgsLz3AE9St3CpotXj7kyoOCGVyZWh2RJwpufFnVukp/li7ixEj1Wuve+KLXIeSRE5VMh9xf+JQNrK4wWpYAO4wOkNKvtP3oNZIYf9cW6T8zHaMt1lHCVvhO2IY7OpuaaAC0CCFgWwg4j/ON4ouw1jcQIRK1+ykfgUpRXlI09yt2CzhXM/od9tEXtSqmGbKklf9Q38DOBb4YmiR2pwCL/gMyXzFeKzROajEeAhjrmEFxD4jfFIlSQlhUMRFF76QMJBLorkEsIdOrLIFCzRMHtXkCS8= 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: List-Subscribe: List-Unsubscribe: On 3/4/25 07:38, Harry Yoo wrote: > On Mon, Mar 03, 2025 at 05:28:05PM +0000, Matthew Wilcox (Oracle) wrote: >> If a user calls p = kmalloc(1024); kfree(p); kfree(p); and 'p' was the >> only object in the slab, we may free the slab after the first call to >> kfree(). If we do, we clear PGTY_slab and the second call to kfree() >> will call free_large_kmalloc(). That will leave a trace in the logs >> ("object pointer: 0x%p"), but otherwise proceed to free the memory, >> which is likely to corrupt the page allocator's metadata. >> >> Allocate a new page type for large kmalloc and mark the memory with it >> while it's allocated. That lets us detect this double-free and return >> without harming any data structures. >> >> Reported-by: Hannes Reinecke >> Signed-off-by: Matthew Wilcox (Oracle) >> --- > > Looks good to me, > Reviewed-by: Harry Yoo Added to slab/for-next, thanks!