Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3601571ybl; Mon, 19 Aug 2019 22:39:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxC2RHQbnVv8SLhExqR6zsyAAkqVK9btXI/KvUMrkSE5s9aK31jgliPIvfJdLUfHSRP/zuV X-Received: by 2002:aa7:9e04:: with SMTP id y4mr27752030pfq.18.1566279579143; Mon, 19 Aug 2019 22:39:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566279579; cv=none; d=google.com; s=arc-20160816; b=e1ciE7ZKvV+LGIzhIfqKv8aG10W5eT4O49g2l5EVplZMUNZeFjwnKNUwAWXZSVnZ2t DOfW93mQkw828oF2wu7SLkYpwrbxDhUpW4IEJH02clyiVMy/ilCPQIC1pjDTUEaRRm0N MKeN1Vb6s+WEZJyNd6jGKn6adpg1zQ5gNu0bQuimWv3gjb6m39t/v3PlfBOqP09QV6hO kzzfZqQWXMzH6f7OlpN1Ddac1/tF4RDjQk72qv+SgIQtEP3Z2DPihxtD7a41iyC1wOUL biGZ8qNo4B5h5KWxhRoCwxnaKkMTyVK/2SmBRdCIRi5q6yrrUollzcmsQcb8Bvi56w8g EGYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=aiutwDXcYz8gtA0jVSRs05N+s/bv8JEDTTBbKXPE3wg=; b=C9SAvz5vUDGlwb07p1hOdVWXKSpDkHZT7wucUDaLxTaBVE4H6MmHUCoem7blBAoyby Dnskopt+QtGCHkx9gFbxuQGLmZy1PfDujGBZsPLf8eXeKdWnXmuMPCPV7AL6Lj0IceO2 wmwcxTPZ/kB33JEzRpveDzaZ4E9m9LddYwaUKHgRNCJjOFIAi7VPrzBXdnEN9sZh9EYJ bYJzGI9CRFrPspo5BnlPRSp13mm1JMefKjbPbm8Z3XJ2IlpeHiyIgyFlKRNnLnIn6RgR AlLzBlUpLBnnpbafeJbewmgdvv8JZWbtWX5p0FsKhxaRmiyLfJiAymb1Ltk7gVamUi35 U4iA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x126si11425418pgx.356.2019.08.19.22.39.24; Mon, 19 Aug 2019 22:39:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729108AbfHTFiG (ORCPT + 99 others); Tue, 20 Aug 2019 01:38:06 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:58674 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727006AbfHTFiG (ORCPT ); Tue, 20 Aug 2019 01:38:06 -0400 X-UUID: 0758c9be4181404e9004a4f966717179-20190820 X-UUID: 0758c9be4181404e9004a4f966717179-20190820 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 757742129; Tue, 20 Aug 2019 13:37:58 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 20 Aug 2019 13:37:57 +0800 Received: from [172.21.84.99] (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 20 Aug 2019 13:37:57 +0800 Message-ID: <1566279478.9993.21.camel@mtksdccf07> Subject: Re: [PATCH v4] kasan: add memory corruption identification for software tag-based mode From: Walter Wu To: Andrey Ryabinin CC: Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , "Andrew Morton" , Martin Schwidefsky , Arnd Bergmann , Thomas Gleixner , Vasily Gorbik , Andrey Konovalov , Miles Chen , , , , , , Date: Tue, 20 Aug 2019 13:37:58 +0800 In-Reply-To: <20190806054340.16305-1-walter-zh.wu@mediatek.com> References: <20190806054340.16305-1-walter-zh.wu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-08-06 at 13:43 +0800, Walter Wu wrote: > This patch adds memory corruption identification at bug report for > software tag-based mode, the report show whether it is "use-after-free" > or "out-of-bound" error instead of "invalid-access" error. This will make > it easier for programmers to see the memory corruption problem. > > We extend the slab to store five old free pointer tag and free backtrace, > we can check if the tagged address is in the slab record and make a > good guess if the object is more like "use-after-free" or "out-of-bound". > therefore every slab memory corruption can be identified whether it's > "use-after-free" or "out-of-bound". > > ====== Changes > Change since v1: > - add feature option CONFIG_KASAN_SW_TAGS_IDENTIFY. > - change QUARANTINE_FRACTION to reduce quarantine size. > - change the qlist order in order to find the newest object in quarantine > - reduce the number of calling kmalloc() from 2 to 1 time. > - remove global variable to use argument to pass it. > - correct the amount of qobject cache->size into the byes of qlist_head. > - only use kasan_cache_shrink() to shink memory. > > Change since v2: > - remove the shinking memory function kasan_cache_shrink() > - modify the description of the CONFIG_KASAN_SW_TAGS_IDENTIFY > - optimize the quarantine_find_object() and qobject_free() > - fix the duplicating function name 3 times in the header. > - modify the function name set_track() to kasan_set_track() > > Change since v3: > - change tag-based quarantine to extend slab to identify memory corruption Hi,Andrey, Would you review the patch,please? This patch is to pre-allocate slub record(tag and free backtrace) during create slub object. When kernel has memory corruption, it will print correct corruption type and free backtrace. Thanks. Walter