Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2145398imm; Thu, 23 Aug 2018 15:10:15 -0700 (PDT) X-Google-Smtp-Source: AA+uWPy1wKVnIfT3ADNcCoHvZXqyrHZk71/5LSDL4/KQsEC53lWij39PJSzCxEkrfMjqEFMOjQI/ X-Received: by 2002:a63:fe4d:: with SMTP id x13-v6mr57241210pgj.152.1535062215255; Thu, 23 Aug 2018 15:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535062215; cv=none; d=google.com; s=arc-20160816; b=ukdxiRiJan2/thHmjnol+oOQ+/xv2j+bHcTTKIStga9LWAMe+Nx19kw68d/NPrTB12 gm4znnz6IeD0fcKRHHu1cVPpocbHOMusIwLLfJ99b27eOzMoCUBSl0g32CqMuEoR6SiA o9hfkxkqbg/mnWnCPQH6q4y2xFns9VF2Jz1TWbQitlZm6QlXzwxzVEXEOGwc3a2wxjtq 2ds4hpgX7mvlz5TRrpcpaA6XkXFvn/cw78OTLD3yrL9EXd0JkEdeojObQCiYL1e9sDFX Cdw6b2AfWf9jFoEDy3+ePiRi+uXMLEP3SODgdvV/M4H1O0ECKwnQ0soQUDFy9IZ8NsDG SSNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=OllTFVZcYPjSOdznqqCGINsdjfJQ/y7RkEi5G+iuhqM=; b=LulEKVHZLZ8WRDrI2WLKJ8JqdHsOzr84vz8ey3Kr87xQa8VFF2wARotgmv957kOEOB jozbXKpgDiH4ir9fVI0BZ9A4guLhQOSoOFRODiwgpYmIKYMwyJsZl2e/iTXxnw96b53z sItvaKafdp+yW/fWkOAb76CPqj8nn+MEvik0vbTJXmhsDFaItXxqGWqKKQjxjhinBqz6 4TbgSp4MBiBR4sOhBp89hTuwH2qcmZ45wC66SViSmb7L7h0C786yqiqTaV2bJUHWt6i3 hYPoOcGE1/Z4sgNSyy9b9idqZ08A+koGY59Mq0vl7Dz78IhleiccfNmmCuWf3zNtH7AH mIuw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24-v6si4541917pgi.515.2018.08.23.15.09.59; Thu, 23 Aug 2018 15:10:15 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728473AbeHXBkg (ORCPT + 99 others); Thu, 23 Aug 2018 21:40:36 -0400 Received: from nautica.notk.org ([91.121.71.147]:41787 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbeHXBkg (ORCPT ); Thu, 23 Aug 2018 21:40:36 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 3FCD2C009; Fri, 24 Aug 2018 00:08:49 +0200 (CEST) Date: Fri, 24 Aug 2018 00:08:34 +0200 From: Dominique Martinet To: Nick Desaulniers Cc: Kees Cook , Linus Torvalds , joe@perches.com, Masahiro Yamada , Jonathan Corbet , Arnd Bergmann , dwmw@amazon.co.uk, LKML , Thomas Gleixner , Will Deacon , Geert Uytterhoeven , Ingo Molnar , Andrew Morton , daniel@iogearbox.net, hpa@zytor.com Subject: Re: [PATCH] include/linux/compiler*.h: make compiler-*.h mutually exclusive Message-ID: <20180823220834.GA25096@nautica> References: <20180822233724.110454-1-ndesaulniers@google.com> <20180823002508.GA822@nautica> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nick Desaulniers wrote on Thu, Aug 23, 2018: > > On a side note, I noticed tools/include/linux/compiler.h includes > > linux/compiler-gcc.h but maybe it should include linux/compiler_types.h? > > (I'm not sure at who uses that header, so it really is an open question > > here) > > Without looking into the code, this sounds like compiler.h is wrong. > Looking at the source, there's references to ancient Android NDK's > (what?! Let me show this to the NDK maintainers). This whole thing > needs to be cleaned up, too, IMO. Oh, there's two compiler-gcc.h in > the tree: > > - tools/include/linux/compiler-gcc.h (that's what's being included in > the case you point out) > - include/linux/compiler-gcc.h > > Maybe they can be combined? Ah, I didn't notice there is another compiler-gcc... Looking closer there seem to be other "reused" headers (almost all of the headers in tools/include/linux have a counterpart in include/linux), and some e.g. rbtree.h went from being a copy of the main include's to a single '#include "../../../../include/linux/rbtree.h"' line to a slightly simplified copy again to avoid bringing in rcu as dependency... I think compiler.h could be done with a similar trick with a bit of massaging, but as things stand linux/compiler.h includes uapi/linux/types.h, and this complains about using kernel headers from user space... So this isn't as trivial as just making tools use the kernel's include at least. > > If you tried to align these, __always_unused and __alias(symbol) look > > off > > I have `set tabstop=8` in vim, and it looks correct there, but both > `git diff` and github's code viewer show it as off. Maybe I have my > settings wrong in vim and need to go back to first grade, but > (personal opinion ahead) you don't have this kind of nonsense > (ambiguity around how many spaces a tab should be displayed as in > various code viewers) if you just always use spaces everywhere, for > everything. Other large codebases use automatic code formatters (like > clang-format) and that prevents holy wars and other distractions. > There's even a cool utility called `git-clang-format` that can check > just the code you changed, which is useful for not reformatting the > entire codebase messing up git blame. Right, this is my mistake - the diff view adds a space so these "inner tabs" alignments can be messed up. FWIW I think checkpatch only complains about leading space-based indentation, the inner filling can be whatever you want, but this is fine and I was overzealous. > On Wed, Aug 22, 2018 at 7:43 PM Masahiro Yamada > wrote: > > It was previous included by all compilers, > > but now it is only by _true_ GCC. > > Good catch, and thanks for the report and testing. I missed that > because I was testing x86_64 and arm64 (which I guess don't hit that > in the configs I tested) and not arm32. Should be a simple fix to > move it to shared the definition. Send me a patch, or I'll get to it. > > > Even if I move the __naked definition > > to , > > I see a different error. > > Did that regress due to my change? If so, sorry and I'll look into it > more soon. I've looked at that one quickly and that warning looks legitimate to me, I'm not sure why it would appear only now but clang does document[1] not allowing the parameters to be used even in extended asm, and gcc documentation[2] says "While using extended asm or a mixture of basic asm and C code may appear to work, they cannot be depended upon to work reliably and are not supported." [1] http://infocenter.arm.com/help/topic/com.arm.doc.dui0774g/jhg1476893564298.html [2] https://gcc.gnu.org/onlinedocs/gcc/ARM-Function-Attributes.html In this case it looks like the arguments are only used for sanity with __asmeq but in the first place the original commit for trusted foundations talks about it not respecting the API so naked makes sense but they're not making the API function naked (and the one which takes an argument does use its argument) so this all feels a bit weird to me. It might be worth asking the original authors on this one... -- Dominique Martinet