On Tue, 4 Aug 2020 at 14:27, Andrey Konovalov <andreyknvl@xxxxxxxxxx> wrote: > > On Mon, Aug 3, 2020 at 8:04 PM Arvind Sankar <nivedita@xxxxxxxxxxxx> 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 <lkp@xxxxxxxxx> 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 <lkp@xxxxxxxxx> > > > > > > > > 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.