mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: vigneshr@codeaurora.org
To: vigneshr@codeaurora.org
Cc: "Catalin Marinas" <catalin.marinas@arm.com>,
	"vigneshr@codeaurora.org" <vigneshr@codeaurora.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"bernd.schubert@itwm.fraunhofer.de" 
	<bernd.schubert@itwm.fraunhofer.de>
Subject: Re: Crash in crc32_le during kmemleak_scan()
Date: Fri, 19 Jun 2015 10:30:50 -0000	[thread overview]
Message-ID: <854083a556afab7337db85722e719a5b.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <bd69286d1779d9cfc109082f261c4337.squirrel@www.codeaurora.org>


>>
>> 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@codeaurora.org>
>

Hi,

Gentle reminder ping for the above.

-- 
Thanks and regards,
Vignesh Radhakrishnan

QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation.


  reply	other threads:[~2015-06-19 10:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 13:15 vigneshr
2015-05-14 11:21 ` Catalin Marinas
2015-05-15  4:53   ` vigneshr
2015-05-20 13:16 ` vigneshr
2015-05-21  5:45   ` vigneshr
2015-05-22 16:51     ` Catalin Marinas
2015-06-01  4:57       ` vigneshr
2015-06-19 10:30         ` vigneshr [this message]
2015-06-19 13:20           ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=854083a556afab7337db85722e719a5b.squirrel@www.codeaurora.org \
    --to=vigneshr@codeaurora.org \
    --cc=bernd.schubert@itwm.fraunhofer.de \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome