Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp599444pxk; Wed, 16 Sep 2020 11:51:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCpWDt9c+SY6ug7OMiQ/tWRyQ8g8zgwwo9s+KhpxolSp99CP2lsk4g4jHC7uNblQIvq+Wm X-Received: by 2002:a17:906:5e59:: with SMTP id b25mr27755670eju.414.1600282313699; Wed, 16 Sep 2020 11:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600282313; cv=none; d=google.com; s=arc-20160816; b=gTln5iCCKTjxsiyX5q10uN042h4ZOJuFeitg8T0TzL7a1btulNqKa3QlzhDU/xI3fb xtmPfVKeTqOnE62zgoWqfOO2wVF+e2NhoOHucjCs5u6uNz7Q/SaSmWIqG7SPgn/gYRTW wDWPUBAy7i9ch63wHKzUD0iOsmTCBUxfG4Sw1oKTV4YyfzdP/jeaC61uO0vEim6H40zx tG+/fhVTelQ/4+DrhTd7tVGEDkQW+3k3RihQGjxQreFNsLfc7QgDSB2c3LBX3gJ0UNW6 7zs8U8O0Aw/uB8nYaf4fLcNJHfFGA5Ty2t0TTmX+f4RUpNteDkYGjDVqVNcej0Op4Mkq myaA== 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; bh=G4+iKrUyandKRtKRuuCLFiJQwudPWpGc6jdXc33Pspo=; b=Ky4NehgnXyXNJ4dvagO7ydWyZG5Gip7gC2J0mVUJPcb+RKb6uAeCRaCBuLC8Amqmiy BPLaJNmns5FLvL90HTN1QGrifXffxbge5VlulFoWecV82AnB7w3h2Nv2vAXalCveI2eJ zc/p5tPkCbpUFjOKTVONEXi6vv8q+byFvegcZb4ydlDmpcAA/l8+4u6BazCUKEfxg6YD DgVEjhpZE5sFzDq7FdXMJ732AY0d6N5Gwg+2kkUfLhnBZS9hHHM9G77ov52QWjLlAPqv pnaHY4vndhVGA3NIMkMfUsiOl+W87w77jNj7lkn7DyMDZ8nQ9P+8YAaiyycJ8OiM4vb2 KCIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uaTByqfC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n19si12283021edq.82.2020.09.16.11.51.30; Wed, 16 Sep 2020 11:51:53 -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=@google.com header.s=20161025 header.b=uaTByqfC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728034AbgIPSux (ORCPT + 99 others); Wed, 16 Sep 2020 14:50:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727895AbgIPSWQ (ORCPT ); Wed, 16 Sep 2020 14:22:16 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09BBFC06174A for ; Wed, 16 Sep 2020 11:22:16 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id k13so3639039plk.3 for ; Wed, 16 Sep 2020 11:22:15 -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=G4+iKrUyandKRtKRuuCLFiJQwudPWpGc6jdXc33Pspo=; b=uaTByqfCsUMo8FMT0PNRX4i1IRe4HkN132nFE+RceVu4vFVrRVf9xOkEYpQpLHzh8D QFnJqR4JiXXY4J51F2cmSCK2q9n/H4Ib8BdauCd5rdDAc+NPUbDdLtzrCZUhuy0LZNLg 7W4lfxBfDT5shWBzO4EgsV+FDNCKhJbBnM4LCU7lfHsEP2afKa5PPNOpc9lFJsNtIwYN zKt/N/DoZmMAsdEZyAgA1hL+NlXeWeJLO2D4xtRG9qufBH6z9G2t7QYNLSzeVtR7QXuS 2qh20qXdF9SwJMmtZK/CjSACyU1YjROTHzDcRZngr9TroYcTMawgIqYR0IR/ufMAGTzq ApuA== 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=G4+iKrUyandKRtKRuuCLFiJQwudPWpGc6jdXc33Pspo=; b=TldlkCAU7JbuKMv/p/q5H0ICs9cXum+9U6xZO/N+Rkb8p50O2HW+XqvBWnPAR8P2ga g1Ok/sImcuAEaThgtDISgXHTEh1JZ00eB7+hhEcjEqugOCfUPRn/VRf4/UHZSbaFrcLG 0k9YhU1ICSOBCMaOaTB8lOcDKVPSZjusLiZrPeDy0EWnG0YxijXs0xqO1Wj/YU+Bnl6s +bfh2foQfJFreF6mKZYHXhKr1f6xDQnlxNGB7qXMOT0BV+s5vdmmRk63g9Kc9JaiCnve U9QWAmMnbgyrhOE5OxL+B02Cru7wXeFnzolzxIQyD8Fj4IrgSUoEKeYKHiPjbof3UvE7 Zcsg== X-Gm-Message-State: AOAM531ZDxiGvp/oiq7NMOOHQK5j4te1LoLL7aVazbuEymC1oYzgoQYs KJrwVRsziyLEb0NJ7FdC6WKA0zLkvGwkJyPowkuoyA== X-Received: by 2002:a17:90a:e517:: with SMTP id t23mr4866165pjy.25.1600280533846; Wed, 16 Sep 2020 11:22:13 -0700 (PDT) MIME-Version: 1.0 References: <5f60c4e0.Ru0MTgSE9A7mqhpG%lkp@intel.com> <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> In-Reply-To: From: Nick Desaulniers Date: Wed, 16 Sep 2020 11:22:02 -0700 Message-ID: Subject: Re: [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e To: Marco Elver Cc: Peter Zijlstra , Josh Poimboeuf , 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 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 Wed, Sep 16, 2020 at 1:46 AM Marco Elver wrote: > > On Wed, 16 Sep 2020 at 10:30, wrote: > > On Tue, Sep 15, 2020 at 08:09:16PM +0200, Marco Elver wrote: > > > On Tue, 15 Sep 2020 at 19:40, Nick Desaulniers wrote: > > > > On Tue, Sep 15, 2020 at 10:21 AM Borislav Petkov wrote: > > > > > > > init/calibrate.o: warning: objtool: asan.module_ctor()+0xc: call without frame pointer save/setup > > > > > init/calibrate.o: warning: objtool: asan.module_dtor()+0xc: call without frame pointer save/setup > > > > > init/version.o: warning: objtool: asan.module_ctor()+0xc: call without frame pointer save/setup > > > > > init/version.o: warning: objtool: asan.module_dtor()+0xc: call without frame pointer save/setup > > > > > certs/system_keyring.o: warning: objtool: asan.module_ctor()+0xc: call without frame pointer save/setup > > > > > certs/system_keyring.o: warning: objtool: asan.module_dtor()+0xc: call without frame pointer save/setup > > > > > > This one also appears with Clang 11. This is new I think because we > > > started emitting ASAN ctors for globals redzone initialization. > > > > > > I think we really do not care about precise stack frames in these > > > compiler-generated functions. So, would it be reasonable to make > > > objtool ignore all *san.module_ctor and *san.module_dtor functions (we > > > have them for ASAN, TSAN, MSAN)? > > > > The thing is, if objtool cannot follow, it cannot generate ORC data and > > our unwinder cannot unwind through the instrumentation, and that is a > > fail. > > > > Or am I missing something here? > > They aren't about the actual instrumentation. The warnings are about > module_ctor/module_dtor functions which are compiler-generated, and > these are only called on initialization/destruction (dtors only for > modules I guess). > > E.g. for KASAN it's the calls to __asan_register_globals that are > called from asan.module_ctor. For KCSAN the tsan.module_ctor is > effectively a noop (because __tsan_init() is a noop), so it really > doesn't matter much. > > Is my assumption correct that the only effect would be if something > called by them fails, we just don't see the full stack trace? I think > we can live with that, there are only few central places that deal > with ctors/dtors (do_ctors(), ...?). > > The "real" fix would be to teach the compilers about "frame pointer > save/setup" for generated functions, but I don't think that's > realistic. So this has come up before, specifically in the context of gcov: https://github.com/ClangBuiltLinux/linux/issues/955. 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. -- Thanks, ~Nick Desaulniers