From patchwork Mon Aug 10 07:23:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11707037 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 CB2E8138C for ; Mon, 10 Aug 2020 07:23:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 959612073E for ; Mon, 10 Aug 2020 07:23:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="mUc+I3UY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 959612073E 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 AD4C76B0003; Mon, 10 Aug 2020 03:23:23 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A84536B0005; Mon, 10 Aug 2020 03:23:23 -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 99C068D0001; Mon, 10 Aug 2020 03:23:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 84E6E6B0003 for ; Mon, 10 Aug 2020 03:23:23 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 40DC5180AD804 for ; Mon, 10 Aug 2020 07:23:23 +0000 (UTC) X-FDA: 77133818286.05.swim30_231029e26fd8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 16CFA1801788A for ; Mon, 10 Aug 2020 07:23:23 +0000 (UTC) X-Spam-Summary: 1,0,0,2c570c6272c3c1d3,d41d8cd98f00b204,walter-zh.wu@mediatek.com,,RULES_HIT:41:355:379:421:541:800:960:966:973:988:989:1185:1260:1277:1311:1313:1314:1345:1431:1437:1514:1515:1516:1518:1535:1544:1585:1711:1730:1747:1777:1792:1981:2194:2196:2198:2199:2200:2201:2393:2559:2562:2731:2907:3138:3139:3140:3141:3142:3355:3865:3867:3868:3870:3871:3872:4119:4250:4321:4385:4605:5007:6261:6653:8660:8957:10004:11026:11473:11658:11914:12043:12048:12291:12296:12297:12438:12521:12555:12895:13148:13230:14181:14394:14721:21080:21451:21627:21939:21990:30029:30054,0,RBL:210.61.82.183:@mediatek.com:.lbl8.mailshell.net-64.100.201.201 62.2.12.100;04yfttsfk7owmxaj6hpyyr9az3xbyycdiozbaydzgp4qxdpfgaj6s6b4hiiaewj.7rrowa7t394cerxtp1hdreccdzitjwpag3ba4kakbwbfntjpar5s64d1mo3jpb8.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:24,LUA_SUMMARY:none X-HE-Tag: swim30_231029e26fd8 X-Filterd-Recvd-Size: 8313 Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Aug 2020 07:23:21 +0000 (UTC) X-UUID: a2a2e3ec4d1e4852ae6c1321513c1dbc-20200810 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=PpSc/tEQuCx3Ee+gj4Ko/cEUAbvYmxsK1TcRUj0zqIE=; b=mUc+I3UYkH6D5bMqSwM0Z2C483rqHVq6lSsH5OADMnuNFWEb24s6QtIuT7rCeJ8hUKIWjczy1obNaHtGA892W56rwWuDunYSHh8s1suqhZ37d64RoeuqFBThFO1sTDEGfKEBmxQyzEGN12cUqmhGgTFZbtR1/SH6t4IRnZLkDic=; X-UUID: a2a2e3ec4d1e4852ae6c1321513c1dbc-20200810 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1729549305; Mon, 10 Aug 2020 15:23:16 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 Aug 2020 15:23:13 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 Aug 2020 15:23:13 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , John Stultz , Stephen Boyd , Andrew Morton CC: , , , , wsd_upstream , , Walter Wu , Thomas Gleixner Subject: [PATCH 1/5] timer: kasan: record and print timer stack Date: Mon, 10 Aug 2020 15:23:13 +0800 Message-ID: <20200810072313.529-1-walter-zh.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-TM-SNTS-SMTP: 98F01DCE42DA20CE4E3012D87E3ABB3D61BAAF8BDBEAA7561BC5D251A16DF3722000:8 X-MTK: N X-Rspamd-Queue-Id: 16CFA1801788A 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: This patch records the last two timer queueing stacks and prints up to 2 timer stacks in KASAN report. It is useful for programmers to solve use-after-free or double-free memory timer issues. When timer_setup() or timer_setup_on_stack() is called, then it prepares to use this timer and sets timer callback, we store this call stack in order to print it in KASAN report. Signed-off-by: Walter Wu Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Thomas Gleixner Cc: John Stultz Cc: Stephen Boyd Cc: Andrew Morton --- include/linux/kasan.h | 2 ++ kernel/time/timer.c | 2 ++ mm/kasan/generic.c | 21 +++++++++++++++++++++ mm/kasan/kasan.h | 4 +++- mm/kasan/report.c | 11 +++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/include/linux/kasan.h b/include/linux/kasan.h index 23b7ee00572d..763664b36dc6 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -175,12 +175,14 @@ static inline size_t kasan_metadata_size(struct kmem_cache *cache) { return 0; } void kasan_cache_shrink(struct kmem_cache *cache); void kasan_cache_shutdown(struct kmem_cache *cache); void kasan_record_aux_stack(void *ptr); +void kasan_record_tmr_stack(void *ptr); #else /* CONFIG_KASAN_GENERIC */ static inline void kasan_cache_shrink(struct kmem_cache *cache) {} static inline void kasan_cache_shutdown(struct kmem_cache *cache) {} static inline void kasan_record_aux_stack(void *ptr) {} +static inline void kasan_record_tmr_stack(void *ptr) {} #endif /* CONFIG_KASAN_GENERIC */ diff --git a/kernel/time/timer.c b/kernel/time/timer.c index a5221abb4594..ef2da9ddfac7 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -783,6 +783,8 @@ 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); + + kasan_record_tmr_stack(timer); } /** diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c index 4b3cbad7431b..f35dcec990ab 100644 --- a/mm/kasan/generic.c +++ b/mm/kasan/generic.c @@ -347,6 +347,27 @@ void kasan_record_aux_stack(void *addr) alloc_info->aux_stack[0] = kasan_save_stack(GFP_NOWAIT); } +void kasan_record_tmr_stack(void *addr) +{ + struct page *page = kasan_addr_to_page(addr); + struct kmem_cache *cache; + struct kasan_alloc_meta *alloc_info; + void *object; + + if (!(page && PageSlab(page))) + return; + + cache = page->slab_cache; + object = nearest_obj(cache, page, addr); + alloc_info = get_alloc_info(cache, object); + + /* + * record the last two timer stacks. + */ + alloc_info->tmr_stack[1] = alloc_info->tmr_stack[0]; + alloc_info->tmr_stack[0] = kasan_save_stack(GFP_NOWAIT); +} + void kasan_set_free_info(struct kmem_cache *cache, void *object, u8 tag) { diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index ef655a1c6e15..c50827f388a3 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -108,10 +108,12 @@ struct kasan_alloc_meta { struct kasan_track alloc_track; #ifdef CONFIG_KASAN_GENERIC /* - * call_rcu() call stack is stored into struct kasan_alloc_meta. + * call_rcu() call stack and timer queueing stack are stored + * into struct kasan_alloc_meta. * The free stack is stored into struct kasan_free_meta. */ depot_stack_handle_t aux_stack[2]; + depot_stack_handle_t tmr_stack[2]; #else struct kasan_track free_track[KASAN_NR_FREE_STACKS]; #endif diff --git a/mm/kasan/report.c b/mm/kasan/report.c index fed3c8fdfd25..6fa3bfee381f 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -191,6 +191,17 @@ static void describe_object(struct kmem_cache *cache, void *object, print_stack(alloc_info->aux_stack[1]); pr_err("\n"); } + + if (alloc_info->tmr_stack[0]) { + pr_err("Last timer stack:\n"); + print_stack(alloc_info->tmr_stack[0]); + pr_err("\n"); + } + if (alloc_info->tmr_stack[1]) { + pr_err("Second to last timer stack:\n"); + print_stack(alloc_info->tmr_stack[1]); + pr_err("\n"); + } #endif } From patchwork Mon Aug 10 07:25:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11707043 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 48FC1138C for ; Mon, 10 Aug 2020 07:25:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 14CC52075D for ; Mon, 10 Aug 2020 07:25:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="s6qdsFqZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14CC52075D 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 3A7B06B0003; Mon, 10 Aug 2020 03:25:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 358C76B0005; Mon, 10 Aug 2020 03:25:27 -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 26F5A8D0001; Mon, 10 Aug 2020 03:25:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0133.hostedemail.com [216.40.44.133]) by kanga.kvack.org (Postfix) with ESMTP id 10C356B0003 for ; Mon, 10 Aug 2020 03:25:27 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B797F8248047 for ; Mon, 10 Aug 2020 07:25:26 +0000 (UTC) X-FDA: 77133823452.18.bells32_560f61726fd8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 88103100EC683 for ; Mon, 10 Aug 2020 07:25:26 +0000 (UTC) X-Spam-Summary: 1,0,0,2ad40724160fa0f1,d41d8cd98f00b204,walter-zh.wu@mediatek.com,,RULES_HIT:41:355:379:421:541:800:960:966:973:988:989:1185:1260:1277:1311:1313:1314:1345:1431:1437:1514:1515:1516:1518:1535:1544:1585:1711:1730:1747:1777:1792:1981:2194:2196:2198:2199:2200:2201:2393:2559:2562:2731:2902:2907:3138:3139:3140:3141:3142:3355:3865:3867:3868:3870:3871:3872:4119:4250:4321:4385:4605:5007:6261:6653:7514:7903:8660:8957:9707:10004:11026:11473:11658:11914:12043:12048:12291:12296:12297:12438:12521:12555:12895:12986:13148:13230:14181:14394:14721:21080:21451:21627:21740:21939:21990:30054,0,RBL:210.61.82.184:@mediatek.com:.lbl8.mailshell.net-62.2.12.100 64.100.201.201;04yrqxt35cruiqcp4p5id4o4p4iaxyc6ef491rcw3kee4b4s7zjjpba7xxqq8ep.jknn5ogr1baeakqa8f3zaczbm7yti7pzx5a9neqij53th8u9jjfi93cq9pcfuge.1-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:24,LUA_SUMMARY:none X-HE-Tag: bells32_560f61726fd8 X-Filterd-Recvd-Size: 8517 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Aug 2020 07:25:25 +0000 (UTC) X-UUID: 941674fcae4649e68bed1d030d86ddc6-20200810 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=WMW/SN71MKFExQk+QjN4pv2EvhjdGtOmUqiO3skR3Gk=; b=s6qdsFqZgfHTw8w12yMlaVZGaejwQaGKrRcgqLaJxDbPse0oFVE3uUgkgQ7Nt1a5bRtcaggQKMIR0ZSGPAqKwiX0/hLQZ/Gws6L57DVKMe2ySYprY7pSmQxmmgaNevoyzX5NUBSFg3U7N6spjtCJVLIycw0XymEtkEUl4pzOaTo=; X-UUID: 941674fcae4649e68bed1d030d86ddc6-20200810 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 2068200356; Mon, 10 Aug 2020 15:25:19 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 Aug 2020 15:25:18 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 Aug 2020 15:25:15 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , Andrew Morton , Tejun Heo , Lai Jiangshan CC: , , , , wsd_upstream , , Walter Wu Subject: [PATCH 2/5] workqueue: kasan: record and print workqueue stack Date: Mon, 10 Aug 2020 15:25:15 +0800 Message-ID: <20200810072515.632-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: 88103100EC683 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: This patch records the last two enqueueing work call stacks on workqueue and prints up to 2 workqueue stacks in KASAN report. It is useful for programmers to solve use-after-free or double-free memory wq issue. When queue_work() is called, then queue the work into a workqueue, we store this call stack in order to print it in KASAN report. Signed-off-by: Walter Wu Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Alexander Potapenko Cc: Tejun Heo Cc: Lai Jiangshan Cc: Andrew Morton --- include/linux/kasan.h | 2 ++ kernel/workqueue.c | 3 +++ mm/kasan/generic.c | 21 +++++++++++++++++++++ mm/kasan/kasan.h | 8 +++++--- mm/kasan/report.c | 11 +++++++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/include/linux/kasan.h b/include/linux/kasan.h index 43ae040ae9b2..687cbf2faf83 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -174,6 +174,7 @@ void kasan_cache_shrink(struct kmem_cache *cache); void kasan_cache_shutdown(struct kmem_cache *cache); void kasan_record_aux_stack(void *ptr); void kasan_record_tmr_stack(void *ptr); +void kasan_record_wq_stack(void *ptr); #else /* CONFIG_KASAN_GENERIC */ @@ -181,6 +182,7 @@ static inline void kasan_cache_shrink(struct kmem_cache *cache) {} static inline void kasan_cache_shutdown(struct kmem_cache *cache) {} static inline void kasan_record_aux_stack(void *ptr) {} static inline void kasan_record_tmr_stack(void *ptr) {} +static inline void kasan_record_wq_stack(void *ptr) {} #endif /* CONFIG_KASAN_GENERIC */ diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c41c3c17b86a..0e5963e06730 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 in order to print it in KASAN reports */ + kasan_record_wq_stack(work); + /* we own @work, set data and link */ set_work_pwq(work, pwq, extra_flags); list_add_tail(&work->entry, head); diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c index 627792d11569..592dc58fbe42 100644 --- a/mm/kasan/generic.c +++ b/mm/kasan/generic.c @@ -367,6 +367,27 @@ void kasan_record_tmr_stack(void *addr) alloc_info->tmr_stack[0] = kasan_save_stack(GFP_NOWAIT); } +void kasan_record_wq_stack(void *addr) +{ + struct page *page = kasan_addr_to_page(addr); + struct kmem_cache *cache; + struct kasan_alloc_meta *alloc_info; + void *object; + + if (!(page && PageSlab(page))) + return; + + cache = page->slab_cache; + object = nearest_obj(cache, page, addr); + alloc_info = get_alloc_info(cache, object); + + /* + * record the last two workqueue stacks. + */ + alloc_info->wq_stack[1] = alloc_info->wq_stack[0]; + alloc_info->wq_stack[0] = kasan_save_stack(GFP_NOWAIT); +} + void kasan_set_free_info(struct kmem_cache *cache, void *object, u8 tag) { diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 4059f327767c..a4f76b1bde0a 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -108,12 +108,14 @@ struct kasan_alloc_meta { struct kasan_track alloc_track; #ifdef CONFIG_KASAN_GENERIC /* - * call_rcu() call stack and timer queueing stack are stored - * into struct kasan_alloc_meta. - * The free stack is stored into struct kasan_free_meta. + * call_rcu() call stack, timer queueing stack, and workqueue + * queueing stack are stored into kasan_alloc_meta. + * + * With generic KASAN the free stack is stored into kasan_free_meta. */ depot_stack_handle_t aux_stack[2]; depot_stack_handle_t tmr_stack[2]; + depot_stack_handle_t wq_stack[2]; #else struct kasan_track free_track[KASAN_NR_FREE_STACKS]; #endif diff --git a/mm/kasan/report.c b/mm/kasan/report.c index f602f090d90b..e6bc470fcd0a 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -203,6 +203,17 @@ static void describe_object(struct kmem_cache *cache, void *object, print_stack(alloc_info->tmr_stack[1]); pr_err("\n"); } + + if (alloc_info->wq_stack[0]) { + pr_err("Last workqueue stack:\n"); + print_stack(alloc_info->wq_stack[0]); + pr_err("\n"); + } + if (alloc_info->wq_stack[1]) { + pr_err("Second to last workqueue stack:\n"); + print_stack(alloc_info->wq_stack[1]); + pr_err("\n"); + } #endif } From patchwork Mon Aug 10 07:26:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11707045 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 CF37A13B6 for ; Mon, 10 Aug 2020 07:26:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9BAB42076C for ; Mon, 10 Aug 2020 07:26:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="GyJWAJ4X" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BAB42076C 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 D45496B0003; Mon, 10 Aug 2020 03:26:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CF5C66B0005; Mon, 10 Aug 2020 03:26:36 -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 BBE9D6B0006; Mon, 10 Aug 2020 03:26:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id A1B886B0003 for ; Mon, 10 Aug 2020 03:26:36 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5B269181AC9B6 for ; Mon, 10 Aug 2020 07:26:36 +0000 (UTC) X-FDA: 77133826392.08.alarm31_10058d326fd8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 1D8C31819E76C for ; Mon, 10 Aug 2020 07:26:36 +0000 (UTC) X-Spam-Summary: 1,0,0,233df5e63b1f581f,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:1541:1585:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2915:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870: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:13069:13161:13229:13311:13357:14181:14394:14721:19904:19999:21080:21451:21627:21990:30054,0,RBL:210.61.82.183:@mediatek.com:.lbl8.mailshell.net-62.2.12.100 64.100.201.201;04yrg1kwtejzusop5559s4xqzu9fuopeo15x6i7m64gocx1ojn7hpb8wjnhgax1.uf7dth8otxsrcq4yyhgt676xnajhfgqkqqzh4ruwosse5nnc4ob47136c8ngn64.4-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: alarm31_10058d326fd8 X-Filterd-Recvd-Size: 4815 Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Aug 2020 07:26:34 +0000 (UTC) X-UUID: 3103f9590f114368a6175e1b069cbd80-20200810 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=MiZ6leJF9tYuSzVOQIulz0H4R7mIPrSUOEtllZRLwmQ=; b=GyJWAJ4XvfW9O2Vc9O1hgQ/ZePfms5ONFEyEMB1bpJrHQ86G/mukGyOXcKBDGw8fzXjV0OLXQh73bMI6/u75pjVY7NA89PI7tRA/DaPezlV1cHKisZacM5wddZjxZZDf7uDvgNKEm3+muRVFcWfRq9WvmfBnL0ZDvSPk8BlAmy4=; X-UUID: 3103f9590f114368a6175e1b069cbd80-20200810 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 455172873; Mon, 10 Aug 2020 15:26:23 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 Aug 2020 15:26:22 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 Aug 2020 15:26:20 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger CC: , , , , wsd_upstream , , Walter Wu Subject: [PATCH 3/5] lib/test_kasan.c: add timer test case Date: Mon, 10 Aug 2020 15:26:20 +0800 Message-ID: <20200810072620.747-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: 1D8C31819E76C 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 case to verify timer stack recording and print the last timer stack 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 timer stack: 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 --- 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 10 07:27:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11707047 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 D317813B6 for ; Mon, 10 Aug 2020 07:27:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9F92D2076C for ; Mon, 10 Aug 2020 07:27:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="E71a/yQY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F92D2076C 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 E57726B0005; Mon, 10 Aug 2020 03:27:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E06366B0006; Mon, 10 Aug 2020 03:27:19 -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 CD1606B0007; Mon, 10 Aug 2020 03:27:19 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id B74A36B0005 for ; Mon, 10 Aug 2020 03:27:19 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 76B46824805A for ; Mon, 10 Aug 2020 07:27:19 +0000 (UTC) X-FDA: 77133828198.24.hole93_141559326fd8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 30BF51A4A0 for ; Mon, 10 Aug 2020 07:27:19 +0000 (UTC) X-Spam-Summary: 1,0,0,dc556ff1d50fe9e8,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:4250:4385:5007:6261:6653:7514:7903:9707:10004:10400:11026:11658:11914:12043:12048:12291:12296:12297:12438:12521:12555:12679:12683:12895:13161:13229:14181:14394:14721:21080:21451:21627:21740:21990:30054,0,RBL:210.61.82.183:@mediatek.com:.lbl8.mailshell.net-64.100.201.201 62.2.12.100;04yfk1kkgc5uyp4kyy84r89y341r3ope94smg3tgnabz9p1ijefw8f1rttkmay1.a8pk1z6cby164afsw7hrzrm476roffh9xg7yzfbxunnj1baadx6f6bqetnjxjda.g-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:24,LUA_SUMMARY:none X-HE-Tag: hole93_141559326fd8 X-Filterd-Recvd-Size: 5148 Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Aug 2020 07:27:17 +0000 (UTC) X-UUID: ce21aa2c3116486aa06a0f860cedb531-20200810 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=jm5/2VLDnPvpsF4CTFjMyvNKvdSPsuQ1Vi/sP3a85vU=; b=E71a/yQY3qtyRP5dzROkjRwN7WQdPs8t6K1K9fYtV2zFKtv4TCB0lRleLiJq2534KAfRL+mscEtelg0No7xbg4eb730kvYOA2pkqWu7olLSt4+MWc4HOJEmsoAh3qu5Z3XwZ3m7CJXgP6wvquovtIxH5KhQdgN7uM2YPins+aG4=; X-UUID: ce21aa2c3116486aa06a0f860cedb531-20200810 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 560984028; Mon, 10 Aug 2020 15:27:12 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 Aug 2020 15:27:09 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 Aug 2020 15:27:09 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger CC: , , , , wsd_upstream , , Walter Wu Subject: [PATCH 4/5] lib/test_kasan.c: add workqueue test case Date: Mon, 10 Aug 2020 15:27:09 +0800 Message-ID: <20200810072709.827-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: 30BF51A4A0 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 case to verify workqueue stack recording and print the last workqueue stack 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 workqueue stack: 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 --- lib/test_kasan.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index c3c6e22ec959..2c6c20cd154b 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -869,6 +869,35 @@ 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) { /* @@ -918,6 +947,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 10 07:28:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Wu X-Patchwork-Id: 11707059 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 B0D03138C for ; Mon, 10 Aug 2020 07:28:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7DACA2078B for ; Mon, 10 Aug 2020 07:28:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="qLCWArRY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DACA2078B 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 C0AE66B0005; Mon, 10 Aug 2020 03:28:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BBAFE6B0006; Mon, 10 Aug 2020 03:28:54 -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 A84556B0007; Mon, 10 Aug 2020 03:28:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id 91F2A6B0005 for ; Mon, 10 Aug 2020 03:28:54 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 54AF72493 for ; Mon, 10 Aug 2020 07:28:54 +0000 (UTC) X-FDA: 77133832188.13.hill34_4f1282c26fd8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 26F4518140B67 for ; Mon, 10 Aug 2020 07:28:54 +0000 (UTC) X-Spam-Summary: 1,0,0,dd84d1fc29c88232,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.183:@mediatek.com:.lbl8.mailshell.net-62.2.12.100 64.100.201.201;04y8tye5xtpcc4a61httj4nm95yytocyhocfecewcq3ezyh9zaiz1ki5qgcktrp.6xgqsqmcq7g61mq5acr1ah58giuifhgq9hjeuxxfzjicbqr3comtnfscx6q6hrn.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:24,LUA_SUMMARY:none X-HE-Tag: hill34_4f1282c26fd8 X-Filterd-Recvd-Size: 3839 Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Aug 2020 07:28:53 +0000 (UTC) X-UUID: 664afc6c40cf4209a5f22d6ad54708c7-20200810 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=fNYSYPr/EUtrb5AE0HZcFt+MO/QDfADl7kGfo3uCntY=; b=qLCWArRYBL/s6QmwRwC3W+F72p9XtzECtMFBScH4yYdUFvvN7ueXYRBWMcoF4CFretyV4ITarA4dV9LFynSRAuCN4ZU2AhLtYeDkwK4XxC9bF9pduJVsvFzwAjq5YBzzdLx4TvJF/uLP6pINCabHP7X22ThUj0g396i28XdQ4lg=; X-UUID: 664afc6c40cf4209a5f22d6ad54708c7-20200810 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 1679514413; Mon, 10 Aug 2020 15:28:49 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 Aug 2020 15:28:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 Aug 2020 15:28:46 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , Jonathan Corbet CC: , , , , wsd_upstream , , Walter Wu Subject: [PATCH 5/5] kasan: update documentation for generic KASAN Date: Mon, 10 Aug 2020 15:28:47 +0800 Message-ID: <20200810072847.921-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: 26F4518140B67 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.005418, 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, +and workqueue queueing stacks in reports, the last one and the second to last. Software tag-based KASAN ~~~~~~~~~~~~~~~~~~~~~~~~