Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3751995imm; Fri, 25 May 2018 10:58:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrWP5GQcs8kNqEUA6TPU4Q+EG11XqhH16KaxJjIZxPJLUvH+gc7CU7vERXYknGKz6uOTiEn X-Received: by 2002:a62:7f91:: with SMTP id a139-v6mr3549890pfd.25.1527271113329; Fri, 25 May 2018 10:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527271113; cv=none; d=google.com; s=arc-20160816; b=dGvX0ZZLbr0GQadw6U50FHtV9+qEU64w40qoPuL2/oBnBc9+ERWKwDhCWMZNcE+UqW VkQAAjy/fRqKZyU8BF6CmZv+uq8oUt+HVA4kUctSJtPhnyf5SZH3Bv7GrgLjrhfLYEmi atpPVZwYrYbo4oalmS32Ep8XVnHnu9smEKYJMMrCi9n/FahZTDmsjihDG/HYWVlxH9wm qPRAsQ6voPKp5FvbkMgO7GPa1OZq3PYQ8nxVm7NNH2dUmHWqZh3Bo11j6omzq7SKd0kD 28qW8XD43zQxvkX0V6EV0Qp/vU5s3ux8lsrnvhyH0I+oDkyIpAayhM3NfYBhaxH16CdR Ky7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:arc-authentication-results; bh=dcs9sGyxqTq+RBmdmOEs65ZqQUYBVx2XEnxFa3DF+Ko=; b=c50CKcbPxnnpiEXvHnIolb95sgzQeFeqBr/Q9sz94uIOUZ+LggI+TUa8Nn6adcnqHO yfSjDoWYd72xAUcwoRTGf2SbNl0i1p1f6qIuyFR4Y6d04IPV09o6BbipU+8da9RCtieE wt4jVmIo6jei6D+ynYtxLeLkZEXrXonEfyn2AWK3bPNpQHvcDBhYGWe898yWIt3GYWwI OwJDi81KY5OaY7Mxb/Xy1pX5BxPPvrDyR23z5Lx3M79Ya4CUwXRDW4RWsu8orMWtIe5H v2Ig7kx2SBrCa7dvAFxoP9xWXZtSyF30UpUU4WAo0qpc3Dui7yE6rWO35V964/AMU6zE VZxg== 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 n28-v6si24619414pfh.210.2018.05.25.10.58.18; Fri, 25 May 2018 10:58:33 -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 S967596AbeEYR6I convert rfc822-to-8bit (ORCPT + 99 others); Fri, 25 May 2018 13:58:08 -0400 Received: from terminus.zytor.com ([198.137.202.136]:45307 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967386AbeEYR6I (ORCPT ); Fri, 25 May 2018 13:58:08 -0400 Received: from wld62.hos.anvin.org (c-24-5-245-234.hsd1.ca.comcast.net [24.5.245.234] (may be forged)) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id w4PHw49g1144546 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Fri, 25 May 2018 10:58:04 -0700 Date: Fri, 25 May 2018 10:57:56 -0700 User-Agent: K-9 Mail for Android In-Reply-To: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: [clang] stack protector and f1f029c7bf To: Nick Desaulniers , tstellar@redhat.com CC: Alistair Strachan , Manoj Gupta , Matthias Kaehlcke , Greg Hackmann , sedat.dilek@gmail.com, LKML , Kees Cook From: hpa@zytor.com Message-ID: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On May 25, 2018 10:49:28 AM PDT, Nick Desaulniers wrote: >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=37512#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: ‘naked’ 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). No, we found that the paravirt code can do the wrong thing for a C implementation. Nick, could you forward the list of problems so we all have it? -- Sent from my Android device with K-9 Mail. Please excuse my brevity.