linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
       [not found] <12c9e499-9c11-d248-6a3f-14ec8c4e07f1@molgen.mpg.de>
@ 2018-02-01 16:33 ` Andrey Ryabinin
  2018-02-01 19:57   ` Matthew Wilcox
                     ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Andrey Ryabinin @ 2018-02-01 16:33 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Paul Menzel, Alexander Potapenko, Dmitry Vyukov, kasan-dev,
	linux-kernel, linux-mm, Andrey Ryabinin, stable

KASAN uses different routines to map shadow for hot added memory and memory
obtained in boot process. Attempt to offline memory onlined by normal boot
process leads to this:

    Trying to vfree() nonexistent vm area (000000005d3b34b9)
    WARNING: CPU: 2 PID: 13215 at mm/vmalloc.c:1525 __vunmap+0x147/0x190

    Call Trace:
     kasan_mem_notifier+0xad/0xb9
     notifier_call_chain+0x166/0x260
     __blocking_notifier_call_chain+0xdb/0x140
     __offline_pages+0x96a/0xb10
     memory_subsys_offline+0x76/0xc0
     device_offline+0xb8/0x120
     store_mem_state+0xfa/0x120
     kernfs_fop_write+0x1d5/0x320
     __vfs_write+0xd4/0x530
     vfs_write+0x105/0x340
     SyS_write+0xb0/0x140

Obviously we can't call vfree() to free memory that wasn't allocated via
vmalloc(). Use find_vm_area() to see if we can call vfree().

Unfortunately it's a bit tricky to properly unmap and free shadow allocated
during boot, so we'll have to keep it. If memory will come online again
that shadow will be reused.

Fixes: fa69b5989bb0 ("mm/kasan: add support for memory hotplug")
Reported-by: Paul Menzel <pmenzel+linux-kasan-dev@molgen.mpg.de>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: <stable@vger.kernel.org>
---
 mm/kasan/kasan.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 55 insertions(+), 2 deletions(-)

diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index e13d911251e7..0d9d9d268f32 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -791,6 +791,41 @@ DEFINE_ASAN_SET_SHADOW(f5);
 DEFINE_ASAN_SET_SHADOW(f8);
 
 #ifdef CONFIG_MEMORY_HOTPLUG
+static bool shadow_mapped(unsigned long addr)
+{
+	pgd_t *pgd = pgd_offset_k(addr);
+	p4d_t *p4d;
+	pud_t *pud;
+	pmd_t *pmd;
+	pte_t *pte;
+
+	if (pgd_none(*pgd))
+		return false;
+	p4d = p4d_offset(pgd, addr);
+	if (p4d_none(*p4d))
+		return false;
+	pud = pud_offset(p4d, addr);
+	if (pud_none(*pud))
+		return false;
+
+	/*
+	 * We can't use pud_large() or pud_huge(), the first one
+	 * is arch-specific, the last one depend on HUGETLB_PAGE.
+	 * So let's abuse pud_bad(), if bud is bad it's has to
+	 * because it's huge.
+	 */
+	if (pud_bad(*pud))
+		return true;
+	pmd = pmd_offset(pud, addr);
+	if (pmd_none(*pmd))
+		return false;
+
+	if (pmd_bad(*pmd))
+		return true;
+	pte = pte_offset_kernel(pmd, addr);
+	return !pte_none(*pte);
+}
+
 static int __meminit kasan_mem_notifier(struct notifier_block *nb,
 			unsigned long action, void *data)
 {
@@ -812,6 +847,14 @@ static int __meminit kasan_mem_notifier(struct notifier_block *nb,
 	case MEM_GOING_ONLINE: {
 		void *ret;
 
+		/*
+		 * If shadow is mapped already than it must have been mapped
+		 * during the boot. This could happen if we onlining previously
+		 * offlined memory.
+		 */
+		if (shadow_mapped(shadow_start))
+			return NOTIFY_OK;
+
 		ret = __vmalloc_node_range(shadow_size, PAGE_SIZE, shadow_start,
 					shadow_end, GFP_KERNEL,
 					PAGE_KERNEL, VM_NO_GUARD,
@@ -823,8 +866,18 @@ static int __meminit kasan_mem_notifier(struct notifier_block *nb,
 		kmemleak_ignore(ret);
 		return NOTIFY_OK;
 	}
-	case MEM_OFFLINE:
-		vfree((void *)shadow_start);
+	case MEM_OFFLINE: {
+		struct vm_struct *vm;
+
+		/*
+		 * Only hot-added memory have vm_area. Freeing shadow
+		 * mapped during boot would be tricky, so we'll just
+		 * have to keep it.
+		 */
+		vm = find_vm_area((void *)shadow_start);
+		if (vm)
+			vfree((void *)shadow_start);
+	}
 	}
 
 	return NOTIFY_OK;
-- 
2.13.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
  2018-02-01 16:33 ` [PATCH] mm/kasan: Don't vfree() nonexistent vm_area Andrey Ryabinin
@ 2018-02-01 19:57   ` Matthew Wilcox
  2018-02-01 20:22     ` Andrey Ryabinin
  2018-05-18 15:57   ` David Hildenbrand
  2018-05-22 16:44   ` Andrey Ryabinin
  2 siblings, 1 reply; 16+ messages in thread
From: Matthew Wilcox @ 2018-02-01 19:57 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: Andrew Morton, Paul Menzel, Alexander Potapenko, Dmitry Vyukov,
	kasan-dev, linux-kernel, linux-mm, stable

On Thu, Feb 01, 2018 at 07:33:49PM +0300, Andrey Ryabinin wrote:
> +	case MEM_OFFLINE: {
> +		struct vm_struct *vm;
> +
> +		/*
> +		 * Only hot-added memory have vm_area. Freeing shadow
> +		 * mapped during boot would be tricky, so we'll just
> +		 * have to keep it.
> +		 */
> +		vm = find_vm_area((void *)shadow_start);
> +		if (vm)
> +			vfree((void *)shadow_start);
> +	}

This looks like a complicated way to spell 'is_vmalloc_addr' ...

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
  2018-02-01 19:57   ` Matthew Wilcox
@ 2018-02-01 20:22     ` Andrey Ryabinin
  2018-02-02 17:20       ` Matthew Wilcox
  0 siblings, 1 reply; 16+ messages in thread
From: Andrey Ryabinin @ 2018-02-01 20:22 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Andrew Morton, Paul Menzel, Alexander Potapenko, Dmitry Vyukov,
	kasan-dev, linux-kernel, linux-mm, stable



On 02/01/2018 10:57 PM, Matthew Wilcox wrote:
> On Thu, Feb 01, 2018 at 07:33:49PM +0300, Andrey Ryabinin wrote:
>> +	case MEM_OFFLINE: {
>> +		struct vm_struct *vm;
>> +
>> +		/*
>> +		 * Only hot-added memory have vm_area. Freeing shadow
>> +		 * mapped during boot would be tricky, so we'll just
>> +		 * have to keep it.
>> +		 */
>> +		vm = find_vm_area((void *)shadow_start);
>> +		if (vm)
>> +			vfree((void *)shadow_start);
>> +	}
> 
> This looks like a complicated way to spell 'is_vmalloc_addr' ...
> 

It's not. shadow_start is never vmalloc address.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
  2018-02-01 20:22     ` Andrey Ryabinin
@ 2018-02-02 17:20       ` Matthew Wilcox
  2018-02-05  8:48         ` Andrey Ryabinin
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Wilcox @ 2018-02-02 17:20 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: Andrew Morton, Paul Menzel, Alexander Potapenko, Dmitry Vyukov,
	kasan-dev, linux-kernel, linux-mm, stable

On Thu, Feb 01, 2018 at 11:22:55PM +0300, Andrey Ryabinin wrote:
> >> +		vm = find_vm_area((void *)shadow_start);
> >> +		if (vm)
> >> +			vfree((void *)shadow_start);
> >> +	}
> > 
> > This looks like a complicated way to spell 'is_vmalloc_addr' ...
> > 
> 
> It's not. shadow_start is never vmalloc address.

I'm confused.  How can you call vfree() on something that isn't a vmalloc
address?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
  2018-02-02 17:20       ` Matthew Wilcox
@ 2018-02-05  8:48         ` Andrey Ryabinin
  0 siblings, 0 replies; 16+ messages in thread
From: Andrey Ryabinin @ 2018-02-05  8:48 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Andrew Morton, Paul Menzel, Alexander Potapenko, Dmitry Vyukov,
	kasan-dev, linux-kernel, linux-mm, stable



On 02/02/2018 08:20 PM, Matthew Wilcox wrote:
> On Thu, Feb 01, 2018 at 11:22:55PM +0300, Andrey Ryabinin wrote:
>>>> +		vm = find_vm_area((void *)shadow_start);
>>>> +		if (vm)
>>>> +			vfree((void *)shadow_start);
>>>> +	}
>>>
>>> This looks like a complicated way to spell 'is_vmalloc_addr' ...
>>>
>>
>> It's not. shadow_start is never vmalloc address.
> 
> I'm confused.  How can you call vfree() on something that isn't a vmalloc
> address?
> 

a??vfree() is able to free any address returned by __vmalloc_node_range().
And __vmalloc_node_range() gives you any address you ask.
It doesn't have to be an address in [VMALLOC_START, VMALLOC_END] range.

That's also how the module_alloc()/module_memfree() works on architectures that
have designated area for modules.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
  2018-02-01 16:33 ` [PATCH] mm/kasan: Don't vfree() nonexistent vm_area Andrey Ryabinin
  2018-02-01 19:57   ` Matthew Wilcox
@ 2018-05-18 15:57   ` David Hildenbrand
  2018-05-18 16:01     ` David Hildenbrand
  2018-05-22 16:44   ` Andrey Ryabinin
  2 siblings, 1 reply; 16+ messages in thread
From: David Hildenbrand @ 2018-05-18 15:57 UTC (permalink / raw)
  To: Andrey Ryabinin, Andrew Morton
  Cc: Paul Menzel, Alexander Potapenko, Dmitry Vyukov, kasan-dev,
	linux-kernel, linux-mm, stable

On 01.02.2018 17:33, Andrey Ryabinin wrote:
> KASAN uses different routines to map shadow for hot added memory and memory
> obtained in boot process. Attempt to offline memory onlined by normal boot
> process leads to this:
> 
>     Trying to vfree() nonexistent vm area (000000005d3b34b9)
>     WARNING: CPU: 2 PID: 13215 at mm/vmalloc.c:1525 __vunmap+0x147/0x190
> 
>     Call Trace:
>      kasan_mem_notifier+0xad/0xb9
>      notifier_call_chain+0x166/0x260
>      __blocking_notifier_call_chain+0xdb/0x140
>      __offline_pages+0x96a/0xb10
>      memory_subsys_offline+0x76/0xc0
>      device_offline+0xb8/0x120
>      store_mem_state+0xfa/0x120
>      kernfs_fop_write+0x1d5/0x320
>      __vfs_write+0xd4/0x530
>      vfs_write+0x105/0x340
>      SyS_write+0xb0/0x140
> 
> Obviously we can't call vfree() to free memory that wasn't allocated via
> vmalloc(). Use find_vm_area() to see if we can call vfree().
> 
> Unfortunately it's a bit tricky to properly unmap and free shadow allocated
> during boot, so we'll have to keep it. If memory will come online again
> that shadow will be reused.
> 

While debugging kasan memory hotplug problems I am having, stumbled over
this patch.

Couldn't we handle that via VM_KASAN like in kasan_module_alloc/free
instead?

> Fixes: fa69b5989bb0 ("mm/kasan: add support for memory hotplug")
> Reported-by: Paul Menzel <pmenzel+linux-kasan-dev@molgen.mpg.de>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: <stable@vger.kernel.org>
> ---
>  mm/kasan/kasan.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 55 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
> index e13d911251e7..0d9d9d268f32 100644
> --- a/mm/kasan/kasan.c
> +++ b/mm/kasan/kasan.c
> @@ -791,6 +791,41 @@ DEFINE_ASAN_SET_SHADOW(f5);
>  DEFINE_ASAN_SET_SHADOW(f8);
>  
>  #ifdef CONFIG_MEMORY_HOTPLUG
> +static bool shadow_mapped(unsigned long addr)
> +{
> +	pgd_t *pgd = pgd_offset_k(addr);
> +	p4d_t *p4d;
> +	pud_t *pud;
> +	pmd_t *pmd;
> +	pte_t *pte;
> +
> +	if (pgd_none(*pgd))
> +		return false;
> +	p4d = p4d_offset(pgd, addr);
> +	if (p4d_none(*p4d))
> +		return false;
> +	pud = pud_offset(p4d, addr);
> +	if (pud_none(*pud))
> +		return false;
> +
> +	/*
> +	 * We can't use pud_large() or pud_huge(), the first one
> +	 * is arch-specific, the last one depend on HUGETLB_PAGE.
> +	 * So let's abuse pud_bad(), if bud is bad it's has to
> +	 * because it's huge.
> +	 */
> +	if (pud_bad(*pud))
> +		return true;
> +	pmd = pmd_offset(pud, addr);
> +	if (pmd_none(*pmd))
> +		return false;
> +
> +	if (pmd_bad(*pmd))
> +		return true;
> +	pte = pte_offset_kernel(pmd, addr);
> +	return !pte_none(*pte);
> +}
> +
>  static int __meminit kasan_mem_notifier(struct notifier_block *nb,
>  			unsigned long action, void *data)
>  {
> @@ -812,6 +847,14 @@ static int __meminit kasan_mem_notifier(struct notifier_block *nb,
>  	case MEM_GOING_ONLINE: {
>  		void *ret;
>  
> +		/*
> +		 * If shadow is mapped already than it must have been mapped
> +		 * during the boot. This could happen if we onlining previously
> +		 * offlined memory.
> +		 */
> +		if (shadow_mapped(shadow_start))
> +			return NOTIFY_OK;
> +
>  		ret = __vmalloc_node_range(shadow_size, PAGE_SIZE, shadow_start,
>  					shadow_end, GFP_KERNEL,
>  					PAGE_KERNEL, VM_NO_GUARD,
> @@ -823,8 +866,18 @@ static int __meminit kasan_mem_notifier(struct notifier_block *nb,
>  		kmemleak_ignore(ret);
>  		return NOTIFY_OK;
>  	}
> -	case MEM_OFFLINE:
> -		vfree((void *)shadow_start);
> +	case MEM_OFFLINE: {
> +		struct vm_struct *vm;
> +
> +		/*
> +		 * Only hot-added memory have vm_area. Freeing shadow
> +		 * mapped during boot would be tricky, so we'll just
> +		 * have to keep it.
> +		 */
> +		vm = find_vm_area((void *)shadow_start);
> +		if (vm)
> +			vfree((void *)shadow_start);
> +	}
>  	}
>  
>  	return NOTIFY_OK;
> 


-- 

Thanks,

David / dhildenb

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

* Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
  2018-05-18 15:57   ` David Hildenbrand
@ 2018-05-18 16:01     ` David Hildenbrand
  0 siblings, 0 replies; 16+ messages in thread
From: David Hildenbrand @ 2018-05-18 16:01 UTC (permalink / raw)
  To: Andrey Ryabinin, Andrew Morton
  Cc: Paul Menzel, Alexander Potapenko, Dmitry Vyukov, kasan-dev,
	linux-kernel, linux-mm, stable

On 18.05.2018 17:57, David Hildenbrand wrote:
> On 01.02.2018 17:33, Andrey Ryabinin wrote:
>> KASAN uses different routines to map shadow for hot added memory and memory
>> obtained in boot process. Attempt to offline memory onlined by normal boot
>> process leads to this:
>>
>>     Trying to vfree() nonexistent vm area (000000005d3b34b9)
>>     WARNING: CPU: 2 PID: 13215 at mm/vmalloc.c:1525 __vunmap+0x147/0x190
>>
>>     Call Trace:
>>      kasan_mem_notifier+0xad/0xb9
>>      notifier_call_chain+0x166/0x260
>>      __blocking_notifier_call_chain+0xdb/0x140
>>      __offline_pages+0x96a/0xb10
>>      memory_subsys_offline+0x76/0xc0
>>      device_offline+0xb8/0x120
>>      store_mem_state+0xfa/0x120
>>      kernfs_fop_write+0x1d5/0x320
>>      __vfs_write+0xd4/0x530
>>      vfs_write+0x105/0x340
>>      SyS_write+0xb0/0x140
>>
>> Obviously we can't call vfree() to free memory that wasn't allocated via
>> vmalloc(). Use find_vm_area() to see if we can call vfree().
>>
>> Unfortunately it's a bit tricky to properly unmap and free shadow allocated
>> during boot, so we'll have to keep it. If memory will come online again
>> that shadow will be reused.
>>
> 
> While debugging kasan memory hotplug problems I am having, stumbled over
> this patch.
> 
> Couldn't we handle that via VM_KASAN like in kasan_module_alloc/free
> instead?
> 

Just realized that this will most probably not work. So please ignore my
comment for now :)

-- 

Thanks,

David / dhildenb

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

* Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
  2018-02-01 16:33 ` [PATCH] mm/kasan: Don't vfree() nonexistent vm_area Andrey Ryabinin
  2018-02-01 19:57   ` Matthew Wilcox
  2018-05-18 15:57   ` David Hildenbrand
@ 2018-05-22 16:44   ` Andrey Ryabinin
  2018-05-22 21:03     ` Andrew Morton
  2 siblings, 1 reply; 16+ messages in thread
From: Andrey Ryabinin @ 2018-05-22 16:44 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Paul Menzel, Alexander Potapenko, Dmitry Vyukov, kasan-dev,
	linux-kernel, linux-mm, stable



On 02/01/2018 07:33 PM, Andrey Ryabinin wrote:
> KASAN uses different routines to map shadow for hot added memory and memory
> obtained in boot process. Attempt to offline memory onlined by normal boot
> process leads to this:
> 
>     Trying to vfree() nonexistent vm area (000000005d3b34b9)
>     WARNING: CPU: 2 PID: 13215 at mm/vmalloc.c:1525 __vunmap+0x147/0x190
> 
>     Call Trace:
>      kasan_mem_notifier+0xad/0xb9
>      notifier_call_chain+0x166/0x260
>      __blocking_notifier_call_chain+0xdb/0x140
>      __offline_pages+0x96a/0xb10
>      memory_subsys_offline+0x76/0xc0
>      device_offline+0xb8/0x120
>      store_mem_state+0xfa/0x120
>      kernfs_fop_write+0x1d5/0x320
>      __vfs_write+0xd4/0x530
>      vfs_write+0x105/0x340
>      SyS_write+0xb0/0x140
> 
> Obviously we can't call vfree() to free memory that wasn't allocated via
> vmalloc(). Use find_vm_area() to see if we can call vfree().
> 
> Unfortunately it's a bit tricky to properly unmap and free shadow allocated
> during boot, so we'll have to keep it. If memory will come online again
> that shadow will be reused.
> 
> Fixes: fa69b5989bb0 ("mm/kasan: add support for memory hotplug")
> Reported-by: Paul Menzel <pmenzel+linux-kasan-dev@molgen.mpg.de>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: <stable@vger.kernel.org>
> ---

This seems stuck in -mm. Andrew, can we proceed?

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

* Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
  2018-05-22 16:44   ` Andrey Ryabinin
@ 2018-05-22 21:03     ` Andrew Morton
  2018-05-23 12:33       ` Andrey Ryabinin
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Morton @ 2018-05-22 21:03 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: Paul Menzel, Alexander Potapenko, Dmitry Vyukov, kasan-dev,
	linux-kernel, linux-mm, stable

On Tue, 22 May 2018 19:44:06 +0300 Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:

> > Obviously we can't call vfree() to free memory that wasn't allocated via
> > vmalloc(). Use find_vm_area() to see if we can call vfree().
> > 
> > Unfortunately it's a bit tricky to properly unmap and free shadow allocated
> > during boot, so we'll have to keep it. If memory will come online again
> > that shadow will be reused.
> > 
> > Fixes: fa69b5989bb0 ("mm/kasan: add support for memory hotplug")
> > Reported-by: Paul Menzel <pmenzel+linux-kasan-dev@molgen.mpg.de>
> > Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> > Cc: <stable@vger.kernel.org>
> > ---
> 
> This seems stuck in -mm. Andrew, can we proceed?

OK.

Should there be a code comment explaining the situation that Matthew
asked about?  It's rather obscure.

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

* Re: [PATCH] mm/kasan: Don't vfree() nonexistent vm_area.
  2018-05-22 21:03     ` Andrew Morton
@ 2018-05-23 12:33       ` Andrey Ryabinin
  2018-05-26  3:31         ` [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix kbuild test robot
  2018-05-30 11:53         ` kbuild test robot
  0 siblings, 2 replies; 16+ messages in thread
From: Andrey Ryabinin @ 2018-05-23 12:33 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Paul Menzel, Alexander Potapenko, Dmitry Vyukov, kasan-dev,
	linux-kernel, linux-mm, stable, Matthew Wilcox



On 05/23/2018 12:03 AM, Andrew Morton wrote:
> On Tue, 22 May 2018 19:44:06 +0300 Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> 
>>> Obviously we can't call vfree() to free memory that wasn't allocated via
>>> vmalloc(). Use find_vm_area() to see if we can call vfree().
>>>
>>> Unfortunately it's a bit tricky to properly unmap and free shadow allocated
>>> during boot, so we'll have to keep it. If memory will come online again
>>> that shadow will be reused.
>>>
>>> Fixes: fa69b5989bb0 ("mm/kasan: add support for memory hotplug")
>>> Reported-by: Paul Menzel <pmenzel+linux-kasan-dev@molgen.mpg.de>
>>> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
>>> Cc: <stable@vger.kernel.org>
>>> ---
>>
>> This seems stuck in -mm. Andrew, can we proceed?
> 
> OK.
> 
> Should there be a code comment explaining the situation that Matthew
> asked about?  It's rather obscure.
> 

Ok. Here is my attempt to improve the situation. If something is still not clear,
I'm open to suggestions.



From: Andrey Ryabinin <aryabinin@virtuozzo.com>
Subject: [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix

Improve comments.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/kasan/kasan.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index 135ce2838c89..ea44dd0bc4e7 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -812,7 +812,7 @@ static bool shadow_mapped(unsigned long addr)
 	/*
 	 * We can't use pud_large() or pud_huge(), the first one
 	 * is arch-specific, the last one depend on HUGETLB_PAGE.
-	 * So let's abuse pud_bad(), if bud is bad it's has to
+	 * So let's abuse pud_bad(), if pud is bad than it's bad
 	 * because it's huge.
 	 */
 	if (pud_bad(*pud))
@@ -871,9 +871,16 @@ static int __meminit kasan_mem_notifier(struct notifier_block *nb,
 		struct vm_struct *vm;
 
 		/*
-		 * Only hot-added memory have vm_area. Freeing shadow
-		 * mapped during boot would be tricky, so we'll just
-		 * have to keep it.
+		 * shadow_start was either mapped during boot by kasan_init()
+		 * or during memory online by __vmalloc_node_range().
+		 * In the latter case we can use vfree() to free shadow.
+		 * Non-NULL result of the find_vm_area() will tell us if
+		 * that was the second case.
+		 *
+		 * Currently it's not possible to free shadow mapped
+		 * during boot by kasan_init(). It's because the code
+		 * to do that hasn't been written yet. So we'll just
+		 * leak the memory.
 		 */
 		vm = find_vm_area((void *)shadow_start);
 		if (vm)
-- 
2.16.1

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

* Re: [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix
  2018-05-23 12:33       ` Andrey Ryabinin
@ 2018-05-26  3:31         ` kbuild test robot
  2018-05-26  3:48           ` Andrew Morton
  2018-05-30 11:53         ` kbuild test robot
  1 sibling, 1 reply; 16+ messages in thread
From: kbuild test robot @ 2018-05-26  3:31 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: kbuild-all, Andrew Morton, Paul Menzel, Alexander Potapenko,
	Dmitry Vyukov, kasan-dev, linux-kernel, linux-mm, stable,
	Matthew Wilcox

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

Hi Andrey,

I love your patch! Yet something to improve:

[auto build test ERROR on mmotm/master]
[cannot apply to v4.17-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/mm-kasan-dont-vfree-nonexistent-vm_area-fix/20180526-093255
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc 

All errors (new ones prefixed by >>):

   fs/autofs/inode.o: In function `autofs_new_ino':
   inode.c:(.text+0x220): multiple definition of `autofs_new_ino'
   fs/autofs/inode.o:inode.c:(.text+0x220): first defined here
   fs/autofs/inode.o: In function `autofs_clean_ino':
   inode.c:(.text+0x280): multiple definition of `autofs_clean_ino'
   fs/autofs/inode.o:inode.c:(.text+0x280): first defined here
   fs/autofs/inode.o: In function `autofs_free_ino':
   inode.c:(.text+0x2c0): multiple definition of `autofs_free_ino'
   fs/autofs/inode.o:inode.c:(.text+0x2c0): first defined here
   fs/autofs/inode.o: In function `autofs_kill_sb':
   inode.c:(.text+0x2e0): multiple definition of `autofs_kill_sb'
   fs/autofs/inode.o:inode.c:(.text+0x2e0): first defined here
   fs/autofs/inode.o: In function `autofs_get_inode':
   inode.c:(.text+0x360): multiple definition of `autofs_get_inode'
   fs/autofs/inode.o:inode.c:(.text+0x360): first defined here
   fs/autofs/inode.o: In function `autofs_fill_super':
   inode.c:(.text+0x440): multiple definition of `autofs_fill_super'
   fs/autofs/inode.o:inode.c:(.text+0x440): first defined here
   fs/autofs/root.o: In function `is_autofs_dentry':
   root.c:(.text+0x1860): multiple definition of `is_autofs_dentry'
   fs/autofs/root.o:root.c:(.text+0x1860): first defined here
   fs/autofs/root.o:(.rodata+0x100): multiple definition of `autofs_dentry_operations'
   fs/autofs/root.o:(.rodata+0x100): first defined here
   fs/autofs/root.o:(.rodata+0x180): multiple definition of `autofs_dir_inode_operations'
   fs/autofs/root.o:(.rodata+0x180): first defined here
   fs/autofs/root.o:(.rodata+0x240): multiple definition of `autofs_dir_operations'
   fs/autofs/root.o:(.rodata+0x240): first defined here
   fs/autofs/root.o:(.rodata+0x338): multiple definition of `autofs_root_operations'
   fs/autofs/root.o:(.rodata+0x338): first defined here
   fs/autofs/symlink.o:(.rodata+0x0): multiple definition of `autofs_symlink_inode_operations'
   fs/autofs/symlink.o:(.rodata+0x0): first defined here
   fs/autofs/waitq.o: In function `autofs_catatonic_mode':
>> waitq.c:(.text+0x80): multiple definition of `autofs_catatonic_mode'
   fs/autofs/waitq.o:waitq.c:(.text+0x80): first defined here
   fs/autofs/waitq.o: In function `autofs_wait_release':
>> waitq.c:(.text+0x180): multiple definition of `autofs_wait_release'
   fs/autofs/waitq.o:waitq.c:(.text+0x180): first defined here
   fs/autofs/waitq.o: In function `autofs_wait':
>> waitq.c:(.text+0x520): multiple definition of `autofs_wait'
   fs/autofs/waitq.o:waitq.c:(.text+0x520): first defined here
   fs/autofs/expire.o: In function `autofs_expire_direct':
   expire.c:(.text+0x7a0): multiple definition of `autofs_expire_direct'
   fs/autofs/expire.o:expire.c:(.text+0x7a0): first defined here
   fs/autofs/expire.o: In function `autofs_expire_indirect':
   expire.c:(.text+0x8e0): multiple definition of `autofs_expire_indirect'
   fs/autofs/expire.o:expire.c:(.text+0x8e0): first defined here
   fs/autofs/expire.o: In function `autofs_expire_wait':
   expire.c:(.text+0xba0): multiple definition of `autofs_expire_wait'
   fs/autofs/expire.o:expire.c:(.text+0xba0): first defined here
   fs/autofs/expire.o: In function `autofs_expire_run':
   expire.c:(.text+0xce0): multiple definition of `autofs_expire_run'
   fs/autofs/expire.o:expire.c:(.text+0xce0): first defined here
   fs/autofs/expire.o: In function `autofs_do_expire_multi':
   expire.c:(.text+0xde0): multiple definition of `autofs_do_expire_multi'
   fs/autofs/expire.o:expire.c:(.text+0xde0): first defined here
   fs/autofs/expire.o: In function `autofs_expire_multi':
   expire.c:(.text+0xea0): multiple definition of `autofs_expire_multi'
   fs/autofs/expire.o:expire.c:(.text+0xea0): first defined here
   fs/autofs/dev-ioctl.o: In function `autofs_dev_ioctl_init':
   dev-ioctl.c:(.init.text+0x0): multiple definition of `autofs_dev_ioctl_init'
   fs/autofs/dev-ioctl.o:dev-ioctl.c:(.init.text+0x0): first defined here
   fs/autofs/dev-ioctl.o: In function `autofs_dev_ioctl_exit':
   dev-ioctl.c:(.text+0xbc0): multiple definition of `autofs_dev_ioctl_exit'
   fs/autofs/dev-ioctl.o:dev-ioctl.c:(.text+0xbc0): first defined here

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

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

* Re: [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix
  2018-05-26  3:31         ` [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix kbuild test robot
@ 2018-05-26  3:48           ` Andrew Morton
  2018-05-28  4:13             ` Ian Kent
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Morton @ 2018-05-26  3:48 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Andrey Ryabinin, kbuild-all, Paul Menzel, Alexander Potapenko,
	Dmitry Vyukov, kasan-dev, linux-kernel, linux-mm, stable,
	Matthew Wilcox, Ian Kent

On Sat, 26 May 2018 11:31:35 +0800 kbuild test robot <lkp@intel.com> wrote:

> Hi Andrey,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on mmotm/master]
> [cannot apply to v4.17-rc6]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/mm-kasan-dont-vfree-nonexistent-vm_area-fix/20180526-093255
> base:   git://git.cmpxchg.org/linux-mmotm.git master
> config: sparc-allyesconfig (attached as .config)
> compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=sparc 
> 
> All errors (new ones prefixed by >>):
> 
>    fs/autofs/inode.o: In function `autofs_new_ino':
>    inode.c:(.text+0x220): multiple definition of `autofs_new_ino'
>    fs/autofs/inode.o:inode.c:(.text+0x220): first defined here
>    fs/autofs/inode.o: In function `autofs_clean_ino':
>    inode.c:(.text+0x280): multiple definition of `autofs_clean_ino'
>    fs/autofs/inode.o:inode.c:(.text+0x280): first defined here

There's bot breakage here - clearly that patch didn't cause this error.

Ian, this autofs glitch may still not be fixed.

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

* Re: [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix
  2018-05-26  3:48           ` Andrew Morton
@ 2018-05-28  4:13             ` Ian Kent
  2018-05-28  4:39               ` Ian Kent
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Kent @ 2018-05-28  4:13 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andrey Ryabinin, Paul Menzel, Alexander Potapenko, Dmitry Vyukov,
	kasan-dev, linux-kernel, linux-mm, Matthew Wilcox

On Fri, 2018-05-25 at 20:48 -0700, Andrew Morton wrote:
> On Sat, 26 May 2018 11:31:35 +0800 kbuild test robot <lkp@intel.com> wrote:
> 
> > Hi Andrey,
> > 
> > I love your patch! Yet something to improve:
> > 
> > [auto build test ERROR on mmotm/master]
> > [cannot apply to v4.17-rc6]
> > [if your patch is applied to the wrong git tree, please drop us a note to
> > help improve the system]
> > 
> > url:    https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/mm-kasan-do
> > nt-vfree-nonexistent-vm_area-fix/20180526-093255
> > base:   git://git.cmpxchg.org/linux-mmotm.git master
> > config: sparc-allyesconfig (attached as .config)
> > compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/m
> > ake.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # save the attached .config to linux build tree
> >         make.cross ARCH=sparc 
> > 
> > All errors (new ones prefixed by >>):
> > 
> >    fs/autofs/inode.o: In function `autofs_new_ino':
> >    inode.c:(.text+0x220): multiple definition of `autofs_new_ino'
> >    fs/autofs/inode.o:inode.c:(.text+0x220): first defined here
> >    fs/autofs/inode.o: In function `autofs_clean_ino':
> >    inode.c:(.text+0x280): multiple definition of `autofs_clean_ino'
> >    fs/autofs/inode.o:inode.c:(.text+0x280): first defined here
> 
> There's bot breakage here - clearly that patch didn't cause this error.
> 
> Ian, this autofs glitch may still not be fixed.

Yes, autofs-make-autofs4-Kconfig-depend-on-AUTOFS_FS.patch should have
fixed that.

I tied a bunch of .config combinations and I was unable to find any that
lead to both CONFIG_AUTOFS_FS and CONFIG_AUTOFS4_FS being defined.

I must be missing something else, I'll investigate.

Ian

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

* Re: [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix
  2018-05-28  4:13             ` Ian Kent
@ 2018-05-28  4:39               ` Ian Kent
  2018-05-29  4:01                 ` Ian Kent
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Kent @ 2018-05-28  4:39 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andrey Ryabinin, Paul Menzel, Alexander Potapenko, Dmitry Vyukov,
	kasan-dev, linux-kernel, linux-mm, Matthew Wilcox

On Mon, 2018-05-28 at 12:13 +0800, Ian Kent wrote:
> On Fri, 2018-05-25 at 20:48 -0700, Andrew Morton wrote:
> > On Sat, 26 May 2018 11:31:35 +0800 kbuild test robot <lkp@intel.com> wrote:
> > 
> > > Hi Andrey,
> > > 
> > > I love your patch! Yet something to improve:
> > > 
> > > [auto build test ERROR on mmotm/master]
> > > [cannot apply to v4.17-rc6]
> > > [if your patch is applied to the wrong git tree, please drop us a note to
> > > help improve the system]
> > > 
> > > url:    https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/mm-kasan-
> > > do
> > > nt-vfree-nonexistent-vm_area-fix/20180526-093255
> > > base:   git://git.cmpxchg.org/linux-mmotm.git master
> > > config: sparc-allyesconfig (attached as .config)
> > > compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> > > reproduce:
> > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin
> > > /m
> > > ake.cross -O ~/bin/make.cross
> > >         chmod +x ~/bin/make.cross
> > >         # save the attached .config to linux build tree
> > >         make.cross ARCH=sparc 
> > > 
> > > All errors (new ones prefixed by >>):
> > > 
> > >    fs/autofs/inode.o: In function `autofs_new_ino':
> > >    inode.c:(.text+0x220): multiple definition of `autofs_new_ino'
> > >    fs/autofs/inode.o:inode.c:(.text+0x220): first defined here
> > >    fs/autofs/inode.o: In function `autofs_clean_ino':
> > >    inode.c:(.text+0x280): multiple definition of `autofs_clean_ino'
> > >    fs/autofs/inode.o:inode.c:(.text+0x280): first defined here
> > 
> > There's bot breakage here - clearly that patch didn't cause this error.
> > 
> > Ian, this autofs glitch may still not be fixed.
> 
> Yes, autofs-make-autofs4-Kconfig-depend-on-AUTOFS_FS.patch should have
> fixed that.
> 
> I tied a bunch of .config combinations and I was unable to find any that
> lead to both CONFIG_AUTOFS_FS and CONFIG_AUTOFS4_FS being defined.

Oh, autofs-make-autofs4-Kconfig-depend-on-AUTOFS_FS.patch was sent as
a follow up patch which means it's still possible to have both
CONFIG_AUTOFS_FS and CONFIG_AUTOFS4_FS set between 
autofs-create-autofs-Kconfig-and-Makefile.patch and the above patch.

Perhaps all that's needed is to fold the follow up patch into
autofs-create-autofs-Kconfig-and-Makefile.patch to close that
possibility.

I'll check that can be done without problem.

> 
> I must be missing something else, I'll investigate.

And I'll check if there's anything else I'm missing.

Sorry for the inconvenience.

> 
> Ian

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

* Re: [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix
  2018-05-28  4:39               ` Ian Kent
@ 2018-05-29  4:01                 ` Ian Kent
  0 siblings, 0 replies; 16+ messages in thread
From: Ian Kent @ 2018-05-29  4:01 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andrey Ryabinin, Paul Menzel, Alexander Potapenko, Dmitry Vyukov,
	kasan-dev, linux-kernel, linux-mm, Matthew Wilcox

On Mon, 2018-05-28 at 12:39 +0800, Ian Kent wrote:
> On Mon, 2018-05-28 at 12:13 +0800, Ian Kent wrote:
> > On Fri, 2018-05-25 at 20:48 -0700, Andrew Morton wrote:
> > > On Sat, 26 May 2018 11:31:35 +0800 kbuild test robot <lkp@intel.com>
> > > wrote:
> > > 
> > > > Hi Andrey,
> > > > 
> > > > I love your patch! Yet something to improve:
> > > > 
> > > > [auto build test ERROR on mmotm/master]
> > > > [cannot apply to v4.17-rc6]
> > > > [if your patch is applied to the wrong git tree, please drop us a note
> > > > to
> > > > help improve the system]
> > > > 
> > > > url:    https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/mm-kasa
> > > > n-
> > > > do
> > > > nt-vfree-nonexistent-vm_area-fix/20180526-093255
> > > > base:   git://git.cmpxchg.org/linux-mmotm.git master
> > > > config: sparc-allyesconfig (attached as .config)
> > > > compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> > > > reproduce:
> > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sb
> > > > in
> > > > /m
> > > > ake.cross -O ~/bin/make.cross
> > > >         chmod +x ~/bin/make.cross
> > > >         # save the attached .config to linux build tree
> > > >         make.cross ARCH=sparc 
> > > > 
> > > > All errors (new ones prefixed by >>):
> > > > 
> > > >    fs/autofs/inode.o: In function `autofs_new_ino':
> > > >    inode.c:(.text+0x220): multiple definition of `autofs_new_ino'
> > > >    fs/autofs/inode.o:inode.c:(.text+0x220): first defined here
> > > >    fs/autofs/inode.o: In function `autofs_clean_ino':
> > > >    inode.c:(.text+0x280): multiple definition of `autofs_clean_ino'
> > > >    fs/autofs/inode.o:inode.c:(.text+0x280): first defined here
> > > 
> > > There's bot breakage here - clearly that patch didn't cause this error.
> > > 
> > > Ian, this autofs glitch may still not be fixed.
> > 
> > Yes, autofs-make-autofs4-Kconfig-depend-on-AUTOFS_FS.patch should have
> > fixed that.
> > 
> > I tied a bunch of .config combinations and I was unable to find any that
> > lead to both CONFIG_AUTOFS_FS and CONFIG_AUTOFS4_FS being defined.
> 
> Oh, autofs-make-autofs4-Kconfig-depend-on-AUTOFS_FS.patch was sent as
> a follow up patch which means it's still possible to have both
> CONFIG_AUTOFS_FS and CONFIG_AUTOFS4_FS set between 
> autofs-create-autofs-Kconfig-and-Makefile.patch and the above patch.
> 
> Perhaps all that's needed is to fold the follow up patch into
> autofs-create-autofs-Kconfig-and-Makefile.patch to close that
> possibility.
> 
> I'll check that can be done without problem.

I've had a look and I can't see any reason for this other than
CONFIG_AUTOFS_FS and CONFIG_AUTOFS4_FS both being set which isn't
ok because the file system name is the same for both.

I have seen build system configs that have both of these set even
though the "autofs" module was removed years ago so that's probably
still present in some site build systems.

I see you've added the follow up patch I mentioned above as
"autofs-update-fs-autofs4-kconfig-fix.patch"
with title
"autofs - make autofs4 Kconfig depend on AUTOFS_FS"

Folding this patch into the patch
"autofs-create-autofs-kconfig-and-makefile.patch"
with title
"autofs: create autofs Kconfig and Makefile"

I'm unable to reproduce the breakage which leads me to think
the problem must be due to .config having both the CONFIG_AUTOFS*
entries defined to something other than n (which certainly does
produce the breakage if the follow up patch is not present, so
the result is not bisectable until the follow up patch is added).

Also, I don't think there is a need to update the description of
"autofs: create autofs Kconfig and Makefile"
because the patch that is folded into it adds a NOTE to the
fs/autofs4/Kconfig help that essentially re-states what is in
the description.

If this continues to happen I'll need more information about
applied patches and kernel config used to work out what's going
on.

For completeness here's the resulting patch after folding in the
follow up patch above:

autofs - create autofs Kconfig and Makefile

From: Ian Kent <raven@themaw.net>

Create Makefile and Kconfig for autofs module.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 fs/Kconfig         |    1 +
 fs/Makefile        |    1 +
 fs/autofs/Kconfig  |   20 ++++++++++++++++++++
 fs/autofs/Makefile |    7 +++++++
 fs/autofs4/Kconfig |    8 ++++++++
 5 files changed, 37 insertions(+)
 create mode 100644 fs/autofs/Kconfig
 create mode 100644 fs/autofs/Makefile

diff --git a/fs/Kconfig b/fs/Kconfig
index bc821a86d965..e712e62afe59 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -108,6 +108,7 @@ source "fs/notify/Kconfig"
 
 source "fs/quota/Kconfig"
 
+source "fs/autofs/Kconfig"
 source "fs/autofs4/Kconfig"
 source "fs/fuse/Kconfig"
 source "fs/overlayfs/Kconfig"
diff --git a/fs/Makefile b/fs/Makefile
index c9375fd2c8c4..2e005525cc19 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -102,6 +102,7 @@ obj-$(CONFIG_AFFS_FS)		+= affs/
 obj-$(CONFIG_ROMFS_FS)		+= romfs/
 obj-$(CONFIG_QNX4FS_FS)		+= qnx4/
 obj-$(CONFIG_QNX6FS_FS)		+= qnx6/
+obj-$(CONFIG_AUTOFS_FS)		+= autofs/
 obj-$(CONFIG_AUTOFS4_FS)	+= autofs4/
 obj-$(CONFIG_ADFS_FS)		+= adfs/
 obj-$(CONFIG_FUSE_FS)		+= fuse/
diff --git a/fs/autofs/Kconfig b/fs/autofs/Kconfig
new file mode 100644
index 000000000000..6a2064eb3b27
--- /dev/null
+++ b/fs/autofs/Kconfig
@@ -0,0 +1,20 @@
+config AUTOFS_FS
+	tristate "Kernel automounter support (supports v3, v4 and v5)"
+	default n
+	help
+	   The automounter is a tool to automatically mount remote file systems
+	   on demand. This implementation is partially kernel-based to reduce
+	   overhead in the already-mounted case; this is unlike the BSD
+	   automounter (amd), which is a pure user space daemon.
+
+	   To use the automounter you need the user-space tools from
+	   <https://www.kernel.org/pub/linux/daemons/autofs/>; you also want
+	   to answer Y to "NFS file system support", below.
+
+	   To compile this support as a module, choose M here: the module will be
+	   called autofs.
+
+	   If you are not a part of a fairly large, distributed network or
+	   don't have a laptop which needs to dynamically reconfigure to the
+	   local network, you probably do not need an automounter, and can say
+	   N here.
diff --git a/fs/autofs/Makefile b/fs/autofs/Makefile
new file mode 100644
index 000000000000..43fedde15c26
--- /dev/null
+++ b/fs/autofs/Makefile
@@ -0,0 +1,7 @@
+#
+# Makefile for the linux autofs-filesystem routines.
+#
+
+obj-$(CONFIG_AUTOFS_FS) += autofs.o
+
+autofs-objs := init.o inode.o root.o symlink.o waitq.o expire.o dev-ioctl.o
diff --git a/fs/autofs4/Kconfig b/fs/autofs4/Kconfig
index 53bc592a250d..2c2fdf989f90 100644
--- a/fs/autofs4/Kconfig
+++ b/fs/autofs4/Kconfig
@@ -1,6 +1,7 @@
 config AUTOFS4_FS
 	tristate "Kernel automounter version 4 support (also supports v3 and v5)"
 	default n
+	depends on AUTOFS_FS = n
 	help
 	  The automounter is a tool to automatically mount remote file systems
 	  on demand. This implementation is partially kernel-based to reduce
@@ -30,3 +31,10 @@ config AUTOFS4_FS
 	  - any "alias autofs autofs4" will need to be removed.
 
 	  Please configure AUTOFS_FS instead of AUTOFS4_FS from now on.
+
+	  NOTE: Since the modules autofs and autofs4 use the same file system
+		type name of "autofs" only one can be built. The "depends"
+		above will result in AUTOFS4_FS not appearing in .config for
+		any setting of AUTOFS_FS other than n and AUTOFS4_FS will
+		appear under the AUTOFS_FS entry otherwise which is intended
+		to draw attention to the module rename change.

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

* Re: [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix
  2018-05-23 12:33       ` Andrey Ryabinin
  2018-05-26  3:31         ` [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix kbuild test robot
@ 2018-05-30 11:53         ` kbuild test robot
  1 sibling, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2018-05-30 11:53 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: kbuild-all, Andrew Morton, Paul Menzel, Alexander Potapenko,
	Dmitry Vyukov, kasan-dev, linux-kernel, linux-mm, stable,
	Matthew Wilcox

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

Hi Andrey,

I love your patch! Yet something to improve:

[auto build test ERROR on mmotm/master]
[cannot apply to v4.17-rc7 next-20180529]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/mm-kasan-dont-vfree-nonexistent-vm_area-fix/20180526-093255
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   fs/autofs/inode.o: In function `autofs_new_ino':
>> inode.c:(.text+0x170): multiple definition of `autofs_new_ino'
   fs/autofs/inode.o:inode.c:(.text+0x170): first defined here
   fs/autofs/inode.o: In function `autofs_clean_ino':
>> inode.c:(.text+0x1c0): multiple definition of `autofs_clean_ino'
   fs/autofs/inode.o:inode.c:(.text+0x1c0): first defined here
   fs/autofs/inode.o: In function `autofs_free_ino':
>> inode.c:(.text+0x1f0): multiple definition of `autofs_free_ino'
   fs/autofs/inode.o:inode.c:(.text+0x1f0): first defined here
   fs/autofs/inode.o: In function `autofs_kill_sb':
>> inode.c:(.text+0x200): multiple definition of `autofs_kill_sb'
   fs/autofs/inode.o:inode.c:(.text+0x200): first defined here
   fs/autofs/inode.o: In function `autofs_get_inode':
>> inode.c:(.text+0x250): multiple definition of `autofs_get_inode'
   fs/autofs/inode.o:inode.c:(.text+0x250): first defined here
   fs/autofs/inode.o: In function `autofs_fill_super':
>> inode.c:(.text+0x300): multiple definition of `autofs_fill_super'
   fs/autofs/inode.o:inode.c:(.text+0x300): first defined here
   fs/autofs/root.o: In function `is_autofs_dentry':
>> root.c:(.text+0x1170): multiple definition of `is_autofs_dentry'
   fs/autofs/root.o:root.c:(.text+0x1170): first defined here
>> fs/autofs/root.o:(.rodata+0x0): multiple definition of `autofs_dentry_operations'
   fs/autofs/root.o:(.rodata+0x0): first defined here
>> fs/autofs/root.o:(.rodata+0x40): multiple definition of `autofs_dir_inode_operations'
   fs/autofs/root.o:(.rodata+0x40): first defined here
>> fs/autofs/root.o:(.rodata+0xc0): multiple definition of `autofs_dir_operations'
   fs/autofs/root.o:(.rodata+0xc0): first defined here
>> fs/autofs/root.o:(.rodata+0x140): multiple definition of `autofs_root_operations'
   fs/autofs/root.o:(.rodata+0x140): first defined here
>> fs/autofs/symlink.o:(.rodata+0x0): multiple definition of `autofs_symlink_inode_operations'
   fs/autofs/symlink.o:(.rodata+0x0): first defined here
   fs/autofs/waitq.o: In function `autofs_catatonic_mode':
>> waitq.c:(.text+0x60): multiple definition of `autofs_catatonic_mode'
   fs/autofs/waitq.o:waitq.c:(.text+0x60): first defined here
   fs/autofs/waitq.o: In function `autofs_wait_release':
>> waitq.c:(.text+0x110): multiple definition of `autofs_wait_release'
   fs/autofs/waitq.o:waitq.c:(.text+0x110): first defined here
   fs/autofs/waitq.o: In function `autofs_wait':
>> waitq.c:(.text+0x520): multiple definition of `autofs_wait'
   fs/autofs/waitq.o:waitq.c:(.text+0x520): first defined here
   fs/autofs/expire.o: In function `autofs_expire_direct':
   expire.c:(.text+0x4d0): multiple definition of `autofs_expire_direct'
   fs/autofs/expire.o:expire.c:(.text+0x4d0): first defined here
   fs/autofs/expire.o: In function `autofs_expire_indirect':
   expire.c:(.text+0x5c0): multiple definition of `autofs_expire_indirect'
   fs/autofs/expire.o:expire.c:(.text+0x5c0): first defined here
   fs/autofs/expire.o: In function `autofs_expire_wait':
   expire.c:(.text+0x840): multiple definition of `autofs_expire_wait'
   fs/autofs/expire.o:expire.c:(.text+0x840): first defined here
   fs/autofs/expire.o: In function `autofs_expire_run':
   expire.c:(.text+0x910): multiple definition of `autofs_expire_run'
   fs/autofs/expire.o:expire.c:(.text+0x910): first defined here
   fs/autofs/expire.o: In function `autofs_do_expire_multi':
   expire.c:(.text+0xa30): multiple definition of `autofs_do_expire_multi'
   fs/autofs/expire.o:expire.c:(.text+0xa30): first defined here
   fs/autofs/expire.o: In function `autofs_expire_multi':
   expire.c:(.text+0xb00): multiple definition of `autofs_expire_multi'
   fs/autofs/expire.o:expire.c:(.text+0xb00): first defined here
   fs/autofs/dev-ioctl.o: In function `autofs_dev_ioctl_init':
   dev-ioctl.c:(.init.text+0x0): multiple definition of `autofs_dev_ioctl_init'
   fs/autofs/dev-ioctl.o:dev-ioctl.c:(.init.text+0x0): first defined here
   fs/autofs/dev-ioctl.o: In function `autofs_dev_ioctl_exit':
   dev-ioctl.c:(.text+0xac0): multiple definition of `autofs_dev_ioctl_exit'
   fs/autofs/dev-ioctl.o:dev-ioctl.c:(.text+0xac0): first defined here

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

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

end of thread, other threads:[~2018-05-30 11:53 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <12c9e499-9c11-d248-6a3f-14ec8c4e07f1@molgen.mpg.de>
2018-02-01 16:33 ` [PATCH] mm/kasan: Don't vfree() nonexistent vm_area Andrey Ryabinin
2018-02-01 19:57   ` Matthew Wilcox
2018-02-01 20:22     ` Andrey Ryabinin
2018-02-02 17:20       ` Matthew Wilcox
2018-02-05  8:48         ` Andrey Ryabinin
2018-05-18 15:57   ` David Hildenbrand
2018-05-18 16:01     ` David Hildenbrand
2018-05-22 16:44   ` Andrey Ryabinin
2018-05-22 21:03     ` Andrew Morton
2018-05-23 12:33       ` Andrey Ryabinin
2018-05-26  3:31         ` [PATCH] mm-kasan-dont-vfree-nonexistent-vm_area-fix kbuild test robot
2018-05-26  3:48           ` Andrew Morton
2018-05-28  4:13             ` Ian Kent
2018-05-28  4:39               ` Ian Kent
2018-05-29  4:01                 ` Ian Kent
2018-05-30 11:53         ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).