All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@google.com>
To: Dmitry Vyukov <dvyukov@google.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	kasan-dev@googlegroups.com
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Alexander Potapenko <glider@google.com>,
	Marco Elver <elver@google.com>,
	Evgenii Stepanov <eugenis@google.com>,
	Elena Petrova <lenaptr@google.com>,
	Branislav Rankov <Branislav.Rankov@arm.com>,
	Kevin Brodsky <kevin.brodsky@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Andrey Konovalov <andreyknvl@google.com>
Subject: [PATCH v2 00/37] kasan: add hardware tag-based mode for arm64
Date: Tue, 15 Sep 2020 23:15:42 +0200	[thread overview]
Message-ID: <cover.1600204505.git.andreyknvl@google.com> (raw)

This patchset adds a new hardware tag-based mode to KASAN [1]. The new mode
is similar to the existing software tag-based KASAN, but relies on arm64
Memory Tagging Extension (MTE) [2] to perform memory and pointer tagging
(instead of shadow memory and compiler instrumentation).

This patchset is co-developed by
Vincenzo Frascino <vincenzo.frascino@arm.com>.

This patchset is available here:

https://github.com/xairy/linux/tree/up-kasan-mte-v2

and has also been uploaded to the Linux kernel Gerrit instance:

https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/2700

This patchset is based on the v10 of the user MTE patchset [3].

This patchset essentially consists of four parts:

1. Rework KASAN code to allow easier integration of the hardware tag-based
   mode.
2. Introduce config option for the new mode.
3. Introduce core in-kernel MTE routines.
4. Combine the previous parts together to implement the new mode.

For testing in QEMU hardware tag-based KASAN requires:

1. QEMU built from master [4] (use "-machine virt,mte=on -cpu max" arguments
   to run).
2. GCC version 10.

[1] https://www.kernel.org/doc/html/latest/dev-tools/kasan.html
[2] https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/enhancing-memory-safety
[3] git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux for-next/mte
[4] https://github.com/qemu/qemu

====== Overview

The underlying ideas of the approach used by hardware tag-based KASAN are:

1. By relying on the Top Byte Ignore (TBI) arm64 CPU feature, pointer tags
   are stored in the top byte of each kernel pointer.

2. With the Memory Tagging Extension (MTE) arm64 CPU feature, memory tags
   for kernel memory allocations are stored in a dedicated memory not
   accessible via normal instuctions.

3. On each memory allocation, a random tag is generated, embedded it into
   the returned pointer, and the corresponding memory is tagged with the
   same tag value.

4. With MTE the CPU performs a check on each memory access to make sure
   that the pointer tag matches the memory tag.

5. On a tag mismatch the CPU generates a tag fault, and a KASAN report is
   printed.

Same as other KASAN modes, hardware tag-based KASAN is intended as a
debugging feature at this point.

====== Rationale

There are two main reasons for this new hardware tag-based mode:

1. Previously implemented software tag-based KASAN is being successfully
   used on dogfood testing devices due to its low memory overhead (as
   initially planned). The new hardware mode keeps the same low memory
   overhead, and is expected to have significantly lower performance
   impact, due to the tag checks being performed by the hardware.
   Therefore the new mode can be used as a better alternative in dogfood
   testing for hardware that supports MTE.

2. The new mode lays the groundwork for the planned in-kernel MTE-based
   memory corruption mitigation to be used in production.

====== Technical details

From the implementation perspective, hardware tag-based KASAN is almost
identical to the software mode. The key difference is using MTE for
assigning and checking tags.

Compared to the software mode, the hardware mode uses 4 bits per tag, as
dictated by MTE. Pointer tags are stored in bits [56:60), the top 4 bits
have the normal value 0xF. Having less distict tags increases the
probablity of false negatives (from ~1/256 to ~1/16) in certain cases.

Only synchronous exceptions are set up and used by hardware tag-based KASAN.

====== Benchmarks

Note: all measurements have been performed with software emulation of Memory
Tagging Extension, performance numbers for hardware tag-based KASAN on the
actual hardware are expected to be better.

Boot time [1]:
* 2.8 sec for clean kernel
* 5.7 sec for hardware tag-based KASAN
* 11.8 sec for software tag-based KASAN
* 11.6 sec for generic KASAN

Slab memory usage after boot [2]:
* 7.0 kb for clean kernel
* 9.7 kb for hardware tag-based KASAN
* 9.7 kb for software tag-based KASAN
* 41.3 kb for generic KASAN

Measurements have been performed with:
* defconfig-based configs
* Manually built QEMU master
* QEMU arguments: -machine virt,mte=on -cpu max
* CONFIG_KASAN_STACK_ENABLE disabled
* CONFIG_KASAN_INLINE enabled
* clang-10 as the compiler and gcc-10 as the assembler
    
[1] Time before the ext4 driver is initialized.
[2] Measured as `cat /proc/meminfo | grep Slab`.

====== Notes

The cover letter for software tag-based KASAN patchset can be found here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0116523cfffa62aeb5aa3b85ce7419f3dae0c1b8

====== History

Changes v1->v2:
- Rebase onto v10 of the user MTE patchset.
- Only enable in-kernel MTE when KASAN_HW_TAGS is enabled.
- Add a layer of arch-level indirection, so KASAN doesn't call MTE helpers
  directly (this will be useful in case more architectures will add support
  for HW_TAGS).
- Don't do arm64_skip_faulting_instruction() on MTE fault, disable MTE
  instead.
- Don't allow software tags with MTE via arch/arm64/Kconfig instead of
  lib/Kconfig.kasan.
- Rename mm/kasan/tags.c to tags_sw.c and mte.c to tags_hw.c, and do the
  same for report_*.c files.
- Reword HW_TAGS Kconfig help text to make it less MTE specific.
- Reword and clarify Documentation.
- Drop unnecessary is_el1_mte_sync_tag_check_fault().
- Change report_tag_fault() to only call kasan_report() once HW_TAGS is
  introduced.
- Rename arch/arm64/include/asm/mte_asm.h to mte-helpers.h and move all
  MTE-related defines and some helper functions there.
- Change mm/kasan/kasan.h to include mte-def.h instead of mte.h.
- Add WARN_ON() on unaligned size to mte_set_mem_tag_range().
- Implement ldg/irg MTE routines as inline assembly.
- Remove smp_wmb() from mte_set_mem_tag_range().
- Drop __must_check 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 <asm/kasan.h> from low-level arm64 code.
- Move enabling TBI1 into __cpu_setup().
- Drop 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 (31):
  kasan: KASAN_VMALLOC depends on KASAN_GENERIC
  kasan: group vmalloc code
  kasan: shadow declarations only for software modes
  kasan: rename (un)poison_shadow to (un)poison_memory
  kasan: rename KASAN_SHADOW_* to KASAN_GRANULE_*
  kasan: only build init.c for software modes
  kasan: split out shadow.c from common.c
  kasan: rename generic/tags_report.c files
  kasan: don't duplicate config dependencies
  kasan: hide invalid free check implementation
  kasan: decode stack frame only with KASAN_STACK_ENABLE
  kasan, arm64: only init shadow for software modes
  kasan, arm64: only use kasan_depth for software modes
  kasan: rename addr_has_shadow to addr_has_metadata
  kasan: rename print_shadow_for_address to print_memory_metadata
  kasan: kasan_non_canonical_hook only for software modes
  kasan: rename SHADOW layout macros to META
  kasan: separate metadata_fetch_row for each mode
  kasan: don't allow SW_TAGS with ARM64_MTE
  kasan: rename tags.c to tags_sw.c
  kasan: introduce CONFIG_KASAN_HW_TAGS
  arm64: kasan: Add arch layer for memory tagging helpers
  arm64: kasan: Align allocations for HW_TAGS
  kasan: define KASAN_GRANULE_SIZE for HW_TAGS
  kasan, x86, s390: update undef CONFIG_KASAN
  kasan, arm64: expand CONFIG_KASAN checks
  kasan, arm64: implement HW_TAGS runtime
  kasan, arm64: print report from tag fault handler
  kasan, slub: reset tags when accessing metadata
  kasan, arm64: enable CONFIG_KASAN_HW_TAGS
  kasan: add documentation for hardware tag-based mode

Vincenzo Frascino (6):
  arm64: mte: Add in-kernel MTE helpers
  arm64: mte: Add in-kernel tag fault handler
  arm64: kasan: Enable in-kernel MTE
  arm64: mte: Convert gcr_user into an exclude mask
  arm64: mte: Switch GCR_EL1 in kernel entry and exit
  arm64: kasan: Enable TBI EL1

 Documentation/dev-tools/kasan.rst            |  80 ++-
 arch/arm64/Kconfig                           |   5 +-
 arch/arm64/Makefile                          |   2 +-
 arch/arm64/include/asm/assembler.h           |   2 +-
 arch/arm64/include/asm/cache.h               |   3 +
 arch/arm64/include/asm/esr.h                 |   1 +
 arch/arm64/include/asm/kasan.h               |   8 +-
 arch/arm64/include/asm/memory.h              |  14 +-
 arch/arm64/include/asm/mte-helpers.h         |  54 ++
 arch/arm64/include/asm/mte.h                 |  19 +-
 arch/arm64/include/asm/processor.h           |   2 +-
 arch/arm64/include/asm/string.h              |   5 +-
 arch/arm64/kernel/asm-offsets.c              |   3 +
 arch/arm64/kernel/cpufeature.c               |  10 +
 arch/arm64/kernel/entry.S                    |  26 +
 arch/arm64/kernel/head.S                     |   2 +-
 arch/arm64/kernel/image-vars.h               |   2 +-
 arch/arm64/kernel/mte.c                      |  90 ++-
 arch/arm64/kernel/setup.c                    |   1 -
 arch/arm64/lib/mte.S                         |  17 +
 arch/arm64/mm/dump.c                         |   6 +-
 arch/arm64/mm/fault.c                        |  43 +-
 arch/arm64/mm/kasan_init.c                   |  22 +-
 arch/arm64/mm/proc.S                         |  26 +-
 arch/s390/boot/string.c                      |   1 +
 arch/x86/boot/compressed/misc.h              |   1 +
 include/linux/kasan-checks.h                 |   2 +-
 include/linux/kasan.h                        | 110 ++--
 include/linux/mm.h                           |   2 +-
 include/linux/moduleloader.h                 |   3 +-
 include/linux/page-flags-layout.h            |   2 +-
 include/linux/sched.h                        |   2 +-
 include/linux/string.h                       |   2 +-
 init/init_task.c                             |   2 +-
 kernel/fork.c                                |   4 +-
 lib/Kconfig.kasan                            |  69 ++-
 lib/test_kasan.c                             |   2 +-
 mm/kasan/Makefile                            |  25 +-
 mm/kasan/common.c                            | 554 +------------------
 mm/kasan/generic.c                           |  33 +-
 mm/kasan/generic_report.c                    | 165 ------
 mm/kasan/init.c                              |  10 +-
 mm/kasan/kasan.h                             |  64 ++-
 mm/kasan/report.c                            | 254 ++-------
 mm/kasan/report_generic.c                    | 331 +++++++++++
 mm/kasan/report_tags_hw.c                    |  47 ++
 mm/kasan/{tags_report.c => report_tags_sw.c} |   9 +-
 mm/kasan/shadow.c                            | 509 +++++++++++++++++
 mm/kasan/tags_hw.c                           |  78 +++
 mm/kasan/{tags.c => tags_sw.c}               |  16 +-
 mm/page_poison.c                             |   2 +-
 mm/ptdump.c                                  |  13 +-
 mm/slab_common.c                             |   2 +-
 mm/slub.c                                    |  25 +-
 scripts/Makefile.lib                         |   2 +
 55 files changed, 1689 insertions(+), 1095 deletions(-)
 create mode 100644 arch/arm64/include/asm/mte-helpers.h
 delete mode 100644 mm/kasan/generic_report.c
 create mode 100644 mm/kasan/report_generic.c
 create mode 100644 mm/kasan/report_tags_hw.c
 rename mm/kasan/{tags_report.c => report_tags_sw.c} (91%)
 create mode 100644 mm/kasan/shadow.c
 create mode 100644 mm/kasan/tags_hw.c
 rename mm/kasan/{tags.c => tags_sw.c} (93%)

-- 
2.28.0.618.gf4bc123cb7-goog


WARNING: multiple messages have this Message-ID (diff)
From: Andrey Konovalov <andreyknvl@google.com>
To: Dmitry Vyukov <dvyukov@google.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	 Catalin Marinas <catalin.marinas@arm.com>,
	kasan-dev@googlegroups.com
Cc: Marco Elver <elver@google.com>,
	Elena Petrova <lenaptr@google.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Kevin Brodsky <kevin.brodsky@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Branislav Rankov <Branislav.Rankov@arm.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Alexander Potapenko <glider@google.com>,
	linux-arm-kernel@lists.infradead.org,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Evgenii Stepanov <eugenis@google.com>
Subject: [PATCH v2 00/37] kasan: add hardware tag-based mode for arm64
Date: Tue, 15 Sep 2020 23:15:42 +0200	[thread overview]
Message-ID: <cover.1600204505.git.andreyknvl@google.com> (raw)

This patchset adds a new hardware tag-based mode to KASAN [1]. The new mode
is similar to the existing software tag-based KASAN, but relies on arm64
Memory Tagging Extension (MTE) [2] to perform memory and pointer tagging
(instead of shadow memory and compiler instrumentation).

This patchset is co-developed by
Vincenzo Frascino <vincenzo.frascino@arm.com>.

This patchset is available here:

https://github.com/xairy/linux/tree/up-kasan-mte-v2

and has also been uploaded to the Linux kernel Gerrit instance:

https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/2700

This patchset is based on the v10 of the user MTE patchset [3].

This patchset essentially consists of four parts:

1. Rework KASAN code to allow easier integration of the hardware tag-based
   mode.
2. Introduce config option for the new mode.
3. Introduce core in-kernel MTE routines.
4. Combine the previous parts together to implement the new mode.

For testing in QEMU hardware tag-based KASAN requires:

1. QEMU built from master [4] (use "-machine virt,mte=on -cpu max" arguments
   to run).
2. GCC version 10.

[1] https://www.kernel.org/doc/html/latest/dev-tools/kasan.html
[2] https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/enhancing-memory-safety
[3] git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux for-next/mte
[4] https://github.com/qemu/qemu

====== Overview

The underlying ideas of the approach used by hardware tag-based KASAN are:

1. By relying on the Top Byte Ignore (TBI) arm64 CPU feature, pointer tags
   are stored in the top byte of each kernel pointer.

2. With the Memory Tagging Extension (MTE) arm64 CPU feature, memory tags
   for kernel memory allocations are stored in a dedicated memory not
   accessible via normal instuctions.

3. On each memory allocation, a random tag is generated, embedded it into
   the returned pointer, and the corresponding memory is tagged with the
   same tag value.

4. With MTE the CPU performs a check on each memory access to make sure
   that the pointer tag matches the memory tag.

5. On a tag mismatch the CPU generates a tag fault, and a KASAN report is
   printed.

Same as other KASAN modes, hardware tag-based KASAN is intended as a
debugging feature at this point.

====== Rationale

There are two main reasons for this new hardware tag-based mode:

1. Previously implemented software tag-based KASAN is being successfully
   used on dogfood testing devices due to its low memory overhead (as
   initially planned). The new hardware mode keeps the same low memory
   overhead, and is expected to have significantly lower performance
   impact, due to the tag checks being performed by the hardware.
   Therefore the new mode can be used as a better alternative in dogfood
   testing for hardware that supports MTE.

2. The new mode lays the groundwork for the planned in-kernel MTE-based
   memory corruption mitigation to be used in production.

====== Technical details

From the implementation perspective, hardware tag-based KASAN is almost
identical to the software mode. The key difference is using MTE for
assigning and checking tags.

Compared to the software mode, the hardware mode uses 4 bits per tag, as
dictated by MTE. Pointer tags are stored in bits [56:60), the top 4 bits
have the normal value 0xF. Having less distict tags increases the
probablity of false negatives (from ~1/256 to ~1/16) in certain cases.

Only synchronous exceptions are set up and used by hardware tag-based KASAN.

====== Benchmarks

Note: all measurements have been performed with software emulation of Memory
Tagging Extension, performance numbers for hardware tag-based KASAN on the
actual hardware are expected to be better.

Boot time [1]:
* 2.8 sec for clean kernel
* 5.7 sec for hardware tag-based KASAN
* 11.8 sec for software tag-based KASAN
* 11.6 sec for generic KASAN

Slab memory usage after boot [2]:
* 7.0 kb for clean kernel
* 9.7 kb for hardware tag-based KASAN
* 9.7 kb for software tag-based KASAN
* 41.3 kb for generic KASAN

Measurements have been performed with:
* defconfig-based configs
* Manually built QEMU master
* QEMU arguments: -machine virt,mte=on -cpu max
* CONFIG_KASAN_STACK_ENABLE disabled
* CONFIG_KASAN_INLINE enabled
* clang-10 as the compiler and gcc-10 as the assembler
    
[1] Time before the ext4 driver is initialized.
[2] Measured as `cat /proc/meminfo | grep Slab`.

====== Notes

The cover letter for software tag-based KASAN patchset can be found here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0116523cfffa62aeb5aa3b85ce7419f3dae0c1b8

====== History

Changes v1->v2:
- Rebase onto v10 of the user MTE patchset.
- Only enable in-kernel MTE when KASAN_HW_TAGS is enabled.
- Add a layer of arch-level indirection, so KASAN doesn't call MTE helpers
  directly (this will be useful in case more architectures will add support
  for HW_TAGS).
- Don't do arm64_skip_faulting_instruction() on MTE fault, disable MTE
  instead.
- Don't allow software tags with MTE via arch/arm64/Kconfig instead of
  lib/Kconfig.kasan.
- Rename mm/kasan/tags.c to tags_sw.c and mte.c to tags_hw.c, and do the
  same for report_*.c files.
- Reword HW_TAGS Kconfig help text to make it less MTE specific.
- Reword and clarify Documentation.
- Drop unnecessary is_el1_mte_sync_tag_check_fault().
- Change report_tag_fault() to only call kasan_report() once HW_TAGS is
  introduced.
- Rename arch/arm64/include/asm/mte_asm.h to mte-helpers.h and move all
  MTE-related defines and some helper functions there.
- Change mm/kasan/kasan.h to include mte-def.h instead of mte.h.
- Add WARN_ON() on unaligned size to mte_set_mem_tag_range().
- Implement ldg/irg MTE routines as inline assembly.
- Remove smp_wmb() from mte_set_mem_tag_range().
- Drop __must_check 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 <asm/kasan.h> from low-level arm64 code.
- Move enabling TBI1 into __cpu_setup().
- Drop 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 (31):
  kasan: KASAN_VMALLOC depends on KASAN_GENERIC
  kasan: group vmalloc code
  kasan: shadow declarations only for software modes
  kasan: rename (un)poison_shadow to (un)poison_memory
  kasan: rename KASAN_SHADOW_* to KASAN_GRANULE_*
  kasan: only build init.c for software modes
  kasan: split out shadow.c from common.c
  kasan: rename generic/tags_report.c files
  kasan: don't duplicate config dependencies
  kasan: hide invalid free check implementation
  kasan: decode stack frame only with KASAN_STACK_ENABLE
  kasan, arm64: only init shadow for software modes
  kasan, arm64: only use kasan_depth for software modes
  kasan: rename addr_has_shadow to addr_has_metadata
  kasan: rename print_shadow_for_address to print_memory_metadata
  kasan: kasan_non_canonical_hook only for software modes
  kasan: rename SHADOW layout macros to META
  kasan: separate metadata_fetch_row for each mode
  kasan: don't allow SW_TAGS with ARM64_MTE
  kasan: rename tags.c to tags_sw.c
  kasan: introduce CONFIG_KASAN_HW_TAGS
  arm64: kasan: Add arch layer for memory tagging helpers
  arm64: kasan: Align allocations for HW_TAGS
  kasan: define KASAN_GRANULE_SIZE for HW_TAGS
  kasan, x86, s390: update undef CONFIG_KASAN
  kasan, arm64: expand CONFIG_KASAN checks
  kasan, arm64: implement HW_TAGS runtime
  kasan, arm64: print report from tag fault handler
  kasan, slub: reset tags when accessing metadata
  kasan, arm64: enable CONFIG_KASAN_HW_TAGS
  kasan: add documentation for hardware tag-based mode

Vincenzo Frascino (6):
  arm64: mte: Add in-kernel MTE helpers
  arm64: mte: Add in-kernel tag fault handler
  arm64: kasan: Enable in-kernel MTE
  arm64: mte: Convert gcr_user into an exclude mask
  arm64: mte: Switch GCR_EL1 in kernel entry and exit
  arm64: kasan: Enable TBI EL1

 Documentation/dev-tools/kasan.rst            |  80 ++-
 arch/arm64/Kconfig                           |   5 +-
 arch/arm64/Makefile                          |   2 +-
 arch/arm64/include/asm/assembler.h           |   2 +-
 arch/arm64/include/asm/cache.h               |   3 +
 arch/arm64/include/asm/esr.h                 |   1 +
 arch/arm64/include/asm/kasan.h               |   8 +-
 arch/arm64/include/asm/memory.h              |  14 +-
 arch/arm64/include/asm/mte-helpers.h         |  54 ++
 arch/arm64/include/asm/mte.h                 |  19 +-
 arch/arm64/include/asm/processor.h           |   2 +-
 arch/arm64/include/asm/string.h              |   5 +-
 arch/arm64/kernel/asm-offsets.c              |   3 +
 arch/arm64/kernel/cpufeature.c               |  10 +
 arch/arm64/kernel/entry.S                    |  26 +
 arch/arm64/kernel/head.S                     |   2 +-
 arch/arm64/kernel/image-vars.h               |   2 +-
 arch/arm64/kernel/mte.c                      |  90 ++-
 arch/arm64/kernel/setup.c                    |   1 -
 arch/arm64/lib/mte.S                         |  17 +
 arch/arm64/mm/dump.c                         |   6 +-
 arch/arm64/mm/fault.c                        |  43 +-
 arch/arm64/mm/kasan_init.c                   |  22 +-
 arch/arm64/mm/proc.S                         |  26 +-
 arch/s390/boot/string.c                      |   1 +
 arch/x86/boot/compressed/misc.h              |   1 +
 include/linux/kasan-checks.h                 |   2 +-
 include/linux/kasan.h                        | 110 ++--
 include/linux/mm.h                           |   2 +-
 include/linux/moduleloader.h                 |   3 +-
 include/linux/page-flags-layout.h            |   2 +-
 include/linux/sched.h                        |   2 +-
 include/linux/string.h                       |   2 +-
 init/init_task.c                             |   2 +-
 kernel/fork.c                                |   4 +-
 lib/Kconfig.kasan                            |  69 ++-
 lib/test_kasan.c                             |   2 +-
 mm/kasan/Makefile                            |  25 +-
 mm/kasan/common.c                            | 554 +------------------
 mm/kasan/generic.c                           |  33 +-
 mm/kasan/generic_report.c                    | 165 ------
 mm/kasan/init.c                              |  10 +-
 mm/kasan/kasan.h                             |  64 ++-
 mm/kasan/report.c                            | 254 ++-------
 mm/kasan/report_generic.c                    | 331 +++++++++++
 mm/kasan/report_tags_hw.c                    |  47 ++
 mm/kasan/{tags_report.c => report_tags_sw.c} |   9 +-
 mm/kasan/shadow.c                            | 509 +++++++++++++++++
 mm/kasan/tags_hw.c                           |  78 +++
 mm/kasan/{tags.c => tags_sw.c}               |  16 +-
 mm/page_poison.c                             |   2 +-
 mm/ptdump.c                                  |  13 +-
 mm/slab_common.c                             |   2 +-
 mm/slub.c                                    |  25 +-
 scripts/Makefile.lib                         |   2 +
 55 files changed, 1689 insertions(+), 1095 deletions(-)
 create mode 100644 arch/arm64/include/asm/mte-helpers.h
 delete mode 100644 mm/kasan/generic_report.c
 create mode 100644 mm/kasan/report_generic.c
 create mode 100644 mm/kasan/report_tags_hw.c
 rename mm/kasan/{tags_report.c => report_tags_sw.c} (91%)
 create mode 100644 mm/kasan/shadow.c
 create mode 100644 mm/kasan/tags_hw.c
 rename mm/kasan/{tags.c => tags_sw.c} (93%)

-- 
2.28.0.618.gf4bc123cb7-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-09-15 22:02 UTC|newest]

Thread overview: 237+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 21:15 Andrey Konovalov [this message]
2020-09-15 21:15 ` [PATCH v2 00/37] kasan: add hardware tag-based mode for arm64 Andrey Konovalov
2020-09-15 21:15 ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 01/37] kasan: KASAN_VMALLOC depends on KASAN_GENERIC Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 02/37] kasan: group vmalloc code Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 03/37] kasan: shadow declarations only for software modes Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 04/37] kasan: rename (un)poison_shadow to (un)poison_memory Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 05/37] kasan: rename KASAN_SHADOW_* to KASAN_GRANULE_* Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-18  8:04   ` Alexander Potapenko
2020-09-18  8:04     ` Alexander Potapenko
2020-09-18  8:04     ` Alexander Potapenko
2020-09-18 10:42     ` Andrey Konovalov
2020-09-18 10:42       ` Andrey Konovalov
2020-09-18 10:42       ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 06/37] kasan: only build init.c for software modes Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 07/37] kasan: split out shadow.c from common.c Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-18  8:17   ` Alexander Potapenko
2020-09-18  8:17     ` Alexander Potapenko
2020-09-18  8:17     ` Alexander Potapenko
2020-09-18 10:39     ` Andrey Konovalov
2020-09-18 10:39       ` Andrey Konovalov
2020-09-18 10:39       ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 08/37] kasan: rename generic/tags_report.c files Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 09/37] kasan: don't duplicate config dependencies Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 10/37] kasan: hide invalid free check implementation Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 11/37] kasan: decode stack frame only with KASAN_STACK_ENABLE Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 12/37] kasan, arm64: only init shadow for software modes Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-17 17:05   ` Catalin Marinas
2020-09-17 17:05     ` Catalin Marinas
2020-09-15 21:15 ` [PATCH v2 13/37] kasan, arm64: only use kasan_depth " Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-17 17:05   ` Catalin Marinas
2020-09-17 17:05     ` Catalin Marinas
2020-09-15 21:15 ` [PATCH v2 14/37] kasan: rename addr_has_shadow to addr_has_metadata Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 15/37] kasan: rename print_shadow_for_address to print_memory_metadata Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 16/37] kasan: kasan_non_canonical_hook only for software modes Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15 ` [PATCH v2 17/37] kasan: rename SHADOW layout macros to META Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:15   ` Andrey Konovalov
2020-09-15 21:16 ` [PATCH v2 18/37] kasan: separate metadata_fetch_row for each mode Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16 ` [PATCH v2 19/37] kasan: don't allow SW_TAGS with ARM64_MTE Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 17:05   ` Catalin Marinas
2020-09-17 17:05     ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 20/37] kasan: rename tags.c to tags_sw.c Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-18  9:41   ` Alexander Potapenko
2020-09-18  9:41     ` Alexander Potapenko
2020-09-18  9:41     ` Alexander Potapenko
2020-09-18  9:44     ` Alexander Potapenko
2020-09-18  9:44       ` Alexander Potapenko
2020-09-18  9:44       ` Alexander Potapenko
2020-09-18  9:46       ` Alexander Potapenko
2020-09-18  9:46         ` Alexander Potapenko
2020-09-18  9:46         ` Alexander Potapenko
2020-09-18 10:42         ` Andrey Konovalov
2020-09-18 10:42           ` Andrey Konovalov
2020-09-18 10:42           ` Andrey Konovalov
2020-09-15 21:16 ` [PATCH v2 21/37] kasan: introduce CONFIG_KASAN_HW_TAGS Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-18 12:32   ` Marco Elver
2020-09-18 12:32     ` Marco Elver
2020-09-18 15:06     ` Andrey Konovalov
2020-09-18 15:06       ` Andrey Konovalov
2020-09-18 15:06       ` Andrey Konovalov
2020-09-18 15:36       ` Marco Elver
2020-09-18 15:36         ` Marco Elver
2020-09-18 15:36         ` Marco Elver
2020-09-18 15:45         ` Andrey Konovalov
2020-09-18 15:45           ` Andrey Konovalov
2020-09-18 15:45           ` Andrey Konovalov
2020-09-15 21:16 ` [PATCH v2 22/37] arm64: mte: Add in-kernel MTE helpers Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 13:46   ` Catalin Marinas
2020-09-17 13:46     ` Catalin Marinas
2020-09-17 14:21     ` Vincenzo Frascino
2020-09-17 14:21       ` Vincenzo Frascino
2020-09-18  9:36       ` Catalin Marinas
2020-09-18  9:36         ` Catalin Marinas
2020-09-22 10:16         ` Vincenzo Frascino
2020-09-22 10:16           ` Vincenzo Frascino
2020-09-17 16:17     ` Vincenzo Frascino
2020-09-17 16:17       ` Vincenzo Frascino
2020-09-17 17:07       ` Catalin Marinas
2020-09-17 17:07         ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 23/37] arm64: kasan: Add arch layer for memory tagging helpers Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 17:05   ` Catalin Marinas
2020-09-17 17:05     ` Catalin Marinas
2020-09-18 13:00   ` Marco Elver
2020-09-18 13:00     ` Marco Elver
2020-09-18 14:56     ` Andrey Konovalov
2020-09-18 14:56       ` Andrey Konovalov
2020-09-18 14:56       ` Andrey Konovalov
2020-09-15 21:16 ` [PATCH v2 24/37] arm64: mte: Add in-kernel tag fault handler Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 14:03   ` Catalin Marinas
2020-09-17 14:03     ` Catalin Marinas
2020-09-17 14:24     ` Vincenzo Frascino
2020-09-17 14:24       ` Vincenzo Frascino
2020-09-17 14:59   ` Catalin Marinas
2020-09-17 14:59     ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 25/37] arm64: kasan: Enable in-kernel MTE Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 16:35   ` Catalin Marinas
2020-09-17 16:35     ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 26/37] arm64: mte: Convert gcr_user into an exclude mask Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 17:06   ` Catalin Marinas
2020-09-17 17:06     ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 27/37] arm64: mte: Switch GCR_EL1 in kernel entry and exit Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 16:52   ` Catalin Marinas
2020-09-17 16:52     ` Catalin Marinas
2020-09-17 16:58     ` Catalin Marinas
2020-09-17 16:58       ` Catalin Marinas
2020-09-17 18:47     ` Vincenzo Frascino
2020-09-17 18:47       ` Vincenzo Frascino
2020-09-18  9:39       ` Catalin Marinas
2020-09-18  9:39         ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 28/37] arm64: kasan: Enable TBI EL1 Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 16:54   ` Catalin Marinas
2020-09-17 16:54     ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 29/37] arm64: kasan: Align allocations for HW_TAGS Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 17:06   ` Catalin Marinas
2020-09-17 17:06     ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 30/37] kasan: define KASAN_GRANULE_SIZE " Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16 ` [PATCH v2 31/37] kasan, x86, s390: update undef CONFIG_KASAN Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-18 10:52   ` Marco Elver
2020-09-18 10:52     ` Marco Elver
2020-09-18 15:07     ` Andrey Konovalov
2020-09-18 15:07       ` Andrey Konovalov
2020-09-18 15:07       ` Andrey Konovalov
2020-09-24 21:35       ` Andrey Konovalov
2020-09-24 21:35         ` Andrey Konovalov
2020-09-24 21:35         ` Andrey Konovalov
2020-09-15 21:16 ` [PATCH v2 32/37] kasan, arm64: expand CONFIG_KASAN checks Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 17:06   ` Catalin Marinas
2020-09-17 17:06     ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 33/37] kasan, arm64: implement HW_TAGS runtime Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 17:06   ` Catalin Marinas
2020-09-17 17:06     ` Catalin Marinas
2020-09-18 10:46   ` Marco Elver
2020-09-18 10:46     ` Marco Elver
2020-09-18 12:28     ` Andrey Konovalov
2020-09-18 12:28       ` Andrey Konovalov
2020-09-18 12:28       ` Andrey Konovalov
2020-09-18 12:52   ` Marco Elver
2020-09-18 12:52     ` Marco Elver
2020-09-18 15:00     ` Andrey Konovalov
2020-09-18 15:00       ` Andrey Konovalov
2020-09-18 15:00       ` Andrey Konovalov
2020-09-18 15:19   ` Marco Elver
2020-09-18 15:19     ` Marco Elver
2020-09-18 15:52     ` Andrey Konovalov
2020-09-18 15:52       ` Andrey Konovalov
2020-09-18 15:52       ` Andrey Konovalov
2020-09-15 21:16 ` [PATCH v2 34/37] kasan, arm64: print report from tag fault handler Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 17:04   ` Catalin Marinas
2020-09-17 17:04     ` Catalin Marinas
2020-09-18 12:26     ` Andrey Konovalov
2020-09-18 12:26       ` Andrey Konovalov
2020-09-18 12:26       ` Andrey Konovalov
2020-09-15 21:16 ` [PATCH v2 35/37] kasan, slub: reset tags when accessing metadata Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-18 14:44   ` Marco Elver
2020-09-18 14:44     ` Marco Elver
2020-09-18 14:55     ` Andrey Konovalov
2020-09-18 14:55       ` Andrey Konovalov
2020-09-18 14:55       ` Andrey Konovalov
2020-09-18 15:29       ` Catalin Marinas
2020-09-18 15:29         ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 36/37] kasan, arm64: enable CONFIG_KASAN_HW_TAGS Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-17 17:04   ` Catalin Marinas
2020-09-17 17:04     ` Catalin Marinas
2020-09-15 21:16 ` [PATCH v2 37/37] kasan: add documentation for hardware tag-based mode Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov
2020-09-15 21:16   ` Andrey Konovalov

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=cover.1600204505.git.andreyknvl@google.com \
    --to=andreyknvl@google.com \
    --cc=Branislav.Rankov@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=catalin.marinas@arm.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=eugenis@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kevin.brodsky@arm.com \
    --cc=lenaptr@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vincenzo.frascino@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.