[RAMEN9610-14440] UPSTREAM: kasan: support alloca() poisoning
authorPaul Lawrence <paullawrence@google.com>
Tue, 6 Feb 2018 23:36:11 +0000 (15:36 -0800)
committerhskang <hs1218.kang@samsung.com>
Sun, 21 Apr 2019 09:10:23 +0000 (18:10 +0900)
commitc686d5cd1094a26144c91667ec4950b492fcc9ab
tree938b3294731d2e9c25d80653b787057006316240
parent0af04e0391b5c46ea6003f357cedcdd70d4d9403
[RAMEN9610-14440] UPSTREAM: kasan: support alloca() poisoning

clang's AddressSanitizer implementation adds redzones on either side of
alloca()ed buffers.  These redzones are 32-byte aligned and at least 32
bytes long.

__asan_alloca_poison() is passed the size and address of the allocated
buffer, *excluding* the redzones on either side.  The left redzone will
always be to the immediate left of this buffer; but AddressSanitizer may
need to add padding between the end of the buffer and the right redzone.
If there are any 8-byte chunks inside this padding, we should poison
those too.

__asan_allocas_unpoison() is just passed the top and bottom of the dynamic
stack area, so unpoisoning is simpler.

Link: http://lkml.kernel.org/r/20171204191735.132544-4-paullawrence@google.com
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(Cherry-picked from 342061ee4ef3d80001d1ae494378f3979c861dba)

Change-Id: I3da748cd5aa5190b2b40deab9d32da0030f4d465
Signed-off-by: Paul Lawrence <paullawrence@google.com>
mm/kasan/kasan.c
mm/kasan/kasan.h
mm/kasan/report.c
scripts/Makefile.kasan