Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2950843imm; Thu, 24 May 2018 19:44:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpR+EvYfgga/6AzCVWVkhylxR5H7I6106TbAUPHSpoR0/X29QUa+HpY+x+O6RR0Qh1o7MUJ X-Received: by 2002:a62:3f81:: with SMTP id z1-v6mr599516pfj.216.1527216285770; Thu, 24 May 2018 19:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216285; cv=none; d=google.com; s=arc-20160816; b=dyI8PpLOPsxbtZHcDOX/DT0ymfvOyxLbryhyS8wmB88kGKvK5xDvcRO6IWTKsIw6JJ CK0PKqaD1UVcCFymgFZEWoAFk+t97N1orxD6Wm7OUCsdoNu0Div7sW1GrwaR1VYrW6MU ute+RgbkRAo4qFgfSSlHw7mG+wb+xTEriBhmD90PBpkgiYdSbMyA8HFyzjmwQo98yj+N cUxuCRKQUZR5MltUexNat9jB8WAAUVYkC8wV0eCWGUMQNno3ys3uL6LIuzGedWaWnW/7 pXxgswbEyX0V0+cdwyeIqcCgeZMC9uFqfZwlX7zFj731ysecBzrTOVLBKrSmGo8+i+CS to5w== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=RQ8ciB+G8GZc39DiKfRZJZbhjIBW2DFesuypQBYP7iQ=; b=WVk4yqeACbdBu/E5y7Ig9PQCmcJ7skVuYSKowCNmgI00w4st55cyP9chFrWSaVTDfO w+rU9ZVybcN/b5Afdnz3rWU8I3cAgLoEl/MrFZmGtaCtM20ZdMcP3GabF+7HLKHHHXt8 Jf9w0N8lyz9Vps1BOKQARBPbgMduT4eWS9r9YTkBujbt5NXWsCtVe1WbVZr1QqhNKEgf ym28ImmDXld+ZTtY8GvBh8yJkS5OKUzHh82PK4KSY3Ia+iY6fFXLKGWEdphQ3iX1PgFx mYiB7Su5J9i7FfQwb6/SHpEQ7M5G7KaddU9pdEjpRqr0TqFJc2M6vn3Zz4FCnBx9zNTh /RQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZWKe836y; 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 x1-v6si21671945pfm.32.2018.05.24.19.44.31; Thu, 24 May 2018 19:44: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=ZWKe836y; 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 S971561AbeEXVNK (ORCPT + 99 others); Thu, 24 May 2018 17:13:10 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:40098 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969310AbeEXVNH (ORCPT ); Thu, 24 May 2018 17:13:07 -0400 Received: by mail-pf0-f196.google.com with SMTP id f189-v6so1485803pfa.7 for ; Thu, 24 May 2018 14:13:07 -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; bh=RQ8ciB+G8GZc39DiKfRZJZbhjIBW2DFesuypQBYP7iQ=; b=ZWKe836y38krigfjARqM0o7FmjdNBFW94/NHzGM0TqxsJ0CkSjkS20RQWp5QSRRHSG KwtmY2+Uo609UIKur1AQD4xdO253P6lokOxczs0+xtkxfn8K9sO9G3GmH6RdShB8N1xy C/wpIk35IvAbUsEWyGFD32UhnCjwJjm2DQSfo1b+lq/MuZgxkJPDAxHH6HX4ya4kq+yt z+sRqrIYi0uwFL5pAk848QF3M9DxgqFVLAEivXNJcAfx5ukZMuoLXppY4lqhdxyWfQ44 tpVsgnI9xVWlNN2RffA8IAM32oL6fhLwBVBaj0DxwsxRzRLVPlHtRYhAWiY4wlftc3Q/ JxKg== 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; bh=RQ8ciB+G8GZc39DiKfRZJZbhjIBW2DFesuypQBYP7iQ=; b=aauhId9bBScnjgMpWD64AZzPP/lhpaejNP7XfE/d12KwtGIUPcaKd4zxUh5Mk6zg2b xVTQn8VZzEIiRqiz8RkHu+kJ9llITnP1t0G2f3gxnnrX3I6DyLZBJwGdKu4o+uvwJG2J Ije8fz/uP/wuSIS0ji0CVKUqmUjgyCrAkOugqECj+nawtbqEy6+O8U9AL8vDZEXgHpo1 Vkt2JoUPkfFjWMmdsbxo783saJGYL+K5+lG2VwGcERpAHk2u7KKJyV13Q/a0CHbgZTxJ kVsF5L5VjYrWPV3U+s15gATtQhpHN7C31qmnJJpTxDfLi/cg3/EbefTGg6nmKRO1GqSp 5PPQ== X-Gm-Message-State: ALKqPwcZrxMpdnpcxRPagX2bxiv3CmkbDE27Qa+SYK6sfkHfogLsJYmf wH7V6CH2PG9VhQA5B2JrIEp5KJxO+BeZE8h/dvfC9A== X-Received: by 2002:a62:c6d9:: with SMTP id x86-v6mr8897191pfk.192.1527196386641; Thu, 24 May 2018 14:13:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nick Desaulniers Date: Thu, 24 May 2018 14:12:54 -0700 Message-ID: Subject: Re: [clang] stack protector and f1f029c7bf To: hpa@zytor.com Cc: Alistair Strachan , Manoj Gupta , Matthias Kaehlcke , Greg Hackmann , sedat.dilek@gmail.com, tstellar@redhat.com, LKML , Kees Cook 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 Thu, May 24, 2018 at 1:52 PM 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()? > -- > Thanks, > ~Nick Desaulniers Looks like those builtins got added to GCC around the 4.9 timeframe: https://godbolt.org/g/9VS2E9 Problematically, it seems that GCC does not have __has_builtin to do feature detection: https://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros https://godbolt.org/g/oku8ux -- Thanks, ~Nick Desaulniers