Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2950521imm; Thu, 24 May 2018 19:44:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqfZNRnhEFjC96tb8ciZDImDGz0fJU3M7dDEw431BqYE4luFu6v7lVbKgmWpel2N0m0XcSC X-Received: by 2002:a65:4789:: with SMTP id e9-v6mr463188pgs.235.1527216263293; Thu, 24 May 2018 19:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216263; cv=none; d=google.com; s=arc-20160816; b=aM8lYtMtiEr6FxdJ8+LAEV4YeGQ3be+uwKRIS61WOZDROiVw0LM6lmkS8GkHJUAA6W ganDmM0OGPpf67zn7zxfiezM2p78VBKf2ttGKWiAR+fVR8rL+T3YM0TN58eiDcj3fhq8 MvDhVkpuXXIoBLjuA9CerrKUGB67vI1FQ67e2GJI10ksa4QZubxpRRbtAHZSUwGGQ6f4 Kj2+kwgQ7gDTbvCDM4dBiOjxxB4FzV+jgVOBo39FP6FZ1ZS2PELgtI/VqPQJHBLqPIYc 12EEpzjIamOkJ3EjDEe2IpD5GrIm9jT/qipkk/2ZDyQj05bv6t9ssyRSHps7IEMP5aJk TSDg== 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=wO8429LYUUWDBXUmarGaK1BdKRnFzqtXlzKCasL7Pdw=; b=kP8i7JQVdNJNpmezWhggFJgakXfBqYaaYod89gMfZGacAVvHMMYj/TX0FO+sTEItcY ZOk4VbrjCD0Rxrw/XXL0tCDTryevYI+FdQCWbx8qKMVHPWe9a6gOnllgGgDZ6hS3UStF wzguROzlj6v1YNukulab4E6tqgsrimC/O4ZzSnPo4kLeyzrdzEs1ErVGj3GU29cGFIwG txUeLzqvJWecvqqP8gQw9jmLHlk85w1T7J75IGxLgqgNtReTPZjPSce2dnyMJ80qO/DW n+52oDj15BWsAX34CeP5WiXkpYwwJeI8f9lqC9bCE5hPc5fYmDYapvxmHjSLWLiugTrc T8Ag== 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 7-v6si22635459plc.179.2018.05.24.19.44.08; Thu, 24 May 2018 19:44:23 -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 S969742AbeEXVih convert rfc822-to-8bit (ORCPT + 99 others); Thu, 24 May 2018 17:38:37 -0400 Received: from terminus.zytor.com ([198.137.202.136]:47165 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161426AbeEXVie (ORCPT ); Thu, 24 May 2018 17:38:34 -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 w4OLcSoK784464 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 24 May 2018 14:38:30 -0700 Date: Thu, 24 May 2018 14:38:21 -0700 User-Agent: K-9 Mail for Android In-Reply-To: References: 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 CC: Alistair Strachan , Manoj Gupta , Matthias Kaehlcke , Greg Hackmann , sedat.dilek@gmail.com, tstellar@redhat.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 24, 2018 1:52:16 PM PDT, Nick Desaulniers wrote: >On Thu, May 24, 2018 at 1:26 PM Nick Desaulniers > >wrote: >> On Thu, May 24, 2018 at 11:59 AM wrote: >> > Issue 3: Let's face it, reading and writing the flags should be >builtins, >> exactly because it has to do stack operations, which really means the >> compiler should be involved. > >> I'm happy to propose that as a feature request to llvm+gcc. > >Oh, looks like both clang and gcc have: >__builtin_ia32_readeflags_u64() > >https://godbolt.org/g/SwPjhq > >Maybe native_save_fl() and native_restore_fl() should be replaced in >the >kernel with >__builtin_ia32_readeflags_u64() and __builtin_ia32_writeeflags_u64()? It should, at least when the compiler supports them (we keep support in for old compilers back to about gcc 3.4 or 4.1 or so for x86, but they are intently special cases.) For the PV case, I think we should create it as an explicit assembly function, meaning it should be an extern inline in C code. That way we're fixing the kernel right. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.