Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2945822imm; Thu, 24 May 2018 19:38:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZovzvBs19H4jeBkxGSLl8r1lor8480ZaJt5d1xSRcLJ/83d0L7wEDc8V7nyKLHhxqdtF0Iu X-Received: by 2002:a65:6497:: with SMTP id e23-v6mr440627pgv.293.1527215889223; Thu, 24 May 2018 19:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527215889; cv=none; d=google.com; s=arc-20160816; b=yH22qY0XvbQ8LBNGu4dw5LHT7O98GHiV3ZBGCXZadZ+118IWF8HCyZyNxZjZkv9BMb MbliOShWUmXyDhfEPig6Ue6FlCjxFEzSoGBg8D6pNc+B0z+HwG24YowfJ/kJz6/l/URM bdpOSpbAEbmtZjm1Sk83Os3zAUh2VY2eEPlPgTiYJyZdz1WzrSt0ZmFOw5DuP+CMq8+1 Mt5tqiW6oqYNrMF/CEy/DAOe7CZAz83FLyNT29yxpOEQaIm5yhoPe7J/P+gEWLSKhHwJ ils8YLP14JYJU9v7tL3gjrshjAo7pUCMt9z37eG7h7BQDq8t61s+ue+xwDKGhNCCzysS Jngg== 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=noXJnYWnxwYAg50tT5Z0e8z5IT/lJSDpIjFz0Jga10Q=; b=sSA8YCvgJgZohJynWic/v17me6BiS2SRYvcIdx8Q6DYHPXzLF5zE374ngJ04YcsbX1 Yqs8JPMbbIf3FpZM2n3oHPxmuKIt348CBpR22EphU0VIf9L87v5H4/S5bawOAX7xweLr hiHdlWpAQxyogOqiT4PkB2P0amxrPpOcmQD6O3DbNWUKTvBgWQrrsuC22keHAMH/ffmU e6lmeNNe42L8pZU26mAL4M1eZ968qQ4dSy0JISXQ6+4Kq6u30bXa80ql+gt4Wi4wxJI/ FSjFyvJcfFX1H1jTPFhsZlbshocjaWDR7gtd6vw4zc1mJytTsXE+9kaW/O07SzPzkhGP W3aw== 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 n9-v6si17575244pgq.470.2018.05.24.19.37.54; Thu, 24 May 2018 19:38:09 -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 S1032509AbeEXSUK convert rfc822-to-8bit (ORCPT + 99 others); Thu, 24 May 2018 14:20:10 -0400 Received: from terminus.zytor.com ([198.137.202.136]:60321 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030261AbeEXSUI (ORCPT ); Thu, 24 May 2018 14:20: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 w4OIK2Dr730623 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 24 May 2018 11:20:03 -0700 Date: Thu, 24 May 2018 11:19:55 -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 From: hpa@zytor.com Message-ID: <57C635C3-716C-4FC3-90C7-E394AA7242BA@zytor.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On May 23, 2018 3:08:19 PM PDT, Nick Desaulniers wrote: >H. Peter, > >It was reported [0] that compiling the Linux kernel with Clang + >CC_STACKPROTECTOR_STRONG was causing a crash in native_save_fl(), due >to >how GCC does not emit a stack guard for static inline functions (see >Alistair's excellent report in [1]) but Clang does. > >When working with the LLVM release maintainers, Tom had suggested [2] >changing the inline assembly constraint in native_save_fl() from '=rm' >to >'=r', and Alistair had verified the disassembly: > >(good) code generated w/o -fstack-protector-strong: > >native_save_fl: > pushfq > popq -8(%rsp) > movq -8(%rsp), %rax > retq > >(good) code generated w/ =r input constraint: > >native_save_fl: > pushfq > popq %rax > retq > >(bad) code generated with -fstack-protector-strong: > >native_save_fl: > subq $24, %rsp > movq %fs:40, %rax > movq %rax, 16(%rsp) > pushfq > popq 8(%rsp) > movq 8(%rsp), %rax > movq %fs:40, %rcx > cmpq 16(%rsp), %rcx > jne .LBB0_2 > addq $24, %rsp > retq >.LBB0_2: > callq __stack_chk_fail > >It looks like the sugguestion is actually a revert of your commit: >ab94fcf528d127fcb490175512a8910f37e5b346: >x86: allow "=rm" in native_save_fl() > >It seemed like there was a question internally about why worry about >pop >adjusting the stack if the stack could be avoided altogether. > >I think Sedat can retest this, but I was curious as well about the >commit >message in ab94fcf528d: "[ Impact: performance ]", but Alistair's >analysis >of the disassembly seems to indicate there is no performance impact (in >fact, looks better as there's one less mov). > >Is there a reason we should not revert ab94fcf528d12, or maybe a better >approach? > >[0] https://lkml.org/lkml/2018/5/7/534 >[1] https://bugs.llvm.org/show_bug.cgi?id=37512#c15 >[2] https://bugs.llvm.org/show_bug.cgi?id=37512#c22 A stack canary on an *inlined* function? That's bound to break things elsewhere too sooner or later. It feels like *once again* clang is asking for the Linux kernel to change to paper over technical or compatibility problems in clang/LLVM. This is not exactly helping the feeling that we should just rip out any and all clang hacks and call it a loss. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.