[PATCH] arm64: fix build error when use rodata_enabled

kernel test robot lkp at intel.com
Wed Jan 5 02:22:29 PST 2022


Hi AliOS,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on v5.16-rc8 next-20220105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/AliOS-system-security/arm64-fix-build-error-when-use-rodata_enabled/20220105-110838
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm64-randconfig-s032-20220105 (https://download.01.org/0day-ci/archive/20220105/202201051817.4KPMZJag-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/6af4245e93d33d4f4a79a560a707539be994f73e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review AliOS-system-security/arm64-fix-build-error-when-use-rodata_enabled/20220105-110838
        git checkout 6af4245e93d33d4f4a79a560a707539be994f73e
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/mm/

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

All warnings (new ones prefixed by >>):

   arch/arm64/mm/mmu.c: In function 'map_entry_trampoline':
>> arch/arm64/mm/mmu.c:627:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     627 |         phys_addr_t pa_start = __pa_symbol(__entry_tramp_text_start);
         |         ^~~~~~~~~~~


vim +627 arch/arm64/mm/mmu.c

28b066da69b937 Ard Biesheuvel        2017-03-09  618  
51a0048beb4496 Will Deacon           2017-11-14  619  #ifdef CONFIG_UNMAP_KERNEL_AT_EL0
51a0048beb4496 Will Deacon           2017-11-14  620  static int __init map_entry_trampoline(void)
51a0048beb4496 Will Deacon           2017-11-14  621  {
6af4245e93d33d AliOS system security 2022-01-05  622  	pgprot_t prot = PAGE_KERNEL_EXEC;
6af4245e93d33d AliOS system security 2022-01-05  623  #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
6af4245e93d33d AliOS system security 2022-01-05  624  	if (rodata_enabled)
6af4245e93d33d AliOS system security 2022-01-05  625  		prot = PAGE_KERNEL_ROX;
6af4245e93d33d AliOS system security 2022-01-05  626  #endif
51a0048beb4496 Will Deacon           2017-11-14 @627  	phys_addr_t pa_start = __pa_symbol(__entry_tramp_text_start);
51a0048beb4496 Will Deacon           2017-11-14  628  
51a0048beb4496 Will Deacon           2017-11-14  629  	/* The trampoline is always mapped and can therefore be global */
51a0048beb4496 Will Deacon           2017-11-14  630  	pgprot_val(prot) &= ~PTE_NG;
51a0048beb4496 Will Deacon           2017-11-14  631  
51a0048beb4496 Will Deacon           2017-11-14  632  	/* Map only the text into the trampoline page table */
51a0048beb4496 Will Deacon           2017-11-14  633  	memset(tramp_pg_dir, 0, PGD_SIZE);
51a0048beb4496 Will Deacon           2017-11-14  634  	__create_pgd_mapping(tramp_pg_dir, pa_start, TRAMP_VALIAS, PAGE_SIZE,
475ba3fc194b64 Will Deacon           2019-04-08  635  			     prot, __pgd_pgtable_alloc, 0);
51a0048beb4496 Will Deacon           2017-11-14  636  
6c27c4082f4f70 Will Deacon           2017-12-06  637  	/* Map both the text and data into the kernel page table */
51a0048beb4496 Will Deacon           2017-11-14  638  	__set_fixmap(FIX_ENTRY_TRAMP_TEXT, pa_start, prot);
6c27c4082f4f70 Will Deacon           2017-12-06  639  	if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
6c27c4082f4f70 Will Deacon           2017-12-06  640  		extern char __entry_tramp_data_start[];
6c27c4082f4f70 Will Deacon           2017-12-06  641  
6c27c4082f4f70 Will Deacon           2017-12-06  642  		__set_fixmap(FIX_ENTRY_TRAMP_DATA,
6c27c4082f4f70 Will Deacon           2017-12-06  643  			     __pa_symbol(__entry_tramp_data_start),
6c27c4082f4f70 Will Deacon           2017-12-06  644  			     PAGE_KERNEL_RO);
6c27c4082f4f70 Will Deacon           2017-12-06  645  	}
6c27c4082f4f70 Will Deacon           2017-12-06  646  
51a0048beb4496 Will Deacon           2017-11-14  647  	return 0;
51a0048beb4496 Will Deacon           2017-11-14  648  }
51a0048beb4496 Will Deacon           2017-11-14  649  core_initcall(map_entry_trampoline);
51a0048beb4496 Will Deacon           2017-11-14  650  #endif
51a0048beb4496 Will Deacon           2017-11-14  651  

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



More information about the linux-arm-kernel mailing list