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=-9.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 F2080C433DF for ; Tue, 4 Aug 2020 12:41:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B9A6F2067D for ; Tue, 4 Aug 2020 12:41:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="FSLS02wm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9A6F2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1F4D48D0155; Tue, 4 Aug 2020 08:41:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A5418D0081; Tue, 4 Aug 2020 08:41:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BBB88D0155; Tue, 4 Aug 2020 08:41:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0105.hostedemail.com [216.40.44.105]) by kanga.kvack.org (Postfix) with ESMTP id EAA3F8D0081 for ; Tue, 4 Aug 2020 08:41:12 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 775331EE6 for ; Tue, 4 Aug 2020 12:41:12 +0000 (UTC) X-FDA: 77112846384.30.pies10_5a0ba2926fa6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 55446180B3C85 for ; Tue, 4 Aug 2020 12:41:12 +0000 (UTC) X-HE-Tag: pies10_5a0ba2926fa6 X-Filterd-Recvd-Size: 5034 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Tue, 4 Aug 2020 12:41:11 +0000 (UTC) Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93A6B208C7 for ; Tue, 4 Aug 2020 12:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596544870; bh=QU2pSvaZV1KtMwZYMcedjy8l3khzEPaqkhJCfCrFtK4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FSLS02wmdSuZbHg+F9B/P3fC/UcdBIWETnQaPVZ2O7EqKZmqvIQN1Z+d6002/oNm/ 8o8Izr9pbaq7zN1YaRHJ7YAjhxF3/7j9t50ZdTkrgCDler+bxpvTpL3YGSMmBCrsjb JuXEdV6x7P/ky2xtXCBKLsg4ARxThMRH4AYda3H8= Received: by mail-oi1-f174.google.com with SMTP id l204so7423084oib.3 for ; Tue, 04 Aug 2020 05:41:10 -0700 (PDT) X-Gm-Message-State: AOAM530KwDJbxaa4inFwR9qYz40YgauzfYukWZ71VU4p7+E5VTUgzLnM 4eoa1wF1zJ6SZ7i8yLBgKOgKGCv1eh5/TUqbDLc= X-Google-Smtp-Source: ABdhPJypAJbECXWBhTKw1HRiWTnJ6TEh661Ks0jXxYTTNBtRAxvXUpBFuVQ7Jb43aTWKTb/TSFL2d9/q/qH2UFTAC0Q= X-Received: by 2002:aca:afd0:: with SMTP id y199mr3015769oie.47.1596544869896; Tue, 04 Aug 2020 05:41:09 -0700 (PDT) MIME-Version: 1.0 References: <202008020649.TJ8Zu7ei%lkp@intel.com> <20200803180358.GA1299225@rani.riverdale.lan> In-Reply-To: From: Ard Biesheuvel Date: Tue, 4 Aug 2020 14:40:57 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [hnaz-linux-mm:master 168/421] init/main.c:1012: undefined reference to `efi_enter_virtual_mode' To: Andrey Konovalov Cc: Arvind Sankar , linux-efi , Dmitry Vyukov , Alexander Potapenko , kasan-dev , Andrey Ryabinin , kbuild-all@lists.01.org, Johannes Weiner , Andrew Morton , Linux Memory Management List , kernel test robot Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 55446180B3C85 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 4 Aug 2020 at 14:27, Andrey Konovalov wrote: > > On Mon, Aug 3, 2020 at 8:04 PM Arvind Sankar wrote: > > > > On Mon, Aug 03, 2020 at 05:37:32PM +0200, Andrey Konovalov wrote: > > > On Sun, Aug 2, 2020 at 12:25 AM kernel test robot wrote: > > > > > > > > tree: https://github.com/hnaz/linux-mm master > > > > head: 2932a9e66c580f3c8d95ec27716d437198fb4c94 > > > > commit: 7c0265f304de3c3acd02d0015b56a076357bcce3 [168/421] kasan, arm64: don't instrument functions that enable kasan > > > > config: x86_64-randconfig-r036-20200802 (attached as .config) > > > > compiler: gcc-9 (Debian 9.3.0-14) 9.3.0 > > > > reproduce (this is a W=1 build): > > > > git checkout 7c0265f304de3c3acd02d0015b56a076357bcce3 > > > > # save the attached .config to linux build tree > > > > make W=1 ARCH=x86_64 > > > > > > > > If you fix the issue, kindly add following tag as appropriate > > > > Reported-by: kernel test robot > > > > > > > > All errors (new ones prefixed by >>): > > > > > > > > ld: init/main.o: in function `start_kernel': > > > > >> init/main.c:1012: undefined reference to `efi_enter_virtual_mode' > > > > > > Hm, I can reproduce the issue, but I don't understand why it happens. > > > > > > +EFI and KASAN people, maybe someone has an idea. > > > > > > This is the guilty patch: > > > > > > https://github.com/hnaz/linux-mm/commit/7c0265f304de3c3acd02d0015b56a076357bcce3 > > > > > > The issue is only with efi_enter_virtual_mode() AFAIU, not with any of > > > the other functions. > > > > > > Thanks! > > > > > > > After adding __no_sanitize_address, gcc doesn't inline efi_enabled() on > > a KASAN build, even when CONFIG_EFI is disabled, and the function is > > just > > return false; > > and so it isn't optimizing out the call to efi_enter_virtual_mode(). > > > > Making efi_enabled() __always_inline fixes this, but not sure if that is > > the correct fix? > > Ah, makes sense. > > We could also do #if defined(CONFIG_X86) && defined(CONFIG_EFI) in > start_kernel(). > > Or provide an empty efi_enter_virtual_mode() implementation when > CONFIG_EFI isn't enabled. > > Ard, WDYT? > The latter seems more appropriate (as a static inline in efi.h), since we could then remove the ifdef altogether afaict.