linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vishwath Mohan <vishwath@google.com>
To: Kostya Serebryany <kcc@google.com>
Cc: akpm@linux-foundation.org, andreyknvl@google.com,
	aryabinin@virtuozzo.com, Alexander Potapenko <glider@google.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	catalin.marinas@arm.com, will.deacon@arm.com, cl@linux.com,
	mark.rutland@arm.com, Nick Desaulniers <ndesaulniers@google.com>,
	marc.zyngier@arm.com, dave.martin@arm.com,
	ard.biesheuvel@linaro.org, ebiederm@xmission.com,
	mingo@kernel.org, Paul Lawrence <paullawrence@google.com>,
	geert@linux-m68k.org, arnd@arndb.de,
	kirill.shutemov@linux.intel.com, gregkh@linuxfoundation.org,
	kstewart@linuxfoundation.org, rppt@linux.vnet.ibm.com,
	kasan-dev@googlegroups.com, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sparse@vger.kernel.org, linux-mm@kvack.org,
	linux-kbuild@vger.kernel.org,
	Evgenii Stepanov <eugenis@google.com>,
	Lee.Smith@arm.com, Ramana.Radhakrishnan@arm.com,
	Jacob.Bramley@arm.com, Ruben.Ayrapetyan@arm.com,
	Jann Horn <jannh@google.com>, Mark Brand <markbrand@google.com>,
	cpandya@codeaurora.org
Subject: Re: [PATCH v4 00/17] khwasan: kernel hardware assisted address sanitizer
Date: Wed, 27 Jun 2018 17:59:00 -0700	[thread overview]
Message-ID: <CAEZpscCcP6=O_OCqSwW8Y6u9Ee99SzWN+hRcgpP2tK=OEBFnNw@mail.gmail.com> (raw)
In-Reply-To: <CAN=P9pivApAo76Kjc0TUDE0kvJn0pET=47xU6e=ioZV2VqO0Rg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3911 bytes --]

On Wed, Jun 27, 2018 at 5:04 PM Kostya Serebryany <kcc@google.com> wrote:

> On Wed, Jun 27, 2018 at 4:08 PM Andrew Morton <akpm@linux-foundation.org>
> wrote:
> >
> > On Tue, 26 Jun 2018 15:15:10 +0200 Andrey Konovalov <
> andreyknvl@google.com> wrote:
> >
> > > This patchset adds a new mode to KASAN [1], which is called KHWASAN
> > > (Kernel HardWare assisted Address SANitizer).
> > >
> > > The plan is to implement HWASan [2] for the kernel with the incentive,
> > > that it's going to have comparable to KASAN performance, but in the
> same
> > > time consume much less memory, trading that off for somewhat imprecise
> > > bug detection and being supported only for arm64.
> >
> > Why do we consider this to be a worthwhile change?
> >
> > Is KASAN's memory consumption actually a significant problem?  Some
> > data regarding that would be very useful.
>
> On mobile, ASAN's and KASAN's memory usage is a significant problem.
> Not sure if I can find scientific evidence of that.
> CC-ing Vishwath Mohan who deals with KASAN on Android to provide
> anecdotal evidence.
>
Yeah, I can confirm that it's an issue. Like Kostya mentioned, I don't have
data on-hand, but anecdotally both ASAN and KASAN have proven problematic
to enable for environments that don't tolerate the increased memory
pressure well. This includes,
(a) Low-memory form factors - Wear, TV, Things, lower-tier phones like Go
(c) Connected components like Pixel's visual core
<https://www.blog.google/products/pixel/pixel-visual-core-image-processing-and-machine-learning-pixel-2/>


These are both places I'd love to have a low(er) memory footprint option at
my disposal.


> There are several other benefits too:
> * HWASAN more reliably detects non-linear-buffer-overflows compared to
> ASAN (same for kernel-HWASAN vs kernel-ASAN)
> * Same for detecting use-after-free (since HWASAN doesn't rely on
> quarantine).
> * Much easier to implement stack-use-after-return detection (which
> IIRC KASAN doesn't have yet, because in KASAN it's too hard)
>
> > If it is a large problem then we still have that problem on x86, so the
> > problem remains largely unsolved?
>
> The problem is more significant on mobile devices than on desktop/server.
> I'd love to have [K]HWASAN on x86_64 as well, but it's less trivial since
> x86_64
> doesn't have an analog of aarch64's top-byte-ignore hardware feature.
>
>
> >
> > > ====== Benchmarks
> > >
> > > The following numbers were collected on Odroid C2 board. Both KASAN and
> > > KHWASAN were used in inline instrumentation mode.
> > >
> > > Boot time [1]:
> > > * ~1.7 sec for clean kernel
> > > * ~5.0 sec for KASAN
> > > * ~5.0 sec for KHWASAN
> > >
> > > Slab memory usage after boot [2]:
> > > * ~40 kb for clean kernel
> > > * ~105 kb + 1/8th shadow ~= 118 kb for KASAN
> > > * ~47 kb + 1/16th shadow ~= 50 kb for KHWASAN
> > >
> > > Network performance [3]:
> > > * 8.33 Gbits/sec for clean kernel
> > > * 3.17 Gbits/sec for KASAN
> > > * 2.85 Gbits/sec for KHWASAN
> > >
> > > Note, that KHWASAN (compared to KASAN) doesn't require quarantine.
> > >
> > > [1] Time before the ext4 driver is initialized.
> > > [2] Measured as `cat /proc/meminfo | grep Slab`.
> > > [3] Measured as `iperf -s & iperf -c 127.0.0.1 -t 30`.
> >
> > The above doesn't actually demonstrate the whole point of the
> > patchset: to reduce KASAN's very high memory consumption?
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "kasan-dev" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to kasan-dev+unsubscribe@googlegroups.com.
> > To post to this group, send email to kasan-dev@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/kasan-dev/20180627160800.3dc7f9ee41c0badbf7342520%40linux-foundation.org
> .
> > For more options, visit https://groups.google.com/d/optout.
>

[-- Attachment #2: Type: text/html, Size: 5660 bytes --]

  reply	other threads:[~2018-06-28  0:59 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26 13:15 Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 01/17] khwasan, mm: change kasan hooks signatures Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 02/17] khwasan: move common kasan and khwasan code to common.c Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 03/17] khwasan: add CONFIG_KASAN_GENERIC and CONFIG_KASAN_HW Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 04/17] khwasan, arm64: adjust shadow size for CONFIG_KASAN_HW Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 05/17] khwasan: initialize shadow to 0xff Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 06/17] khwasan, arm64: untag virt address in __kimg_to_phys and _virt_addr_is_linear Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 07/17] khwasan: add tag related helper functions Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 08/17] khwasan, arm64: fix up fault handling logic Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 09/17] khwasan, arm64: enable top byte ignore for the kernel Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 10/17] khwasan, mm: perform untagged pointers comparison in krealloc Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 11/17] khwasan: split out kasan_report.c from report.c Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 12/17] khwasan: add bug reporting routines Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 13/17] khwasan: add hooks implementation Andrey Konovalov
2018-07-25 13:44   ` Vincenzo Frascino@Foss
2018-07-31 13:05     ` Andrey Konovalov
2018-07-31 14:50       ` Andrey Ryabinin
2018-07-31 15:03         ` Dmitry Vyukov
2018-07-31 15:38           ` Christopher Lameter
2018-07-31 16:03             ` Dmitry Vyukov
2018-07-31 16:04           ` Andrey Ryabinin
2018-07-31 16:08             ` Dmitry Vyukov
2018-07-31 16:18               ` Andrey Ryabinin
2018-07-31 15:21         ` Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 14/17] khwasan, arm64: add brk handler for inline instrumentation Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 15/17] khwasan, mm, arm64: tag non slab memory allocated via pagealloc Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 16/17] khwasan: update kasan documentation Andrey Konovalov
2018-06-26 13:15 ` [PATCH v4 17/17] kasan: add SPDX-License-Identifier mark to source files Andrey Konovalov
2018-06-27 23:08 ` [PATCH v4 00/17] khwasan: kernel hardware assisted address sanitizer Andrew Morton
2018-06-28  0:04   ` Kostya Serebryany
2018-06-28  0:59     ` Vishwath Mohan [this message]
2018-06-28  1:11       ` Andrew Morton
2018-06-28 18:26         ` Andrey Konovalov
2018-06-28  7:01     ` Geert Uytterhoeven
2018-07-02 20:33     ` Matthew Wilcox
2018-07-02 23:39       ` Evgenii Stepanov
2018-06-28 18:29   ` Andrey Konovalov
2018-06-28 19:40     ` Andrew Morton
2018-06-29 12:45       ` Andrey Konovalov
2018-06-29 13:01         ` Mark Rutland
2018-06-29 14:40           ` Andrey Konovalov
2018-06-30  2:41         ` Andrew Morton
2018-07-02 19:16           ` Evgenii Stepanov
2018-07-02 19:21             ` Andrew Morton
2018-07-02 20:22               ` Evgenii Stepanov
2018-07-02 20:30                 ` Andrew Morton
2018-07-05 21:02                 ` Nick Desaulniers
2018-06-28 10:51 ` Dave Martin
2018-06-28 18:56   ` Andrey Konovalov
2018-06-29 10:14     ` Mark Rutland
2018-06-29 11:04     ` Dave Martin
2018-06-29 11:26       ` Luc Van Oostenryck
2018-06-29 13:18         ` Andrey Konovalov
2018-06-29 13:42         ` Dan Carpenter
2018-06-29 11:07     ` Catalin Marinas
2018-06-29 11:07     ` Will Deacon
2018-06-29 16:36       ` Andrey Konovalov
2018-07-03 17:36         ` Will Deacon
2018-07-18 17:16           ` Andrey Konovalov
2018-07-31 13:22             ` Andrey Konovalov
2018-08-01 16:35               ` Will Deacon
2018-08-01 16:52                 ` Dmitry Vyukov
2018-08-02 11:10                   ` Catalin Marinas
2018-08-02 11:36                     ` Dmitry Vyukov
2018-08-02 13:52                       ` Catalin Marinas
2018-08-02 14:11                         ` Andrey Ryabinin
2018-08-03  9:23                   ` Will Deacon
2018-08-03  9:42                     ` Dmitry Vyukov
2018-08-08 16:27                       ` Will Deacon
2018-08-08 16:53                         ` Dmitry Vyukov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEZpscCcP6=O_OCqSwW8Y6u9Ee99SzWN+hRcgpP2tK=OEBFnNw@mail.gmail.com' \
    --to=vishwath@google.com \
    --cc=Jacob.Bramley@arm.com \
    --cc=Lee.Smith@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=Ruben.Ayrapetyan@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=arnd@arndb.de \
    --cc=aryabinin@virtuozzo.com \
    --cc=catalin.marinas@arm.com \
    --cc=cl@linux.com \
    --cc=cpandya@codeaurora.org \
    --cc=dave.martin@arm.com \
    --cc=dvyukov@google.com \
    --cc=ebiederm@xmission.com \
    --cc=eugenis@google.com \
    --cc=geert@linux-m68k.org \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jannh@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kcc@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=markbrand@google.com \
    --cc=mingo@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=paullawrence@google.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox