Re: [PATCH v3 32/39] kasan: define KASAN_GRANULE_SIZE for HW_TAGS

2020-10-01 Thread Andrey Konovalov
On Thu, Oct 1, 2020 at 7:58 PM wrote: > > On Fri, Sep 25, 2020 at 12:50AM +0200, Andrey Konovalov wrote: > > 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

Re: [PATCH v3 37/39] kasan, slub: reset tags when accessing metadata

2020-10-01 Thread Andrey Konovalov
On Thu, Oct 1, 2020 at 8:03 PM wrote: > > On Fri, Sep 25, 2020 at 12:50AM +0200, Andrey Konovalov wrote: > > SLUB allocator accesses metadata for slab objects, that may lie > > out-of-bounds of the object itself, or be accessed when an object is freed. > > Such acc

[PATCH v4 01/39] kasan: drop unnecessary GPL text from comment headers

2020-10-01 Thread Andrey Konovalov
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 ---

[PATCH v4 08/39] kasan: split out shadow.c from common.c

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 07/39] kasan: only build init.c for software modes

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 10/39] kasan: rename report and tags files

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 06/39] kasan: rename KASAN_SHADOW_* to KASAN_GRANULE_*

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 09/39] kasan: define KASAN_GRANULE_PAGE

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 05/39] kasan: rename (un)poison_shadow to (un)poison_memory

2020-10-01 Thread Andrey Konovalov
. 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

[PATCH v4 00/39] kasan: add hardware tag-based mode for arm64

2020-10-01 Thread Andrey Konovalov
arch/arm64/kernel/entry.S. - Mark gcr_kernel_excl as __ro_after_init. - Use GENMASK() in mte_init_tags(). Andrey Konovalov (32): kasan: drop unnecessary GPL text from comment headers kasan: KASAN_VMALLOC depends on KASAN_GENERIC kasan: group vmalloc code kasan: shadow declarations only for sof

[PATCH v4 03/39] kasan: group vmalloc code

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 04/39] kasan: shadow declarations only for software modes

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 16/39] kasan: rename addr_has_shadow to addr_has_metadata

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 12/39] kasan: hide invalid free check implementation

2020-10-01 Thread Andrey Konovalov
(). 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

[PATCH v4 02/39] kasan: KASAN_VMALLOC depends on KASAN_GENERIC

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 21/39] kasan, arm64: don't allow SW_TAGS with ARM64_MTE

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 25/39] arm64: kasan: Add arch layer for memory tagging helpers

2020-10-01 Thread Andrey Konovalov
-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

[PATCH v4 17/39] kasan: rename print_shadow_for_address to print_memory_metadata

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 14/39] kasan, arm64: only init shadow for software modes

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 15/39] kasan, arm64: only use kasan_depth for software modes

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 19/39] kasan: rename SHADOW layout macros to META

2020-10-01 Thread Andrey Konovalov
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-

[PATCH v4 11/39] kasan: don't duplicate config dependencies

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 13/39] kasan: decode stack frame only with KASAN_STACK_ENABLE

2020-10-01 Thread 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

[PATCH v4 18/39] kasan: kasan_non_canonical_hook only for software modes

2020-10-01 Thread Andrey Konovalov
-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 9e4d539d62f4

[PATCH v4 30/39] arm64: kasan: Enable TBI EL1

2020-10-01 Thread Andrey Konovalov
-developed-by: Andrey Konovalov Signed-off-by: Andrey Konovalov --- Change-Id: I91944903bc9c9c9044f0d50e74bcd6b9971d21ff --- arch/arm64/mm/proc.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 6c1a6621d769..7c3304fb15d9 100644

[PATCH v4 23/39] arm64: Enable armv8.5-a asm-arch option

2020-10-01 Thread Andrey Konovalov
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 e875db8e1c86

[PATCH v4 26/39] arm64: mte: Add in-kernel tag fault handler

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 31/39] arm64: kasan: Align allocations for HW_TAGS

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 20/39] kasan: separate metadata_fetch_row for each mode

2020-10-01 Thread 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 --- Change-Id: I5b0ed1d079ea776e620beca6a529a861e7dced95 --- mm/kasan/kasan.h

[PATCH v4 29/39] arm64: mte: Switch GCR_EL1 in kernel entry and exit

2020-10-01 Thread Andrey Konovalov
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 --- Change-Id

[PATCH v4 22/39] kasan: introduce CONFIG_KASAN_HW_TAGS

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 24/39] arm64: mte: Add in-kernel MTE helpers

2020-10-01 Thread Andrey Konovalov
-by: Andrey Konovalov Signed-off-by: Andrey Konovalov --- 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 ++ arch/arm64/include/asm

[PATCH v4 28/39] arm64: mte: Convert gcr_user into an exclude mask

2020-10-01 Thread Andrey Konovalov
-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

[PATCH v4 27/39] arm64: kasan: Enable in-kernel MTE

2020-10-01 Thread Andrey Konovalov
in a page. Note: For MTE, the TCF bit field in SCTLR_EL1 affects only EL1 in a similar way as TCF0 affects EL0. Signed-off-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov --- Change-Id: I4d67497268bb7f0c2fc5dcacefa1e273df4af71d --- arch/arm64/kernel/cpufeature.c | 7 +++ arch/arm64/mm/proc.S

[PATCH v4 39/39] kasan: add documentation for hardware tag-based mode

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 36/39] kasan, arm64: print report from tag fault handler

2020-10-01 Thread Andrey Konovalov
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

[PATCH v4 34/39] kasan, arm64: expand CONFIG_KASAN checks

2020-10-01 Thread Andrey Konovalov
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

Re: [PATCH v2] kcov, usbip: collect coverage from vhci_rx_loop

2020-10-14 Thread Andrey Konovalov
On Tue, Oct 13, 2020 at 7:28 PM Shuah Khan wrote: > > On 10/12/20 11:10 AM, Andrey Konovalov wrote: > > From: Nazime Hande Harputluoglu > > > > Add kcov_remote_start()/kcov_remote_stop() annotations to the > > vhci_rx_loop() function, which is responsible for par

Re: [PATCH v2 1/3] kernel: make kcov_common_handle consider the current context

2020-10-14 Thread Andrey Konovalov
before kcov_remote_start() for usage details. */ > u64 kcov_common_handle(void) > { > + if (!in_task()) > + return 0; > return current->kcov_handle; > } > EXPORT_SYMBOL(kcov_common_handle); > -- > 2.28.0.1011.ga647a8990f-goog > Reviewed-by: Andrey Konovalov

[PATCH RFC 3/8] kasan: introduce set_alloc_info

2020-10-14 Thread Andrey Konovalov
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 Link: https://linux-review.googlesource.com/id/I0316193cbb4ecc9b87b7c2eee0dd79f8ec908c1a --- mm/kasan/common.c

[PATCH RFC 1/8] kasan: simplify quarantine_put call

2020-10-14 Thread Andrey Konovalov
Move get_free_info() call into quarantine_put() to simplify the call site. No functional changes. Signed-off-by: Andrey Konovalov Link: https://linux-review.googlesource.com/id/Iab0f04e7ebf8d83247024b7190c67c3c34c7940f --- mm/kasan/common.c | 2 +- mm/kasan/kasan.h | 5 ++--- mm

[PATCH RFC 0/8] kasan: hardware tag-based mode for production use on arm64

2020-10-14 Thread Andrey Konovalov
7.pdf [4] https://github.com/microsoft/MSRC-Security-Research/blob/master/papers/2020/Security%20analysis%20of%20memory%20tagging.pdf [5] https://source.android.com/devices/architecture/kernel/generic-kernel-image [6] https://github.com/qemu/qemu Andrey Konovalov (8): kasan: simplif

[PATCH RFC 2/8] kasan: rename get_alloc/free_info

2020-10-14 Thread Andrey Konovalov
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 Link: https://linux-review.googlesource.com/id

[PATCH RFC 5/8] kasan: mark kasan_init_tags as __init

2020-10-14 Thread Andrey Konovalov
Similarly to kasan_init() mark kasan_init_tags() as __init. Signed-off-by: Andrey Konovalov Link: https://linux-review.googlesource.com/id/I8792e22f1ca5a703c5e979969147968a99312558 --- include/linux/kasan.h | 4 ++-- mm/kasan/hw_tags.c| 2 +- mm/kasan/sw_tags.c| 2 +- 3 files changed

[PATCH RFC 4/8] kasan: unpoison stack only with CONFIG_KASAN_STACK

2020-10-14 Thread Andrey Konovalov
is enabled. Signed-off-by: Andrey Konovalov Link: https://linux-review.googlesource.com/id/If8a891e9fe01ea543e00b576852685afec0887e3 --- arch/arm64/kernel/sleep.S| 2 +- arch/x86/kernel/acpi/wakeup_64.S | 2 +- include/linux/kasan.h| 10 ++ mm/kasan/common.c

[PATCH RFC 8/8] kasan: add and integrate kasan_mode boot param

2020-10-14 Thread Andrey Konovalov
TODO: no meaningful description here yet, please see the cover letter for this RFC series. Signed-off-by: Andrey Konovalov Link: https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a4 --- mm/kasan/common.c | 69

[PATCH RFC 7/8] arm64: kasan: Add system_supports_tags helper

2020-10-14 Thread Andrey Konovalov
Add a helper that exposes information about whether the system supports memory tagging to be called in generic code. Signed-off-by: Andrey Konovalov Link: https://linux-review.googlesource.com/id/Ib4b56a42c57c6293df29a0cdfee334c3ca7bdab4 --- arch/arm64/include/asm/memory.h | 1 + mm/kasan

[PATCH RFC 6/8] kasan, arm64: move initialization message

2020-10-14 Thread Andrey Konovalov
t; instead of KBUILD_MODNAME. Signed-off-by: Andrey Konovalov Link: https://linux-review.googlesource.com/id/Idfd1e50625ffdf42dfc3dbf7455b11bd200a0a49 --- arch/arm64/mm/kasan_init.c | 3 +++ mm/kasan/generic.c | 2 -- mm/kasan/hw_tags.c | 4 mm/kasan/sw_tags.c | 4 +++

Re: [PATCH RFC 5/8] kasan: mark kasan_init_tags as __init

2020-10-16 Thread Andrey Konovalov
On Thu, Oct 15, 2020 at 12:23 PM Marco Elver wrote: > > On Wed, 14 Oct 2020 at 22:44, Andrey Konovalov wrote: > > > > Similarly to kasan_init() mark kasan_init_tags() as __init. > > > > Signed-off-by: Andrey Konovalov > > Link: > >

Re: [PATCH RFC 8/8] kasan: add and integrate kasan_mode boot param

2020-10-16 Thread Andrey Konovalov
On Thu, Oct 15, 2020 at 3:56 PM Marco Elver wrote: > > On Wed, 14 Oct 2020 at 22:45, Andrey Konovalov wrote: > > [...] > > @@ -180,6 +182,7 @@ size_t kasan_metadata_size(struct kmem_cache *cache) > > struct kasan_alloc_meta *kasan_get_alloc_meta(

Re: [PATCH RFC 0/8] kasan: hardware tag-based mode for production use on arm64

2020-10-16 Thread Andrey Konovalov
On Thu, Oct 15, 2020 at 4:41 PM Marco Elver wrote: > > On Wed, 14 Oct 2020 at 22:44, Andrey Konovalov wrote: > > This patchset is not complete (see particular TODOs in the last patch), > > and I haven't performed any benchmarking yet, but I would like to start the > >

[PATCH v4] kcov, usb: only collect coverage from __usb_hcd_giveback_urb in softirq

2020-10-16 Thread Andrey Konovalov
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: - Don't make any kcov changes, do a softirq context check in usb code inst

Re: [PATCH v2] kcov, usbip: collect coverage from vhci_rx_loop

2020-10-16 Thread Andrey Konovalov
On Tue, Oct 13, 2020 at 7:28 PM Shuah Khan wrote: > > On 10/12/20 11:10 AM, Andrey Konovalov wrote: > > From: Nazime Hande Harputluoglu > > > > Add kcov_remote_start()/kcov_remote_stop() annotations to the > > vhci_rx_loop() function, which is responsible for par

Re: [PATCH RFC 0/8] kasan: hardware tag-based mode for production use on arm64

2020-10-16 Thread Andrey Konovalov
On Wed, Oct 14, 2020 at 10:44 PM Andrey Konovalov wrote: > > This patchset is not complete (see particular TODOs in the last patch), > and I haven't performed any benchmarking yet, but I would like to start the > discussion now and hear people's opinions regarding the questions menti

Re: [PATCH RFC 0/8] kasan: hardware tag-based mode for production use on arm64

2020-10-16 Thread Andrey Konovalov
On Thu, Oct 15, 2020 at 4:41 PM Marco Elver wrote: > > On Wed, 14 Oct 2020 at 22:44, Andrey Konovalov wrote: > > This patchset is not complete (see particular TODOs in the last patch), > > and I haven't performed any benchmarking yet, but I would like to start the > >

Re: [PATCH RFC 0/8] kasan: hardware tag-based mode for production use on arm64

2020-10-16 Thread Andrey Konovalov
On Fri, Oct 16, 2020 at 3:31 PM Marco Elver wrote: > > On Fri, 16 Oct 2020 at 15:17, 'Andrey Konovalov' via kasan-dev > wrote: > [...] > > > > The intention with this kind of a high level switch is to hide the > > > > implementation details. Argu

[PATCH] kcov, usb, vhost: specify contexts for remote coverage sections

2020-10-07 Thread Andrey Konovalov
-by: Andrey Konovalov --- Documentation/dev-tools/kcov.rst | 5 + drivers/usb/core/hcd.c | 4 ++-- drivers/usb/core/hub.c | 4 ++-- drivers/vhost/vhost.c| 5 +++-- include/linux/kcov.h | 24 ++-- kernel/kcov.c

Re: [PATCH] kcov, usb, vhost: specify contexts for remote coverage sections

2020-10-07 Thread Andrey Konovalov
On Wed, Oct 7, 2020 at 7:30 PM Andrey Konovalov wrote: > > Currently there's a KCOV remote coverage collection section in > __usb_hcd_giveback_urb(). Initially that section was added based on the > assumption that usb_hcd_giveback_urb() can only be called in interrupt > conte

Re: [PATCH] kcov, usb, vhost: specify contexts for remote coverage sections

2020-10-07 Thread Andrey Konovalov
On Wed, Oct 7, 2020 at 9:29 PM Alan Stern wrote: > > On Wed, Oct 07, 2020 at 07:30:51PM +0200, Andrey Konovalov wrote: > > Currently there's a KCOV remote coverage collection section in > > __usb_hcd_giveback_urb(). Initially that section was added based on

Re: [PATCH] kcov, usb, vhost: specify contexts for remote coverage sections

2020-10-07 Thread Andrey Konovalov
On Wed, Oct 7, 2020 at 10:07 PM Alan Stern wrote: > > On Wed, Oct 07, 2020 at 09:54:57PM +0200, Andrey Konovalov wrote: > > On Wed, Oct 7, 2020 at 9:29 PM Alan Stern wrote: > > > > > > On Wed, Oct 07, 2020 at 07:30:51PM +0200, Andrey Konovalov wrote: > >

[PATCH v2] kcov, usb, vhost: specify contexts for remote coverage sections

2020-10-09 Thread Andrey Konovalov
usb_hcd_giveback_urb() 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 --- Changes v1->v2: - Fix context checks in kcov_remote_start/s

Re: [PATCH v2 0/3] [PATCH v2 0/3] [PATCH v2 0/3] net, mac80211, kernel: enable KCOV remote coverage collection for 802.11 frame handling

2020-10-11 Thread Andrey Konovalov
On Fri, Oct 9, 2020 at 7:13 PM Johannes Berg wrote: > > > > On 9 October 2020 19:01:59 CEST, Aleksandr Nogikh wrote: > > >This patch series conflicts with another proposed patch > >http://lkml.kernel.org/r/223901affc7bd759b2d6995c2dbfbdd0a29bc88a.1602248029.git.andreyk...@google.com > >One of

Re: [PATCH v2 0/3] [PATCH v2 0/3] [PATCH v2 0/3] net, mac80211, kernel: enable KCOV remote coverage collection for 802.11 frame handling

2020-10-11 Thread Andrey Konovalov
On Sun, Oct 11, 2020 at 8:50 PM Johannes Berg wrote: > > On Fri, 2020-10-09 at 17:01 +, Aleksandr Nogikh wrote: > > From: Aleksandr Nogikh > > > > This patch series enables remote KCOV coverage collection during > > 802.11 frames processing. These changes make it possible to perform > >

Re: [PATCH] usbip, kcov: collect coverage from usbip client

2020-10-12 Thread Andrey Konovalov
On Sat, Oct 10, 2020 at 8:55 AM Greg Kroah-Hartman wrote: > > On Fri, Oct 09, 2020 at 03:22:55PM +, > nazimehandeharputluogluhandehar...@gmail.com wrote: > > From: Nazime Hande Harputluoglu > > > > Add kcov_remote_start()/kcov_remote_stop() annotations to the > > vhci_rx_loop() function,

Re: WARNING in hif_usb_send/usb_submit_urb

2020-10-12 Thread Andrey Konovalov
On Fri, Oct 9, 2020 at 8:55 PM Alan Stern wrote: > > To the ath9k_htc maintainers: > > This is an attempt to fix a bug detected by the syzbot fuzzer. The bug > arises when a USB device claims to be an ATH9K but doesn't have the > expected endpoints. (In this case there was a bulk endpoint where

[PATCH v3] kcov, usb: specify contexts for remote coverage sections

2020-10-12 Thread Andrey Konovalov
() 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 --- Changes v2->v3: - Keep behavoir of existing callbacks the same exc

Re: [PATCH v3] kcov, usb: specify contexts for remote coverage sections

2020-10-12 Thread Andrey Konovalov
On Mon, Oct 12, 2020 at 6:08 PM Marco Elver wrote: > > On Mon, 12 Oct 2020 at 17:25, Andrey Konovalov wrote: > > > > Currently there's a KCOV remote coverage collection section in > > __usb_hcd_giveback_urb(). Initially that section was added based on the > > assump

Re: [PATCH v3 0/6] kasan: add workqueue and timer stack for generic KASAN

2020-08-26 Thread Andrey Konovalov
asan: record timer stack > > workqueue: kasan: record workqueue stack > > kasan: print timer and workqueue stack > > lib/test_kasan.c: add timer test case > > lib/test_kasan.c: add workqueue test case > > kasan: update documentation for generic kasan > > Acked-by: M

Re: [PATCH 19/35] kasan: don't allow SW_TAGS with ARM64_MTE

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 11:52 AM Vincenzo Frascino wrote: > > Hi Andrey, > > On 8/27/20 9:04 AM, Catalin Marinas wrote: > > On Fri, Aug 14, 2020 at 07:27:01PM +0200, Andrey Konovalov wrote: > >> Software tag-based KASAN provides its own tag checking machinery that

Re: [PATCH 28/35] kasan: define KASAN_GRANULE_SIZE for HW_TAGS

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 1:05 PM Vincenzo Frascino wrote: > > > > On 8/27/20 11:41 AM, Catalin Marinas wrote: > > On Fri, Aug 14, 2020 at 07:27:10PM +0200, Andrey Konovalov wrote: > >> Hardware tag-based KASAN has granules of MTE_GRANULE_SIZE. Define > >> KA

Re: [PATCH 25/35] kasan: introduce CONFIG_KASAN_HW_TAGS

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 1:31 PM Vincenzo Frascino wrote: > > Hi Andrey, > > On 8/14/20 6:27 PM, Andrey Konovalov wrote: > > +config·KASAN_HW_TAGS > > +» bool·"Hardware·tag-based·mode" > > +» depends·on·HAVE_ARCH_KASAN_HW_TAGS > > +» depends·on·

Re: [PATCH 32/35] kasan, arm64: print report from tag fault handler

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 12:48 PM Catalin Marinas wrote: > > On Fri, Aug 14, 2020 at 07:27:14PM +0200, Andrey Konovalov wrote: > > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > > index c62c8ba85c0e..cf00b3942564 100644 > > --- a/arch/arm64/mm/fault.c > &g

Re: [PATCH 26/35] kasan, arm64: Enable TBI EL1

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 1:15 PM Vincenzo Frascino wrote: > > > > On 8/27/20 12:13 PM, Catalin Marinas wrote: > > On Thu, Aug 27, 2020 at 12:05:55PM +0100, Vincenzo Frascino wrote: > >> On 8/27/20 11:40 AM, Catalin Marinas wrote: > >>> On Fri, Aug 14, 202

Re: [PATCH 20/35] arm64: mte: Add in-kernel MTE helpers

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 11:38 AM Catalin Marinas wrote: > > On Fri, Aug 14, 2020 at 07:27:02PM +0200, Andrey Konovalov wrote: > > diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h > > index 1c99fcadb58c..733be1cb5c95 100644 > > --- a/arch/arm64/inc

Re: [PATCH 21/35] arm64: mte: Add in-kernel tag fault handler

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 11:54 AM Catalin Marinas wrote: > > On Fri, Aug 14, 2020 at 07:27:03PM +0200, Andrey Konovalov wrote: > > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > > index 5e832b3387f1..c62c8ba85c0e 100644 > > --- a/arch/arm64/mm/fault.c > &g

Re: [PATCH 21/35] arm64: mte: Add in-kernel tag fault handler

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 3:10 PM Catalin Marinas wrote: > > On Thu, Aug 27, 2020 at 02:31:23PM +0200, Andrey Konovalov wrote: > > On Thu, Aug 27, 2020 at 11:54 AM Catalin Marinas > > wrote: > > > On Fri, Aug 14, 2020 at 07:27:03PM +0200, Andrey Konovalov wrote: > >

Re: [PATCH 26/35] kasan, arm64: Enable TBI EL1

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 3:42 PM Vincenzo Frascino wrote: > > Hi Andrey, > > On 8/27/20 1:43 PM, Andrey Konovalov wrote: > > On Thu, Aug 27, 2020 at 1:15 PM Vincenzo Frascino > > wrote: > >> > >> > >> > >> On 8/27/20 12:13 PM, Catalin M

Re: [PATCH 31/35] kasan, arm64: implement HW_TAGS runtime

2020-08-27 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 12:45 PM Catalin Marinas wrote: > > On Fri, Aug 14, 2020 at 07:27:13PM +0200, Andrey Konovalov wrote: > > diff --git a/mm/kasan/mte.c b/mm/kasan/mte.c > > new file mode 100644 > > index ..43b7d74161e5 > > --- /dev/null >

Re: [PATCH v12 0/6] KASAN-KUnit Integration

2020-08-12 Thread Andrey Konovalov
On Tue, Aug 11, 2020 at 7:39 AM David Gow wrote: > > This patchset contains everything needed to integrate KASAN and KUnit. > > KUnit will be able to: > (1) Fail tests when an unexpected KASAN error occurs > (2) Pass tests when an expected KASAN error occurs > > Convert KASAN tests to KUnit with

Re: [PATCH 20/35] arm64: mte: Add in-kernel MTE helpers

2020-09-08 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 11:38 AM Catalin Marinas wrote: > > On Fri, Aug 14, 2020 at 07:27:02PM +0200, Andrey Konovalov wrote: > > diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h > > index 1c99fcadb58c..733be1cb5c95 100644 > > --- a/arch/arm64/inc

Re: [PATCH 24/35] arm64: mte: Switch GCR_EL1 in kernel entry and exit

2020-09-08 Thread Andrey Konovalov
On Thu, Aug 27, 2020 at 12:38 PM Catalin Marinas wrote: > > On Fri, Aug 14, 2020 at 07:27:06PM +0200, Andrey Konovalov wrote: > > @@ -957,6 +984,7 @@ SYM_FUNC_START(cpu_switch_to) > > mov sp, x9 > > msr sp_el0, x1 > > ptrauth_keys_

Re: [PATCH v3 0/3] add fault injection to user memory access

2020-08-31 Thread Andrey Konovalov
On Mon, Aug 31, 2020 at 8:32 PM Andrew Morton wrote: > > On Mon, 31 Aug 2020 17:17:30 + albert.li...@gmail.com wrote: > > > The goal of this series is to improve testing of fault-tolerance in > > usages of user memory access functions, by adding support for fault > > injection. > > Does

Re: [PATCH v10 0/5] KASAN-KUnit Integration

2020-08-03 Thread Andrey Konovalov
On Sat, Aug 1, 2020 at 9:09 AM David Gow wrote: > > This patchset contains everything needed to integrate KASAN and KUnit. > > KUnit will be able to: > (1) Fail tests when an unexpected KASAN error occurs > (2) Pass tests when an expected KASAN error occurs > > Convert KASAN tests to KUnit with

Re: [PATCH v2 5/6] kasan: add tests for workqueue stack recording

2020-08-24 Thread Andrey Konovalov
queue_work_on+0xf4/0x118 > > kasan_workqueue_uaf+0xfc/0x190 > > > > Signed-off-by: Walter Wu > > Cc: Andrey Ryabinin > > Cc: Dmitry Vyukov > > Cc: Alexander Potapenko > > Cc: Matthias Brugger > > Cc: Andrey Konovalov > > --- > >

Re: [PATCH v13 0/5] KASAN-KUnit Integration

2020-09-10 Thread Andrey Konovalov
On Thu, Sep 10, 2020 at 9:03 AM David Gow wrote: > > This patchset contains everything needed to integrate KASAN and KUnit. > > KUnit will be able to: > (1) Fail tests when an unexpected KASAN error occurs > (2) Pass tests when an expected KASAN error occurs > > Convert KASAN tests to KUnit with

[PATCH v2 03/37] kasan: shadow declarations only for software modes

2020-09-15 Thread Andrey Konovalov
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

[PATCH v2 02/37] kasan: group vmalloc code

2020-09-15 Thread Andrey Konovalov
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

[PATCH v2 01/37] kasan: KASAN_VMALLOC depends on KASAN_GENERIC

2020-09-15 Thread Andrey Konovalov
Currently only generic KASAN mode supports vmalloc, reflect that in the config. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Change-Id: I1889e5b3bed28cc5d607802fb6ae43ba461c0dc1 --- lib/Kconfig.kasan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v2 04/37] kasan: rename (un)poison_shadow to (un)poison_memory

2020-09-15 Thread Andrey Konovalov
. No functional changes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Change-Id: Ia359f32815242c4704e49a5f1639ca2d2f8cba69 --- include/linux/kasan.h | 6 +++--- kernel/fork.c | 4 ++-- mm/kasan/common.c | 38 +++--- mm/kasan/generic.c

[PATCH v2 05/37] kasan: rename KASAN_SHADOW_* to KASAN_GRANULE_*

2020-09-15 Thread Andrey Konovalov
to KASAN_GRANULE_MASK. Also use MASK when used as a mask, otherwise use SIZE. No functional changes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Change-Id: Iac733e2248aa9d29f6fc425d8946ba07cca73ecf --- Documentation/dev-tools/kasan.rst | 2 +- lib/test_kasan.c | 2

[PATCH v2 12/37] kasan, arm64: only init shadow for software modes

2020-09-15 Thread Andrey Konovalov
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

[PATCH v2 10/37] kasan: hide invalid free check implementation

2020-09-15 Thread Andrey Konovalov
(). No functional changes for software modes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Change-Id: I5fae9531c9fc948eb4d4e0c589744032fc5a0789 --- mm/kasan/common.c | 19 +-- mm/kasan/generic.c | 7 +++ mm/kasan/kasan.h | 2 ++ mm/kasan/tags.c

[PATCH v2 11/37] kasan: decode stack frame only with KASAN_STACK_ENABLE

2020-09-15 Thread 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 --- Change-Id

[PATCH v2 08/37] kasan: rename generic/tags_report.c files

2020-09-15 Thread Andrey Konovalov
Rename generic_report.c to report_generic.c and tags_report.c to report_tags.c, as their content is more relevant to report.c file, then to generic.c or tags.c. No functional changes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Change-Id

[PATCH v2 07/37] kasan: split out shadow.c from common.c

2020-09-15 Thread Andrey Konovalov
for software modes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Change-Id: Ic1c32ce72d4649848e9e6a1f2c8dd269c77673f2 --- mm/kasan/Makefile | 6 +- mm/kasan/common.c | 486 +-- mm/kasan/shadow.c | 509

[PATCH v2 06/37] kasan: only build init.c for software modes

2020-09-15 Thread Andrey Konovalov
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

[PATCH v2 24/37] arm64: mte: Add in-kernel tag fault handler

2020-09-15 Thread Andrey Konovalov
() and panics. Signed-off-by: Vincenzo Frascino Co-developed-by: Andrey Konovalov Signed-off-by: Andrey Konovalov --- Change-Id: I9b8aa79567f7c45f4d6a1290efcf34567e620717 --- arch/arm64/mm/fault.c | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git

[PATCH v2 14/37] kasan: rename addr_has_shadow to addr_has_metadata

2020-09-15 Thread Andrey Konovalov
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

[PATCH v2 09/37] kasan: don't duplicate config dependencies

2020-09-15 Thread Andrey Konovalov
Both KASAN_GENERIC and KASAN_SW_TAGS have common dependencies, move those to KASAN. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Change-Id: I77e475802e8f1750b9154fe4a6e6da4456054fcd --- lib/Kconfig.kasan | 11 +++ 1 file changed, 3 insertions(+), 8 deletions

[PATCH v2 27/37] arm64: mte: Switch GCR_EL1 in kernel entry and exit

2020-09-15 Thread Andrey Konovalov
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 --- Change-Id

<    5   6   7   8   9   10   11   12   13   14   >