Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3745340imm; Fri, 25 May 2018 10:50:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqRrvHEWmrxEZ/lWyBLpEYqJYSLr11OFvVWq0kWPYePGRgcaMfzvMkQpL0QpI5hTltOjfr3 X-Received: by 2002:a62:1e02:: with SMTP id e2-v6mr3563050pfe.212.1527270619350; Fri, 25 May 2018 10:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527270619; cv=none; d=google.com; s=arc-20160816; b=QAT1WunDeizm8gjwRSax1OEnQ5BAwjUs67Hn7sEFjAyZNWj+HO81veQl5ljtA+6qbZ ccRm635IgKuM0Sd/KNRxSkTKfZr0H2x9m17WmuVs971rOam7cjNaYguumsDgW3XmIk8s qz64LKKMRg6WE6K7baQ8jj+ymroaFtUILhzJGWhovMpVYLsmH5MTmaded9Gelkt91Cpy +lGC6ejV4lspHH7MNWxbx9cu6OT4sf5sfqUeCzF4PBLReaeU3pQqNibnJTJ7tHM5o/j8 gh6NVzEHAnDaZsNBKgl1plALeXjTp6ASMQL80nbOERGz7A64I+q6TAiCkN/rXhya4GUZ UPlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:arc-authentication-results; bh=Adcck3ROUIYWQYfLdZbMwlTwUEGEvga3f+Ny2Zf/cjQ=; b=EosHEs2GPYhwi/K3bQulmGMrg7Q/xy1tXUA0DzNKDrpuyzEwNN4UPD4YOrtuBvNZNe ZYHmeZCfTg5E8bpcH6jeJ1mh9ouFaliy3tsEmtiV2PrCwan3TH4DMihuTlPN//7HoQ0t tRaQOLKYZnhb1a9FArs1lHHT0/RYSJEE744936gFp5Y4EMQJEEGlf6VX9wXwYyyUbDGo sbra+09Ha4t6ujAP9r2XZMb7FesLbI6E8gfKUHEh9CAPGgBlhufiiz5tp2mdGD2Y+VQ0 KxU3MWNZ27QoDUCGGaXznI243e/5fp3UoCdp004L2ZxAfagJQuVoAgHnJo0c1XGemtJe kdWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DAxbDfeK; 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 l21-v6si2951526pgo.93.2018.05.25.10.50.04; Fri, 25 May 2018 10:50:19 -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=DAxbDfeK; 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 S967536AbeEYRtm (ORCPT + 99 others); Fri, 25 May 2018 13:49:42 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:41544 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967349AbeEYRtl (ORCPT ); Fri, 25 May 2018 13:49:41 -0400 Received: by mail-pf0-f194.google.com with SMTP id v63-v6so2917763pfk.8 for ; Fri, 25 May 2018 10:49:40 -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:content-transfer-encoding; bh=Adcck3ROUIYWQYfLdZbMwlTwUEGEvga3f+Ny2Zf/cjQ=; b=DAxbDfeKkWvcXecrDqIOFiDHBksQOqjt/C7eVQ7zM8QZnu0K4aNFWuLAJzQ1oiraHv 1oxmP6977FNbQCUKDVALR9VNJjpOes5oPpvUR5EZDYYWU3upmpI3+OxaE7HUpN77Kjgm YuvYUAkiI1BI2FPS4UE176OW5dflBbPaEKXrP8sCqbSUQWPAwZMl2pcQgNdMb7k97u7B 33azPBBIXL6sKt5ki6ElpTE1e1GFY81MvlEvIyUUFcsj33jQmX0/YAegGbXu5G6for0L 0nC9OtBebMKnFOg2x6SW4zR+ij3QEUk51C2d08joQVW+nK2/lfRA2VLCeOamCdSljPTx jEPw== 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:content-transfer-encoding; bh=Adcck3ROUIYWQYfLdZbMwlTwUEGEvga3f+Ny2Zf/cjQ=; b=CGQ2RuorGRhJ7YomN0O0eh/Y6ae7VWhDfo27cfkUthA0QdoC5GK5oA9mgPH0f3V0aU ZEkIXIyc5JYu1QMdK06RJZfCi471fwHe9IRbeeMWZHknTutmqzn+V5y6WoTa3Cjceegh JSEVVRZCIxpjHXTqCsdrTaoUVQ1PQtkUhRa38lDq4TdpRoU4/+DkTw8/jZ3CFKAkzrOd NQ4qVv55XK+hmgkKgKS4rdBla81oqNOdNynOWnCzvLdEGBY5RurCQ1l4C+87uOPaEOMA 0g3Sa/Ew23aKNckBoCPMUnRwaPGvH7l8ZHs1aj4rh/HxMUL7GL2/tJ5mMwvnJqUnaDIW UmOA== X-Gm-Message-State: ALKqPwcc41OqpkJ7lea4dWgw1vHQChLVHQxLeet6Mwo2977pb4bN0t1m NdVyIaH3Q9zLguybFR0NSU2Ga1kfMe1fQmpUeuEm7w== X-Received: by 2002:a62:a315:: with SMTP id s21-v6mr3584039pfe.168.1527270580197; Fri, 25 May 2018 10:49:40 -0700 (PDT) MIME-Version: 1.0 References: <26B017D5-4063-46CB-8768-B0E5E7CD3838@zytor.com> <319FB971-ABB6-4BE7-969B-D87D84853196@zytor.com> <31A5469A-176F-451F-886A-ECD649DDC78C@zytor.com> <12a870df-5f9d-94d1-8318-42cfff1bedab@redhat.com> In-Reply-To: <12a870df-5f9d-94d1-8318-42cfff1bedab@redhat.com> From: Nick Desaulniers Date: Fri, 25 May 2018 10:49:28 -0700 Message-ID: Subject: Re: [clang] stack protector and f1f029c7bf To: tstellar@redhat.com Cc: hpa@zytor.com, Alistair Strachan , Manoj Gupta , Matthias Kaehlcke , Greg Hackmann , sedat.dilek@gmail.com, LKML , Kees Cook Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 25, 2018 at 10:35 AM Tom Stellard wrote: > On 05/25/2018 10:31 AM, Nick Desaulniers wrote: > > On Fri, May 25, 2018 at 9:53 AM wrote: > >> On May 25, 2018 9:46:42 AM PDT, Nick Desaulniers < ndesaulniers@google.com> > > wrote: > >>> On Fri, May 25, 2018 at 9:33 AM wrote: > >>>> On May 25, 2018 9:27:40 AM PDT, Nick Desaulniers > >>> wrote: > >>> When you say > >>> > >>>> It still should be available as as inline, however, but now "extern > >>> inline". > >>> > >>> Am I understanding correctly that native_save_fl should be inlined into > >>> all > >>> call sites (modulo the problematic pv_irq_ops.save_fl case)? Because > >>> for > >>> these two assembly implementations, it's not, but maybe there's > >>> something > >>> missing in my implementation? > > > >> Yes, that's what "extern inline" means. Maybe it needs a must inline > > annotation, but that's really messed up. > > > What about doing something like suggested here: > https://bugs.llvm.org/show_bug.cgi?id=3D37512#c17 > This would keep the definition in C and make it easier for compilers > to inline. The GCC docs for __attribute__((naked)) seem to imply this is a machine specific constraint (of which x86 is not listed): https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html But let's try with source: https://godbolt.org/g/aJ4gZB Clang errors: :3:3: error: non-ASM statement in naked function is not supported unsigned long flags; ^ Is it valid to use assembly to place the results in %rax and mark the c function somehow? gcc doesn't support this attribute until 4.9 (but we can add a feature test for attributes with gcc (unlike builtins)), but warns that: warning: =E2=80=98naked=E2=80=99 attribute directive ignored [-Wattributes] gcc 8.1 and trunk inserts a `ud2` instruction (what?!) (let me see if I can repro outside of godbolt, and will file a bug report). --=20 Thanks, ~Nick Desaulniers