-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
---
Change-Id: Id15c0b47582fb51594bb26fb8353d78c7d0953c1
---
arch/arm64/include/asm/processor.h | 2 +-
arch/arm64/kernel/mte.c| 29 +++--
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/arch
Provide implementation of KASAN functions required for the hardware
tag-based mode. Those include core functions for memory and pointer
tagging (tags_hw.c) and bug reporting (report_tags_hw.c). Also adapt
common KASAN code to support the new mode.
Signed-off-by: Andrey Konovalov
Signed-off
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Hardware tag-based KASAN won't be using shadow memory, but will reuse
this function. Rename "shadow" to implementation-neutral "metadata".
No functional changes.
S
-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
---
Change-Id: Icc9f5ef100a2e86f3a4214a0c3131a68266181b2
---
mm/kasan/report.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 5d5733831ad7
().
Also simplify the code for software tag-based mode.
No functional changes for software modes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
---
Change-Id: I5fae9531c9fc948eb4d4e0c589744032fc5a0789
---
mm/kasan/common.c | 19
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Group shadow-related KASAN function declarations and only define them
for the two existing software modes.
No functional changes for software modes.
Signed-off-by: Andrey Konovalov
Signed
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Hardware tag-based KASAN won't be using shadow memory, but will reuse
these macros. Rename "SHADOW" to implementation-neutral "META".
No functional changes.
Signed-off-
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Hardware tag-based KASAN won't be using shadow memory. Only initialize
it when one of the software KASAN modes are enabled.
No functional changes for software modes.
Signed-off-by: Andrey
Define KASAN_GRANULE_PAGE as (KASAN_GRANULE_SIZE << PAGE_SHIFT), which is
the same as (KASAN_GRANULE_SIZE * PAGE_SIZE), and use it across KASAN code
to simplify it.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
---
Cha
changes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
---
Change-Id: Iac733e2248aa9d29f6fc425d8946ba07cca73ecf
---
Documentation/dev-tools/kasan.rst | 2 +-
lib/test_kasan.c | 2 +-
lib/test_kasan_module.c | 2 +-
mm/kasan
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Group all vmalloc-related function declarations in include/linux/kasan.h,
and their implementations in mm/kasan/common.c.
No functional changes.
Signed-off-by: Andrey Konovalov
Signed-off
Add set_alloc_info() helper and move kasan_set_track() into it. This will
simplify the code for one of the upcoming changes.
No functional changes.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id
is
enabled.
Note, that CONFIG_KASAN_STACK is an option that is currently always
defined when CONFIG_KASAN is enabled, and therefore has to be tested
with #if instead of #ifdef.
Signed-off-by: Andrey Konovalov
Link:
https://linux-review.googlesource.com/id
Rename get_alloc_info() and get_free_info() to kasan_get_alloc_meta()
and kasan_get_free_meta() to better reflect what those do and avoid
confusion with kasan_set_free_info().
No functional changes.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Link:
https://linux
Move get_free_info() call into quarantine_put() to simplify the call site.
No functional changes.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id/Iab0f04e7ebf8d83247024b7190c67c3c34c7940f
---
mm/kasan/common.c | 2 +-
mm/kasan
.
- Drop __init from empty kasan_init_tags() definition.
- Add cpu_supports_mte() helper that can be used during early boot and use
it in kasan_init_tags()
- Lots of new KASAN optimization commits.
Andrey Konovalov (20):
kasan: simplify quarantine_put call site
kasan: rename get_alloc/free_info
kasan
There's no need for __kasan_unpoison_stack() helper, as it's only
currently used in a single place. Removing it also removes unneeded
arithmetic.
No functional changes.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id
Using random_tag() currently results in a function call. Move its
definition to mm/kasan/kasan.h and turn it into a static inline function
for hardware tag-based mode to avoid uneeded function calls.
Signed-off-by: Andrey Konovalov
Link:
https://linux-review.googlesource.com/id
lue for free_meta_offset, introduce KASAN_NO_FREE_META as an indicator
that the free metadata is missing.
Along the way rework __kasan_cache_create() and add claryfying comments.
Signed-off-by: Andrey Konovalov
Link:
https://linux-review.googlesource.com/id/Icd947e2bea054cb5cfbdc6cf6652227d97032dcb
---
mm/ka
Currently it says that the memory gets poisoned by page_alloc code.
Clarify this by mentioning the specific callback that poisons the
memory.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id/I1334dffb69b87d7986fab88a1a039cc3ea764725
kasan_poison_kfree() is currently only called for mempool allocations
that are backed by either kmem_cache_alloc() or kmalloc(). Therefore, the
page passed to kasan_poison_kfree() is always PageSlab() and there's no
need to do the check. Remove it.
Signed-off-by: Andrey Konovalov
Reviewed
Image) initiative [1].
[1] https://source.android.com/devices/architecture/kernel/generic-kernel-image
Signed-off-by: Andrey Konovalov
Link:
https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a4
---
mm/kasan/common.c | 22 +--
mm/kasan/hw_tags.c | 152
This change updates KASAN documentation to reflect the addition of boot
parameters and also reworks and clarifies some of the existing sections,
in particular: defines what a memory granule is, mentions quarantine,
makes Kunit section more readable.
Signed-off-by: Andrey Konovalov
algorithm and make
it friendly to the cache merging code. Instead this change takes a simpler
approach and allows merging caches when no metadata is present. Which is
the case for hardware tag-based KASAN with kasan.mode=prod.
Signed-off-by: Andrey Konovalov
Link:
https://linux
kasan_unpoison_slab() that is currently
defined as static inline and uses kasan_unpoison_memory(). With this
change it's turned into a function call. Overall, this results in the
same number of calls for hardware tag-based mode as
kasan_unpoison_memory() is now inlined.
Signed-off-by: Andrey Konovalov
Rename kasan_poison_kfree() to kasan_slab_free_mempool() as it better
reflects what this annotation does.
No functional changes.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id/I5026f87364e556b506ef1baee725144bb04b8810
---
include
set_tag() already ignores the tag for the generic mode, so just call it
as is. Add a check for the generic mode to assign_tag(), and simplify its
call in kasan_kmalloc().
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id
For hardware tag-based mode kasan_poison_memory() already rounds up the
size. Do the same for software modes and remove round_up() from the common
code.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id
Even though hardware tag-based mode currently doesn't support checking
vmalloc allocations, it doesn't use shadow memory and works with
VMAP_STACK as is. Change VMAP_STACK definition accordingly.
Signed-off-by: Andrey Konovalov
Link:
https://linux-review.googlesource.com/id
Declare the kasan_enabled static key in include/linux/kasan.h and in
include/linux/mm.h and check it in all kasan annotations. This allows to
avoid any slowdown caused by function calls when kasan_enabled is
disabled.
Signed-off-by: Andrey Konovalov
Link:
https://linux-review.googlesource.com
Using kasan_poison_memory() or check_invalid_free() currently results in
function calls. Move their definitions to mm/kasan/kasan.h and turn them
into static inline functions for hardware tag-based mode to avoid
unneeded function calls.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
kasan_reset_tag() instead.
Signed-off-by: Andrey Konovalov
Link:
https://linux-review.googlesource.com/id/I4d2061acfe91d480a75df00b07c22d8494ef14b5
---
include/linux/kasan.h | 5 -
mm/kasan/common.c | 6 +++---
mm/kasan/hw_tags.c| 9 ++---
mm/kasan/kasan.h | 4
On Tue, Nov 10, 2020 at 11:20 PM Andrey Konovalov wrote:
>
> === Overview
>
> Hardware tag-based KASAN mode [1] is intended to eventually be used in
> production as a security mitigation. Therefore there's a need for finer
> control over KASAN features and for an existenc
On Fri, Oct 23, 2020 at 5:26 PM syzbot
wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:f9893351 Merge tag 'kconfig-v5.10' of git://git.kernel.org..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=13ff53f790
> kernel config:
Add myself (using the personal email address) as a reviewer for the
USB Raw Gadget driver.
Signed-off-by: Andrey Konovalov
---
MAINTAINERS | 8
1 file changed, 8 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 94ac10a153c7..f68835aaaddc 100644
--- a/MAINTAINERS
+++ b
On Mon, Nov 16, 2020 at 1:42 PM Vincenzo Frascino
wrote:
>
>
> Not sure why we did this instead of the following, but okay.
>
> config KASAN_STACK
> - int
> - default 1 if KASAN_STACK_ENABLE || CC_IS_GCC
> - default 0
> + bool
>
On Mon, Nov 16, 2020 at 9:35 AM Dmitry Vyukov wrote:
>
> On Mon, Nov 16, 2020 at 3:39 AM Alexander Bulekov wrote:
> >
> > Hello,
> > I'm trying to collect coverage over the syscalls issued by my process,
> > as well as the kthreads spawned as a result of these syscalls
> > (eg coverage over
On Mon, Nov 30, 2020 at 10:46 AM Marco Elver wrote:
>
> On Thu, 26 Nov 2020 at 16:00, Valdis Klētnieks
> wrote:
> > commit 2df573d2ca4c1ce6ea33cb7849222f771e759211
> > Author: Andrey Konovalov
> > Date: Tue Nov 24 16:45:08 2020 +1100
> >
> > kasan
On Tue, Nov 17, 2020 at 2:25 PM Dmitry Vyukov wrote:
>
> On Fri, Nov 13, 2020 at 11:20 PM Andrey Konovalov
> wrote:
> >
> > The reason cache merging is disabled with KASAN is because KASAN puts its
> > metadata right after the allocated object. When the merged caches
On Thu, Nov 19, 2020 at 11:16 PM kernel test robot wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> master
> head: 3494d58865ad4a47611dbb427b214cc5227fa5eb
> commit: cae9dc35ed9ff82a99754e51d57ff6c332e1f7e4 kasan: allow enabling stack
> tagging for
On Fri, Nov 20, 2020 at 6:00 PM Alan Stern wrote:
>
> On Fri, Nov 20, 2020 at 08:56:11AM -0800, syzbot wrote:
> > > On Fri, Nov 20, 2020 at 07:15:20AM -0800, syzbot wrote:
> > >> Hello,
> > >>
> > >> syzbot found the following issue on:
> > >>
> > >> HEAD commit:4d02da97 Merge tag
On Tue, Nov 17, 2020 at 2:12 PM Dmitry Vyukov wrote:
>
> > void __kasan_poison_slab(struct page *page)
> > {
> > @@ -272,11 +305,9 @@ void * __must_check __kasan_init_slab_obj(struct
> > kmem_cache *cache,
> > struct kasan_alloc_meta *alloc_meta;
> >
> > if
On Mon, Nov 23, 2020 at 7:54 PM Andrey Konovalov wrote:
>
> > > @@ -168,6 +173,9 @@ void quarantine_put(struct kmem_cache *cache, void
> > > *object)
> > > struct qlist_head temp = QLIST_INIT;
> > > struct kasan_free_meta *m
Don't mention "GNU General Public License version 2" text explicitly,
as it's already covered by the SPDX-License-Identifier.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
from mte_set_mem_tag_range() as KASAN has no use for
the return value.
- Drop zero size check from mte_assign_mem_tag_range().
- Drop unnecessary include from low-level arm64 code.
- Move enabling TBI1 into __cpu_setup().
- Drop stale comment about callee-saved register from
arch/arm64/kernel
Currently only generic KASAN mode supports vmalloc, reflect that
in the config.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
Change-Id: I1889e5b3bed28cc5d607802fb6ae43ba461c0dc1
---
lib/Kconfig.kasan | 2 +-
1
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Group all vmalloc-related function declarations in include/linux/kasan.h,
and their implementations in mm/kasan/common.c.
No functional changes.
Signed-off-by: Andrey Konovalov
Signed-off
prefix).
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Alexander Potapenko
---
Change-Id: Ia359f32815242c4704e49a5f1639ca2d2f8cba69
---
include/linux/kasan.h | 6 +++---
kernel/fork.c | 4 ++--
mm
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Group shadow-related KASAN function declarations and only define them
for the two existing software modes.
No functional changes for software modes.
Signed-off-by: Andrey Konovalov
Signed
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
The new mode won't be using shadow memory, so only build init.c that
contains shadow initialization code for software modes.
No functional changes for software modes.
Signed-off-by: Andrey
changes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
Change-Id: Iac733e2248aa9d29f6fc425d8946ba07cca73ecf
---
Documentation/dev-tools/kasan.rst | 2 +-
lib/test_kasan.c | 2 +-
lib
Define KASAN_MEMORY_PER_SHADOW_PAGE as (KASAN_GRANULE_SIZE << PAGE_SHIFT),
which is the same as (KASAN_GRANULE_SIZE * PAGE_SIZE) for software modes
that use shadow memory, and use it across KASAN code to simplify it.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Re
for software modes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
Change-Id: Ic1c32ce72d4649848e9e6a1f2c8dd269c77673f2
---
mm/kasan/Makefile | 6 +-
mm/kasan/common.c | 498 +---
mm
Rename generic_report.c to report_generic.c and tags_report.c to
report_sw_tags.c, as their content is more relevant to report.c file.
Also rename tags.c to sw_tags.c to better reflect that this file contains
code for software tag-based mode.
No functional changes.
Signed-off-by: Andrey
Decoding routines aren't needed when CONFIG_KASAN_STACK_ENABLE is not
enabled. Currently only generic KASAN mode implements stack error
reporting.
No functional changes for software modes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Hardware tag-based KASAN won't use kasan_depth. Only define and use it
when one of the software KASAN modes are enabled.
No functional changes for software modes.
Signed-off-by: Andrey
functions; tag-based mode should use "kasan:"
instead of KBUILD_MODNAME (which stands for file name).
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
Reviewed-by: Alexander Potapenko
---
Change-Id: Iddca9764b30ff0fab1922f26ca9d4f39b6f22673
---
arch/arm64/include/asm/ka
().
Also simplify the code for software tag-based mode.
No functional changes for software modes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
Change-Id: I5fae9531c9fc948eb4d4e0c589744032fc5a0789
---
mm/kasan
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Hardware tag-based KASAN won't be using shadow memory. Only initialize
it when one of the software KASAN modes are enabled.
No functional changes for software modes.
Signed-off-by: Andrey
Rename kasan_init_tags() to kasan_init_sw_tags() as the upcoming hardware
tag-based KASAN mode will have its own initialization routine.
Also similarly to kasan_init() mark kasan_init_tags() as __init.
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
Reviewed-by: Alexander Potapenko
Both KASAN_GENERIC and KASAN_SW_TAGS have common dependencies, move
those to KASAN.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
Change-Id: I77e475802e8f1750b9154fe4a6e6da4456054fcd
---
lib/Kconfig.kasan | 8
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Hardware tag-based KASAN won't be using shadow memory, but will reuse
this function. Rename "shadow" to implementation-neutral "metadata".
No functional changes.
S
Software tag-based KASAN provides its own tag checking machinery that
can conflict with MTE. Don't allow enabling software tag-based KASAN
when MTE is enabled.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Catalin Marinas
Reviewed-by: Alexander Potapenko
This patch adds a configuration option for a new KASAN mode called
hardware tag-based KASAN. This mode uses the memory tagging approach
like the software tag-based mode, but relies on arm64 Memory Tagging
Extension feature for tag management and access checking.
Signed-off-by: Andrey Konovalov
-based KASAN will provide
its own implementation that doesn't use shadow memory.
No functional changes for software modes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
Change-Id
Frascino
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
Reviewed-by: Alexander Potapenko
---
Change-Id: I172e15e4c189f073e4c14a10276b276092e76536
---
arch/arm64/Kconfig | 4
arch/arm64/Makefile | 5 +
2 files changed, 9 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch
aps the same with PROT_MTE and becomes tagged the subsequent kernel
access would fail.
Signed-off-by: Vincenzo Frascino
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
---
Change-Id: I8451d438bb63364de2a3e68041e3a27866921d4e
---
arch/arm64/kernel/hibernate.c | 5 +
arch/arm64/ker
-by: Andrey Konovalov
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
---
Change-Id: I1b5230254f90dc21a913447cb17f07fea7944ece
---
arch/arm64/include/asm/esr.h | 1 +
arch/arm64/include/asm/mte-def.h | 15
arch/arm64/include/asm/mte-kasan.h | 56
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Hardware tag-based KASAN won't be using shadow memory, but will reuse
these macros. Rename "SHADOW" to implementation-neutral "META".
No functional changes.
Signed-off-
runtime and shouldn't have any KASAN
annotations.
Also #undef CONFIG_KASAN_GENERIC with CONFIG_KASAN.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Acked-by: Vasily Gorbik
Reviewed-by: Alexander Potapenko
---
Change-Id
Some #ifdef CONFIG_KASAN checks are only relevant for software KASAN
modes (either related to shadow memory or compiler instrumentation).
Expand those into CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Catalin Marinas
-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
---
Change-Id: Id15c0b47582fb51594bb26fb8353d78c7d0953c1
---
arch/arm64/include/asm/processor.h | 2 +-
arch/arm64/kernel/mte.c| 29 +++--
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/arch
is disabled after the first one.
Instead, reset tags when accessing metadata (currently only for SLUB).
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Acked-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
Change-Id: I39f3c4d4f29299d4fbbda039bedf230db1c746fb
---
mm/page_alloc.c
Hardware tag-based KASAN uses the memory tagging approach, which requires
all allocations to be aligned to the memory granule size. Align the
allocations to MTE_GRANULE_SIZE via ARCH_SLAB_MINALIGN when
CONFIG_KASAN_HW_TAGS is enabled.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo
that it is the same. If the values are not the
same it reports a failure.
Note: The test has been extended to verify that even SYNC and ASYNC mode
setting is preserved correctly over context switching.
Signed-off-by: Vincenzo Frascino
Signed-off-by: Andrey Konovalov
Acked-by: Catalin Marinas
faults.
Cc: Andrew Morton
Signed-off-by: Vincenzo Frascino
Signed-off-by: Andrey Konovalov
Reviewed-by: Alexander Potapenko
---
Change-Id: If12b4944383575b8bbd7d971decbd7f04be6748b
---
mm/page_alloc.c | 5 +
1 file changed, 5 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index
-by: Vincenzo Frascino
Co-developed-by: Andrey Konovalov
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
---
Change-Id: I4d67497268bb7f0c2fc5dcacefa1e273df4af71d
---
arch/arm64/include/asm/mte-kasan.h | 6 ++
arch/arm64/kernel/mte.c| 7 +++
arch/arm64/mm/proc.S
Hardware tag-based KASAN is now ready, enable the configuration option.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Acked-by: Catalin Marinas
Reviewed-by: Alexander Potapenko
---
Change-Id: I6eb1eea770e6b61ad71c701231b8d815a7ccc853
---
arch/arm64/Kconfig | 1 +
1 file
Add documentation for hardware tag-based KASAN mode and also add some
clarifications for software tag-based mode.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
Change-Id: Ib46cb444cfdee44054628940a82f5139e10d0258
fault handler for kernel addresses is currently empty and will be
filled in by a future commit.
Signed-off-by: Vincenzo Frascino
Co-developed-by: Andrey Konovalov
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
---
Change-Id: I9b8aa79567f7c45f4d6a1290efcf34567e620717
---
arch/arm64
Hardware tag-based KASAN has granules of MTE_GRANULE_SIZE. Define
KASAN_GRANULE_SIZE to MTE_GRANULE_SIZE for CONFIG_KASAN_HW_TAGS.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
Reviewed-by: Alexander Potapenko
---
Change-Id
-based KASAN support for other architectures in the future by defining
the appropriate arch_*() macros.
Signed-off-by: Andrey Konovalov
Co-developed-by: Vincenzo Frascino
Signed-off-by: Vincenzo Frascino
Reviewed-by: Catalin Marinas
---
Change-Id: I42b0795a28067872f8308e00c6f0195bca435c2a
code to handle this case.
Signed-off-by: Andrey Konovalov
Co-developed-by: Vincenzo Frascino
Signed-off-by: Vincenzo Frascino
Reviewed-by: Catalin Marinas
Reviewed-by: Alexander Potapenko
---
Change-Id: I3780fe7db6e075dff2937d3d8508f55c9322b095
---
arch/arm64/mm/fault.c | 14
Provide implementation of KASAN functions required for the hardware
tag-based mode. Those include core functions for memory and pointer
tagging (tags_hw.c) and bug reporting (report_tags_hw.c). Also adapt
common KASAN code to support the new mode.
Signed-off-by: Andrey Konovalov
Signed-off
This is a preparatory commit for the upcoming addition of a new hardware
tag-based (MTE-based) KASAN mode.
Hardware tag-based KASAN won't be using shadow memory, but will reuse
this function. Rename "shadow" to implementation-neutral "metadata".
No functional changes.
S
implementation
has to make sure that the GCR_EL1 setting for the kernel does not affect
the userspace processes and viceversa.
Save and restore the kernel/user mask in GCR_EL1 in kernel entry and exit.
Signed-off-by: Vincenzo Frascino
Co-developed-by: Andrey Konovalov
Signed-off-by: Andrey
AN documentation to mention boot parameters.
Changes RFC v1 -> RFC v2:
- Rework boot parameters.
- Drop __init from empty kasan_init_tags() definition.
- Add cpu_supports_mte() helper that can be used during early boot and use
it in kasan_init_tags()
- Lots of new KASAN optimization commits.
And
Move get_free_info() call into quarantine_put() to simplify the call site.
No functional changes.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Reviewed-by: Marco Elver
Link:
https://linux-review.googlesource.com/id/Iab0f04e7ebf8d83247024b7190c67c3c34c7940f
---
mm/kasan
Add set_alloc_info() helper and move kasan_set_track() into it. This will
simplify the code for one of the upcoming changes.
No functional changes.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Reviewed-by: Marco Elver
Link:
https://linux-review.googlesource.com/id
Even though hardware tag-based mode currently doesn't support checking
vmalloc allocations, it doesn't use shadow memory and works with
VMAP_STACK as is. Change VMAP_STACK definition accordingly.
Signed-off-by: Andrey Konovalov
Reviewed-by: Marco Elver
Acked-by: Catalin Marinas
Reviewed
is
enabled.
Note, that CONFIG_KASAN_STACK is an option that is currently always
defined when CONFIG_KASAN is enabled, and therefore has to be tested
with #if instead of #ifdef.
Signed-off-by: Andrey Konovalov
Reviewed-by: Marco Elver
Acked-by: Catalin Marinas
Reviewed-by: Dmitry Vyukov
Link
kasan_reset_tag() instead.
Signed-off-by: Andrey Konovalov
Reviewed-by: Marco Elver
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id/I4d2061acfe91d480a75df00b07c22d8494ef14b5
---
include/linux/kasan.h | 5 -
mm/kasan/common.c | 6 +++---
mm/kasan
There's no need for __kasan_unpoison_stack() helper, as it's only
currently used in a single place. Removing it also removes unneeded
arithmetic.
No functional changes.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Reviewed-by: Marco Elver
Link:
https://linux
Using random_tag() currently results in a function call. Move its
definition to mm/kasan/kasan.h and turn it into a static inline function
for hardware tag-based mode to avoid uneeded function calls.
Signed-off-by: Andrey Konovalov
Reviewed-by: Marco Elver
Reviewed-by: Dmitry Vyukov
Link
Using (un)poison_range() or check_invalid_free() currently results in
function calls. Move their definitions to mm/kasan/kasan.h and turn them
into static inline functions for hardware tag-based mode to avoid
unneeded function calls.
Signed-off-by: Andrey Konovalov
Reviewed-by: Marco Elver
Link
Image) initiative [1].
[1] https://source.android.com/devices/architecture/kernel/generic-kernel-image
Signed-off-by: Andrey Konovalov
Reviewed-by: Marco Elver
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a4
---
mm/kasan
Rename kasan_poison_kfree() to kasan_slab_free_mempool() as it better
reflects what this annotation does. Also add a comment that explains the
PageSlab() check.
No functional changes.
Signed-off-by: Andrey Konovalov
Reviewed-by: Marco Elver
Link:
https://linux-review.googlesource.com/id
-off-by: Andrey Konovalov
Reviewed-by: Marco Elver
Reviewed-by: Dmitry Vyukov
Link:
https://linux-review.googlesource.com/id/I2589451d3c96c97abbcbf714baabe6161c6f153e
---
include/linux/kasan.h | 213 --
include/linux/mm.h| 22 +++--
mm/kasan/common.c
set_tag() already ignores the tag for the generic mode, so just call it
as is. Add a check for the generic mode to assign_tag(), and simplify its
call in kasan_kmalloc().
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Reviewed-by: Marco Elver
Link:
https://linux
For hardware tag-based mode kasan_poison_memory() already rounds up the
size. Do the same for software modes and remove round_up() from the common
code.
Signed-off-by: Andrey Konovalov
Reviewed-by: Dmitry Vyukov
Reviewed-by: Marco Elver
Link:
https://linux-review.googlesource.com/id
1201 - 1300 of 2648 matches
Mail list logo