The patch titled Subject: kasan: fix last shadow judgement in memory_is_poisoned_16() has been added to the -mm tree. Its filename is kasan-fix-last-shadow-judgement-in-memory_is_poisoned_16.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kasan-fix-last-shadow-judgement-in-memory_is_poisoned_16.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kasan-fix-last-shadow-judgement-in-memory_is_poisoned_16.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Xishi Qiu <qiuxishi@xxxxxxxxxx> Subject: kasan: fix last shadow judgement in memory_is_poisoned_16() The shadow which correspond 16 bytes memory may span 2 or 3 bytes. If the memory is aligned on 8, then the shadow takes only 2 bytes. So we check "shadow_first_bytes" is enough, and need not to call "memory_is_poisoned_1(addr + 15);". But the code "if (likely(!last_byte))" is wrong judgement. e.g. addr=0, so last_byte = 15 & KASAN_SHADOW_MASK = 7, then the code will continue to call "memory_is_poisoned_1(addr + 15);" Signed-off-by: Xishi Qiu <qiuxishi@xxxxxxxxxx> Acked-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Andrey Konovalov <adech.fo@xxxxxxxxx> Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx> Cc: Michal Marek <mmarek@xxxxxxx> Cc: <zhongjiang@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/kasan/kasan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff -puN mm/kasan/kasan.c~kasan-fix-last-shadow-judgement-in-memory_is_poisoned_16 mm/kasan/kasan.c --- a/mm/kasan/kasan.c~kasan-fix-last-shadow-judgement-in-memory_is_poisoned_16 +++ a/mm/kasan/kasan.c @@ -135,12 +135,11 @@ static __always_inline bool memory_is_po if (unlikely(*shadow_addr)) { u16 shadow_first_bytes = *(u16 *)shadow_addr; - s8 last_byte = (addr + 15) & KASAN_SHADOW_MASK; if (unlikely(shadow_first_bytes)) return true; - if (likely(!last_byte)) + if (likely(IS_ALIGNED(addr, 8))) return false; return memory_is_poisoned_1(addr + 15); _ Patches currently in -mm which might be from qiuxishi@xxxxxxxxxx are kasan-fix-last-shadow-judgement-in-memory_is_poisoned_16.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html