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 49B49C38A2D for ; Tue, 25 Oct 2022 22:55:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74E2E8E0002; Tue, 25 Oct 2022 18:55:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6FD3A8E0001; Tue, 25 Oct 2022 18:55:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C5BE8E0002; Tue, 25 Oct 2022 18:55:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4E18E8E0001 for ; Tue, 25 Oct 2022 18:55:07 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2448E1C6833 for ; Tue, 25 Oct 2022 22:55:07 +0000 (UTC) X-FDA: 80060979054.03.B8F3DF0 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf04.hostedemail.com (Postfix) with ESMTP id BE14B40021 for ; Tue, 25 Oct 2022 22:55:06 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id l6so8701975pjj.0 for ; Tue, 25 Oct 2022 15:55:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ra6g/OJlkYVneeWayx4/X1tGU61tNPtmZeLJALiKlsg=; b=OdfBlk3ohwk4OPGswlL77glZyOEhkpZ9paxEg4UCiRkb5yVtyDSa+yHjdwg4rCAr3W yz2OIF4v85vVqzXNMMmsc885oRRYXYJKN3jNWWJ2GA5k2+EM/4MOz0vSg+4c0Ite27nj 4D2Ycx9FAwYnUQbGwEWLvzR5J94/ofXVY65Ls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ra6g/OJlkYVneeWayx4/X1tGU61tNPtmZeLJALiKlsg=; b=TAJmvxxPiY4iUxoAbsKEUbYrFLFkxzADSDlZUcFAORFZLdew1TALet2K2d5xKe31Bk m+IsBvKziC2qo0knmsyPamnARbIorUki1/zad4iWN22QF2gh+A5YntWQ6s61mxGkiOPe OihOpyOBsjjzbHsZbRIZ17fIpEEGv+tazSqXz78PHZz4X8/oL7VJAWC39HMyzs8kQUy3 9zKvEmZFQ+fsIRYZHD00/sFvJLHK1psLL8GhUUe0xRJg++sHMBfUjZtIUyrhRQFDI+Nr ejtvN2t5wLfxgWdmh+UTvinZrsHwompcA+6KC080/bkpOY1OEzpdi7dRvqHYMuysUCAN dF9A== X-Gm-Message-State: ACrzQf0wtC+f0aAJUBjEXA5Geo+mJ5/fMp/HpF3oWFtiSind4Cqm/y+J hPTGAnkeC8CspIs7Stzd3vaUtg== X-Google-Smtp-Source: AMsMyM44mRwoe5IWqac/2v8N0xaf9xGSEr4+1fALOhdzTO3Jh2wF+APz+24QcWl4IO/1AQPTfrJywQ== X-Received: by 2002:a17:902:d2c1:b0:186:9e90:6ad with SMTP id n1-20020a170902d2c100b001869e9006admr15087411plc.2.1666738505517; Tue, 25 Oct 2022 15:55:05 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b65-20020a62cf44000000b00562784609fbsm1851645pfg.209.2022.10.25.15.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 15:55:04 -0700 (PDT) Date: Tue, 25 Oct 2022 15:55:03 -0700 From: Kees Cook To: "Vlastimil Babka (SUSE)" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] mempool: Use kmalloc_size_roundup() to match ksize() usage Message-ID: <202210251554.11FA130@keescook> References: <20221018090323.never.897-kees@kernel.org> <20221018155137.f6898d165aade2e3a5f0b2d3@linux-foundation.org> <202210182235.3B19DFCB28@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666738506; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ra6g/OJlkYVneeWayx4/X1tGU61tNPtmZeLJALiKlsg=; b=lzw7MzIuOat4uL6T0H1fHYiIrcH43zklGqmUkff4XEZ0R25XrvzAPaVDBv8/2RjjZmDn76 JG20KZvVEMTipaujRh+JPgDPM5eJl8H8U0v5I+L2f5zk/SPQqLbOq7tRv2tHq3eVCrVV+i UCBC5unrSYf7JsLoU2ueAaf700Ztyq4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=OdfBlk3o; spf=pass (imf04.hostedemail.com: domain of keescook@chromium.org designates 209.85.216.50 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666738506; a=rsa-sha256; cv=none; b=ikJw0E1nhk/kiqEl35njwwamYWJfr/7jdJt45/JJfVYvDtl2b9wm/z3WhljZvfPGqY4w2J KN31TWwjVkPU+V01OUi+6mfcsfRJuv8e2JUrXD2B+yMGMCQPIoJrw84Om5Hq5WPWuOoGPT OKTY9TKjHWCZiCRRn6qoIudpO9G7ukg= Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=OdfBlk3o; spf=pass (imf04.hostedemail.com: domain of keescook@chromium.org designates 209.85.216.50 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Stat-Signature: qczccsy5n7f9cg7rn9yxrrzyrcka967u X-Rspamd-Queue-Id: BE14B40021 X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1666738506-445972 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Oct 24, 2022 at 08:03:34PM +0200, Vlastimil Babka (SUSE) wrote: > 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/ Oops, yes. This failed to get on my TODO list. New version coming! -- Kees Cook