Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp662932pxb; Wed, 18 Aug 2021 11:00:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyH8b22oKkp8SsYaw4DY+dqq9alFYQ2fRqotq6vObKfLCblms0f10bL7FQxw3CHm/lX8EVM X-Received: by 2002:a92:c6d1:: with SMTP id v17mr7005303ilm.302.1629309648250; Wed, 18 Aug 2021 11:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629309648; cv=none; d=google.com; s=arc-20160816; b=QrHeKzh2CPNYJpds+hVy0HIzYnbj/drpCNO03F7r5f148ti80wizM4+zmMa1RYjKUK YgNpq4hDaccp79MXdZ1osxF9EBNAOjDzD6heW4tDxDjuPAKd/8zWmgcxQ7Khdss372PS hVrY7ujJnsM+HMUc8OkXIA4/+HEnOuvCC2lz6sf1xQ+sBO7Ck88U80o9nXnJ+CbysNrD GBuCMQZu4N/5gWMXzlQKl5sla0S7E2lI/yHHYdvvv0e/is/jmAIqfPdhdQJQO+2bIdy3 faV7XnxH6DA9KIhQsNvUja6m7OL4nk6iDrgqN0aUgyn30g4EdDORQKjYGxIdc5iuBg1L Livw== 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=04ISnfQR+B0rcb/OFZEw0eB8ueZIQ4PQaRknilR6Dg0=; b=FrAg4x+5ln2WloivPvczvwvR/AQW7ZGLg6A8sZTE9JSGCLBDJRuy4zyvstMLgLF7CP 1B+xvn4avG+W08QGNFvuU97oKG524cGiK1OtJxSOxWVgCskNP5gPXUnMkOWTRWjAWiAZ +TuVUL6tz4V1E/fooZuFYMBKTzjXB33+K7Z2nfVTORUVVeTw3bHO1eAnOFgFnOSs0ixE tYQyuwAU7aDmp38Fch5h/bEKTe9LJrVlZp2NWh0IJoiphDKpxnqnvQzZWb5yEsrVxo7D ozxWAhIWiYlwbnTGWehV2JcmJ8ghx7IpU5rPwEwYXmI/vpp7vpLFBpP8g7cv21jSPskB Vm1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="EE/CeXz6"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si370302iod.5.2021.08.18.11.00.36; Wed, 18 Aug 2021 11:00:48 -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=@chromium.org header.s=google header.b="EE/CeXz6"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbhHRR7T (ORCPT + 99 others); Wed, 18 Aug 2021 13:59:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232016AbhHRR7R (ORCPT ); Wed, 18 Aug 2021 13:59:17 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5A0AC0613CF for ; Wed, 18 Aug 2021 10:58:42 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id q2so2253184plr.11 for ; Wed, 18 Aug 2021 10:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=04ISnfQR+B0rcb/OFZEw0eB8ueZIQ4PQaRknilR6Dg0=; b=EE/CeXz6vjyMo7KPeu/SD6vdsPUTn6pv377B+z4KyjkKSzcySCd1XXhWCcxj+Tl1IO CA0Sz/mnQ8UO+5bK8u6Jo6/o/VKVzgMCTtk4WgGjjfWLiLoazibPnBOcWoxbe8CDSsZZ MdLvNCLJQnT1c+yXXYW211ZokJKEMcckrSHvA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=04ISnfQR+B0rcb/OFZEw0eB8ueZIQ4PQaRknilR6Dg0=; b=ufgDUudbTNwhTZ4Lpy5Qq7+LtYiWKu2+UgIOl4/zgbizCounQB+/FOzINDhhiWJ6gP cO7RalOyjxfV8+QxVICTv5a4OAcvB+sKOFPe/T4eQxykuvEocoFoWca97dcT4lyHCir9 wsm3Gtu4mCA6DWojgHw6Igz9B5hNr5RTbaIldfMaanddS7fmzY2bUubyr9Cy+Vf46C7G JaQdE1LIYO/fp/UwvRQsN1TlDTMGYZo93H+O0ViiVC9BuVSCfVHrh38/Op3HmGrkNGPf LH254n2bTQqKB4GP6STY8/XPXYD40uqZF7U9w9QI7Wq+CGZQ7bR0ydadSx/YUx7718K/ LNJQ== X-Gm-Message-State: AOAM533Ff05/ZmuYkxVbTqFo7lfWMzI+XG3edu1+RVaMzKoRV0KLFODE z5drzBjj7Cq211fQd268CC/AIw== X-Received: by 2002:a17:90a:458c:: with SMTP id v12mr10748262pjg.50.1629309522461; Wed, 18 Aug 2021 10:58:42 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id o1sm411141pfd.129.2021.08.18.10.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 10:58:41 -0700 (PDT) Date: Wed, 18 Aug 2021 10:58:40 -0700 From: Kees Cook To: Miguel Ojeda Cc: linux-kernel , Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , clang-built-linux , Andrew Morton , Daniel Micay , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Dennis Zhou , Tejun Heo , Masahiro Yamada , Michal Marek , Linux-MM , Linux Kbuild mailing list , linux-hardening@vger.kernel.org Subject: Re: [PATCH 1/5] Compiler Attributes: Add __alloc_size() for better bounds checking Message-ID: <202108181058.2BE1508@keescook> References: <20210818050841.2226600-1-keescook@chromium.org> <20210818050841.2226600-2-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 18, 2021 at 03:07:48PM +0200, Miguel Ojeda wrote: > On Wed, Aug 18, 2021 at 7:08 AM Kees Cook wrote: > > > > Clang can additionally use alloc_size to informt the results of > > Typo. > > > Additionally disables -Wno-alloc-size-larger-than since the allocators > > Disables -Walloc-size-larger-than? > > > already reject SIZE_MAX, and the compile-time warnings aren't helpful. > > Perhaps a bit more context here (and/or in the comment in the > Makefile) would be nice: i.e. why are they not helpful (even if > rejected by the allocators). Thanks for the review! I'll get this all fixed for v2. -- Kees Cook