Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp749177pxb; Wed, 25 Aug 2021 14:12:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF7j7S89v6YxgMpDtmnU9Vqr868d8dLiZ05wHBSL0EE++9Pi6seXXmC6x7kIojMjPS6LWa X-Received: by 2002:a05:6e02:1a4f:: with SMTP id u15mr216203ilv.251.1629925936108; Wed, 25 Aug 2021 14:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629925936; cv=none; d=google.com; s=arc-20160816; b=Nd/okR5BiAHZ5I6jlUHxecYqS2KYRK3Dvpr4U8s9e0dbDozgUvK5e4mP8jwW75AekD SoWI8ihIVvdTKuHEqUE9rZOA42WNjwnVT6faXVHfJSB1Ti+8s4Y8ySR6v7KCyp+xz5wk mYO0W/F6DkSqxOi/lDjHvaiL2jtRpdmphnJxSZc5zFLWOxIJ0EVmCEsveJxOfjEZFp8Y usQtqLDPglKltfVgg63ACubcYh083GpMqVvY8MqhOzckdG+o7yeiiiKsf+oQcp4Bmmu8 nYom9qjtI8fUhsqs3Fs+xVj0KcWVWjugi8CYeng1MRfVwt7d7LJTLrST1t93zRwzbyyY CHHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6hionP+S3WQHCeRsfV2U1fbeKdh6BHUGkpwhUBr6Opo=; b=xYYXiBzp4SgGgd0HGCFFXz4WVJ7ODnVSkO8fQ/JbopjgHMrkAKSW7sUTUndRYbB19t znqnkG8M1x++WOpyiK9vMr9+Y6FjCs5jvJrwXqdPeNBRseIks+aLdSCuCsLViK65jUQ2 UgIktSwwwukVOvQnv5tusiWjeFqRrXQKuE50vnszUzl5AnGHzHBwcm9X09FOvlSRuQCH /EngtegsNrsMAjRQHx1KdH8cdv8wlJSrTezJG7EbrObWbtpItrLPwl6X1QFuzcVkSD07 QNvMsI6R4D7j0FxWROgGEtJ1w+dLaQ4rjSK5YjGeRir7QVpRHPDEPRnvK31/yCkWTRQA rXCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cSO5M3pX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z14si810364ilq.148.2021.08.25.14.12.05; Wed, 25 Aug 2021 14:12:16 -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=@google.com header.s=20161025 header.b=cSO5M3pX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239947AbhHYTox (ORCPT + 99 others); Wed, 25 Aug 2021 15:44:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbhHYTow (ORCPT ); Wed, 25 Aug 2021 15:44:52 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AD33C0613C1 for ; Wed, 25 Aug 2021 12:44:06 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id q21so618173ljj.6 for ; Wed, 25 Aug 2021 12:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6hionP+S3WQHCeRsfV2U1fbeKdh6BHUGkpwhUBr6Opo=; b=cSO5M3pXxwAmQTu4luHD6GnYnkqg92T0OMr1XA6ueriTiYW41YJ1a4sLbAmVHerBfw Twvwln+3PoG5r3psuTBFR3bMMBT21KQan37TbOfPSqxaWBJwUjIK7Z6Fb/ySGvljgGZ+ /9XpvKthjhblWn4cPz+TQGVoKb2//adm+EAHu702s3rePIN1d1gJtOMnHQXVRmj/jzQG F4Tm4Jc5nKZp+chGDsdDfI5M3twgwM5WfuqdOAGx+jF1TXsZp93DfdgRlck4ywgtDCPo nUMs9u6uiZnEnhVVFlQqRNnkcq+Y+UwuKC5Dbp33Me8D35Xw5mlK9Jk9Q2qJjkBhS0db 2NSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6hionP+S3WQHCeRsfV2U1fbeKdh6BHUGkpwhUBr6Opo=; b=rSeWvLvxP1fvgAVaeIfMrD88iKxZjdKi74bdTogCSm9ClUtqWKULVicqk8+doXpbNz n60NMJyRI2w//L6yhEF27/cJy6iZUI9hn1ubVw3XY6a6IUl6GsGZA6TDhAJSYPvKPYvC jtGKk/Q2/6qL+gLLyy6myTobVzU44dthymDl8iwizXdLadWUs3Av/qbj1S4iz5qqLI+5 d4dvwaqxPsp8RUNW4z+JZg8948iQuvmr1gB7aqpFkeIk+VMc7vM/o9FA6qcWToXCV7Lv WIveovi6Oz0eO0zoEEfVkqDapYq+MPP9Fyu9VI3u+7PmUOk/wgVi/Mo8ykxEM9iUcYLj lOHg== X-Gm-Message-State: AOAM533rzY6RCCTG4Xlv8klHBGVeNzwcF+wV3w6iGZu+hBuRncrUgRtz ge7023GLo/5Id0UMpNd2pRjHs/L7prsPu6I5unowZg== X-Received: by 2002:a2e:a367:: with SMTP id i7mr268052ljn.244.1629920644666; Wed, 25 Aug 2021 12:44:04 -0700 (PDT) MIME-Version: 1.0 References: <20210822075122.864511-1-keescook@chromium.org> <20210822075122.864511-14-keescook@chromium.org> <4fff1f46-ab10-317b-8cf0-05871e4a9d71@rasmusvillemoes.dk> In-Reply-To: <4fff1f46-ab10-317b-8cf0-05871e4a9d71@rasmusvillemoes.dk> From: Nick Desaulniers Date: Wed, 25 Aug 2021 12:43:53 -0700 Message-ID: Subject: Re: [PATCH for-next 13/25] compiler_types.h: Remove __compiletime_object_size() To: Rasmus Villemoes Cc: Kees Cook , linux-kernel@vger.kernel.org, Miguel Ojeda , Daniel Micay , Francis Laniel , Bart Van Assche , David Gow , linux-mm@kvack.org, clang-built-linux@googlegroups.com, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 22, 2021 at 11:43 PM Rasmus Villemoes wrote: > > On 22/08/2021 09.51, Kees Cook wrote: > > > - int sz = __compiletime_object_size(addr); > > + int sz = __builtin_object_size(addr, 0); > > Not directly related to this patch, but seeing this I wonder if there > would be some value in introducing names for those magic 0/1/2/3 that > are used with __b_o_s. Every time I stumble on code using that I have to > go to the gcc docs, and even then it takes me a while to grok what > > TYPE is an integer constant from 0 to 3. If the least significant > bit is clear, objects are whole variables, if it is set, a closest > surrounding subobject is considered the object a pointer points to. > The second bit determines if maximum or minimum of remaining bytes > is computed. > > means. The names don't need to be too verbose, just having a few > #defines in-tree with the above quoted above them makes it a lot easier > to figure out what they mean. We share a similar experience. -- Thanks, ~Nick Desaulniers