[PATCH mm v11 34/42] kasan: define KASAN_GRANULE_SIZE for HW_TAGS

2020-11-23 Thread Andrey Konovalov
Hardware tag-based KASAN has granules of MTE_GRANULE_SIZE. Define KASAN_GRANULE_SIZE to MTE_GRANULE_SIZE for CONFIG_KASAN_HW_TAGS. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko --- Change-Id

[PATCH mm v11 33/42] arm64: kasan: Add arch layer for memory tagging helpers

2020-11-23 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 mm v11 38/42] kasan, arm64: print report from tag fault handler

2020-11-23 Thread Andrey Konovalov
reporting code to handle this case. Signed-off-by: Andrey Konovalov Co-developed-by: Vincenzo Frascino Signed-off-by: Vincenzo Frascino Reviewed-by: Catalin Marinas Reviewed-by: Alexander Potapenko --- Change-Id: I3780fe7db6e075dff2937d3d8508f55c9322b095 --- arch/arm64/mm/fa

[PATCH mm v11 37/42] kasan, arm64: implement HW_TAGS runtime

2020-11-23 Thread Andrey Konovalov
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-by

[PATCH mm v11 18/42] kasan: rename addr_has_shadow to addr_has_metadata

2020-11-23 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 change

[PATCH mm v11 30/42] arm64: mte: Switch GCR_EL1 in kernel entry and exit

2020-11-23 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 Co-developed-by: Andrey Konovalov Signed-off-by: Andrey

[PATCH mm v4 00/19] kasan: boot parameters for hardware tag-based mode

2020-11-23 Thread Andrey Konovalov
tion changes, those will be included in a separate patchset. - Update KASAN documentation to mention boot parameters. Changes RFC v1 -> RFC v2: - Rework boot parameters. - Drop __init from empty kasan_init_tags() definition. - Add cpu_supports_mte() helper that can be used during early boot and u

[PATCH mm v4 01/19] kasan: simplify quarantine_put call site

2020-11-23 Thread Andrey Konovalov
Move get_free_info() call into quarantine_put() to simplify the call site. No functional changes. Signed-off-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Reviewed-by: Marco Elver Link: https://linux-review.googlesource.com/id/Iab0f04e7ebf8d83247024b7190c67c3c34c7940f --- mm/kasan

[PATCH mm v4 03/19] kasan: introduce set_alloc_info

2020-11-23 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 Reviewed-by: Dmitry Vyukov Reviewed-by: Marco Elver Link: https://linux-review.googlesource.com/id

[PATCH mm v4 05/19] kasan: allow VMAP_STACK for HW_TAGS mode

2020-11-23 Thread 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 Reviewed-by: Marco Elver Acked-by: Catalin Marinas R

[PATCH mm v4 04/19] kasan, arm64: unpoison stack only with CONFIG_KASAN_STACK

2020-11-23 Thread Andrey Konovalov
ASAN_STACK is enabled. Note, that CONFIG_KASAN_STACK is an option that is currently always defined when CONFIG_KASAN is enabled, and therefore has to be tested with #if instead of #ifdef. Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Acked-by: Catalin Marinas Reviewed-by: Dmitry Vy

[PATCH mm v4 07/19] kasan: inline kasan_reset_tag for tag-based modes

2020-11-23 Thread Andrey Konovalov
d use kasan_reset_tag() instead. Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Reviewed-by: Dmitry Vyukov Link: https://linux-review.googlesource.com/id/I4d2061acfe91d480a75df00b07c22d8494ef14b5 --- include/linux/kasan.h | 5 - mm/kasan/common.c | 6 +++--- mm/

[PATCH mm v4 06/19] kasan: remove __kasan_unpoison_stack

2020-11-23 Thread Andrey Konovalov
There's no need for __kasan_unpoison_stack() helper, as it's only currently used in a single place. Removing it also removes unneeded arithmetic. No functional changes. Signed-off-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Reviewed-by: Marco Elver Link: htt

[PATCH mm v4 08/19] kasan: inline random_tag for HW_TAGS

2020-11-23 Thread Andrey Konovalov
Using random_tag() currently results in a function call. Move its definition to mm/kasan/kasan.h and turn it into a static inline function for hardware tag-based mode to avoid uneeded function calls. Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Reviewed-by: Dmitry Vyukov Link

[PATCH mm v4 10/19] kasan: inline (un)poison_range and check_invalid_free

2020-11-23 Thread Andrey Konovalov
Using (un)poison_range() or check_invalid_free() currently results in function calls. Move their definitions to mm/kasan/kasan.h and turn them into static inline functions for hardware tag-based mode to avoid unneeded function calls. Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Link

[PATCH mm v4 11/19] kasan: add and integrate kasan boot parameters

2020-11-23 Thread Andrey Konovalov
(Generic Kernel Image) initiative [1]. [1] https://source.android.com/devices/architecture/kernel/generic-kernel-image Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Reviewed-by: Dmitry Vyukov Link: https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a

[PATCH mm v4 13/19] kasan, mm: rename kasan_poison_kfree

2020-11-23 Thread Andrey Konovalov
Rename kasan_poison_kfree() to kasan_slab_free_mempool() as it better reflects what this annotation does. Also add a comment that explains the PageSlab() check. No functional changes. Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Link: https://linux-review.googlesource.com/id

[PATCH mm v4 12/19] kasan, mm: check kasan_enabled in annotations

2020-11-23 Thread Andrey Konovalov
-off-by: Andrey Konovalov Reviewed-by: Marco Elver Reviewed-by: Dmitry Vyukov Link: https://linux-review.googlesource.com/id/I2589451d3c96c97abbcbf714baabe6161c6f153e --- include/linux/kasan.h | 213 -- include/linux/mm.h| 22 +++-- mm/kasan/common.c

[PATCH mm v4 15/19] kasan: simplify assign_tag and set_tag calls

2020-11-23 Thread 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 Reviewed-by: Marco Elver Link: https://linux

[PATCH mm v4 14/19] kasan: don't round_up too much

2020-11-23 Thread Andrey Konovalov
For hardware tag-based mode kasan_poison_memory() already rounds up the size. Do the same for software modes and remove round_up() from the common code. Signed-off-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Reviewed-by: Marco Elver Link: https://linux-review.googlesource.com/id

[PATCH mm v4 16/19] kasan: clarify comment in __kasan_kfree_large

2020-11-23 Thread Andrey Konovalov
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 Reviewed-by: Marco Elver Link: https://linux-review.googlesource.com/id

[PATCH mm v4 18/19] kasan, mm: allow cache merging with no metadata

2020-11-23 Thread Andrey Konovalov
scino Signed-off-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Reviewed-by: Marco Elver Link: https://linux-review.googlesource.com/id/Ia114847dfb2244f297d2cb82d592bf6a07455dba --- include/linux/kasan.h | 21 +++-- mm/kasan/common.c | 11 +++ mm/slab_common.c

[PATCH mm v4 17/19] kasan: sanitize objects when metadata doesn't fit

2020-11-23 Thread Andrey Konovalov
rest is freed right away. Along the way rework __kasan_cache_create() and add claryfying comments. Co-developed-by: Vincenzo Frascino Signed-off-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Link: https://linux-review.googlesourc

[PATCH mm v4 19/19] kasan: update documentation

2020-11-23 Thread Andrey Konovalov
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 Reviewed-by

[PATCH mm v4 09/19] kasan: open-code kasan_unpoison_slab

2020-11-23 Thread Andrey Konovalov
There's the external annotation kasan_unpoison_slab() that is currently defined as static inline and uses kasan_unpoison_range(). Open-code this function in mempool.c. Otherwise with an upcoming change this function will result in an unnecessary function call. Signed-off-by: Andrey Kono

[PATCH mm v4 02/19] kasan: rename get_alloc/free_info

2020-11-23 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 Reviewed-by: Dmitry Vyukov Reviewed-by: Marco Elver Link

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

2020-11-23 Thread Andrey Konovalov
On Mon, Oct 19, 2020 at 8:52 PM Shuah Khan wrote: > > On 10/19/20 12:49 PM, Shuah Khan wrote: > > On 10/19/20 11:20 AM, Andrey Konovalov wrote: > >> From: Nazime Hande Harputluoglu > >> > >> Add kcov_remote_start()/kcov_remote_stop() annotations to the

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

2020-11-23 Thread Andrey Konovalov
On Fri, Nov 13, 2020 at 4:47 PM Marco Elver wrote: > > On Fri, 13 Nov 2020 at 14:42, Andrey Konovalov wrote: > > On Fri, Nov 13, 2020 at 2:28 PM Sebastian Andrzej Siewior > > wrote: > > > > > > On 2020-11-13 13:51:19 [+0100], Andrey Konovalov wrote: > &g

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

2020-11-23 Thread Andrey Konovalov
ov wrappers. As the result of this change, the coverage from USB/IP related 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-o

[PATCH v4] kcov, usbip: collect coverage from vhci_rx_loop

2020-11-23 Thread Andrey Konovalov
for kcov_remote_start()/stop() annotations (see Documentation/dev-tools/kcov.rst for details). As the result kcov can now be used to collect coverage from vhci_rx_loop() threads. Signed-off-by: Nazime Hande Harputluoglu Co-developed-by: Andrey Konovalov Signed-off-by: Andrey Konovalov

Re: [kbuild-all] Re: drivers/net/wan/slic_ds26522.c:205:12: warning: stack frame size of 12288 bytes in function 'slic_ds26522_probe'

2020-11-24 Thread Andrey Konovalov
On Tue, Nov 24, 2020 at 9:02 AM Rong Chen wrote: > > On 11/23/20 10:15 PM, Andrey Konovalov wrote: > > On Thu, Nov 19, 2020 at 11:16 PM kernel test robot wrote: > >> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Re: [PATCH v9 0/6] KASAN for powerpc64 radix

2020-12-02 Thread Andrey Konovalov
On Tue, Dec 1, 2020 at 5:16 PM Daniel Axtens wrote: > > Building on the work of Christophe, Aneesh and Balbir, I've ported > KASAN to 64-bit Book3S kernels running on the Radix MMU. > > This is a significant reworking of the previous versions. Instead of > the previous approach which supported inl

Re: [PATCH v3 1/1] kasan: fix object remain in offline per-cpu quarantine

2020-12-03 Thread Andrey Konovalov
On Wed, Dec 2, 2020 at 8:58 AM Kuan-Ying Lee wrote: > > We hit this issue in our internal test. > When enabling generic kasan, a kfree()'d object is put into per-cpu > quarantine first. If the cpu goes offline, object still remains in > the per-cpu quarantine. If we call kmem_cache_destroy() now,

Re: linux-next: build failure after merge of the akpm tree

2020-12-03 Thread Andrey Konovalov
On Thu, Dec 3, 2020 at 9:52 AM Stephen Rothwell wrote: > > Hi all, > > After merging the akpm tree, today's linux-next build (x86_64 > allmodconfig) failed like this: > > mm/kasan/quarantine.c: In function 'quarantine_put': > mm/kasan/quarantine.c:197:15: error: 'info' undeclared (first use in thi

Re: [PATCH v2] lib: stackdepot: Add support to configure STACK_HASH_SIZE

2020-12-03 Thread Andrey Konovalov
On Thu, Dec 3, 2020 at 5:04 PM Qian Cai wrote: > > On Thu, 2020-11-26 at 10:13 +0530, vji...@codeaurora.org wrote: > > From: Yogesh Lal > > > > Add a kernel parameter stack_hash_order to configure STACK_HASH_SIZE. > > > > Aim is to have configurable value for STACK_HASH_SIZE, so that one > > can

[PATCH 03/11] kasan: docs: update usage section

2021-03-11 Thread Andrey Konovalov
Update the "Usage" section in KASAN documentation: - Add inline code snippet markers. - Reword the part about stack traces for clarity. - Other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 23 +++ 1 file changed, 11

[PATCH 02/11] kasan: docs: update overview section

2021-03-11 Thread Andrey Konovalov
Update the "Overview" section in KASAN documentation: - Outline main use cases for each mode. - Mention that HW_TAGS mode need compiler support too. - Move the part about SLUB/SLAB support from "Usage" to "Overview". - Punctuation, readability, and other minor cle

[PATCH 01/11] kasan: docs: clean up sections

2021-03-11 Thread Andrey Konovalov
Update KASAN documentation: - Give some sections clearer names. - Remove unneeded subsections in the "Tests" section. - Move the "For developers" section and split into subsections. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 50 ++

[PATCH 06/11] kasan: docs: update GENERIC implementation details section

2021-03-11 Thread Andrey Konovalov
ty, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index 2f939241349d..

[PATCH 07/11] kasan: docs: update SW_TAGS implementation details section

2021-03-11 Thread Andrey Konovalov
Update the "Implementation details" section for SW_TAGS KASAN: - Clarify the introduction sentence. - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 39 +++ 1 file changed, 19

[PATCH 10/11] kasan: docs: update ignoring accesses section

2021-03-11 Thread Andrey Konovalov
Update the "Ignoring accesses" section in KASAN documentation: - Mention kasan_disable/enable_current(). - Mention kasan_reset_tag()/page_kasan_tag_reset(). - A punctuation clean-up. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 15 ++- 1 file c

[PATCH 08/11] kasan: docs: update HW_TAGS implementation details section

2021-03-11 Thread Andrey Konovalov
Update the "Implementation details" section for HW_TAGS KASAN: - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) di

[PATCH 11/11] kasan: docs: update tests section

2021-03-11 Thread Andrey Konovalov
Update the "Tests" section in KASAN documentation: - Add an introductory sentence. - Add proper indentation for the list of ways to run KUnit tests. - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasa

[PATCH 09/11] kasan: docs: update shadow memory section

2021-03-11 Thread Andrey Konovalov
Update the "Shadow memory" section in KASAN documentation: - Rearrange the introduction paragraph do it doesn't give a "KASAN has an issue" impression. - Update the list of architectures with vmalloc support. - Punctuation, readability, and other minor clean-up

[PATCH 04/11] kasan: docs: update error reports section

2021-03-11 Thread Andrey Konovalov
Update the "Error reports" section in KASAN documentation: - Mention that bug titles are best-effort. - Move and reword the part about auxiliary stacks from "Implementation details". - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --

[PATCH 05/11] kasan: docs: update boot parameters section

2021-03-11 Thread Andrey Konovalov
Update the "Boot parameters" section in KASAN documentation: - Mention panic_on_warn. - Mention kasan_multi_shot and its interaction with panic_on_warn. - Clarify kasan.fault=panic interaction with panic_on_warn. - A readability clean-up. Signed-off-by: Andrey Konovalov --- Documen

Re: [PATCH 02/11] kasan: docs: update overview section

2021-03-12 Thread Andrey Konovalov
On Fri, Mar 12, 2021 at 11:18 AM Marco Elver wrote: > > > -Currently generic KASAN is supported for the x86_64, arm, arm64, xtensa, > > s390 > > +The hardware KASAN mode (#3) relies on hardware to perform the checks but > > +still requires a compiler version that supports memory tagging > > inst

Re: [PATCH 09/11] kasan: docs: update shadow memory section

2021-03-12 Thread Andrey Konovalov
On Fri, Mar 12, 2021 at 11:52 AM Marco Elver wrote: > > On Thu, Mar 11, 2021 at 10:37PM +0100, Andrey Konovalov wrote: > [...] > > -The kernel maps memory in a number of different parts of the address > > -space. This poses something of a problem for KASAN, which requires &g

Re: [PATCH 11/11] kasan: docs: update tests section

2021-03-12 Thread Andrey Konovalov
On Fri, Mar 12, 2021 at 11:47 AM Marco Elver wrote: > > On Thu, Mar 11, 2021 at 10:37PM +0100, Andrey Konovalov wrote: > [...] > > -With ``CONFIG_KUNIT`` enabled, ``CONFIG_KASAN_KUNIT_TEST`` can be built as > > -a loadable module and run on any architecture that supports

Re: [PATCH 10/11] kasan: docs: update ignoring accesses section

2021-03-12 Thread Andrey Konovalov
On Fri, Mar 12, 2021 at 12:02 PM Marco Elver wrote: > > On Thu, Mar 11, 2021 at 10:37PM +0100, Andrey Konovalov wrote: > [...] > > +Other parts of the kernel might access metadata for allocated objects. > > Normally, > > +KASAN detects and reports such accesses, but

[PATCH v2 01/11] kasan: docs: clean up sections

2021-03-12 Thread Andrey Konovalov
Update KASAN documentation: - Give some sections clearer names. - Remove unneeded subsections in the "Tests" section. - Move the "For developers" section and split into subsections. Signed-off-by: Andrey Konovalov --- Changes v1->v2: - Rename "By default&qu

[PATCH v2 02/11] kasan: docs: update overview section

2021-03-12 Thread Andrey Konovalov
Update the "Overview" section in KASAN documentation: - Outline main use cases for each mode. - Mention that HW_TAGS mode need compiler support too. - Move the part about SLUB/SLAB support from "Usage" to "Overview". - Punctuation, readability, and other minor cle

[PATCH v2 05/11] kasan: docs: update boot parameters section

2021-03-12 Thread Andrey Konovalov
Update the "Boot parameters" section in KASAN documentation: - Mention panic_on_warn. - Mention kasan_multi_shot and its interaction with panic_on_warn. - Clarify kasan.fault=panic interaction with panic_on_warn. - A readability clean-up. Signed-off-by: Andrey Konovalov --- Documen

[PATCH v2 03/11] kasan: docs: update usage section

2021-03-12 Thread Andrey Konovalov
Update the "Usage" section in KASAN documentation: - Add inline code snippet markers. - Reword the part about stack traces for clarity. - Other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 23 +++ 1 file changed, 11

[PATCH v2 04/11] kasan: docs: update error reports section

2021-03-12 Thread Andrey Konovalov
Update the "Error reports" section in KASAN documentation: - Mention that bug titles are best-effort. - Move and reword the part about auxiliary stacks from "Implementation details". - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --

[PATCH v2 06/11] kasan: docs: update GENERIC implementation details section

2021-03-12 Thread Andrey Konovalov
ty, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index 1189be9b4cb5..

[PATCH v2 07/11] kasan: docs: update SW_TAGS implementation details section

2021-03-12 Thread Andrey Konovalov
Update the "Implementation details" section for SW_TAGS KASAN: - Clarify the introduction sentence. - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 39 +++ 1 file changed, 19

[PATCH v2 10/11] kasan: docs: update ignoring accesses section

2021-03-12 Thread Andrey Konovalov
Update the "Ignoring accesses" section in KASAN documentation: - Mention __no_sanitize_address/noinstr. - Mention kasan_disable/enable_current(). - Mention kasan_reset_tag()/page_kasan_tag_reset(). - Readability and punctuation clean-ups. Signed-off-by: Andrey Konovalov --- Changes

[PATCH v2 09/11] kasan: docs: update shadow memory section

2021-03-12 Thread Andrey Konovalov
Update the "Shadow memory" section in KASAN documentation: - Rearrange the introduction paragraph do it doesn't give a "KASAN has an issue" impression. - Update the list of architectures with vmalloc support. - Punctuation, readability, and other minor clean-up

[PATCH v2 08/11] kasan: docs: update HW_TAGS implementation details section

2021-03-12 Thread Andrey Konovalov
Update the "Implementation details" section for HW_TAGS KASAN: - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) di

[PATCH v2 11/11] kasan: docs: update tests section

2021-03-12 Thread Andrey Konovalov
Update the "Tests" section in KASAN documentation: - Add an introductory sentence. - Add proper indentation for the list of ways to run KUnit tests. - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Changes v1->v2: - Fix missing snip

Re: [PATCH v4] kasan: remove redundant config option

2021-03-12 Thread Andrey Konovalov
On Thu, Mar 11, 2021 at 6:45 AM Andrew Morton wrote: > > On Thu, 11 Mar 2021 09:32:45 +0800 Walter Wu > wrote: > > > > > Hi Andrew, > > > > I see my v4 patch is different in the next tree now. please see below > > information. > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.g

Re: [PATCH v15 8/8] kasan, arm64: tests supports for HW_TAGS async mode

2021-03-12 Thread Andrey Konovalov
On Fri, Mar 12, 2021 at 3:22 PM Vincenzo Frascino wrote: > > From: Andrey Konovalov > > This change adds KASAN-KUnit tests support for the async HW_TAGS mode. > > In async mode, tag fault aren't being generated synchronously when a > bad access happens, but are instead

Re: [PATCH v15 0/8] arm64: ARMv8.5-A: MTE: Add async mode support

2021-03-12 Thread Andrey Konovalov
been updated by the PE the kernel clears it and > reports the error. > > The series is based on linux-next/akpm. > > To simplify the testing a tree with the new patches on top has been made > available at [1]. > > [1] https://git.gitlab.arm.com/linux-arm/linux-vf.git

Re: [PATCH v6 12/22] media: camss: Remove per VFE power domain toggling

2021-03-11 Thread Andrey Konovalov
is no option for this generation of HW. Signed-off-by: Robert Foss --- Changes since v5: - Andrey: Bifurcated PD support into Gen1 & Gen2 paths Reviewed-by: Andrey Konovalov Thanks, Andrey .../media/platform/qcom/camss/camss-vfe-170.c | 21 + .../media/platform/qcom/camss/c

[PATCH] kasan: fix per-page tags for non-page_alloc pages

2021-03-11 Thread Andrey Konovalov
n occur in the future. Fixes: 2813b9c02962 ("kasan, mm, arm64: tag non slab memory allocated via pagealloc") Cc: sta...@vger.kernel.org Signed-off-by: Andrey Konovalov --- include/linux/mm.h | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/include/

Re: [PATCH 3/5] kasan, mm: integrate page_alloc init with HW_TAGS

2021-03-08 Thread Andrey Konovalov
On Mon, Mar 8, 2021 at 12:35 PM Marco Elver wrote: > > > - kasan_free_nondeferred_pages(page, order, fpi_flags); > > + init = want_init_on_free(); > > + if (init && !IS_ENABLED(CONFIG_KASAN_HW_TAGS)) > > Doing the !IS_ENABLED(CONFIG_KASAN_HW_TAGS) check is awkward, and > assumes intern

Re: [PATCH 5/5] kasan, mm: integrate slab init_on_free with HW_TAGS

2021-03-08 Thread Andrey Konovalov
On Mon, Mar 8, 2021 at 12:45 PM Marco Elver wrote: > > > > > - if (unlikely(slab_want_init_on_free(cachep))) > > + /* > > + * As memory initialization is integrated with hardware tag-based > > This may no longer be true if the HW-tags architecture doesn't support > init (although curr

[PATCH] kasan: fix KASAN_STACK dependency for HW_TAGS

2021-03-08 Thread Andrey Konovalov
s: 6a63a63ff1ac ("kasan: introduce CONFIG_KASAN_HW_TAGS") Cc: sta...@vger.kernel.org Reported-by: Catalin Marinas Signed-off-by: Andrey Konovalov --- lib/Kconfig.kasan | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan index 624ae1df7984..fba9

[PATCH v2 1/5] arm64: kasan: allow to init memory when setting tags

2021-03-08 Thread Andrey Konovalov
initialization will improve HW_TAGS KASAN performance when init_on_alloc/free is enabled. This change doesn't integrate memory initialization with KASAN, this is done is subsequent patches in this series. Acked-by: Marco Elver Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/memory.h

[PATCH v2 0/5] kasan: integrate with init_on_alloc/free

2021-03-08 Thread Andrey Konovalov
_HW_TAGS). Andrey Konovalov (5): arm64: kasan: allow to init memory when setting tags kasan: init memory in kasan_(un)poison for HW_TAGS kasan, mm: integrate page_alloc init with HW_TAGS kasan, mm: integrate slab init_on_alloc with HW_TAGS kasan, mm: integrate slab init_on_free with HW_TAG

[PATCH v2 3/5] kasan, mm: integrate page_alloc init with HW_TAGS

2021-03-08 Thread Andrey Konovalov
hooks are called. This doesn't lead to any side-effects, as whenever page poisoning is enabled, memory initialization gets disabled. Combining setting allocation tags with memory initialization improves HW_TAGS KASAN performance when init_on_alloc/free is enabled. Signed-off-by: Andrey Kono

[PATCH v2 4/5] kasan, mm: integrate slab init_on_alloc with HW_TAGS

2021-03-08 Thread Andrey Konovalov
initialized that can be caused by future changes, both KASAN hook and initialization memset() are put together and a warning comment is added. Combining setting allocation tags with memory initialization improves HW_TAGS KASAN performance when init_on_alloc is enabled. Signed-off-by: Andrey

[PATCH v2 5/5] kasan, mm: integrate slab init_on_free with HW_TAGS

2021-03-08 Thread Andrey Konovalov
initialized that can be caused by future changes, both KASAN hook and initialization memset() are put together and a warning comment is added. Combining setting allocation tags with memory initialization improves HW_TAGS KASAN performance when init_on_free is enabled. Signed-off-by: Andrey Konovalov

[PATCH v2 2/5] kasan: init memory in kasan_(un)poison for HW_TAGS

2021-03-08 Thread Andrey Konovalov
x27;t integrate memory initialization with KASAN, this is done is subsequent patches in this series. Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- lib/test_kasan.c | 4 ++-- mm/kasan/common.c | 28 ++-- mm/kasan/generic.c | 12 ++-- mm/kasan/ka

[PATCH] arm64: kasan: fix page_alloc tagging with DEBUG_VIRTUAL

2021-03-08 Thread Andrey Konovalov
when CONFIG_DEBUG_VIRTUAL is enabled that takes care of KASAN tags. Fixes: 2813b9c02962 ("kasan, mm, arm64: tag non slab memory allocated via pagealloc") Cc: Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/memory.h | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm64/include

Re: [PATCH v14 0/8] arm64: ARMv8.5-A: MTE: Add async mode support

2021-03-08 Thread Andrey Konovalov
On Mon, Mar 8, 2021 at 5:14 PM Vincenzo Frascino wrote: > > This patchset implements the asynchronous mode support for ARMv8.5-A > Memory Tagging Extension (MTE), which is a debugging feature that allows > to detect with the help of the architecture the C and C++ programmatic > memory errors like

Re: [PATCH v4 0/5] arm64: ARMv8.5-A: MTE: Add async mode support

2021-01-21 Thread Andrey Konovalov
On Thu, Jan 21, 2021 at 12:31 PM Vincenzo Frascino wrote: > > Hi Andrey, > > On 1/19/21 6:09 PM, Andrey Konovalov wrote: > > Hi Vincenzo, > > > > This change has multiple conflicts with the KASAN testing patches that > > are currently in the mm tree. I

Re: [PATCH] kasan: Add explicit preconditions to kasan_report()

2021-01-21 Thread Andrey Konovalov
On Thu, Jan 21, 2021 at 12:30 PM Vincenzo Frascino wrote: > > Hi Andrey, > > On 1/19/21 8:56 PM, Andrey Konovalov wrote: > >> return (is_vmalloc_addr(addr) || virt_addr_valid(addr)); > > Do we need is_vmalloc_addr()? As we don't yet have vmalloc support

Re: [PATCH v2 2/2] kasan: Add explicit preconditions to kasan_report()

2021-01-21 Thread Andrey Konovalov
An invalid address (e.g. NULL) passed to the function when, > KASAN_HW_TAGS is enabled, leads to a kernel panic. > > Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Dmitry Vyukov > Cc: Leon Romanovsky > Cc: Andrey Konovalov > Signed-off-by: Vincenzo Frascino > -

Re: [PATCH v5 2/6] kasan: Add KASAN mode kernel parameter

2021-01-21 Thread Andrey Konovalov
> Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Andrey Konovalov > Signed-off-by: Vincenzo Frascino > --- > Documentation/dev-tools/kasan.rst | 7 +++ > lib/test_kasan.c | 2 +- > mm/kasan/hw_tags.c| 27 +

Re: [PATCH v5 3/6] kasan: Add report for async mode

2021-01-21 Thread Andrey Konovalov
On Thu, Jan 21, 2021 at 5:39 PM Vincenzo Frascino wrote: > > KASAN provides an asynchronous mode of execution. > > Add reporting functionality for this mode. > > Cc: Dmitry Vyukov > Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Andrey Konovalov > Si

Re: [PATCH v5 6/6] kasan: Forbid kunit tests when async mode is enabled

2021-01-21 Thread Andrey Konovalov
mode is > enabled. > > Cc: Dmitry Vyukov > Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Andrey Konovalov > Signed-off-by: Vincenzo Frascino > --- > lib/test_kasan.c | 5 + > mm/kasan/kasan.h | 2 ++ > 2 files changed, 7 insertions(+) > >

Re: [PATCH v5 5/6] arm64: mte: Expose execution mode

2021-01-21 Thread Andrey Konovalov
On Thu, Jan 21, 2021 at 5:40 PM Vincenzo Frascino wrote: > > MTE enabled arm64 HW can be configured in synchronous or asynchronous > tagging mode of execution. > In synchronous mode, an exception is triggered if a tag check fault > occurs. > In asynchronous mode, if a tag check fault occurs, the T

Re: [PATCH v5 4/6] arm64: mte: Enable async tag check fault

2021-01-21 Thread Andrey Konovalov
On Thu, Jan 21, 2021 at 5:40 PM Vincenzo Frascino wrote: > > MTE provides a mode that asynchronously updates the TFSR_EL1 register > when a tag check exception is detected. > > To take advantage of this mode the kernel has to verify the status of > the register at: > 1. Context switching > 2.

Re: [PATCH v2 0/4] arm64: kasan: support CONFIG_KASAN_VMALLOC

2021-01-21 Thread Andrey Konovalov
asan_module.ko > > It also works in Kaslr with CONFIG_RANDOMIZE_MODULE_REGION_FULL > and randomize module region inside vmalloc area. > > > [1]: commit 0609ae011deb41c ("x86/kasan: support KASAN_VMALLOC") > > Signed-off-by: Lecopzer Chen > Acked-by: Andrey Konov

Re: [PATCH v7 2/4] kasan: Add KASAN mode kernel parameter

2021-01-22 Thread Andrey Konovalov
> Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Andrey Konovalov > Signed-off-by: Vincenzo Frascino > --- > Documentation/dev-tools/kasan.rst | 9 + > lib/test_kasan.c | 2 +- > mm/kasan/hw_tags.c| 32 +

Re: [PATCH v7 4/4] arm64: mte: Enable async tag check fault

2021-01-22 Thread Andrey Konovalov
> if (current->thread.sctlr_tcf0 != next->thread.sctlr_tcf0) > update_sctlr_el1_tcf0(next->thread.sctlr_tcf0); > + else > + isb(); > + > + /* > +* Check if an async tag exception occurred at EL1. > +* > +* Note: On the context switch path we rely on the dsb() present > +* in __switch_to() to guarantee that the indirect writes to TFSR_EL1 > +* are synchronized before this point. > +* isb() above is required for the same reason. > +* > +*/ > + mte_check_tfsr_el1(); > } > > void mte_suspend_exit(void) > -- > 2.30.0 > Acked-by: Andrey Konovalov

Re: [PATCH v7 3/4] kasan: Add report for async mode

2021-01-22 Thread Andrey Konovalov
On Fri, Jan 22, 2021 at 3:11 PM Vincenzo Frascino wrote: > > KASAN provides an asynchronous mode of execution. > > Add reporting functionality for this mode. > > Cc: Dmitry Vyukov > Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Andrey Konovalov > Reviewed-

Re: [PATCH v3 2/2] kasan: Add explicit preconditions to kasan_report()

2021-01-22 Thread Andrey Konovalov
. > > Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Dmitry Vyukov > Cc: Leon Romanovsky > Cc: Andrey Konovalov > Signed-off-by: Vincenzo Frascino > --- > include/linux/kasan.h | 7 +++ > mm/kasan/kasan.h | 2 +- > 2 files changed, 8 inse

Re: [PATCH v4 3/3] kasan: Make addr_has_metadata() return true for valid addresses

2021-01-22 Thread Andrey Konovalov
urn true for valid addresses only. > > Note: KASAN_HW_TAGS support for vmalloc will be added with a future > patch. > > Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Dmitry Vyukov > Cc: Leon Romanovsky > Cc: Andrey Konovalov > Signed-off-by: Vincenzo Frascino >

Re: [PATCH v4 2/3] kasan: Add explicit preconditions to kasan_report()

2021-01-22 Thread Andrey Konovalov
ed. > > Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Dmitry Vyukov > Cc: Leon Romanovsky > Cc: Andrey Konovalov > Signed-off-by: Vincenzo Frascino > --- > include/linux/kasan.h | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/include/linu

Re: [PATCH v2 1/5] arm64: kasan: allow to init memory when setting tags

2021-03-09 Thread Andrey Konovalov
On Mon, Mar 8, 2021 at 5:58 PM Catalin Marinas wrote: > > On Mon, Mar 08, 2021 at 04:55:14PM +0100, Andrey Konovalov wrote: > > @@ -68,10 +69,16 @@ static inline void mte_set_mem_tag_range(void *addr, > > size_t size, u8 tag) > >* 'asm volatil

[PATCH v3 0/5] kasan: integrate with init_on_alloc/free

2021-03-09 Thread Andrey Konovalov
. - Fix non initting memory with kasan=off by checking kasan_enabled() instead of IS_ENABLED(CONFIG_KASAN_HW_TAGS). Andrey Konovalov (5): arm64: kasan: allow to init memory when setting tags kasan: init memory in kasan_(un)poison for HW_TAGS kasan, mm: integrate page_alloc init with HW_TAGS

[PATCH v3 3/5] kasan, mm: integrate page_alloc init with HW_TAGS

2021-03-09 Thread Andrey Konovalov
igned-off-by: Andrey Konovalov --- include/linux/kasan.h | 30 ++ mm/kasan/common.c | 8 mm/mempool.c | 4 ++-- mm/page_alloc.c | 37 ++--- 4 files changed, 54 insertions(+), 25 deletions(-) diff --git a/in

[PATCH v3 1/5] arm64: kasan: allow to init memory when setting tags

2021-03-09 Thread Andrey Konovalov
initialization will improve HW_TAGS KASAN performance when init_on_alloc/free is enabled. This change doesn't integrate memory initialization with KASAN, this is done is subsequent patches in this series. Acked-by: Marco Elver Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/memory.h

[PATCH v3 5/5] kasan, mm: integrate slab init_on_free with HW_TAGS

2021-03-09 Thread Andrey Konovalov
-off-by: Andrey Konovalov --- include/linux/kasan.h | 10 ++ mm/kasan/common.c | 13 +++-- mm/slab.c | 15 +++ mm/slub.c | 43 --- 4 files changed, 48 insertions(+), 33 deletions(-) diff --git a/include

[PATCH v3 2/5] kasan: init memory in kasan_(un)poison for HW_TAGS

2021-03-09 Thread Andrey Konovalov
x27;t integrate memory initialization with KASAN, this is done is subsequent patches in this series. Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- lib/test_kasan.c | 4 ++-- mm/kasan/common.c | 28 ++-- mm/kasan/generic.c | 12 ++-- mm/kasan/ka

[PATCH v3 4/5] kasan, mm: integrate slab init_on_alloc with HW_TAGS

2021-03-09 Thread Andrey Konovalov
Signed-off-by: Andrey Konovalov --- include/linux/kasan.h | 8 mm/kasan/common.c | 4 ++-- mm/slab.c | 28 +--- mm/slab.h | 17 + mm/slub.c | 27 +++ 5 files changed, 43 insertions

Re: [PATCH v6 10/22] media: camss: Add support for CSID hardware version Titan 170

2021-03-09 Thread Andrey Konovalov
n 170 of the Titan architecture and implement support for the CSID subdevice. Signed-off-by: Robert Foss Reviewed-by: Andrey Konovalov --- Changes since v5: - Andrey: Fix test pattern selection logic - Andrey: Add r-b - Move Titan 170 specific test modes to this commit drivers/media/pl

<    1   2   3   4   5   6   7   8   9   10   >