From patchwork Mon Aug 24 08:10:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11732313 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 714D214F6 for ; Mon, 24 Aug 2020 08:10:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3A53C2075B for ; Mon, 24 Aug 2020 08:10:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="UlZb2/C7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A53C2075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 638D36B0002; Mon, 24 Aug 2020 04:10:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5ED256B0005; Mon, 24 Aug 2020 04:10:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FFAD6B0006; Mon, 24 Aug 2020 04:10:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0119.hostedemail.com [216.40.44.119]) by kanga.kvack.org (Postfix) with ESMTP id 382D66B0002 for ; Mon, 24 Aug 2020 04:10:42 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E5F4C181AEF1E for ; Mon, 24 Aug 2020 08:10:41 +0000 (UTC) X-FDA: 77184740682.18.hate72_330c0a327051 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id B9800100EC664 for ; Mon, 24 Aug 2020 08:10:41 +0000 (UTC) X-Spam-Summary: 1,0,0,4895615b9e7d8659,d41d8cd98f00b204,walter-zh.wu@mediatek.com,,RULES_HIT:41:355:379:541:800:960:966:968:973:988:989:1185:1260:1277:1311:1313:1314:1345:1431:1437:1514:1515:1516:1518:1534:1541:1585:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2731:2899:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:4250:4321:4385:5007:6261:6653:7875:8660:10004:10400:11026:11232:11473:11658:11914:12043:12048:12296:12297:12438:12521:12555:12895:13069:13148:13161:13229:13230:13311:13357:13972:14096:14097:14181:14394:14721:21080:21324:21451:21627:21740:21795:21939:30012:30029:30051:30054,0,RBL:210.61.82.183:@mediatek.com:.lbl8.mailshell.net-64.100.201.201 62.2.12.100;04y8kg7zn9r9rnnuq1h7jbkwqpbc9oppkwpkutnhn8q1zxpn3a3tqgs73ex6t7b.6g3157xnrpsaj9qazf7d89a6htrq1hkha3teaqxkswia5yzp9z6iifdwt7eec1o.q-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0, LFtime:2 X-HE-Tag: hate72_330c0a327051 X-Filterd-Recvd-Size: 4823 Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Aug 2020 08:10:40 +0000 (UTC) X-UUID: 8f767e7d6354430589917989e468e817-20200824 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=r0Oq0tBfZ8jFMLMVK7p67PPtKlTRIAQp8x2ll2ZCeYU=; b=UlZb2/C7+hXXHoBO+SQsDMsV+yZLneeDJDp7fQOKoqb/XrlKTMpksIia2h5kGKDHzQUmj6cmBMUs2e7pCBvdgPqCNkc/ZHY0xULq+Mk/Trg8GI9peijg/HJo1t7MKzcuGPrXBzJkXxdUStTosY2OoRjexBzl9FemnsajuO+57pE=; X-UUID: 8f767e7d6354430589917989e468e817-20200824 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 2023979013; Mon, 24 Aug 2020 16:10:35 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 24 Aug 2020 16:10:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 24 Aug 2020 16:10:33 +0800 From: Walter Wu To: Marco Elver , Thomas Gleixner , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , John Stultz , Stephen Boyd , Andrew Morton CC: , , , , wsd_upstream , , Walter Wu Subject: [PATCH v2 1/6] timer: kasan: record timer stack Date: Mon, 24 Aug 2020 16:10:33 +0800 Message-ID: <20200824081033.24786-1-walter-zh.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-TM-SNTS-SMTP: 378A0C9A9031AA52783956160D35589390C54B78AF36FD01C7D67ABD9CD1A3072000:8 X-MTK: N X-Rspamd-Queue-Id: B9800100EC664 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When analyze use-after-free or double-free issue, recording the timer stacks is helpful to to preserve usage history which potentially gives a hint about the affected code. Record the most recent two timer init calls in KASAN which are printed on failure in the KASAN report. For timers it has turned out to be useful to record the stack trace of the timer init call. Because if the UAF root cause is in timer init, then user can see KASAN report to get where it is registered and find out the root cause. It don't need to enable DEBUG_OBJECTS_TIMERS, but they have a chance to find out the root cause. Signed-off-by: Walter Wu Suggested-by: Marco Elver Suggested-by: Thomas Gleixner Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: John Stultz Cc: Thomas Gleixner Cc: Stephen Boyd --- v2: - Thanks for Marco and Thomas suggestion. - Remove unnecessary code and fix commit log - reuse kasan_record_aux_stack() and aux_stack to record timer and workqueue stack. --- kernel/time/timer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index a16764b0116e..1ed8f8aca7f5 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -796,6 +796,9 @@ static void do_init_timer(struct timer_list *timer, timer->function = func; timer->flags = flags | raw_smp_processor_id(); lockdep_init_map(&timer->lockdep_map, name, key, 0); + + /* record the timer stack in order to print it in KASAN report */ + kasan_record_aux_stack(timer); } /** From patchwork Mon Aug 24 08:11:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11732319 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F326314F6 for ; Mon, 24 Aug 2020 08:11:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B4294207D3 for ; Mon, 24 Aug 2020 08:11:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="mxlEXcwl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4294207D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 093816B0002; Mon, 24 Aug 2020 04:11:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 046BE6B0005; Mon, 24 Aug 2020 04:11:47 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E757E6B0006; Mon, 24 Aug 2020 04:11:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id D09A06B0002 for ; Mon, 24 Aug 2020 04:11:46 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9548E1EE6 for ; Mon, 24 Aug 2020 08:11:46 +0000 (UTC) X-FDA: 77184743412.11.time17_0e01ac727051 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 6CFF3180F8B81 for ; Mon, 24 Aug 2020 08:11:46 +0000 (UTC) X-Spam-Summary: 1,0,0,eae1d9e082b466f4,d41d8cd98f00b204,walter-zh.wu@mediatek.com,,RULES_HIT:41:355:379:541:800:960:966:968:973:988:989:1185:1260:1277:1311:1313:1314:1345:1431:1437:1514:1515:1516:1518:1534:1541:1585:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2731:2902:2907:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3871:3872:4250:4385:5007:6261:6653:7514:7875:8660:9707:10004:10400:11026:11232:11658:11914:12048:12296:12297:12438:12521:12555:12895:13069:13148:13230:13311:13357:14096:14097:14181:14394:14721:21080:21324:21451:21627:21740:21795:21939:30012:30051:30054,0,RBL:210.61.82.184:@mediatek.com:.lbl8.mailshell.net-62.2.12.100 64.100.201.201;04yrpf1k6jy4b9sxxd1b3tiydmtd7opueotxjy7nuztdo8g148owd4g68fu7t78.ndkbd8sd4zq6k63icriutzashtamujq85anou6ro78eed3urymoi3rzdtwkx8gj.s-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: time17_0e01ac727051 X-Filterd-Recvd-Size: 4438 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Aug 2020 08:11:45 +0000 (UTC) X-UUID: b5572d05064548b889a8982518a003d1-20200824 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=QjiWiguuQ5aBJrBkNVTbpiMEZNHatuVj+uLpNS9djNY=; b=mxlEXcwlPGq4ITuqKjob6DpZ8N5oH61180ZWGgBdDun9qXQj72HFhmK/V8X4q3G9kl2yAYm6FSgpM5c5ihzIUqgibZHWDqrCmywqFiC7HhRSBuc+PjKk+JXdgesGiIyI4LKFDZyA19VZjNdXtw5bQU5sLYT3EqHNEwy+Ev9UXp4=; X-UUID: b5572d05064548b889a8982518a003d1-20200824 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1824185160; Mon, 24 Aug 2020 16:11:40 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 24 Aug 2020 16:11:39 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 24 Aug 2020 16:11:37 +0800 From: Walter Wu To: Marco Elver , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , Andrew Morton , Tejun Heo , Lai Jiangshan CC: , , , , wsd_upstream , , Walter Wu Subject: [PATCH v2 2/6] workqueue: kasan: record workqueue stack Date: Mon, 24 Aug 2020 16:11:36 +0800 Message-ID: <20200824081137.24868-1-walter-zh.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-TM-SNTS-SMTP: D0B37EE3B138F4637CDEA086AC379B046EFA71CCCB3AF00EA178387DE11421E22000:8 X-MTK: N X-Rspamd-Queue-Id: 6CFF3180F8B81 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Records the last two enqueuing work call stacks in order to print them in KASAN report. It is useful for programmers to solve use-after-free or double-free memory workqueue issue. For workqueue it has turned out to be useful to record the enqueuing work call stacks. Because user can see KASAN report to determine whether it is root cause. They don't need to enable debugobjects, but they have a chance to find out the root cause. Signed-off-by: Walter Wu Suggested-by: Marco Elver Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Tejun Heo Cc: Lai Jiangshan --- v2: - Thanks for Marco suggestion. - Remove unnecessary code - reuse kasan_record_aux_stack() and aux_stack to record timer and workqueue stack --- kernel/workqueue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c41c3c17b86a..5fea7dc9180f 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -1324,6 +1324,9 @@ static void insert_work(struct pool_workqueue *pwq, struct work_struct *work, { struct worker_pool *pool = pwq->pool; + /* record the work call stack in order to print it in KASAN reports */ + kasan_record_aux_stack(work); + /* we own @work, set data and link */ set_work_pwq(work, pwq, extra_flags); list_add_tail(&work->entry, head); From patchwork Mon Aug 24 08:12:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11732321 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 844B61392 for ; Mon, 24 Aug 2020 08:12:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 400C32072D for ; Mon, 24 Aug 2020 08:12:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="kpoLH2aZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 400C32072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 80DBC6B0005; Mon, 24 Aug 2020 04:12:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7BD4B6B0006; Mon, 24 Aug 2020 04:12:32 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AD166B0007; Mon, 24 Aug 2020 04:12:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id 555A26B0005 for ; Mon, 24 Aug 2020 04:12:32 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1F354180AD81D for ; Mon, 24 Aug 2020 08:12:32 +0000 (UTC) X-FDA: 77184745344.24.pies01_2b01a9627051 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id E0D221A4A0 for ; Mon, 24 Aug 2020 08:12:31 +0000 (UTC) X-Spam-Summary: 1,0,0,89ceef6db6692f61,d41d8cd98f00b204,walter-zh.wu@mediatek.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1185:1260:1277:1311:1313:1314:1345:1431:1437:1514:1515:1516:1518:1534:1541:1585:1711:1730:1747:1777:1792:1981:2194:2198:2199:2200:2393:2559:2562:2731:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3871:3874:4250:5007:6261:6653:7875:8660:9707:10004:10400:11026:11232:11473:11658:11914:12043:12048:12296:12297:12438:12521:12555:12895:13069:13148:13161:13229:13230:13311:13357:14181:14394:14721:21080:21451:21627:21740:21939:30029:30054:30070,0,RBL:210.61.82.184:@mediatek.com:.lbl8.mailshell.net-62.2.12.100 64.100.201.201;04ygi7b3eiifmkomej6ggwtu7ff8eoconke5x1jhkxt6pq1cg15sexg7d1tya1o.wgwfq86aka5qb91i591wk5ah6gbemy6z3dwdk1uoofsn56m9rehuqua1oyitcwz.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:99,LUA_SUMMARY:none X-HE-Tag: pies01_2b01a9627051 X-Filterd-Recvd-Size: 4142 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Aug 2020 08:12:30 +0000 (UTC) X-UUID: 0e1feef9c4bc47e6955e9d1135fde177-20200824 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=HDzXMXMz+Dzcg9DxfMTu2qwgwLYa3ujPve0aUqFM/KA=; b=kpoLH2aZI2pLa/Ty/SwW+EtHT4L5E7rv7qzHiwGTOLFNZe0/t1DZ62i3/oHfLX+wIwWmdg7CwUiLZZRLIqY5Ww0xOPBGuuuQLb/VrtLG8RZYYKRmuepxq6Iivyki5qw5Bhr8fFvmqoVZtztbYYvWmOopk5t0obQFbsd1fkM5zjU=; X-UUID: 0e1feef9c4bc47e6955e9d1135fde177-20200824 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1710976290; Mon, 24 Aug 2020 16:12:25 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 24 Aug 2020 16:12:24 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 24 Aug 2020 16:12:22 +0800 From: Walter Wu To: Marco Elver , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger CC: , , , , wsd_upstream , , Walter Wu Subject: [PATCH v2 3/6] kasan: print timer and workqueue stack Date: Mon, 24 Aug 2020 16:12:22 +0800 Message-ID: <20200824081222.24919-1-walter-zh.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-TM-SNTS-SMTP: 5E5BAFD4F7B10F653AFF65497632B9740AE0E97ECCFB021D2E7A102F9709DC8E2000:8 X-MTK: N X-Rspamd-Queue-Id: E0D221A4A0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000951, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The aux_stack[2] is reused to record the call_rcu() call stack, timer init call stack, and enqueuing work call stacks. So that we need to change the auxiliary stack title for common title, print them in KASAN report. Signed-off-by: Walter Wu Suggested-by: Marco Elver Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko --- v2: - Thanks for Marco suggestion. - We modify aux stack title name in KASAN report in order to print call_rcu()/timer/workqueue stack. --- mm/kasan/report.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 4f49fa6cd1aa..886809d0a8dd 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -183,12 +183,12 @@ static void describe_object(struct kmem_cache *cache, void *object, #ifdef CONFIG_KASAN_GENERIC if (alloc_info->aux_stack[0]) { - pr_err("Last call_rcu():\n"); + pr_err("Last potentially related work creation:\n"); print_stack(alloc_info->aux_stack[0]); pr_err("\n"); } if (alloc_info->aux_stack[1]) { - pr_err("Second to last call_rcu():\n"); + pr_err("Second to last potentially related work creation:\n"); print_stack(alloc_info->aux_stack[1]); pr_err("\n"); } From patchwork Mon Aug 24 08:13:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11732323 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1EE9114F6 for ; Mon, 24 Aug 2020 08:13:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D3A362075B for ; Mon, 24 Aug 2020 08:13:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="rA/byCzr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3A362075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 28EDB6B0002; Mon, 24 Aug 2020 04:13:21 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2665F6B0006; Mon, 24 Aug 2020 04:13:21 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 17CBA6B0007; Mon, 24 Aug 2020 04:13:21 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0128.hostedemail.com [216.40.44.128]) by kanga.kvack.org (Postfix) with ESMTP id 020B96B0002 for ; Mon, 24 Aug 2020 04:13:20 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AC7181EF1 for ; Mon, 24 Aug 2020 08:13:20 +0000 (UTC) X-FDA: 77184747360.20.salt41_5c0037527051 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 8006F180C07AB for ; Mon, 24 Aug 2020 08:13:20 +0000 (UTC) X-Spam-Summary: 1,0,0,e91ff19d7688e845,d41d8cd98f00b204,walter-zh.wu@mediatek.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1185:1260:1277:1311:1313:1314:1345:1431:1437:1514:1515:1516:1518:1534:1542:1585:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2915:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3872:4250:4321:4385:5007:6261:6653:7514:7903:10004:10400:10450:10455:11026:11658:11914:12043:12048:12291:12296:12297:12438:12521:12555:12679:12895:13161:13229:14181:14394:14721:19904:19999:21080:21451:21627:21740:21990:30054,0,RBL:210.61.82.184:@mediatek.com:.lbl8.mailshell.net-62.2.12.100 64.100.201.201;04yrp8jnottdmotorh7baqhq4ba3iocyh6fdfyaqs4gocx1ojnek8z461f9niti.3ko4g68ppoxuhk8owh3idipkzc87g7y3nsqh4ruwosse4f1qim5ri9tf16inm39.a-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: salt41_5c0037527051 X-Filterd-Recvd-Size: 4929 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Aug 2020 08:13:19 +0000 (UTC) X-UUID: 9c950f80946c46fbae63dea326b723a3-20200824 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=epF31PMWeocflqrG14ZTfXrn/tbNID2roIzjg+E6Ras=; b=rA/byCzrHWm2LRJdWHSOwDe0afU8MzZkAN2l1L4fJRqvdg8axYzDTPBZGPRGXFqQ2gxnvqVvLL7ejE9UEUuJrbWPDRYQzDLO87wizm1tmaGAD564UWPi961UjNISRkhbXeXGOUNXjiN5qy+WtOkL4BHFGX6OsfqtglamYSD6G/4=; X-UUID: 9c950f80946c46fbae63dea326b723a3-20200824 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1057839245; Mon, 24 Aug 2020 16:13:16 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 24 Aug 2020 16:13:13 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 24 Aug 2020 16:13:13 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger CC: , , , , wsd_upstream , , Walter Wu , Andrey Konovalov Subject: [PATCH v2 4/6] kasan: add tests for timer stack recording Date: Mon, 24 Aug 2020 16:13:12 +0800 Message-ID: <20200824081312.24972-1-walter-zh.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-Rspamd-Queue-Id: 8006F180C07AB X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Adds a test to verify timer stack recording and print it in KASAN report. The KASAN report was as follows(cleaned up slightly): BUG: KASAN: use-after-free in kasan_timer_uaf Freed by task 0: kasan_save_stack+0x24/0x50 kasan_set_track+0x24/0x38 kasan_set_free_info+0x20/0x40 __kasan_slab_free+0x10c/0x170 kasan_slab_free+0x10/0x18 kfree+0x98/0x270 kasan_timer_function+0x1c/0x28 Last potentially related work creation: kasan_save_stack+0x24/0x50 kasan_record_tmr_stack+0xa8/0xb8 init_timer_key+0xf0/0x248 kasan_timer_uaf+0x5c/0xd8 Signed-off-by: Walter Wu Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Matthias Brugger Cc: Andrey Konovalov --- lib/test_kasan.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 6e5fb05d42d8..2bd61674c7a3 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -821,6 +821,30 @@ static noinline void __init kasan_rcu_uaf(void) call_rcu(&global_ptr->rcu, kasan_rcu_reclaim); } +static noinline void __init kasan_timer_function(struct timer_list *timer) +{ + del_timer(timer); + kfree(timer); +} + +static noinline void __init kasan_timer_uaf(void) +{ + struct timer_list *timer; + + timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL); + if (!timer) { + pr_err("Allocation failed\n"); + return; + } + + timer_setup(timer, kasan_timer_function, 0); + add_timer(timer); + msleep(100); + + pr_info("use-after-free on timer\n"); + ((volatile struct timer_list *)timer)->expires; +} + static int __init kmalloc_tests_init(void) { /* @@ -869,6 +893,7 @@ static int __init kmalloc_tests_init(void) kmalloc_double_kzfree(); vmalloc_oob(); kasan_rcu_uaf(); + kasan_timer_uaf(); kasan_restore_multi_shot(multishot); From patchwork Mon Aug 24 08:13:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11732325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 690921392 for ; Mon, 24 Aug 2020 08:14:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 341E22072D for ; Mon, 24 Aug 2020 08:14:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="uJ8vU0ro" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 341E22072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4B1576B0005; Mon, 24 Aug 2020 04:14:07 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 488C86B0006; Mon, 24 Aug 2020 04:14:07 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A3176B0007; Mon, 24 Aug 2020 04:14:07 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id 23C0A6B0005 for ; Mon, 24 Aug 2020 04:14:07 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DD44A180AD81D for ; Mon, 24 Aug 2020 08:14:06 +0000 (UTC) X-FDA: 77184749292.27.bird42_3a004a127051 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id AD3D63D669 for ; Mon, 24 Aug 2020 08:14:06 +0000 (UTC) X-Spam-Summary: 1,0,0,36f6b4f44dd420cd,d41d8cd98f00b204,walter-zh.wu@mediatek.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1185:1260:1277:1311:1313:1314:1345:1431:1437:1514:1515:1516:1518:1535:1542:1585:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2915:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3872:4250:4385:5007:6261:6653:7514:7903:9707:10004:10400:11026:11658:11914:12043:12048:12291:12296:12297:12438:12521:12555:12679:12895:13161:13229:14181:14394:14721:21080:21451:21627:21740:21990:30054,0,RBL:210.61.82.184:@mediatek.com:.lbl8.mailshell.net-62.2.12.100 64.100.201.201;04ygrdht4pbrsoyc9g3z3zww5izn8yp86k1nnyp5nabz9p1ijeecy4sfhqj8k5f.ttcmmz6cby164afzzsxz4w3sohe68qybq6frnknm7g6wfj3yxop4zohj3kt8ztx.h-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: bird42_3a004a127051 X-Filterd-Recvd-Size: 5339 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Aug 2020 08:14:05 +0000 (UTC) X-UUID: 2ecc87aeceac47838ad5479d78cbd960-20200824 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=+uEb+COBoPnYhqxN0aa+Ix9E1vWCkdkDaOsAXwUlrdg=; b=uJ8vU0roc0i8VqruIbe66ieF+3I0FyWDQ1R61Wdcnmn8SyqJYOxEfJIuqoq4f/TfTwSzBuvKCHSPnJZ/1Jk+K0umBir9gQOfc3AylktUZHKHgPJRIRNx0aN/pDGnpqqFzlxUj9cblAyFDgK06fmigPppxxhiva7aO4aljdwbFsM=; X-UUID: 2ecc87aeceac47838ad5479d78cbd960-20200824 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 581680036; Mon, 24 Aug 2020 16:14:02 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 24 Aug 2020 16:14:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 24 Aug 2020 16:13:53 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger CC: , , , , wsd_upstream , , Walter Wu , Andrey Konovalov Subject: [PATCH v2 5/6] kasan: add tests for workqueue stack recording Date: Mon, 24 Aug 2020 16:13:53 +0800 Message-ID: <20200824081353.25148-1-walter-zh.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-TM-SNTS-SMTP: CFFFFCDCAE5D98C607740B946277915AD6F16FFC3CBDE2FE94B34C4765AF670B2000:8 X-MTK: N X-Rspamd-Queue-Id: AD3D63D669 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Adds a test to verify workqueue stack recording and print it in KASAN report. The KASAN report was as follows(cleaned up slightly): BUG: KASAN: use-after-free in kasan_workqueue_uaf Freed by task 54: kasan_save_stack+0x24/0x50 kasan_set_track+0x24/0x38 kasan_set_free_info+0x20/0x40 __kasan_slab_free+0x10c/0x170 kasan_slab_free+0x10/0x18 kfree+0x98/0x270 kasan_workqueue_work+0xc/0x18 Last potentially related work creation: kasan_save_stack+0x24/0x50 kasan_record_wq_stack+0xa8/0xb8 insert_work+0x48/0x288 __queue_work+0x3e8/0xc40 queue_work_on+0xf4/0x118 kasan_workqueue_uaf+0xfc/0x190 Signed-off-by: Walter Wu Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Matthias Brugger Cc: Andrey Konovalov --- lib/test_kasan.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 2bd61674c7a3..7293a55ff51c 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -845,6 +845,34 @@ static noinline void __init kasan_timer_uaf(void) ((volatile struct timer_list *)timer)->expires; } +static noinline void __init kasan_workqueue_work(struct work_struct *work) +{ + kfree(work); +} + +static noinline void __init kasan_workqueue_uaf(void) +{ + struct workqueue_struct *workqueue; + struct work_struct *work; + + workqueue = create_workqueue("kasan_wq_test"); + if (!workqueue) { + pr_err("Allocation failed\n"); + return; + } + work = kmalloc(sizeof(struct work_struct), GFP_KERNEL); + if (!work) { + pr_err("Allocation failed\n"); + return; + } + + INIT_WORK(work, kasan_workqueue_work); + queue_work(workqueue, work); + destroy_workqueue(workqueue); + + pr_info("use-after-free on workqueue\n"); + ((volatile struct work_struct *)work)->data; +} static int __init kmalloc_tests_init(void) { /* @@ -894,6 +922,7 @@ static int __init kmalloc_tests_init(void) vmalloc_oob(); kasan_rcu_uaf(); kasan_timer_uaf(); + kasan_workqueue_uaf(); kasan_restore_multi_shot(multishot); From patchwork Mon Aug 24 08:14:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11732331 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03B431392 for ; Mon, 24 Aug 2020 08:14:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C2B6F208E4 for ; Mon, 24 Aug 2020 08:14:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="aFxz1yah" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2B6F208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 17CE66B0006; Mon, 24 Aug 2020 04:14:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 153B76B0007; Mon, 24 Aug 2020 04:14:41 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06A636B0008; Mon, 24 Aug 2020 04:14:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id E54AA6B0006 for ; Mon, 24 Aug 2020 04:14:40 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A2D9C180AD820 for ; Mon, 24 Aug 2020 08:14:40 +0000 (UTC) X-FDA: 77184750720.27.tooth66_0616d6b27051 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 6BB543D668 for ; Mon, 24 Aug 2020 08:14:40 +0000 (UTC) X-Spam-Summary: 1,0,0,5409add0b68a9bbb,d41d8cd98f00b204,walter-zh.wu@mediatek.com,,RULES_HIT:41:355:379:421:541:800:960:973:988:989:1042:1185:1260:1277:1311:1313:1314:1345:1431:1437:1514:1515:1516:1518:1534:1541:1585:1711:1730:1747:1777:1792:1978:1981:2194:2198:2199:2200:2393:2559:2562:2895:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3872:3874:4250:4321:5007:6119:6261:6653:8660:10004:10400:11232:11658:11914:12043:12048:12198:12297:12521:12555:12895:13069:13148:13200:13229:13230:13311:13357:14181:14394:14721:21080:21451:21627:21740:21772:21939:30012:30054:30070,0,RBL:210.61.82.184:@mediatek.com:.lbl8.mailshell.net-64.100.201.201 62.2.12.100;04y89a8hn83yixkfx66ijiamdmez9ypp17xgt166wq3ezyh9zaiz1ki5qgcmzwc.i957cmmcq7g61mq43e713g7n7fuifhgq9hjeuxxfzjicbqr3comtnfscx6q6hrn.s-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: tooth66_0616d6b27051 X-Filterd-Recvd-Size: 3841 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Aug 2020 08:14:39 +0000 (UTC) X-UUID: 3df8a9808a0645cbb9ff4172bda44e44-20200824 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=fp5BvuMv6aQW1kwsMMF3iiFeaB50z+78RNwBXksdEww=; b=aFxz1yahULKuViUbuEu5f6W4K69DN9zWkFlKCHiOPfFwHNtzrU4lem++Bsi/FuxYWF+R2ymNbztLY2EeVYxYOWCcOREgbjKiXhFNya48JSdYJ7jjiaEvUnmcpsd1ij/iXF6qqZM7cHYq7qoLrK1tSxdEmUKMOfLPxMXO5XfEfFQ=; X-UUID: 3df8a9808a0645cbb9ff4172bda44e44-20200824 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 2082476556; Mon, 24 Aug 2020 16:14:36 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 24 Aug 2020 16:14:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 24 Aug 2020 16:14:33 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , Jonathan Corbet CC: , , , , wsd_upstream , , Walter Wu Subject: [PATCH v2 6/6] kasan: update documentation for generic kasan Date: Mon, 24 Aug 2020 16:14:33 +0800 Message-ID: <20200824081433.25198-1-walter-zh.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-Rspamd-Queue-Id: 6BB543D668 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.037191, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Generic KASAN support to record the last two timer and workqueue stacks and print them in KASAN report. So that need to update documentation. Signed-off-by: Walter Wu Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Jonathan Corbet --- Documentation/dev-tools/kasan.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index fede42e6536b..5a4c5da8bda8 100644 --- a/Documentation/dev-tools/kasan.rst +++ b/Documentation/dev-tools/kasan.rst @@ -193,8 +193,8 @@ function calls GCC directly inserts the code to check the shadow memory. This option significantly enlarges kernel but it gives x1.1-x2 performance boost over outline instrumented kernel. -Generic KASAN prints up to 2 call_rcu() call stacks in reports, the last one -and the second to last. +Generic KASAN prints up to 2 call_rcu() call stacks, timer queueing stacks, +or workqueue queueing stacks in reports, the last one and the second to last. Software tag-based KASAN ~~~~~~~~~~~~~~~~~~~~~~~~