Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp403045pxb; Thu, 19 Aug 2021 02:14:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5z/6nrWclScFbqeR1FaoEe2xBD8tEuvS5wiqW+WjV9QaDBbUAEoFthnNhJGMs+k35/Hj0 X-Received: by 2002:a17:906:2a8e:: with SMTP id l14mr14530869eje.321.1629364479332; Thu, 19 Aug 2021 02:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629364479; cv=none; d=google.com; s=arc-20160816; b=UMNqQHLxIZSSVmG45PX3ZQGk9vHSnHE8BctnKanP2ABwUiuQwTVHUvQdIepjskmta2 BGXofVW8unBdyhoicpsGi8IM3jJWINvC8hPedGtvrM72MRqJwADBPD0xqqdB0sYvxiAe 0+VbkV7k6BBr+FJpllz0Ux6ODsYGCtKVMzxxvTU0BwUOwAzUPs4FiYoY5FD4khFI/Vmz ePNbgJ/ZHtT+LKJt0ARO2+FFw8luNu6Hm0AaCKMn49/y/4OudQQ85yzUxd3Bbw04rXZ6 0KnyZq6fzJcEJjZbNTyuDnJZDMSLxzj/VYLd2zLtF1Lib8vMQvnngFQrD8YYy3wob6B3 BmnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BB3eovbADGqKgiTpHYPV8MhbF7KZE2vZESe22SutjKY=; b=RY6QuFSyMJ0t7tJA++Djjd0zLz7+ZrefaHVLzOk9gVAS6aOYXNyDn3z87adGnOxmRJ R94nhmbskRL2UGZDh+GWWEL05O6LgFxo8aUDOURPkZFMUG3lo70D7YlvCuqJcQkEVmp5 cJpzp/9ZBCRmnsH0wOgv4QjRrPPVbIbaaOkSi3dNMB+tIMyMIhCUZGRgYKo0UlpOWYCi VXm5Lv1VLnCwYIuaEr27Y+CtoYsNtY7t4WHnVYin8gM+CAlmo0Pl9Kx5e030Twb0sLuF aL+Rvn1t1N0CYzi2Ha/MOOz5YqyT2o2pU25WenE9dg9KQG7ryftSz39eL3Z5fYaVVnd4 C1wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tp3WS7v9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n24si2806275ejl.173.2021.08.19.02.14.12; Thu, 19 Aug 2021 02:14:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tp3WS7v9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237076AbhHSJKz (ORCPT + 99 others); Thu, 19 Aug 2021 05:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbhHSJKy (ORCPT ); Thu, 19 Aug 2021 05:10:54 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75588C061575; Thu, 19 Aug 2021 02:10:17 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?