Walter Wu 214c783d59 lib/test_kasan.c: add workqueue test case
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

Link: https://lkml.kernel.org/r/20201203022748.30681-1-walter-zh.wu@mediatek.com
Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com>
Acked-by: Marco Elver <elver@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-12-15 12:13:42 -08:00
..
2020-10-18 14:45:59 -07:00
2020-08-09 14:10:26 -07:00
2020-08-14 19:56:56 -07:00
2020-05-24 20:48:11 +02:00
2020-10-16 11:11:19 -07:00
2018-08-16 12:14:42 -07:00
2020-06-01 08:23:42 -04:00
2020-10-20 14:39:37 -07:00
2020-10-13 18:38:32 -07:00
2020-05-07 14:54:26 +08:00
2020-12-11 14:02:14 -08:00
2018-10-16 13:45:44 +02:00
2020-10-20 14:39:37 -07:00
2020-06-15 18:22:43 -07:00
2019-07-11 15:17:41 -07:00
2020-09-26 10:33:57 -07:00
2020-06-29 10:02:23 +02:00
2018-10-15 16:31:29 -04:00
2020-06-07 10:53:36 -07:00
2020-10-20 14:39:37 -07:00
2020-06-04 19:06:28 -07:00
2020-10-20 14:39:37 -07:00