Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp627867pxk; Thu, 17 Sep 2020 11:43:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqSgM0yXt5uur9zSzPRRbqOlj3hZARuksGSEAq+m5xCDehssPPEsSQIbGqlklNgJ1aLlP5 X-Received: by 2002:a17:906:3c47:: with SMTP id i7mr31476770ejg.554.1600368196846; Thu, 17 Sep 2020 11:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600368196; cv=none; d=google.com; s=arc-20160816; b=mC21R4YJtXWY5NEZTHgcVaCEEr+jeRfXLsB+6hsiHcy5ZkfU+Q0fJ45R1G2ibz0JEC TF4pyCKsAxU9bE0/aI5W+08rww6aR6CUDDTw99rM1uI+vHlq3Cz2S2D5lT1wh6UyDGeS OToYI9ePRFS64buABvRNBXUWVP+0OmA5fLlO5Ee5r/vPonk3TY2k+UChn6nnQmEyeQhC uWgXP4hN7Sjgxs4aYo7LJlE69GNw7lI3PFkP0925F59o37257m9tb8Mo8RgVrZV+w9Jf SxkuSgHp38nuAhAVEt7ScnGJuAJLhiCAG8g2QcG6lRcsCOAwiE3FWlzNf/OZBbIANk6w U85g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=s8/ARKLQp0M0HyDLCLKuWSzwoxVAsS/APQ6NuiD3MNU=; b=am7DK5st+P3p4Xx0KOwMRGJ+1jvQfteBfHNE+Ry+8iKGXsTCt6qQZ0Sq9uZXYUuUf8 F57rjstjjFtKtd0gK2bUOdqMZNNEn0qBqwZ+Y0A+AVK8tTwM1yhbMwEvWEHwShs5SBJ6 7b7VAWUn/KKfpGY5T6VtL9UFlLEgNQA0F1i74X7TtNxedpTN/0LJek2ht7kwaZxn0abt HHQANPDc6Ozs0BLhFAtiPFsWTP9GnUILa7LhmcGPquvOoC9BGZsgf5J87pq9hl3Xb41V /c9+ZDlrCiZTZkuxRcdFE8w1d+CEzrimpKfdoTO44ks68pCHbWKB8WFi1ZiNFs1T+Qo9 TIwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MxgcqBmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r23si527351ejs.259.2020.09.17.11.42.53; Thu, 17 Sep 2020 11:43:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MxgcqBmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726408AbgIQSku (ORCPT + 99 others); Thu, 17 Sep 2020 14:40:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48620 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726543AbgIQSje (ORCPT ); Thu, 17 Sep 2020 14:39:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600367973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=s8/ARKLQp0M0HyDLCLKuWSzwoxVAsS/APQ6NuiD3MNU=; b=MxgcqBmfoL55kXzMxVKa8ElPitFjArTK3zcge1FM2E8kClMQyAqh6FqRKBEcOf0tVQs27b zfxTskc27y+nVtrLJJ/hJqIHxiNIIs1ARkeG800EDJNqSTy7WC42VF1XRomxKTS5PaaYSx FLwH3x0huYEU3SgOjeUoJjGfO4NLQxY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-329-I6O1PZQ6O7yXfGqmLvj70w-1; Thu, 17 Sep 2020 14:39:29 -0400 X-MC-Unique: I6O1PZQ6O7yXfGqmLvj70w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1CC6D10A7AE1; Thu, 17 Sep 2020 18:39:27 +0000 (UTC) Received: from treble (ovpn-112-136.rdu2.redhat.com [10.10.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E159819D6C; Thu, 17 Sep 2020 18:39:24 +0000 (UTC) Date: Thu, 17 Sep 2020 13:39:23 -0500 From: Josh Poimboeuf To: Nick Desaulniers Cc: Marco Elver , Peter Zijlstra , Borislav Petkov , Rong Chen , kernel test robot , "Li, Philip" , x86-ml , LKML , clang-built-linux , Andrew Morton , Kees Cook , Masahiro Yamada , kasan-dev , Daniel Kiss , momchil.velikov@arm.com Subject: Re: [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e Message-ID: <20200917183923.b5b2btxt26u73fgx@treble> References: <20200915135519.GJ14436@zn.tnic> <20200915141816.GC28738@shao2-debian> <20200915160554.GN14436@zn.tnic> <20200915170248.gcv54pvyckteyhk3@treble> <20200915172152.GR14436@zn.tnic> <20200916083032.GL2674@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 16, 2020 at 11:22:02AM -0700, Nick Desaulniers wrote: > I looked into this a bit, and IIRC, the issue was that compiler > generated functions aren't very good about keeping track of whether > they should or should not emit framepointer setup/teardown > prolog/epilogs. In LLVM's IR, -fno-omit-frame-pointer gets attached > to every function as a function level attribute. > https://godbolt.org/z/fcn9c6 ("frame-pointer"="all"). > > There were some recent LLVM patches for BTI (arm64) that made some BTI > related command line flags module level attributes, which I thought > was interesting; I was wondering last night if -fno-omit-frame-pointer > and maybe even the level of stack protector should be? I guess LTO > would complicate things; not sure it would be good to merge modules > with different attributes; I'm not sure how that's handled today in > LLVM. > > Basically, when the compiler is synthesizing a new function > definition, it should check whether a frame pointer should be emitted > or not. We could do that today by maybe scanning all other function > definitions for the presence of "frame-pointer"="all" fn attr, > breaking early if we find one, and emitting the frame pointer setup in > that case. Though I guess it's "frame-pointer"="none" otherwise, so > maybe checking any other fn def would be fine; I don't see any C fn > attr's that allow you to keep frame pointers or not. What's tricky is > that the front end flag was resolved much earlier than where this code > gets generated, so it would need to look for traces that the flag ever > existed, which sounds brittle on paper to me. For code generated by the kernel at runtime, our current (x86) policy is "always use frame pointers for non-leaf functions". A lot of this compiler talk is over my head, but if *non-leaf* generated functions are rare enough then it might be worth considering to just always use frame pointers for them. -- Josh