All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-stable-rc:linux-4.14.y 8552/9999] arch/arm64/kernel/cpu_errata.c:91:23: error: '__bp_harden_hyp_vecs_start' undeclared; did you mean
@ 2021-03-01 22:57 kernel test robot
  2021-03-04 18:09 ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-03-01 22:57 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 10470 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
head:   e1f7d50ae3a3ec342e87a9b1ce6787bfb8b3c08b
commit: 3e91f3eacc91d9d6116ed56ea339f858958ba3ee [8552/9999] arm64: Always enable spectre-v2 vulnerability detection
config: arm64-randconfig-c003-20210301 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.5.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=3e91f3eacc91d9d6116ed56ea339f858958ba3ee
        git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
        git fetch --no-tags linux-stable-rc linux-4.14.y
        git checkout 3e91f3eacc91d9d6116ed56ea339f858958ba3ee
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-7.5.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from arch/arm64/include/asm/thread_info.h:30:0,
                    from include/linux/thread_info.h:38,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/arm64/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:81,
                    from include/linux/radix-tree.h:28,
                    from include/linux/idr.h:15,
                    from include/linux/kernfs.h:14,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:21,
                    from include/linux/device.h:17,
                    from include/linux/node.h:18,
                    from include/linux/cpu.h:17,
                    from arch/arm64/include/asm/cpu.h:19,
                    from arch/arm64/kernel/cpu_errata.c:22:
   arch/arm64/kernel/cpu_errata.c: In function '__copy_hyp_vect_bpi':
>> arch/arm64/kernel/cpu_errata.c:91:23: error: '__bp_harden_hyp_vecs_start' undeclared (first use in this function); did you mean 'hyp_vecs_start'?
     void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K);
                          ^
   arch/arm64/include/asm/memory.h:246:45: note: in definition of macro '__phys_to_virt'
    #define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET)
                                                ^
   include/linux/mm.h:84:21: note: in expansion of macro '__va'
    #define lm_alias(x) __va(__pa_symbol(x))
                        ^~~~
   arch/arm64/include/asm/memory.h:276:44: note: in expansion of macro 'RELOC_HIDE'
    #define __pa_symbol(x)  __phys_addr_symbol(RELOC_HIDE((unsigned long)(x), 0))
                                               ^~~~~~~~~~
   include/linux/mm.h:84:26: note: in expansion of macro '__pa_symbol'
    #define lm_alias(x) __va(__pa_symbol(x))
                             ^~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:91:14: note: in expansion of macro 'lm_alias'
     void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K);
                 ^~~~~~~~
   arch/arm64/kernel/cpu_errata.c:91:23: note: each undeclared identifier is reported only once for each function it appears in
     void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K);
                          ^
   arch/arm64/include/asm/memory.h:246:45: note: in definition of macro '__phys_to_virt'
    #define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET)
                                                ^
   include/linux/mm.h:84:21: note: in expansion of macro '__va'
    #define lm_alias(x) __va(__pa_symbol(x))
                        ^~~~
   arch/arm64/include/asm/memory.h:276:44: note: in expansion of macro 'RELOC_HIDE'
    #define __pa_symbol(x)  __phys_addr_symbol(RELOC_HIDE((unsigned long)(x), 0))
                                               ^~~~~~~~~~
   include/linux/mm.h:84:26: note: in expansion of macro '__pa_symbol'
    #define lm_alias(x) __va(__pa_symbol(x))
                             ^~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:91:14: note: in expansion of macro 'lm_alias'
     void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K);
                 ^~~~~~~~
   In file included from include/linux/init.h:5:0,
                    from include/linux/psci.h:17,
                    from arch/arm64/kernel/cpu_errata.c:20:
   arch/arm64/kernel/cpu_errata.c: In function 'install_bp_hardening_cb':
>> arch/arm64/kernel/cpu_errata.c:118:12: error: '__bp_harden_hyp_vecs_end' undeclared (first use in this function); did you mean 'hyp_vecs_end'?
      BUG_ON(((__bp_harden_hyp_vecs_end - __bp_harden_hyp_vecs_start)
               ^
   include/linux/compiler.h:77:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
   arch/arm64/kernel/cpu_errata.c:118:3: note: in expansion of macro 'BUG_ON'
      BUG_ON(((__bp_harden_hyp_vecs_end - __bp_harden_hyp_vecs_start)
      ^~~~~~
   arch/arm64/kernel/cpu_errata.c:118:39: error: '__bp_harden_hyp_vecs_start' undeclared (first use in this function); did you mean '__bp_harden_hyp_vecs_end'?
      BUG_ON(((__bp_harden_hyp_vecs_end - __bp_harden_hyp_vecs_start)
                                          ^
   include/linux/compiler.h:77:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
   arch/arm64/kernel/cpu_errata.c:118:3: note: in expansion of macro 'BUG_ON'
      BUG_ON(((__bp_harden_hyp_vecs_end - __bp_harden_hyp_vecs_start)
      ^~~~~~
   arch/arm64/kernel/cpu_errata.c: At top level:
   arch/arm64/kernel/cpu_errata.c:259:13: warning: no previous prototype for 'arm64_update_smccc_conduit' [-Wmissing-prototypes]
    void __init arm64_update_smccc_conduit(struct alt_instr *alt,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:281:13: warning: no previous prototype for 'arm64_enable_wa2_handling' [-Wmissing-prototypes]
    void __init arm64_enable_wa2_handling(struct alt_instr *alt,
                ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c: In function 'check_branch_predictor':
   arch/arm64/kernel/cpu_errata.c:492:3: error: '__hardenbp_enab' undeclared (first use in this function)
      __hardenbp_enab = false;
      ^~~~~~~~~~~~~~~


vim +91 arch/arm64/kernel/cpu_errata.c

48993dfa1af8c719 Will Deacon  2018-01-03   87  
5bee81c980297f3f Will Deacon  2018-01-03   88  static void __copy_hyp_vect_bpi(int slot, const char *hyp_vecs_start,
5bee81c980297f3f Will Deacon  2018-01-03   89  				const char *hyp_vecs_end)
5bee81c980297f3f Will Deacon  2018-01-03   90  {
5bee81c980297f3f Will Deacon  2018-01-03  @91  	void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K);
5bee81c980297f3f Will Deacon  2018-01-03   92  	int i;
5bee81c980297f3f Will Deacon  2018-01-03   93  
5bee81c980297f3f Will Deacon  2018-01-03   94  	for (i = 0; i < SZ_2K; i += 0x80)
5bee81c980297f3f Will Deacon  2018-01-03   95  		memcpy(dst + i, hyp_vecs_start, hyp_vecs_end - hyp_vecs_start);
5bee81c980297f3f Will Deacon  2018-01-03   96  
5bee81c980297f3f Will Deacon  2018-01-03   97  	flush_icache_range((uintptr_t)dst, (uintptr_t)dst + SZ_2K);
5bee81c980297f3f Will Deacon  2018-01-03   98  }
5bee81c980297f3f Will Deacon  2018-01-03   99  
806ac9a792672cca Marc Zyngier 2019-10-24  100  static void install_bp_hardening_cb(bp_hardening_cb_t fn,
5bee81c980297f3f Will Deacon  2018-01-03  101  				    const char *hyp_vecs_start,
5bee81c980297f3f Will Deacon  2018-01-03  102  				    const char *hyp_vecs_end)
5bee81c980297f3f Will Deacon  2018-01-03  103  {
5bee81c980297f3f Will Deacon  2018-01-03  104  	static int last_slot = -1;
5bee81c980297f3f Will Deacon  2018-01-03  105  	static DEFINE_SPINLOCK(bp_lock);
5bee81c980297f3f Will Deacon  2018-01-03  106  	int cpu, slot = -1;
5bee81c980297f3f Will Deacon  2018-01-03  107  
5bee81c980297f3f Will Deacon  2018-01-03  108  	spin_lock(&bp_lock);
5bee81c980297f3f Will Deacon  2018-01-03  109  	for_each_possible_cpu(cpu) {
5bee81c980297f3f Will Deacon  2018-01-03  110  		if (per_cpu(bp_hardening_data.fn, cpu) == fn) {
5bee81c980297f3f Will Deacon  2018-01-03  111  			slot = per_cpu(bp_hardening_data.hyp_vectors_slot, cpu);
5bee81c980297f3f Will Deacon  2018-01-03  112  			break;
5bee81c980297f3f Will Deacon  2018-01-03  113  		}
5bee81c980297f3f Will Deacon  2018-01-03  114  	}
5bee81c980297f3f Will Deacon  2018-01-03  115  
5bee81c980297f3f Will Deacon  2018-01-03  116  	if (slot == -1) {
5bee81c980297f3f Will Deacon  2018-01-03  117  		last_slot++;
5bee81c980297f3f Will Deacon  2018-01-03 @118  		BUG_ON(((__bp_harden_hyp_vecs_end - __bp_harden_hyp_vecs_start)
5bee81c980297f3f Will Deacon  2018-01-03  119  			/ SZ_2K) <= last_slot);
5bee81c980297f3f Will Deacon  2018-01-03  120  		slot = last_slot;
5bee81c980297f3f Will Deacon  2018-01-03  121  		__copy_hyp_vect_bpi(slot, hyp_vecs_start, hyp_vecs_end);
5bee81c980297f3f Will Deacon  2018-01-03  122  	}
5bee81c980297f3f Will Deacon  2018-01-03  123  
5bee81c980297f3f Will Deacon  2018-01-03  124  	__this_cpu_write(bp_hardening_data.hyp_vectors_slot, slot);
5bee81c980297f3f Will Deacon  2018-01-03  125  	__this_cpu_write(bp_hardening_data.fn, fn);
5bee81c980297f3f Will Deacon  2018-01-03  126  	spin_unlock(&bp_lock);
5bee81c980297f3f Will Deacon  2018-01-03  127  }
5bee81c980297f3f Will Deacon  2018-01-03  128  #else
dbca45b996550f1a Marc Zyngier 2018-02-06  129  #define __smccc_workaround_1_smc_start		NULL
dbca45b996550f1a Marc Zyngier 2018-02-06  130  #define __smccc_workaround_1_smc_end		NULL
48993dfa1af8c719 Will Deacon  2018-01-03  131  

:::::: The code@line 91 was first introduced by commit
:::::: 5bee81c980297f3f5486539881ab4241c5f0dea3 arm64: Add skeleton to harden the branch predictor against aliasing attacks

:::::: TO: Will Deacon <will.deacon@arm.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 22035 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-stable-rc:linux-4.14.y 8552/9999] arch/arm64/kernel/cpu_errata.c:91:23: error: '__bp_harden_hyp_vecs_start' undeclared; did you mean
  2021-03-01 22:57 [linux-stable-rc:linux-4.14.y 8552/9999] arch/arm64/kernel/cpu_errata.c:91:23: error: '__bp_harden_hyp_vecs_start' undeclared; did you mean kernel test robot
@ 2021-03-04 18:09 ` Catalin Marinas
  2021-03-04 18:21   ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: Catalin Marinas @ 2021-03-04 18:09 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3366 bytes --]

On Tue, Mar 02, 2021 at 06:57:05AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
> head:   e1f7d50ae3a3ec342e87a9b1ce6787bfb8b3c08b
> commit: 3e91f3eacc91d9d6116ed56ea339f858958ba3ee [8552/9999] arm64: Always enable spectre-v2 vulnerability detection
> config: arm64-randconfig-c003-20210301 (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 7.5.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=3e91f3eacc91d9d6116ed56ea339f858958ba3ee
>         git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
>         git fetch --no-tags linux-stable-rc linux-4.14.y
>         git checkout 3e91f3eacc91d9d6116ed56ea339f858958ba3ee
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-7.5.0 make.cross ARCH=arm64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from arch/arm64/include/asm/thread_info.h:30:0,
>                     from include/linux/thread_info.h:38,
>                     from include/asm-generic/preempt.h:5,
>                     from ./arch/arm64/include/generated/asm/preempt.h:1,
>                     from include/linux/preempt.h:81,
>                     from include/linux/radix-tree.h:28,
>                     from include/linux/idr.h:15,
>                     from include/linux/kernfs.h:14,
>                     from include/linux/sysfs.h:16,
>                     from include/linux/kobject.h:21,
>                     from include/linux/device.h:17,
>                     from include/linux/node.h:18,
>                     from include/linux/cpu.h:17,
>                     from arch/arm64/include/asm/cpu.h:19,
>                     from arch/arm64/kernel/cpu_errata.c:22:
>    arch/arm64/kernel/cpu_errata.c: In function '__copy_hyp_vect_bpi':
> >> arch/arm64/kernel/cpu_errata.c:91:23: error: '__bp_harden_hyp_vecs_start' undeclared (first use in this function); did you mean 'hyp_vecs_start'?
>      void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K);

It looks like commit 8c1e3d2bb44c ("arm64: Always enable spectre-v2
vulnerability detection") was backported from 5.2 to 4.14 but the
context for the __bp_harden_hyp_vecs_start declaration/definition is
missing.

In 4.17, commit 4340ba80bd3a ("arm64: KVM: Move BP hardening vectors
into .hyp.text section") moved the __bp_harden_hyp_vecs_start to a
different section and compiled bpi.S if CONFIG_KVM_INDIRECT_VECTORS.
In the same kernel, commit e8b22d0f4500 ("arm64: Move the content of
bpi.S to hyp-entry.S") added #ifdef CONFIG_KVM_INDIRECT_VECTORS around
the faulty code above. However, the 8c1e3d2bb44c backport did not take
any of these into account and left the code above bracketed only by
CONFIG_KVM.

I think it's better if we dropped this commit altogether from 4.14.y.
Jeremy, any reason why this should be in stable?

-- 
Catalin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-stable-rc:linux-4.14.y 8552/9999] arch/arm64/kernel/cpu_errata.c:91:23: error: '__bp_harden_hyp_vecs_start' undeclared; did you mean
  2021-03-04 18:09 ` Catalin Marinas
@ 2021-03-04 18:21   ` Catalin Marinas
  0 siblings, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2021-03-04 18:21 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4246 bytes --]

On Thu, Mar 04, 2021 at 06:09:57PM +0000, Catalin Marinas wrote:
> On Tue, Mar 02, 2021 at 06:57:05AM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
> > head:   e1f7d50ae3a3ec342e87a9b1ce6787bfb8b3c08b
> > commit: 3e91f3eacc91d9d6116ed56ea339f858958ba3ee [8552/9999] arm64: Always enable spectre-v2 vulnerability detection
> > config: arm64-randconfig-c003-20210301 (attached as .config)
> > compiler: aarch64-linux-gcc (GCC) 7.5.0
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=3e91f3eacc91d9d6116ed56ea339f858958ba3ee
> >         git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
> >         git fetch --no-tags linux-stable-rc linux-4.14.y
> >         git checkout 3e91f3eacc91d9d6116ed56ea339f858958ba3ee
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-7.5.0 make.cross ARCH=arm64 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All errors (new ones prefixed by >>):
> > 
> >    In file included from arch/arm64/include/asm/thread_info.h:30:0,
> >                     from include/linux/thread_info.h:38,
> >                     from include/asm-generic/preempt.h:5,
> >                     from ./arch/arm64/include/generated/asm/preempt.h:1,
> >                     from include/linux/preempt.h:81,
> >                     from include/linux/radix-tree.h:28,
> >                     from include/linux/idr.h:15,
> >                     from include/linux/kernfs.h:14,
> >                     from include/linux/sysfs.h:16,
> >                     from include/linux/kobject.h:21,
> >                     from include/linux/device.h:17,
> >                     from include/linux/node.h:18,
> >                     from include/linux/cpu.h:17,
> >                     from arch/arm64/include/asm/cpu.h:19,
> >                     from arch/arm64/kernel/cpu_errata.c:22:
> >    arch/arm64/kernel/cpu_errata.c: In function '__copy_hyp_vect_bpi':
> > >> arch/arm64/kernel/cpu_errata.c:91:23: error: '__bp_harden_hyp_vecs_start' undeclared (first use in this function); did you mean 'hyp_vecs_start'?
> >      void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K);
> 
> It looks like commit 8c1e3d2bb44c ("arm64: Always enable spectre-v2
> vulnerability detection") was backported from 5.2 to 4.14 but the
> context for the __bp_harden_hyp_vecs_start declaration/definition is
> missing.
> 
> In 4.17, commit 4340ba80bd3a ("arm64: KVM: Move BP hardening vectors
> into .hyp.text section") moved the __bp_harden_hyp_vecs_start to a
> different section and compiled bpi.S if CONFIG_KVM_INDIRECT_VECTORS.
> In the same kernel, commit e8b22d0f4500 ("arm64: Move the content of
> bpi.S to hyp-entry.S") added #ifdef CONFIG_KVM_INDIRECT_VECTORS around
> the faulty code above. However, the 8c1e3d2bb44c backport did not take
> any of these into account and left the code above bracketed only by
> CONFIG_KVM.
> 
> I think it's better if we dropped this commit altogether from 4.14.y.
> Jeremy, any reason why this should be in stable?

It looks like it can't be easily reverted, more stuff on top depends on
it. Maybe a quick fix would do (hopefully the problem is only in 4.14):

diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
index 7d15f4cb6393..e565ec5e072f 100644
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -82,7 +82,7 @@ cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *__unused)
 
 DEFINE_PER_CPU_READ_MOSTLY(struct bp_hardening_data, bp_hardening_data);
 
-#ifdef CONFIG_KVM
+#if defined(CONFIG_KVM) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)
 extern char __smccc_workaround_1_smc_start[];
 extern char __smccc_workaround_1_smc_end[];

-- 
Catalin

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-04 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-01 22:57 [linux-stable-rc:linux-4.14.y 8552/9999] arch/arm64/kernel/cpu_errata.c:91:23: error: '__bp_harden_hyp_vecs_start' undeclared; did you mean kernel test robot
2021-03-04 18:09 ` Catalin Marinas
2021-03-04 18:21   ` Catalin Marinas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.