lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150619132048.GF15281@e104818-lin.cambridge.arm.com>
Date:	Fri, 19 Jun 2015 14:20:48 +0100
From:	Catalin Marinas <catalin.marinas@....com>
To:	"vigneshr@...eaurora.org" <vigneshr@...eaurora.org>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"bernd.schubert@...m.fraunhofer.de" 
	<bernd.schubert@...m.fraunhofer.de>
Subject: Re: Crash in crc32_le during kmemleak_scan()

On Fri, Jun 19, 2015 at 11:30:50AM +0100, vigneshr@...eaurora.org wrote:
> >> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> >> index 5405aff5a590..7913386ca506 100644
> >> --- a/mm/kmemleak.c
> >> +++ b/mm/kmemleak.c
> >> @@ -194,6 +194,8 @@ static struct kmem_cache *scan_area_cache;
> >>
> >>  /* set if tracing memory operations is enabled */
> >>  static int kmemleak_enabled;
> >> +/* same as above but only for the kmemleak_free() callback */
> >> +static int kmemleak_free_enabled;
> >>  /* set in the late_initcall if there were no errors */
> >>  static int kmemleak_initialized;
> >>  /* enables or disables early logging of the memory operations */
> >> @@ -941,7 +943,7 @@ void __ref kmemleak_free(const void *ptr)
> >>  {
> >>  	pr_debug("%s(0x%p)\n", __func__, ptr);
> >>
> >> -	if (kmemleak_enabled && ptr && !IS_ERR(ptr))
> >> +	if (kmemleak_free_enabled && ptr && !IS_ERR(ptr))
> >>  		delete_object_full((unsigned long)ptr);
> >>  	else if (kmemleak_early_log)
> >>  		log_early(KMEMLEAK_FREE, ptr, 0, 0);
> >> @@ -981,7 +983,7 @@ void __ref kmemleak_free_percpu(const void __percpu
> >> *ptr)
> >>
> >>  	pr_debug("%s(0x%p)\n", __func__, ptr);
> >>
> >> -	if (kmemleak_enabled && ptr && !IS_ERR(ptr))
> >> +	if (kmemleak_free_enabled && ptr && !IS_ERR(ptr))
> >>  		for_each_possible_cpu(cpu)
> >>  			delete_object_full((unsigned long)per_cpu_ptr(ptr,
> >>  								      cpu));
> >> @@ -1749,6 +1751,12 @@ static void kmemleak_do_cleanup(struct
> >> work_struct
> >> *work)
> >>  	mutex_lock(&scan_mutex);
> >>  	stop_scan_thread();
> >>
> >> +	/*
> >> +	 * Once the scan thread has stopped, it is safe to no longer track
> >> +	 * object freeing.
> >> +	 */
> >> +	kmemleak_free_enabled = 0;
> >> +
> >>  	if (!kmemleak_found_leaks)
> >>  		__kmemleak_do_cleanup();
> >>  	else
> >> @@ -1775,6 +1783,8 @@ static void kmemleak_disable(void)
> >>  	/* check whether it is too early for a kernel thread */
> >>  	if (kmemleak_initialized)
> >>  		schedule_work(&cleanup_work);
> >> +	else
> >> +		kmemleak_free_enabled = 0;
> >>
> >>  	pr_info("Kernel memory leak detector disabled\n");
> >>  }
> >> @@ -1839,8 +1849,10 @@ void __init kmemleak_init(void)
> >>  	if (kmemleak_error) {
> >>  		local_irq_restore(flags);
> >>  		return;
> >> -	} else
> >> +	} else {
> >>  		kmemleak_enabled = 1;
> >> +		kmemleak_free_enabled = 1;
> >> +	}
> >>  	local_irq_restore(flags);
> >>
> >>  	/*
> >>
> >> -------------------8<-----------------
> >
> > We have tested the patch provided above and it was clean report with no
> > crashes that were seen earlier. I guess we can go ahead with this one if
> > its okay with you.
> >
> > Tested-by: Vignesh Radhakrishnan <vigneshr@...eaurora.org>
> 
> Gentle reminder ping for the above.

What's the ping for?

The patch is merged in linux-next via the mm tree as commit d613b66e1df8
("mm: kmemleak: allow safe memory scanning during kmemleak disabling").
It will probably go in during the upcoming merging window (so 4.2) and
it also has a Cc stable tag.

-- 
Catalin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ