Received: by 10.213.65.68 with SMTP id h4csp1325579imn; Wed, 4 Apr 2018 17:21:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+e0SLIKQS5OqEJb6CPelKZG/A8zEx+dJyKZSg+eh6iK5ndWFzP7wBzPa/skrB/UEk5u3LV X-Received: by 10.99.95.22 with SMTP id t22mr13632361pgb.315.1522887705678; Wed, 04 Apr 2018 17:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522887705; cv=none; d=google.com; s=arc-20160816; b=X65Xh1E9AqDFqCwq1xYdNqBm0jL8I0OPce78VccBOJ5OArIMxxCNj//mzsaFrEbuIt hzMS5GNOtQRhoFekKzqHJzg5DSKsftajKv+da7Ug1qOFPYfDjzOv3lUEx0BC67ZovWc9 /5FNOuiKE4hW+p5NVakPNftOxVUZt7iYMUc0YY74jerDlfGrMBkp5blJGVaKSQjjcUnt H4PbVGn23S9frAaSAQ+LhpUjpi10A+5I90OFZl5P6+LfR+M9DjXNn62nunlq7mFTvfVn rir/wFE0Ztnc1AlpNeUkk3nYzjvL/pLmlZD6JK8H0SkaBCpwJLElxmAk987QjIuKvz4c ChnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Ta2lO9P/qzCVDqGo9u/k42El/il8nl9efVWbu6modPQ=; b=LsmH7T/wdFjyWBPij2oJ+52pTnwbCnyeH+34PmikE6gCvcyVPSNOselAcm10HZ+4W2 W2SiQiMrDMtR8A0rqIyaHvcRYfi3jJGBbKz3toxfxG3CPOI5Jmq1rD7658WrptkzMXrN we0TLjJ2aUqsovY3BwvXbbwOINZYCRtaktL0mF1QMi9ED6k9dxvqjzJcVQ90qJRCsWc3 laM6qmvlFcVaSrGeosD4WqNqdoFL3raB3krOFr/Dy1JZtI/D19n9nsbk92TmWAg2jQ8d WesOwXGoEE24GvKzDC/a9a/nEH9rQeSFALsv+G9HOrbsByp+19KTzz1kbzIrWuoy2w/9 a28w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ON7B5FAc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id az2-v6si4107465plb.263.2018.04.04.17.21.30; Wed, 04 Apr 2018 17:21:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ON7B5FAc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1752611AbeDEAUS (ORCPT + 99 others); Wed, 4 Apr 2018 20:20:18 -0400 Received: from mail-vk0-f66.google.com ([209.85.213.66]:36660 "EHLO mail-vk0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752540AbeDEAUQ (ORCPT ); Wed, 4 Apr 2018 20:20:16 -0400 Received: by mail-vk0-f66.google.com with SMTP id q198so13472485vke.3 for ; Wed, 04 Apr 2018 17:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Ta2lO9P/qzCVDqGo9u/k42El/il8nl9efVWbu6modPQ=; b=ON7B5FAcUfB+UpJ+sV9ArZyVWIJFy1NQY6RiGxXE32VY38VhiEgGUEC0GEuTQmtz2h VGIGAUZLzj70XtFmQgO3PDQrOmjCx3sLbd8YCqJjFdxkX0uNllLEQsyyvC6TT4EmNlY+ 6Y0G3qmYF0aOHTtd3AYIFpn6/HpGEuGEK1G/jhOVm+I6/6rt581xmOE6IQQR63+F8fLz S8ld8YwtZ8o/NV7Cwd+apXHnEbSzSWhH3K7zcxAi1dhCe2z9AfxeCUxTRYlkQ3yiTXYz xy9U5lzYOSD0RdJQ8rBV5gZzELC9w3If6gT9zHlJJmlO7nfF+6n3z/KGIFi6GfcjRb4p hpuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Ta2lO9P/qzCVDqGo9u/k42El/il8nl9efVWbu6modPQ=; b=WLE4WAndRUMH/3gnSzUr8D2Ms5rBn8ENnQRxGiJrzJIwm9MAvcBAx2cbLcAPnyxViD asFRWduJyIF+yyISffUEUST8RU8jQnyonKvOvz6L4j6tKV3Iiz+vdiou/hAoHzhvCUdm Fz7VtYDDrrtai3TM67+ELhVA9+M5I22/Ne9IZ8Zunj9l/UjP0hIeJkw/Osfrimc50pSc WGVQP3OK9vZ6+m9mGPKh0t4r809/q0CmRZ881EZr+Rjt1ltXRs4hdVfR/AjGsMrM1cXW 3QRL+ex9ZDejCdwnoiyOezSrH5aCBXRyk/0mvCqbYmxNSCeBUaIZzV408OHrlKBwHHvb 5n6g== X-Gm-Message-State: ALQs6tDYjvXzTWaIIwtU11navqN2FU7MR4+63yVXZ/gwQfRkWmORRv8M Fi67XPYHQUgf8uVGrmZ3muEi4pFJreaOVeiKagkFGA== X-Received: by 10.31.47.147 with SMTP id v141mr12247337vkv.121.1522887615684; Wed, 04 Apr 2018 17:20:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.164.81 with HTTP; Wed, 4 Apr 2018 17:20:14 -0700 (PDT) In-Reply-To: References: <20180403180658.GE87376@google.com> <20180404093007.GI4082@hirez.programming.kicks-ass.net> <20180404191724.GF87376@google.com> <20180404205848.GG87376@google.com> <20180404214639.GH87376@google.com> <20180404221744.GI87376@google.com> <20180404233111.GJ87376@google.com> From: Kees Cook Date: Wed, 4 Apr 2018 17:20:14 -0700 Message-ID: Subject: Re: [GIT PULL] x86/build changes for v4.17 To: Linus Torvalds Cc: Matthias Kaehlcke , Arnd Bergmann , Peter Zijlstra , Ingo Molnar , Linux Kernel Mailing List , Thomas Gleixner , Andrew Morton , James Y Knight , Chandler Carruth , Stephen Hines , Nick Desaulniers , Guenter Roeck , Greg Hackmann , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 4, 2018 at 5:05 PM, Linus Torvalds wrote: > On Wed, Apr 4, 2018 at 4:31 PM, Matthias Kaehlcke wrote: >> >> From some experiments it looks like clang, in difference to gcc, does >> not treat constant values passed as parameters to inline function as >> constants. > > Yeah, I think gcc used to have those semantics a long time ago too. > > Many of our __builtin_constant_p() uses are indeed just in macros, but > certainly not all. > > Other examples are found in our "fortified" string functions. > > There a clang build will likely simply miss some of the build-time > fortification checks, and trigger them at runtime instead. > > Of course, we hopefully don't *have* any build-time failures, because > gcc will have caught them, so you won't care as long as clang is a > secondary compiler, but long-term they'd be good. Yeah, it's used in inline functions in a lot of places. Some quickly jump out: kmalloc, crypto, bitmaps, networking, uaccess, kvm, etc from doing a dumb grep as: git grep -B5 __builtin_constant_p | grep -A5 inline FWIW, I prefer inline functions over macros just to keep type checking a some level of sanity when reading build warnings/errors. ;) -Kees -- Kees Cook Pixel Security