Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7309966rwi; Mon, 24 Oct 2022 12:44:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6D48fg5L92+FPcpIqmKx+MuykUf/d0/FHi4QIzLYDPYnzlFEgnL9pnZ4txHsjra4jqluXk X-Received: by 2002:a17:906:fe45:b0:791:9624:9e9f with SMTP id wz5-20020a170906fe4500b0079196249e9fmr29193019ejb.86.1666640675471; Mon, 24 Oct 2022 12:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640675; cv=none; d=google.com; s=arc-20160816; b=Wj2Fs23VF4zR2rZ/qEBJg31NIeGJS5LpJdCgWIJu2Rz7iDfzt+R0daD5+F19rF8bCN QauORpe5uV9saKEHc+g8qZTxzsFhWhWbJFrt3RfJsPkAjI1PVAC+4bGhO/Os+T+BbuA/ sRL3xm+4TDlX6OTrtCknvcG/3ujCmU+npWSKdwmWroc2NHGErbfMD1558oHMf7zRBXIi L59U5jFZhLXbsh1axAQnv/s9akrhXdwovFDEQ5QFgp7RDlrRtsisnq7svAWfYC9Z9kHT v0Zcchg4RoKrkcoUYKLF9Qzb7EPwIhs0BD2jSrwmHyLppbYONyFiRnkKKBSFlwo4u62q HtVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=hCMG9uQiyj4EuG9TuVKcggOj5dnfdkgCpqW97GzcWsk=; b=sfEJpaMeVUgsHssuSJ5LEp5crxzZZFqltQE5h4rVTntK18uBn8D7aHvHcbPjAvLPJi tC/LWAvk9WSS7+XIjNNHwYUxw0I+bX8tqeZJc24COC1rml4S2svGDvbg/T/0SVI3y3Vp bmpsB6e5uiqpupZOtvu1UL9dr8eQFt1ovlW2VK1Vv0ldZASAhvfyssHhvApLDg9Dug/P SB1h11G016diB7xs1SG301bH5WfFoj/6UFpFywITdPVPQ7wauJaTCfy0gTWylpUNTNze RPkNCPCPYhrhK4GE9cEPec+cuK+hHWrGyGEhKDM6ccsTbFwU+QIuzqN+q7+KH1PJYikI zIcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XRkRjx9V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf29-20020a1709077f1d00b0078dec48d439si613506ejc.590.2022.10.24.12.43.57; Mon, 24 Oct 2022 12:44:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XRkRjx9V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232129AbiJXTex (ORCPT + 99 others); Mon, 24 Oct 2022 15:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233433AbiJXTeO (ORCPT ); Mon, 24 Oct 2022 15:34:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B41EF786F7; Mon, 24 Oct 2022 11:04:50 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id C13CE6151C; Mon, 24 Oct 2022 18:03:37 +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 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/