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
---
Change-Id: I1889e5b3bed28cc5d607802fb6ae43ba461c0dc1
---
lib/Kconfig.kasan | 2 +-
1 file changed, 1 insertion(+), 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
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-
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
---
Change-Id: I99aa2f7115d38a34ed85b329dadab6c7d6952416
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 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
asm/kasan.h relies on pgd_t and _REGION1_SHIFT definitions and therefore
requires asm/pgtable.h include. Include asm/pgtable.h from asm/kasan.h.
Signed-off-by: Andrey Konovalov
Acked-by: Vasily Gorbik
---
Change-Id: I369a8f9beb442b9d05733892232345c3f4120e0a
---
arch/s390/include/asm/kasan.h
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
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
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
---
Change-Id: I77e475802e8f1750b9154fe4a6e6da4456054fcd
---
lib/Kconfig.kasan | 8 ++--
1 file changed, 2
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
().
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
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
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
---
Change-Id
Frascino
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
---
Change-Id: I172e15e4c189f073e4c14a10276b276092e76536
---
arch/arm64/Kconfig | 4
arch/arm64/Makefile | 5 +
2 files changed, 9 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d58b4dcc6d44
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
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
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
---
Change-Id: I6eb1eea770e6b61ad71c701231b8d815a7ccc853
---
arch/arm64/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git
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
---
Change-Id: Ib46cb444cfdee44054628940a82f5139e10d0258
---
Documentation/dev-tools
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
---
Change-Id: I8451d438bb63364de2a3e68041e3a27866921d4e
---
arch/arm64/kernel/mte.c | 1 +
arch/arm64/mm/copypage.c | 1 +
arch/arm64/mm/mteswa
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
---
Change-Id: I9b8aa79567f7c45f4d6a1290efcf34567e620717
---
arch/arm64/include/asm/uaccess.h | 23
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
---
Change-Id: I39f3c4d4f29299d4fbbda039bedf230db1c746fb
---
mm/page_alloc.c | 4 +++-
mm/page_poison.c | 2
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
---
Change-Id
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
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
---
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
---
Change-Id: I3780fe7db6e075dff2937d3d8508f55c9322b095
---
arch/arm64/mm/fault.c | 14 ++
mm/kasan/report.c | 11
-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
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
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
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
---
Change-Id: I2a622db0cb86a8feb60c30d8cb09190075be2a90
---
arch/s390/boot
-by: Andrey Konovalov
Signed-off-by: Andrey Konovalov
---
Change-Id: I4d67497268bb7f0c2fc5dcacefa1e273df4af71d
---
arch/arm64/include/asm/mte-kasan.h | 6 ++
arch/arm64/kernel/mte.c| 7 +++
arch/arm64/mm/proc.S | 23 ---
3 files changed, 33
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
---
Change-Id: I5d1117e6a991cbca00d2cfb4ba66e8ae2d8f513a
---
mm/kasan
-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
---
Change-Id: I5b0ed1d079ea776e620beca6a529a861e7dced95
---
mm/kasan/kasan.h
for software modes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
---
Change-Id: Ic1c32ce72d4649848e9e6a1f2c8dd269c77673f2
---
mm/kasan/Makefile | 6 +-
mm/kasan/common.c | 486 +---
mm/kasan/shadow.c | 505
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
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
---
Change-Id
-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
-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
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
functions; tag-based mode should use "kasan:"
instead of KBUILD_MODNAME (which stands for file name).
Signed-off-by: Andrey Konovalov
---
Change-Id: Iddca9764b30ff0fab1922f26ca9d4f39b6f22673
---
arch/arm64/include/asm/kasan.h | 9 +++--
arch/arm64/mm/kasan_init.c | 13 +--
.
No functional changes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
---
Change-Id: Ia359f32815242c4704e49a5f1639ca2d2f8cba69
---
include/linux/kasan.h | 6 +++---
kernel/fork.c | 4 ++--
mm/kasan/common.c | 38
On Thu, Nov 5, 2020 at 12:20 AM Andrey Konovalov wrote:
>
> 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
> co
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
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
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
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
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
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
on.
- 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: introduce set_alloc_info
kasan, arm64:
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
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
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
[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 | 144
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
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
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
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
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
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
On Thu, Nov 5, 2020 at 12:13 PM Vincenzo Frascino
wrote:
>
> Hi Andrey,
>
> On 11/4/20 11:18 PM, Andrey Konovalov wrote:
> > Hardware tag-based KASAN relies on Memory Tagging Extension (MTE)
> > feature and requires it to be enabled. MTE supports
> >
> >
On Thu, Nov 5, 2020 at 12:39 PM Vincenzo Frascino
wrote:
>
> On 11/5/20 11:35 AM, Andrey Konovalov wrote:
> > This will work. Any preference on the name of this function?
> >
>
> I called it in my current iteration mte_enable(), and calling it from
> cpu_enable_mte().
From: Nazime Hande Harputluoglu
Add kcov_remote_start()/kcov_remote_stop() annotations to the
vhci_rx_loop() function, which is responsible for parsing USB/IP packets
coming into USB/IP client.
Since vhci_rx_loop() threads are spawned per vhci_hcd device instance, the
common kcov handle is used
()
calls won't be collected, but the WARNING is fixed.
A potential future improvement would be to support nested remote coverage
collection sections, but this patch doesn't address that.
Signed-off-by: Andrey Konovalov
Acked-by: Marco Elver
---
Changes v3->v4:
- Drop unnecessary returns from k
Frascino
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
---
Change-Id: I172e15e4c189f073e4c14a10276b276092e76536
---
arch/arm64/Kconfig | 4
arch/arm64/Makefile | 5 +
2 files changed, 9 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e7450fbd0aa7
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 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
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
-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
for software modes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
---
Change-Id: Ic1c32ce72d4649848e9e6a1f2c8dd269c77673f2
---
mm/kasan/Makefile | 6 +-
mm/kasan/common.c | 486 +---
mm/kasan/shadow.c | 505
in a
page.
Note: For MTE, the TCF bit field in SCTLR_EL1 affects only EL1 in a
similar way as TCF0 affects EL0.
MTE that is built on top of the Top Byte Ignore (TBI) feature hence we
enable it as part of this patch as well.
Signed-off-by: Vincenzo Frascino
Signed-off-by: Andrey Konovalov
Reviewed
p stale comment about callee-saved register from
arch/arm64/kernel/entry.S.
- Mark gcr_kernel_excl as __ro_after_init.
- Use GENMASK() in mte_init_tags().
Andrey Konovalov (32):
arm64: kasan: Add arch layer for memory tagging helpers
arm64: kasan: Align allocations for HW_TAGS
kasan:
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
---
Change-Id
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
---
Change-Id: I77e475802e8f1750b9154fe4a6e6da4456054fcd
---
lib/Kconfig.kasan | 8 ++--
1 file changed, 2
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
---
Change-Id: I1889e5b3bed28cc5d607802fb6ae43ba461c0dc1
---
lib/Kconfig.kasan | 2 +-
1 file changed, 1 insertion(+), 1
-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
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
Signed-off-by: Andrey Konovalov
Reviewed-by: Catalin Marinas
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
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
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
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
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
---
Change-Id: If0a2690042a2aa0fca70cea601ae9aabe72fa233
---
-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
.
No functional changes.
Signed-off-by: Andrey Konovalov
Signed-off-by: Vincenzo Frascino
Reviewed-by: Marco Elver
---
Change-Id: Ia359f32815242c4704e49a5f1639ca2d2f8cba69
---
include/linux/kasan.h | 6 +++---
kernel/fork.c | 4 ++--
mm/kasan/common.c | 38
().
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
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
---
Change-Id: I8451d438bb63364de2a3e68041e3a27866921d4e
---
arch/arm64/kernel/mte.c | 1 +
arch/arm64/mm/copypage.c | 1 +
arch/arm64/mm/mteswa
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 +-
mm/kasan/common.c | 39
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
---
Change-Id: I2a622db0cb86a8feb60c30d8cb09190075be2a90
---
arch/s390/boot/string.c | 1 +
arch
code to handle this case.
Signed-off-by: Andrey Konovalov
Co-developed-by: Vincenzo Frascino
Signed-off-by: Vincenzo Frascino
Reviewed-by: Catalin Marinas
---
Change-Id: I3780fe7db6e075dff2937d3d8508f55c9322b095
---
arch/arm64/mm/fault.c | 14 ++
mm/kasan/report.c | 11
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
---
Change-Id: Ib46cb444cfdee44054628940a82f5139e10d0258
---
Documentation/dev-tools
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
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
---
Change-Id: I5d1117e6a991cbca00d2cfb4ba66e8ae2d8f513a
---
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, but will reuse
these macros. Rename "SHADOW" to implementation-neutral "META".
No functional changes.
Signed-off-
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
---
Change-Id: I6eb1eea770e6b61ad71c701231b8d815a7ccc853
---
arch/arm64/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git
-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
---
Change-Id: I5b0ed1d079ea776e620beca6a529a861e7dced95
---
mm/kasan/kasan.h
1501 - 1600 of 2648 matches
Mail list logo