Skip to contentSkip to conversation

linux-next: build failure after merge of the maple tree

DISCUSSION [email protected] 3 participants 4 messages Feb 23, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Hi all,

After merging the maple tree, today's linux-next build (KCONFIG_NAME) failed like this:

/tmp/next/build/arch/arm64/kernel/elfcore.c: In function 'elf_core_extra_phdrs':
/tmp/next/build/arch/arm64/kernel/elfcore.c:13:21: error: 'struct mm_struct' has no member named 'mmap'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:69:2: note: in expansion of macro 'for_each_mte_vma'

   69 |  for_each_mte_vma(current, vma)
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c:13:43: error: 'struct vm_area_struct' has no member named 'vm_next'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:69:2: note: in expansion of macro 'for_each_mte_vma'

   69 |  for_each_mte_vma(current, vma)
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_phdrs':
/tmp/next/build/arch/arm64/kernel/elfcore.c:13:21: error: 'struct mm_struct' has no member named 'mmap'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:79:2: note: in expansion of macro 'for_each_mte_vma'

   79 |  for_each_mte_vma(current, vma) {
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c:13:43: error: 'struct vm_area_struct' has no member named 'vm_next'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:79:2: note: in expansion of macro 'for_each_mte_vma'

   79 |  for_each_mte_vma(current, vma) {
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c: In function 'elf_core_extra_data_size':
/tmp/next/build/arch/arm64/kernel/elfcore.c:13:21: error: 'struct mm_struct' has no member named 'mmap'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:104:2: note: in expansion of macro 'for_each_mte_vma'

  104 |  for_each_mte_vma(current, vma)
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c:13:43: error: 'struct vm_area_struct' has no member named 'vm_next'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:104:2: note: in expansion of macro 'for_each_mte_vma'

  104 |  for_each_mte_vma(current, vma)
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_data':
/tmp/next/build/arch/arm64/kernel/elfcore.c:13:21: error: 'struct mm_struct' has no member named 'mmap'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:114:2: note: in expansion of macro 'for_each_mte_vma'

  114 |  for_each_mte_vma(current, vma) {
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c:13:43: error: 'struct vm_area_struct' has no member named 'vm_next'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:114:2: note: in expansion of macro 'for_each_mte_vma'

  114 |  for_each_mte_vma(current, vma) {
      |  ^~~~~~~~~~~~~~~~

I did not identify the commit which triggered this. I have used the maple tree from 20220217 instead.

#1 lore raw
Quoted 55 lines · * [email protected] <[email protected]> [220222 19:45]:

Hi all,

After merging the maple tree, today's linux-next build (KCONFIG_NAME) failed like this:

/tmp/next/build/arch/arm64/kernel/elfcore.c: In function 'elf_core_extra_phdrs':
/tmp/next/build/arch/arm64/kernel/elfcore.c:13:21: error: 'struct mm_struct' has no member named 'mmap'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:69:2: note: in expansion of macro 'for_each_mte_vma'

   69 |  for_each_mte_vma(current, vma)
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c:13:43: error: 'struct vm_area_struct' has no member named 'vm_next'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:69:2: note: in expansion of macro 'for_each_mte_vma'

   69 |  for_each_mte_vma(current, vma)
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_phdrs':
/tmp/next/build/arch/arm64/kernel/elfcore.c:13:21: error: 'struct mm_struct' has no member named 'mmap'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:79:2: note: in expansion of macro 'for_each_mte_vma'

   79 |  for_each_mte_vma(current, vma) {
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c:13:43: error: 'struct vm_area_struct' has no member named 'vm_next'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:79:2: note: in expansion of macro 'for_each_mte_vma'

   79 |  for_each_mte_vma(current, vma) {
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c: In function 'elf_core_extra_data_size':
/tmp/next/build/arch/arm64/kernel/elfcore.c:13:21: error: 'struct mm_struct' has no member named 'mmap'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:104:2: note: in expansion of macro 'for_each_mte_vma'

  104 |  for_each_mte_vma(current, vma)
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c:13:43: error: 'struct vm_area_struct' has no member named 'vm_next'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:104:2: note: in expansion of macro 'for_each_mte_vma'

  104 |  for_each_mte_vma(current, vma)
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_data':
/tmp/next/build/arch/arm64/kernel/elfcore.c:13:21: error: 'struct mm_struct' has no member named 'mmap'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:114:2: note: in expansion of macro 'for_each_mte_vma'

  114 |  for_each_mte_vma(current, vma) {
      |  ^~~~~~~~~~~~~~~~

/tmp/next/build/arch/arm64/kernel/elfcore.c:13:43: error: 'struct vm_area_struct' has no member named 'vm_next'
13 | for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
| ^~
/tmp/next/build/arch/arm64/kernel/elfcore.c:114:2: note: in expansion of macro 'for_each_mte_vma'

Quoted 5 lines
  114 |  for_each_mte_vma(current, vma) {
      |  ^~~~~~~~~~~~~~~~

I did not identify the commit which triggered this. I have used the maple tree from 20220217 instead.

Hello,

I had generated a fix for this on the 17th and sent it to linux-next [1]. Alternatively, the patch is inline below.

1: https://lore.kernel.org/all/[email protected]/

Thanks,
Liam

----------------------------------------------------------------------
From: "Liam R. Howlett" <[email protected]>
Date: Thu, 17 Feb 2022 21:16:53 -0500
Subject: [PATCH] arm64: Change elfcore for_each_mte_vma() to use VMA iterator

Instead of using the linked list, use the vma iterator.

---
 arch/arm64/kernel/elfcore.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
arch/arm64/kernel/elfcore.c +10 -6
index 3455ee4acc04..930a0bc4cac4 100644
@@ -8,9 +8,9 @@
 #include <asm/cpufeature.h>
 #include <asm/mte.h>
 
-#define for_each_mte_vma(tsk, vma)					\
+#define for_each_mte_vma(vmi, vma)					\
 	if (system_supports_mte())					\
-		for (vma = tsk->mm->mmap; vma; vma = vma->vm_next)	\
+		for_each_vma(vmi, vma)					\
 			if (vma->vm_flags & VM_MTE)
 
 static unsigned long mte_vma_tag_dump_size(struct vm_area_struct *vma)
@@ -65,8 +65,9 @@ Elf_Half elf_core_extra_phdrs(void)
 {
 	struct vm_area_struct *vma;
 	int vma_count = 0;
+	VMA_ITERATOR(vmi, current->mm, 0);
 
-	for_each_mte_vma(current, vma)
+	for_each_mte_vma(vmi, vma)
 		vma_count++;
 
 	return vma_count;
@@ -75,8 +76,9 @@ Elf_Half elf_core_extra_phdrs(void)
 int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
 {
 	struct vm_area_struct *vma;
+	VMA_ITERATOR(vmi, current->mm, 0);
 
-	for_each_mte_vma(current, vma) {
+	for_each_mte_vma(vmi, vma) {
 		struct elf_phdr phdr;
 
 		phdr.p_type = PT_ARM_MEMTAG_MTE;
@@ -100,8 +102,9 @@ size_t elf_core_extra_data_size(void)
 {
 	struct vm_area_struct *vma;
 	size_t data_size = 0;
+	VMA_ITERATOR(vmi, current->mm, 0);
 
-	for_each_mte_vma(current, vma)
+	for_each_mte_vma(vmi, vma)
 		data_size += mte_vma_tag_dump_size(vma);
 
 	return data_size;
@@ -110,8 +113,9 @@ size_t elf_core_extra_data_size(void)
 int elf_core_write_extra_data(struct coredump_params *cprm)
 {
 	struct vm_area_struct *vma;
+	VMA_ITERATOR(vmi, current->mm, 0);
 
-	for_each_mte_vma(current, vma) {
+	for_each_mte_vma(vmi, vma) {
 		if (vma->vm_flags & VM_DONTDUMP)
 			continue;
 
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH] arm64: Change elfcore for_each_mte_vma() to use VMA iterator

Thank you for the patch! Yet something to improve:

Hi Liam,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on next-20220222]
[cannot apply to linux/master linus/master v5.17-rc5]
[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/Liam-Howlett/arm64-Change-elfcore-for_each_mte_vma-to-use-VMA-iterator/20220223-104149
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm64-randconfig-r033-20220221 (https://download.01.org/0day-ci/archive/20220223/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 11.2.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://github.com/0day-ci/linux/commit/e416e64fe4e04c43daa48131e564c9f2f64ec333
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Liam-Howlett/arm64-Change-elfcore-for_each_mte_vma-to-use-VMA-iterator/20220223-104149 git checkout e416e64fe4e04c43daa48131e564c9f2f64ec333
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

arch/arm64/kernel/elfcore.c: In function 'elf_core_extra_phdrs':
arch/arm64/kernel/elfcore.c:68:9: error: implicit declaration of function 'VMA_ITERATOR' [-Werror=implicit-function-declaration]

      68 |         VMA_ITERATOR(vmi, current->mm, 0);
         |         ^~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c:68:22: error: 'vmi' undeclared (first use in this function); did you mean 'vma'?
      68 |         VMA_ITERATOR(vmi, current->mm, 0);
         |                      ^~~
         |                      vma
   arch/arm64/kernel/elfcore.c:68:22: note: each undeclared identifier is reported only once for each function it appears in
   arch/arm64/kernel/elfcore.c:13:17: error: implicit declaration of function 'for_each_vma'; did you mean 'for_each_cpu'? [-Werror=implicit-function-declaration]
      13 |                 for_each_vma(vmi, vma)                                  \
         |                 ^~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c:70:9: note: in expansion of macro 'for_each_mte_vma'
      70 |         for_each_mte_vma(vmi, vma)
         |         ^~~~~~~~~~~~~~~~
>> arch/arm64/kernel/elfcore.c:14:25: error: expected ';' before 'if'
      14 |                         if (vma->vm_flags & VM_MTE)
         |                         ^~
   arch/arm64/kernel/elfcore.c:70:9: note: in expansion of macro 'for_each_mte_vma'
      70 |         for_each_mte_vma(vmi, vma)
         |         ^~~~~~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_phdrs':
   arch/arm64/kernel/elfcore.c:79:22: error: 'vmi' undeclared (first use in this function); did you mean 'vma'?
      79 |         VMA_ITERATOR(vmi, current->mm, 0);
         |                      ^~~
         |                      vma
>> arch/arm64/kernel/elfcore.c:14:25: error: expected ';' before 'if'
      14 |                         if (vma->vm_flags & VM_MTE)
         |                         ^~
   arch/arm64/kernel/elfcore.c:81:9: note: in expansion of macro 'for_each_mte_vma'
      81 |         for_each_mte_vma(vmi, vma) {
         |         ^~~~~~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c: In function 'elf_core_extra_data_size':
   arch/arm64/kernel/elfcore.c:105:22: error: 'vmi' undeclared (first use in this function); did you mean 'vma'?
     105 |         VMA_ITERATOR(vmi, current->mm, 0);
         |                      ^~~
         |                      vma
>> arch/arm64/kernel/elfcore.c:14:25: error: expected ';' before 'if'
      14 |                         if (vma->vm_flags & VM_MTE)
         |                         ^~
   arch/arm64/kernel/elfcore.c:107:9: note: in expansion of macro 'for_each_mte_vma'
     107 |         for_each_mte_vma(vmi, vma)
         |         ^~~~~~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_data':
   arch/arm64/kernel/elfcore.c:116:22: error: 'vmi' undeclared (first use in this function); did you mean 'vma'?
     116 |         VMA_ITERATOR(vmi, current->mm, 0);
         |                      ^~~
         |                      vma
>> arch/arm64/kernel/elfcore.c:14:25: error: expected ';' before 'if'
      14 |                         if (vma->vm_flags & VM_MTE)
         |                         ^~
   arch/arm64/kernel/elfcore.c:118:9: note: in expansion of macro 'for_each_mte_vma'
     118 |         for_each_mte_vma(vmi, vma) {
         |         ^~~~~~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_phdrs':
   arch/arm64/kernel/elfcore.c:99:1: error: control reaches end of non-void function [-Werror=return-type]
      99 | }
         | ^
   arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_data':
   arch/arm64/kernel/elfcore.c:127:1: error: control reaches end of non-void function [-Werror=return-type]
     127 | }
         | ^

At top level:
arch/arm64/kernel/elfcore.c:25:12: warning: 'mte_dump_tag_range' defined but not used [-Wunused-function]
25 | static int mte_dump_tag_range(struct coredump_params *cprm,
| ^~~~~~~~~~~~~~~~~~
arch/arm64/kernel/elfcore.c:16:22: warning: 'mte_vma_tag_dump_size' defined but not used [-Wunused-function]
16 | static unsigned long mte_vma_tag_dump_size(struct vm_area_struct *vma)
| ^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +14 arch/arm64/kernel/elfcore.c

6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  10  
e416e64fe4e04c Liam Howlett    2022-02-23  11  #define for_each_mte_vma(vmi, vma)					\
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  12  	if (system_supports_mte())					\
e416e64fe4e04c Liam Howlett    2022-02-23  13  		for_each_vma(vmi, vma)					\
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31 @14  			if (vma->vm_flags & VM_MTE)
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  15  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  16  static unsigned long mte_vma_tag_dump_size(struct vm_area_struct *vma)
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  17  {
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  18  	if (vma->vm_flags & VM_DONTDUMP)
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  19  		return 0;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  20  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  21  	return vma_pages(vma) * MTE_PAGE_TAG_STORAGE;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  22  }
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  23  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  24  /* Derived from dump_user_range(); start/end must be page-aligned */
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  25  static int mte_dump_tag_range(struct coredump_params *cprm,
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  26  			      unsigned long start, unsigned long end)
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  27  {
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  28  	unsigned long addr;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  29  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  30  	for (addr = start; addr < end; addr += PAGE_SIZE) {
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  31  		char tags[MTE_PAGE_TAG_STORAGE];
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  32  		struct page *page = get_dump_page(addr);
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  33  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  34  		/*
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  35  		 * get_dump_page() returns NULL when encountering an empty
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  36  		 * page table entry that would otherwise have been filled with
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  37  		 * the zero page. Skip the equivalent tag dump which would
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  38  		 * have been all zeros.
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  39  		 */
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  40  		if (!page) {
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  41  			dump_skip(cprm, MTE_PAGE_TAG_STORAGE);
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  42  			continue;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  43  		}
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  44  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  45  		/*
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  46  		 * Pages mapped in user space as !pte_access_permitted() (e.g.
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  47  		 * PROT_EXEC only) may not have the PG_mte_tagged flag set.
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  48  		 */
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  49  		if (!test_bit(PG_mte_tagged, &page->flags)) {
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  50  			put_page(page);
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  51  			dump_skip(cprm, MTE_PAGE_TAG_STORAGE);
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  52  			continue;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  53  		}
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  54  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  55  		mte_save_page_tags(page_address(page), tags);
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  56  		put_page(page);
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  57  		if (!dump_emit(cprm, tags, MTE_PAGE_TAG_STORAGE))
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  58  			return 0;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  59  	}
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  60  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  61  	return 1;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  62  }
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  63  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  64  Elf_Half elf_core_extra_phdrs(void)
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  65  {
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  66  	struct vm_area_struct *vma;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  67  	int vma_count = 0;
e416e64fe4e04c Liam Howlett    2022-02-23 @68  	VMA_ITERATOR(vmi, current->mm, 0);
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  69  
e416e64fe4e04c Liam Howlett    2022-02-23  70  	for_each_mte_vma(vmi, vma)
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  71  		vma_count++;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  72  
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  73  	return vma_count;
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  74  }
6dd8b1a0b6cb3e Catalin Marinas 2022-01-31  75  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

#3 lore raw

Re: [PATCH] arm64: Change elfcore for_each_mte_vma() to use VMA iterator

In reply to Liam Howlett
Thank you for the patch! Yet something to improve:

Hi Liam,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on next-20220222]
[cannot apply to linux/master linus/master v5.17-rc5]
[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/Liam-Howlett/arm64-Change-elfcore-for_each_mte_vma-to-use-VMA-iterator/20220223-104149
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm64-randconfig-p001-20220221 (https://download.01.org/0day-ci/archive/20220223/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 11.2.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://github.com/0day-ci/linux/commit/e416e64fe4e04c43daa48131e564c9f2f64ec333
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Liam-Howlett/arm64-Change-elfcore-for_each_mte_vma-to-use-VMA-iterator/20220223-104149 git checkout e416e64fe4e04c43daa48131e564c9f2f64ec333
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

arch/arm64/kernel/elfcore.c: In function 'elf_core_extra_phdrs':

>> arch/arm64/kernel/elfcore.c:68:9: error: implicit declaration of function 'VMA_ITERATOR' [-Werror=implicit-function-declaration]
      68 |         VMA_ITERATOR(vmi, current->mm, 0);
         |         ^~~~~~~~~~~~
>> arch/arm64/kernel/elfcore.c:68:22: error: 'vmi' undeclared (first use in this function); did you mean 'vma'?
      68 |         VMA_ITERATOR(vmi, current->mm, 0);
         |                      ^~~
         |                      vma
   arch/arm64/kernel/elfcore.c:68:22: note: each undeclared identifier is reported only once for each function it appears in
>> arch/arm64/kernel/elfcore.c:13:17: error: implicit declaration of function 'for_each_vma'; did you mean 'for_each_cpu'? [-Werror=implicit-function-declaration]
      13 |                 for_each_vma(vmi, vma)                                  \
         |                 ^~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c:70:9: note: in expansion of macro 'for_each_mte_vma'
      70 |         for_each_mte_vma(vmi, vma)
         |         ^~~~~~~~~~~~~~~~
   In file included from include/asm-generic/bug.h:5,
                    from arch/arm64/include/asm/bug.h:26,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from include/linux/coredump.h:6,
                    from arch/arm64/kernel/elfcore.c:3:
>> include/linux/compiler.h:56:23: error: expected ';' before 'if'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^~
   arch/arm64/kernel/elfcore.c:14:25: note: in expansion of macro 'if'
      14 |                         if (vma->vm_flags & VM_MTE)
         |                         ^~
   arch/arm64/kernel/elfcore.c:70:9: note: in expansion of macro 'for_each_mte_vma'
      70 |         for_each_mte_vma(vmi, vma)
         |         ^~~~~~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_phdrs':
   arch/arm64/kernel/elfcore.c:79:22: error: 'vmi' undeclared (first use in this function); did you mean 'vma'?
      79 |         VMA_ITERATOR(vmi, current->mm, 0);
         |                      ^~~
         |                      vma
   In file included from include/asm-generic/bug.h:5,
                    from arch/arm64/include/asm/bug.h:26,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from include/linux/coredump.h:6,
                    from arch/arm64/kernel/elfcore.c:3:
>> include/linux/compiler.h:56:23: error: expected ';' before 'if'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^~
   arch/arm64/kernel/elfcore.c:14:25: note: in expansion of macro 'if'
      14 |                         if (vma->vm_flags & VM_MTE)
         |                         ^~
   arch/arm64/kernel/elfcore.c:81:9: note: in expansion of macro 'for_each_mte_vma'
      81 |         for_each_mte_vma(vmi, vma) {
         |         ^~~~~~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c: In function 'elf_core_extra_data_size':
   arch/arm64/kernel/elfcore.c:105:22: error: 'vmi' undeclared (first use in this function); did you mean 'vma'?
     105 |         VMA_ITERATOR(vmi, current->mm, 0);
         |                      ^~~
         |                      vma
   In file included from include/asm-generic/bug.h:5,
                    from arch/arm64/include/asm/bug.h:26,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from include/linux/coredump.h:6,
                    from arch/arm64/kernel/elfcore.c:3:
>> include/linux/compiler.h:56:23: error: expected ';' before 'if'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^~
   arch/arm64/kernel/elfcore.c:14:25: note: in expansion of macro 'if'
      14 |                         if (vma->vm_flags & VM_MTE)
         |                         ^~
   arch/arm64/kernel/elfcore.c:107:9: note: in expansion of macro 'for_each_mte_vma'
     107 |         for_each_mte_vma(vmi, vma)
         |         ^~~~~~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_data':
   arch/arm64/kernel/elfcore.c:116:22: error: 'vmi' undeclared (first use in this function); did you mean 'vma'?
     116 |         VMA_ITERATOR(vmi, current->mm, 0);
         |                      ^~~
         |                      vma
   In file included from include/asm-generic/bug.h:5,
                    from arch/arm64/include/asm/bug.h:26,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from include/linux/coredump.h:6,
                    from arch/arm64/kernel/elfcore.c:3:
>> include/linux/compiler.h:56:23: error: expected ';' before 'if'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^~
   arch/arm64/kernel/elfcore.c:14:25: note: in expansion of macro 'if'
      14 |                         if (vma->vm_flags & VM_MTE)
         |                         ^~
   arch/arm64/kernel/elfcore.c:118:9: note: in expansion of macro 'for_each_mte_vma'
     118 |         for_each_mte_vma(vmi, vma) {
         |         ^~~~~~~~~~~~~~~~
   arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_phdrs':
   arch/arm64/kernel/elfcore.c:99:1: error: control reaches end of non-void function [-Werror=return-type]
      99 | }
         | ^
   arch/arm64/kernel/elfcore.c: In function 'elf_core_write_extra_data':
   arch/arm64/kernel/elfcore.c:127:1: error: control reaches end of non-void function [-Werror=return-type]
     127 | }
         | ^

At top level:
arch/arm64/kernel/elfcore.c:25:12: warning: 'mte_dump_tag_range' defined but not used [-Wunused-function]
25 | static int mte_dump_tag_range(struct coredump_params *cprm,
| ^~~~~~~~~~~~~~~~~~
arch/arm64/kernel/elfcore.c:16:22: warning: 'mte_vma_tag_dump_size' defined but not used [-Wunused-function]
16 | static unsigned long mte_vma_tag_dump_size(struct vm_area_struct *vma)
| ^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/VMA_ITERATOR +68 arch/arm64/kernel/elfcore.c

    10	
    11	#define for_each_mte_vma(vmi, vma)					\
    12		if (system_supports_mte())					\
  > 13			for_each_vma(vmi, vma)					\
    14				if (vma->vm_flags & VM_MTE)
    15	
    16	static unsigned long mte_vma_tag_dump_size(struct vm_area_struct *vma)
    17	{
    18		if (vma->vm_flags & VM_DONTDUMP)
    19			return 0;
    20	
    21		return vma_pages(vma) * MTE_PAGE_TAG_STORAGE;
    22	}
    23	
    24	/* Derived from dump_user_range(); start/end must be page-aligned */
    25	static int mte_dump_tag_range(struct coredump_params *cprm,
    26				      unsigned long start, unsigned long end)
    27	{
    28		unsigned long addr;
    29	
    30		for (addr = start; addr < end; addr += PAGE_SIZE) {
    31			char tags[MTE_PAGE_TAG_STORAGE];
    32			struct page *page = get_dump_page(addr);
    33	
    34			/*
    35			 * get_dump_page() returns NULL when encountering an empty
    36			 * page table entry that would otherwise have been filled with
    37			 * the zero page. Skip the equivalent tag dump which would
    38			 * have been all zeros.
    39			 */
    40			if (!page) {
    41				dump_skip(cprm, MTE_PAGE_TAG_STORAGE);
    42				continue;
    43			}
    44	
    45			/*
    46			 * Pages mapped in user space as !pte_access_permitted() (e.g.
    47			 * PROT_EXEC only) may not have the PG_mte_tagged flag set.
    48			 */
    49			if (!test_bit(PG_mte_tagged, &page->flags)) {
    50				put_page(page);
    51				dump_skip(cprm, MTE_PAGE_TAG_STORAGE);
    52				continue;
    53			}
    54	
    55			mte_save_page_tags(page_address(page), tags);
    56			put_page(page);
    57			if (!dump_emit(cprm, tags, MTE_PAGE_TAG_STORAGE))
    58				return 0;
    59		}
    60	
    61		return 1;
    62	}
    63	
    64	Elf_Half elf_core_extra_phdrs(void)
    65	{
    66		struct vm_area_struct *vma;
    67		int vma_count = 0;
  > 68		VMA_ITERATOR(vmi, current->mm, 0);
    69	
    70		for_each_mte_vma(vmi, vma)
    71			vma_count++;
    72	
    73		return vma_count;
    74	}
    75	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]