From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754704AbbIIKCB (ORCPT ); Wed, 9 Sep 2015 06:02:01 -0400 Received: from mx2.parallels.com ([199.115.105.18]:51039 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753250AbbIIKBp (ORCPT ); Wed, 9 Sep 2015 06:01:45 -0400 Subject: Re: [PATCH V2] kasan: fix last shadow judgement in memory_is_poisoned_16() To: Xishi Qiu , Andrew Morton , Andrey Konovalov , Rusty Russell , Michal Marek , References: <55EED09E.3010107@huawei.com> CC: Linux MM , LKML , From: Andrey Ryabinin Message-ID: <55F0037E.40308@virtuozzo.com> Date: Wed, 9 Sep 2015 13:01:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55EED09E.3010107@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: US-EXCH2.sw.swsoft.com (10.255.249.46) To US-EXCH.sw.swsoft.com (10.255.249.47) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/08/2015 03:12 PM, Xishi Qiu wrote: > 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 Acked-by: Andrey Ryabinin