mm/kasan: Increase size alignment
The following situations cannot be detected by Kasan: On a 32-bit machine, only 12 bytes were poisoned, but 13 bytes were accessed. Due to the lack of upward alignment, only 3 bits were detected Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
parent
b7d5a30f85
commit
4473f2f847
@ -24,6 +24,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/nuttx.h>
|
||||
#include <nuttx/mm/kasan.h>
|
||||
#include <nuttx/spinlock.h>
|
||||
|
||||
@ -210,6 +211,7 @@ bool kasan_is_poisoned(FAR const void *addr, size_t size)
|
||||
|
||||
nbit = KASAN_BITS_PER_WORD - bit % KASAN_BITS_PER_WORD;
|
||||
mask = KASAN_FIRST_WORD_MASK(bit);
|
||||
size = ALIGN_UP(size, KASAN_SHADOW_SCALE);
|
||||
size /= KASAN_SHADOW_SCALE;
|
||||
|
||||
while (size >= nbit)
|
||||
|
Loading…
Reference in New Issue
Block a user