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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 07E0DC432BE for ; Wed, 25 Aug 2021 19:44:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A94D8610A7 for ; Wed, 25 Aug 2021 19:44:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A94D8610A7 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3B45E6B006C; Wed, 25 Aug 2021 15:44:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 364226B0072; Wed, 25 Aug 2021 15:44:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2531B8D0001; Wed, 25 Aug 2021 15:44:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0241.hostedemail.com [216.40.44.241]) by kanga.kvack.org (Postfix) with ESMTP id 0870E6B006C for ; Wed, 25 Aug 2021 15:44:07 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A0B47824999B for ; Wed, 25 Aug 2021 19:44:06 +0000 (UTC) X-FDA: 78514628892.20.0C09CF4 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 5A6E86001981 for ; Wed, 25 Aug 2021 19:44:06 +0000 (UTC) Received: by mail-lj1-f172.google.com with SMTP id m4so602334ljq.8 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=n/5yeQM8gUhwwyLVHoWnttc87MmFJ3kEHjOPMbZIGsz5Fuezg6MAHxEOMXajRn22lb WZR3QoSMvAlI8W/fpPcZ2PlSF4PLABGAxX9A5QyDJ9jnNgfiwQD4PFOFulfxvhxTAlkY Y33Xs2Qd87b1KQ+ek65DEEBH37asDzgGGSRlUxeDGHxajYbZ4Rh8bFblyjL2rvVgGmP0 f09kTA3WriX6kdxbgu9sKbG4zDqiMdP8pdmRNt9EMw5kPt5G16YQMrzVEjuJPrflb1SE Xu/Tti88U54FSE7ZwGdQH8j9LTvcex/nQryBqNlSu7/NYfMjURAI2j7DjGr38Z2thYHy 7W5g== X-Gm-Message-State: AOAM5338wjnB2RnSs3rxht5IyEFbm4MCLxp5ZbL1Hp1t8jG/WVs61W7r 2Lvbmr3eRMJkFBJaFNv3v202SPeU+fIcF4L1XGRuRsIY1LT3Dw== X-Google-Smtp-Source: ABdhPJyZ7uDwfp8fuaRxMK0BR+wxPpEoAE9f9CfLQXt1nMlh04/ioOFiOdQlutGtK4GqkF0S0R4UriHTlLmeZsPRp1A= 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" Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=cSO5M3pX; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf14.hostedemail.com: domain of ndesaulniers@google.com designates 209.85.208.172 as permitted sender) smtp.mailfrom=ndesaulniers@google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5A6E86001981 X-Stat-Signature: yh1it6bf4m18e98mg3toqhuctuwix71p X-HE-Tag: 1629920646-770434 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000307, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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