From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC10BC3A5A1 for ; Wed, 28 Aug 2019 15:22:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CED4C22CED for ; Wed, 28 Aug 2019 15:22:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726983AbfH1PWb (ORCPT ); Wed, 28 Aug 2019 11:22:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53828 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbfH1PW3 (ORCPT ); Wed, 28 Aug 2019 11:22:29 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D58423C92D; Wed, 28 Aug 2019 15:22:28 +0000 (UTC) Received: from treble (ovpn-121-55.rdu2.redhat.com [10.10.121.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 313D25DA8B; Wed, 28 Aug 2019 15:22:28 +0000 (UTC) Date: Wed, 28 Aug 2019 10:22:26 -0500 From: Josh Poimboeuf To: Arnd Bergmann Cc: Nick Desaulniers , Ilie Halip , Linux Kernel Mailing List , clang-built-linux Subject: Re: objtool warning "uses BP as a scratch register" with clang-9 Message-ID: <20190828152226.r6pl64ij5kol6d4p@treble> References: <20190827145102.p7lmkpytf3mngxbj@treble> <20190827192255.wbyn732llzckmqmq@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 28 Aug 2019 15:22:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 28, 2019 at 05:13:59PM +0200, Arnd Bergmann wrote: > On Wed, Aug 28, 2019 at 11:00 AM Arnd Bergmann wrote: > > On Tue, Aug 27, 2019 at 11:22 PM 'Nick Desaulniers' via Clang Built Linux wrote: > I figured this one out as well: > > > http://paste.ubuntu.com/p/XjdDsypRxX/ > > 0x5BA1B7A1:arch/x86/ia32/ia32_signal.o: warning: objtool: > > ia32_setup_rt_frame()+0x238: call to memset() with UACCESS enabled > > 0x5BA1B7A1:arch/x86/kernel/signal.o: warning: objtool: > > __setup_rt_frame()+0x5b8: call to memset() with UACCESS enabled > > When CONFIG_KASAN is set, clang decides to use memset() to set > the first two struct members in this function: > > static inline void sas_ss_reset(struct task_struct *p) > { > p->sas_ss_sp = 0; > p->sas_ss_size = 0; > p->sas_ss_flags = SS_DISABLE; > } > > and that is called from save_altstack_ex(). Adding a barrier() after > the sas_ss_sp() works around the issue, but is certainly not the > best solution. Any other ideas? Wow, is the compiler allowed to insert memset calls like that? Seems a bit overbearing, at least in a kernel context. I don't recall GCC ever doing it. -- Josh