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 1F35DECAAA1 for ; Mon, 24 Oct 2022 18:03:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7315F940008; Mon, 24 Oct 2022 14:03:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E193940007; Mon, 24 Oct 2022 14:03:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5AA0B940008; Mon, 24 Oct 2022 14:03:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 49846940007 for ; Mon, 24 Oct 2022 14:03:41 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 083C4AA964 for ; Mon, 24 Oct 2022 18:03:40 +0000 (UTC) X-FDA: 80056615842.03.2BFBAE9 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf13.hostedemail.com (Postfix) with ESMTP id 2BBD120011 for ; Mon, 24 Oct 2022 18:03:39 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 78EF8B80A39; Mon, 24 Oct 2022 18:03:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 224FEC433D6; Mon, 24 Oct 2022 18:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666634617; bh=fqL8dwseMRVhi3wyP08JG12vPtKS12OItkJ7NcHZ3TM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=XRkRjx9VrhV0zPkEHQkJOJqGesOUCi89qvD4Fu61tCrkRJ5YwtO0UwD1DIbQgGi53 9PneUXID2icTaFnbjWl8m/Yl85icwz6COfCS40mAZ8NN/JvejTCgr7KeQusnn5xJw9 pIrRYzeszd3KG8n5uUsG1mVSkuuD/wPcnIIk/ZNRRo3zI0l+x0jSREYioPFv6s/BP9 aXf3Kv4mVd4uOz286X1Pa21psFvyA6y0plIC8NZfP78oOWkqTVKivfhMlP4mrLmzUO JW5XmlHEPLOhNBt+iopR3KVeiC//YQ3p/Kc7Uwq4el80UPLR7THQ11NunOdSnXwED5 0WqubDEcbBACA== Message-ID: Date: Mon, 24 Oct 2022 20:03:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH] mempool: Use kmalloc_size_roundup() to match ksize() usage Content-Language: en-US To: Kees Cook , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20221018090323.never.897-kees@kernel.org> <20221018155137.f6898d165aade2e3a5f0b2d3@linux-foundation.org> <202210182235.3B19DFCB28@keescook> From: "Vlastimil Babka (SUSE)" In-Reply-To: <202210182235.3B19DFCB28@keescook> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666634620; 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=hCMG9uQiyj4EuG9TuVKcggOj5dnfdkgCpqW97GzcWsk=; b=kF8nylzgx1eTR5X5Pi6GQshQBm1X9Peeb2V+n1mFSKXuPFkJwNI26ktH0exQvH+Hb0/I4z oRwslNi7KcAM0I3oOgUNJu5DucCAJdWDmK8IRndJ54g8vMaSXV+JxmfWG9lB/MuPNCQeIk RVCIxhpogZH4EDYHJuD3on+/LogvSQ8= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XRkRjx9V; spf=pass (imf13.hostedemail.com: domain of vbabka@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=vbabka@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666634620; a=rsa-sha256; cv=none; b=LV4jc4v7ZQe7o4mCv5wcAeUX2xvSzsATz98RJlvyR7FcUpxv8ozNkGisBvU9thkHfBy+yS OioxiVQ5DcOl1OCXgitrVJLy4EFJK2LW5JOjo9mMciHq/x/Of4KYhr+er69MBk9QlOb0qe lHiukmlP8tdo3nDAYKPCJks+jQfk3XA= X-Rspamd-Queue-Id: 2BBD120011 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XRkRjx9V; spf=pass (imf13.hostedemail.com: domain of vbabka@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=vbabka@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspam-User: X-Rspamd-Server: rspam10 X-Stat-Signature: ztspgp81p4anmaygwfr9gsdrzahbjiux X-HE-Tag: 1666634619-27674 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 10/19/22 07:37, Kees Cook wrote: > On Tue, Oct 18, 2022 at 03:51:37PM -0700, Andrew Morton wrote: >> On Tue, 18 Oct 2022 02:03:29 -0700 Kees Cook wrote: >> >> > Round up allocations with kmalloc_size_roundup() so that mempool's use >> > of ksize() is always accurate and no special handling of the memory is >> > needed by KASAN, UBSAN_BOUNDS, nor FORTIFY_SOURCE. >> >> Confused. If the special handling is not needed, why doesn't the patch >> removed the no longer needed special handling? > > The special handling is in the ksize() implementation, so it can't be > removed[1] until all the ksize()-affected users are updated to see their > true allocation sizes first. > > [1] https://lore.kernel.org/lkml/20220923202822.2667581-16-keescook@chromium.org/ But in the previous version I was wondering if we can just stop doing ksize()-like poison handling in mempool completely, if no mempool consumers call ksize() to expand their use of the allocated objects. You seemed to agree but this version is uncahnged? https://lore.kernel.org/all/f4fc52c4-7c18-1d76-0c7a-4058ea2486b9@suse.cz/