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 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6493C4338F for ; Thu, 19 Aug 2021 09:11:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 880D261131 for ; Thu, 19 Aug 2021 09:11:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 880D261131 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 1BA426B006C; Thu, 19 Aug 2021 05:11:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16A93900003; Thu, 19 Aug 2021 05:11:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08146900002; Thu, 19 Aug 2021 05:11:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id E41E26B006C for ; Thu, 19 Aug 2021 05:11:33 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8AF7D820B189 for ; Thu, 19 Aug 2021 09:11:33 +0000 (UTC) X-FDA: 78491262066.35.996E4F8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 3387AD01D52A for ; Thu, 19 Aug 2021 09:11:33 +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=BB3eovbADGqKgiTpHYPV8MhbF7KZE2vZESe22SutjKY=; b=tp3WS7v9Zygm06TNajk0XqWnMz P2wYtvT4QuFvfFTmN/8k8gp+4KF2M5gfWZgHY1qlmfZ5ZKFNDdPtaUQ/ZAITnfsHIiuJIhdmvmhM3 y+8puRoYQbF00lMdH4buZMdWpwjEpUwPbB6f43Fzn2l2TUYpO+FcsuI2yV2onNNphqZuEcab1NcSc 0qhveoNcWu+0IOuenNwujlGQNwntv29LRT2cp0k2p39R4arOotTp9GfUrHxpyd6s++TlM2gB7Dqa4 d4j8H4d5Or3QMdJO09MToT/Kr6Bznnd5dZHY3ICdmdvphXMv+oMZ+XdRkYnJZlW+Zl7lm9jKQQ/zk pl2PXQCA==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGe2o-004qz3-9B; Thu, 19 Aug 2021 09:09:24 +0000 Date: Thu, 19 Aug 2021 10:09:02 +0100 From: Christoph Hellwig To: Kees Cook Cc: linux-kernel@vger.kernel.org, Andrew Morton , Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , Daniel Micay , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Dennis Zhou , Tejun Heo , Masahiro Yamada , Michal Marek , clang-built-linux@googlegroups.com, linux-mm@kvack.org, linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 0/5] Add __alloc_size() for better bounds checking Message-ID: References: <20210818050841.2226600-1-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210818050841.2226600-1-keescook@chromium.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3387AD01D52A X-Stat-Signature: 1g17w3nzeniyqa1w3zbm8qygfxynszm5 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=tp3WS7v9; dmarc=none; spf=none (imf21.hostedemail.com: domain of BATV@casper.srs.infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=BATV@casper.srs.infradead.org X-HE-Tag: 1629364293-322261 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 Tue, Aug 17, 2021 at 10:08:36PM -0700, Kees Cook wrote: > Hi, > > GCC and Clang both use the "alloc_size" attribute to assist with bounds > checking around the use of allocation functions. Add the attribute, > adjust the Makefile to silence needless warnings, and add the hints to > the allocators where possible. These changes have been in use for a > while now in GrapheneOS. Can you explain how this attribute helps? Should we flow it through other allocating functions?