mirror of
https://github.com/apache/nuttx.git
synced 2025-01-12 22:08:35 +08:00
mempool: addbacktrace should be before kasan_unpoison
If thread 1 is executing kasan_unpoison but a scheduling occurs and the block is trampled upon, the displayed backtracking may still be from the previously allocated backtracking Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
parent
39780fdae1
commit
aa0aecbd80
1 changed files with 5 additions and 4 deletions
|
@ -397,16 +397,17 @@ retry:
|
||||||
|
|
||||||
pool->nalloc++;
|
pool->nalloc++;
|
||||||
spin_unlock_irqrestore(&pool->lock, flags);
|
spin_unlock_irqrestore(&pool->lock, flags);
|
||||||
blk = kasan_unpoison(blk, pool->blocksize);
|
|
||||||
#ifdef CONFIG_MM_FILL_ALLOCATIONS
|
|
||||||
memset(blk, MM_ALLOC_MAGIC, pool->blocksize);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CONFIG_MM_BACKTRACE >= 0
|
#if CONFIG_MM_BACKTRACE >= 0
|
||||||
mempool_add_backtrace(pool, (FAR struct mempool_backtrace_s *)
|
mempool_add_backtrace(pool, (FAR struct mempool_backtrace_s *)
|
||||||
((FAR char *)blk + pool->blocksize));
|
((FAR char *)blk + pool->blocksize));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
blk = kasan_unpoison(blk, pool->blocksize);
|
||||||
|
#ifdef CONFIG_MM_FILL_ALLOCATIONS
|
||||||
|
memset(blk, MM_ALLOC_MAGIC, pool->blocksize);
|
||||||
|
#endif
|
||||||
|
|
||||||
return blk;
|
return blk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue