Re: [PATCH v2] kasan, mm: fix crash with HW_TAGS and DEBUG_PAGEALLOC

2021-03-05 Thread Andrey Konovalov
On Sat, Mar 6, 2021 at 12:54 AM Andrey Konovalov wrote: > > On Sat, Mar 6, 2021 at 12:50 AM Andrew Morton > wrote: > > > > On Sat, 6 Mar 2021 00:36:33 +0100 Andrey Konovalov > > wrote: > > > > > Currently, kasan_free_nondeferred_pages()

[PATCH v3] kasan, mm: fix crash with HW_TAGS and DEBUG_PAGEALLOC

2021-03-05 Thread Andrey Konovalov
ap_pages() and arch_free_page(), which can also make the page unavailable. Fixes: 94ab5b61ee16 ("kasan, arm64: enable CONFIG_KASAN_HW_TAGS") Cc: Signed-off-by: Andrey Konovalov --- Changes v2->v3: - Rebase onto mainline. --- mm/page_alloc.c | 8 ++-- 1 file changed, 6 inser

[PATCH v3 2/2] mm, kasan: don't poison boot memory with tag-based modes

2021-03-05 Thread Andrey Konovalov
alled. All memory allocated normally when the boot is over keeps getting poisoned as usual. Reviewed-by: Catalin Marinas Signed-off-by: Andrey Konovalov --- Changes v2->v3: - Rebased onto v3 of "kasan, mm: fix crash with HW_TAGS and DEBUG_PAGEALLOC". -

[PATCH v3 1/2] kasan: initialize shadow to TAG_INVALID for SW_TAGS

2021-03-05 Thread Andrey Konovalov
ich changes the tag-based KASAN modes to not poison the boot memory. Signed-off-by: Andrey Konovalov --- include/linux/kasan.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/kasan.h b/include/linux/kasan.h index b91732bd05d7..1d89b8175027 100644 --- a/in

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

2021-03-05 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. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/memory.h| 4 ++-- arch/arm64/in

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

2021-03-05 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 5/5] kasan, mm: integrate slab init_on_free with HW_TAGS

2021-03-05 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 4/5] kasan, mm: integrate slab init_on_alloc with HW_TAGS

2021-03-05 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 0/5] kasan: integrate with init_on_alloc/free

2021-03-05 Thread Andrey Konovalov
is is expected to improve HW_TAGS KASAN performance when init_on_alloc/free is enabled. The exact perfomance numbers are unknown as MTE-enabled hardware doesn't exist yet. Andrey Konovalov (5): arm64: kasan: allow to init memory when setting tags kasan: init memory in kasan_(un)poison f

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

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

Re: [PATCH] mm: page_alloc: ignore init_on_free=1 for page alloc

2021-03-30 Thread Andrey Konovalov
On Tue, Mar 30, 2021 at 12:07 AM Vlastimil Babka wrote: > > On 3/30/21 12:00 AM, Andrey Konovalov wrote: > > On Mon, Mar 29, 2021 at 2:10 PM Vlastimil Babka wrote: > >> > >> > commit 855a9c4018f3219db8be7e4b9a65ab22aebfde82 > >> > Author: Andrey Konov

[PATCH mm] mm, kasan: fix for "integrate page_alloc init with HW_TAGS"

2021-03-30 Thread Andrey Konovalov
ng comment. Reported-by: Vlastimil Babka Reported-by: Sergei Trofimovich Signed-off-by: Andrey Konovalov --- mm/page_alloc.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 033bd92e8398..1fc5061f8ca1 100644 --- a/mm/page_alloc.

[PATCH] kasan: fix conflict with page poisoning

2021-03-30 Thread Andrey Konovalov
When page poisoning is enabled, it accesses memory that is marked as poisoned by KASAN, which leas to false-positive KASAN reports. Suppress the reports by adding KASAN annotations to unpoison_page() (poison_page() already has them). Signed-off-by: Andrey Konovalov --- mm/page_poison.c | 4

Re: [PATCH v4 5/5] arm64: Kconfig: select KASAN_VMALLOC if KANSAN_GENERIC is enabled

2021-03-30 Thread Andrey Konovalov
On Tue, Mar 30, 2021 at 10:14 AM Lecopzer Chen wrote: > > > Do you know if anybody is working on this? It's really unfortunate that > > we can't move exclusively to VMAP_STACK just because of SW_TAGS KASAN. > > > > That said, what is there to do? As things stand, won't kernel stack > > addresses e

Re: [PATCH mm] mm, kasan: fix for "integrate page_alloc init with HW_TAGS"

2021-03-30 Thread Andrey Konovalov
On Tue, Mar 30, 2021 at 5:54 PM Vlastimil Babka wrote: > > On 3/30/21 5:31 PM, Andrey Konovalov wrote: > > My commit "integrate page_alloc init with HW_TAGS" changed the order of > > kernel_unpoison_pages() and kernel_init_free_pages() calls. This leads > &g

[PATCH mm v2] mm, kasan: fix for "integrate page_alloc init with HW_TAGS"

2021-03-30 Thread Andrey Konovalov
rder. Also add a warning comment. Reported-by: Vlastimil Babka Reported-by: Sergei Trofimovich Signed-off-by: Andrey Konovalov --- mm/page_alloc.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 033bd92e8398..d2c020563c0b 10064

Re: [PATCH] kasan: fix hwasan build for gcc

2021-03-30 Thread Andrey Konovalov
On Tue, Mar 23, 2021 at 1:41 PM Arnd Bergmann wrote: > > From: Arnd Bergmann > > gcc-11 adds support for -fsanitize=kernel-hwaddress, so it becomes > possible to enable CONFIG_KASAN_SW_TAGS. > > Unfortunately this fails to build at the moment, because the > corresponding command line arguments us

[PATCH] kasan: detect false-positives in tests

2021-03-31 Thread Andrey Konovalov
KUNIT_EXPECT_KASAN_FAIL() annotations for consistency. Signed-off-by: Andrey Konovalov --- lib/test_kasan.c | 49 +++- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index d77c45edc7cd..bf9225002a7e

[PATCH v3 0/3] media: qcom: camss: V4L2_CID_PIXEL_RATE/LINK_FREQ fixes

2021-03-03 Thread Andrey Konovalov
The first patch adds printing a warning in v4l2_get_link_freq() if V4L2_CID_LINK_FREQ isn't implemented (this is a mandatory control for CSI-2 transmitter drivers [1], but many sensor drivers don't have it currently). The second patch is the start of the work discussed in the "[RFC] Repurpose V4L2

[PATCH v3 2/3] media: camss: use v4l2_get_link_freq() to calculate the relevant clocks

2021-03-03 Thread Andrey Konovalov
[check,set]_clock_rates() are left intact as it looks like this VFE clock does depend on the rate the pixel samples comes out of the camera sensor, not on the frequency at which the link between the sensor and the CSI receiver operates. Signed-off-by: Andrey Konovalov Acked-by: Robert Foss Reviewed-

[PATCH v3 1/3] v4l: common: v4l2_get_link_freq: add printing a warning

2021-03-03 Thread Andrey Konovalov
Print a warning if V4L2_CID_LINK_FREQ control is not implemented. Signed-off-by: Andrey Konovalov Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/media/v4l2-core/v4l2-common.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-common.c b

[PATCH v3 3/3] media: qcom: camss: Fix overflows in clock rate calculations

2021-03-03 Thread Andrey Konovalov
mistake less likely to be repeated in the future. Signed-off-by: Vladimir Lypak Acked-by: Robert Foss Signed-off-by: Andrey Konovalov --- drivers/media/platform/qcom/camss/camss-vfe.c | 4 ++-- drivers/media/platform/qcom/camss/camss.c | 2 +- drivers/media/platform/qcom/camss/camss.h | 2

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

2021-03-29 Thread Andrey Konovalov
by: Nathan Chancellor > Acked-by: Arnd Bergmann > Reviewed-by: Andrey Konovalov > Cc: Andrey Ryabinin > Cc: Dmitry Vyukov > Cc: Alexander Potapenko > Cc: Andrew Morton > --- > > v4: After this patch sent, someone had modification about KASAN_STACK, > so I need to r

Re: [PATCH] mm: page_alloc: ignore init_on_free=1 for page alloc

2021-03-29 Thread Andrey Konovalov
On Mon, Mar 29, 2021 at 2:10 PM Vlastimil Babka wrote: > > > commit 855a9c4018f3219db8be7e4b9a65ab22aebfde82 > > Author: Andrey Konovalov > > Date: Thu Mar 18 17:01:40 2021 +1100 > > > > kasan, mm: integrate page_alloc init with HW_TAGS > > But th

Re: [PATCH] mm: page_alloc: ignore init_on_free=1 for page alloc

2021-03-26 Thread Andrey Konovalov
On Fri, Mar 26, 2021 at 2:49 PM David Hildenbrand wrote: > > > I observed use of poisoned pages as the crash on ia64 booted with > > init_on_free=1 init_on_alloc=1 (CONFIG_PAGE_POISONING=y config). > > There pmd page contained 0x poison pages and led to early crash. > > > > The change drop

Re: [PATCHv3] Introduced new tracing mode KCOV_MODE_UNIQUE.

2021-03-27 Thread Andrey Konovalov
On Fri, Mar 26, 2021 at 9:52 PM Alexander Lochmann wrote: > Hi Alexander, > It simply stores the executed PCs. > The execution order is discarded. > Each bit in the shared buffer represents every fourth > byte of the text segment. > Since a call instruction on every supported > architecture is a

Re: [syzbot] unexpected kernel reboot (4)

2021-04-14 Thread Andrey Konovalov
On Wed, Apr 14, 2021 at 7:45 AM Dmitry Vyukov wrote: > > On Tue, Apr 13, 2021 at 11:27 PM syzbot > wrote: > > > > Hello, > > > > syzbot found the following issue on: > > > > HEAD commit:89698bec Merge tag 'm68knommu-for-v5.12-rc7' of git://git... > > git tree: upstream > > console outpu

Re: [PATCH] irq_work: record irq_work_queue() call stack

2021-04-02 Thread Andrey Konovalov
@@ -98,6 +101,8 @@ bool irq_work_queue_on(struct irq_work *work, int cpu) > if (!irq_work_claim(work)) > return false; > > + kasan_record_aux_stack(work); > + > preempt_disable(); > if (cpu != smp_processor_id()) { > /* Arch remote IPI send/receive backend aren't NMI safe */ > -- > 2.17.1 Acked-by: Andrey Konovalov

Re: [PATCHv3] Introduced new tracing mode KCOV_MODE_UNIQUE.

2021-04-17 Thread Andrey Konovalov
On Fri, Apr 16, 2021 at 10:42 AM Dmitry Vyukov wrote: > > On Sat, Mar 27, 2021 at 3:56 PM Andrey Konovalov wrote: > > > > On Fri, Mar 26, 2021 at 9:52 PM Alexander Lochmann > > wrote: > > > > > > > Hi Alexander, > > > > > It simply sto

Re: [PATCH v2] task_work: kasan: record task_work_add() call stack

2021-03-17 Thread Andrey Konovalov
es. > > [1]: > https://groups.google.com/g/syzkaller-bugs/search?q=kasan%20use-after-free%20task_work_run > > Signed-off-by: Walter Wu > Suggested-by: Dmitry Vyukov > Cc: Andrey Konovalov > Cc: Andrey Ryabinin > Cc: Dmitry Vyukov > Cc: Alexander Potapenko

Re: [PATCH] kfence: unpoison pool region before use

2021-04-03 Thread Andrey Konovalov
On Sat, Apr 3, 2021 at 7:13 AM Peter Collingbourne wrote: > > If the memory region allocated by KFENCE had previously been poisoned, > any validity checks done using kasan_byte_accessible() will fail. Fix > it by unpoisoning the memory before using it as the pool region. Which kasan_byte_accessib

Re: [PATCH] kfence: unpoison pool region before use

2021-04-03 Thread Andrey Konovalov
On Sun, Apr 4, 2021 at 12:31 AM Marco Elver wrote: > > However, given the above, I think we need to explain this in the > commit message (which also makes the dependency between these 2 > patches clear) and add a comment above the new kasan_unpoison_range(). > That is, if we still think this is th

Re: [PATCH] kfence: unpoison pool region before use

2021-04-04 Thread Andrey Konovalov
On Sun, Apr 4, 2021 at 1:52 AM Andrey Konovalov wrote: > > On Sun, Apr 4, 2021 at 12:31 AM Marco Elver wrote: > > > > However, given the above, I think we need to explain this in the > > commit message (which also makes the dependency between these 2 > > patches

Re: [PATCH] kasan: fix kasan_byte_accessible() to be consistent with actual checks

2021-04-05 Thread Andrey Konovalov
On Mon, Apr 5, 2021 at 11:43 PM Peter Collingbourne wrote: > > We can sometimes end up with kasan_byte_accessible() being called > on non-slab memory. For example ksize() and krealloc() may end up > calling it on KFENCE allocated memory. In this case the memory will > be tagged with KASAN_SHADOW_I

Re: [PATCH v2] kasan: fix kasan_byte_accessible() to be consistent with actual checks

2021-04-05 Thread Andrey Konovalov
TAG_INVALID) && > - (tag == KASAN_TAG_KERNEL || tag == shadow_byte); > + if (untagged_addr < kasan_shadow_to_mem((void *)KASAN_SHADOW_START)) > + return false; > + > + shadow_byte = READ_ONCE(*(u8 *)kasan_mem_to_shadow(untagged_addr

Re: [PATCH v5 06/22] media: camss: Refactor VFE HW version support

2021-02-20 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! Just two minor comments below. On 17.02.2021 14:21, Robert Foss wrote: In order to support Qualcomm ISP hardware architectures that diverge from older architectures, the VFE subdevice driver needs to be refactored to better abstract the different ISP archit

Re: [PATCH v5 04/22] media: camss: Add CAMSS_845 camss version

2021-02-20 Thread Andrey Konovalov
Hi Robert, Reviewed-by: Andrey Konovalov Thanks, Andrey On 17.02.2021 14:21, Robert Foss wrote: Add enum representing the SDM845 SOC, which incorporates version 170 of the Titan architecture ISP. Signed-off-by: Robert Foss --- drivers/media/platform/qcom/camss/camss.h | 1 + 1 file

Re: [PATCH v5 01/22] media: camss: Fix vfe_isr_comp_done() documentation

2021-02-20 Thread Andrey Konovalov
Hi Robert, Reviewed-by: Andrey Konovalov Thanks, Andrey On 17.02.2021 14:21, Robert Foss wrote: Function name is comment is wrong, and was changed to be the same as the actual function name. The comment was changed to kerneldoc format. Signed-off-by: Robert Foss --- Changes since v1

Re: [PATCH v5 07/22] media: camss: Add support for VFE hardware version Titan 170

2021-02-20 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! On 17.02.2021 14:21, Robert Foss wrote: Add register definitions for version 170 of the Titan architecture and implement support for the RDI output mode. The RDI mode as opposed to the PIX output mode for the VFE unit does not support any ISP functionality.

Re: [PATCH v5 07/22] media: camss: Add support for VFE hardware version Titan 170

2021-02-20 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! On 17.02.2021 14:21, Robert Foss wrote: Add register definitions for version 170 of the Titan architecture and implement support for the RDI output mode. The RDI mode as opposed to the PIX output mode for the VFE unit does not support any ISP functionality.

Re: [PATCH v5 09/22] media: camss: Refactor CSID HW version support

2021-02-21 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! Reviewed-by: Andrey Konovalov Thanks, Andrey On 17.02.2021 14:21, Robert Foss wrote: In order to support Qualcomm ISP hardware architectures that diverge from older architectures, the CSID subdevice drivers needs to be refactored to better abstract the

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

2021-02-21 Thread Andrey Konovalov
(val == 0) means "testgen disabled", and (val >= 1) selects the test pattern: (val == 1) corresponds to CSID_PAYLOAD_MODE_INCREMENTING etc. +{ + s32 regval = val - 1; - now regval contains the zero-based test pattern mode number + if (regval > 0 || regval <= CSID

Re: [PATCH v5 09/22] media: camss: Refactor CSID HW version support

2021-02-21 Thread Andrey Konovalov
Hi Robert, After reviewing the [PATCH v5 10/22], I noticed that this patch also has a problematic test_pattern control implementation. See below. On 21.02.2021 18:15, Andrey Konovalov wrote: Hi Robert, Thank you for your patch! Reviewed-by: Andrey Konovalov Thanks, Andrey On 17.02.2021

Re: [PATCH v5 11/22] media: camss: Add support for CSIPHY hardware version Titan 170

2021-02-21 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! On 17.02.2021 14:21, Robert Foss wrote: Add register definitions for version 170 of the Titan architecture and implement support for the CSIPHY subdevice. Signed-off-by: Robert Foss --- Changes since v3 - Sakari: Make variable const Changes since v4

Re: [PATCH v5 13/22] media: camss: Enable SDM845

2021-02-21 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! Reviewed-by: Andrey Konovalov Thanks, Andrey On 17.02.2021 14:21, Robert Foss wrote: Enable support for SDM845 based Titan 170 ISPs. Signed-off-by: Robert Foss --- drivers/media/platform/qcom/camss/camss.c | 17 + drivers/media

Re: [PATCH v5 20/22] arm64: dts: sdm845: Add CAMSS ISP node

2021-02-21 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! Reviewed-by: Andrey Konovalov Thanks, Andrey On 17.02.2021 14:21, Robert Foss wrote: Add the camss dt node for sdm845. Signed-off-by: Robert Foss --- arch/arm64/boot/dts/qcom/sdm845.dtsi | 135 +++ 1 file changed, 135

Re: [PATCH v5 22/22] arm64: dts: sdm845-db845c: Enable ov8856 sensor and connect to ISP

2021-02-21 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! Reviewed-by: Andrey Konovalov Thanks, Andrey On 17.02.2021 14:21, Robert Foss wrote: Enable camss & ov8856 DT nodes. Signed-off-by: Robert Foss --- Changes since v1 - Laurent: Fix subject - Laurent: Remove redundant regulator labels - Lau

Re: [PATCH v5 21/22] arm64: dts: sdm845-db845c: Configure regulators for camss node

2021-02-21 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! Reviewed-by: Andrey Konovalov Thanks, Andrey On 17.02.2021 14:21, Robert Foss wrote: Add regulator to camss device tree node. Signed-off-by: Robert Foss --- arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 4 1 file changed, 4 insertions(+) diff

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

2021-02-22 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! On 17.02.2021 14:21, Robert Foss wrote: For Titan ISPs clocks fail to re-enable during vfe_get() after any vfe has been halted and its corresponding power domain power has been detached. OK. Since all of the clocks depend on all of the PDs, per VFE PD de

Re: [PATCH v13 7/7] kasan: don't run tests in async mode

2021-02-22 Thread Andrey Konovalov
On Mon, Feb 22, 2021 at 12:13 PM Vincenzo Frascino wrote: > > On 2/12/21 9:44 PM, Andrey Konovalov wrote: > >> I think we have time to fix this properly ;), so I'd rather not add this > >> patch at all. > > Yeah, this patch can be dropped. > > > >

Re: [PATCH v5 08/22] media: camss: Add missing format identifiers

2021-02-22 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! On 17.02.2021 14:21, Robert Foss wrote: The CSI-2 spec defines the following types: - Data Type - Often abbreviated DT - Decode Format - Often abbreviated as DF - Encode Format These definitions are as far as I can tell complete for CSI-2. Additional

Re: [PATCH v5 07/22] media: camss: Add support for VFE hardware version Titan 170

2021-02-22 Thread Andrey Konovalov
Hi Robert, On 22.02.2021 19:37, Robert Foss wrote: On Sat, 20 Feb 2021 at 22:40, Andrey Konovalov wrote: Hi Robert, Thank you for your patch! On 17.02.2021 14:21, Robert Foss wrote: Add register definitions for version 170 of the Titan architecture and implement support for the RDI output

Re: [PATCH v5 07/22] media: camss: Add support for VFE hardware version Titan 170

2021-02-22 Thread Andrey Konovalov
Hi Robert, On 22.02.2021 20:21, Robert Foss wrote: On Mon, 22 Feb 2021 at 18:06, Andrey Konovalov wrote: Hi Robert, On 22.02.2021 19:37, Robert Foss wrote: On Sat, 20 Feb 2021 at 22:40, Andrey Konovalov wrote: Hi Robert, Thank you for your patch! On 17.02.2021 14:21, Robert Foss wrote

Re: [PATCH] kcov: don't instrument with UBSAN

2020-12-09 Thread Andrey Konovalov
a printk, etc. > KASAN_SANITIZE_kcov.o := n > KCSAN_SANITIZE_kcov.o := n > +UBSAN_SANITIZE_kcov.o := n > CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack) -fno-stack-protector > > obj-y += sched/ > -- > 2.29.2.576.ga3fc446d84-goog > Reviewed-by: Andrey Konovalov

[PATCH mm 0/2] kasan: a few HW_TAGS fixes

2020-12-09 Thread Andrey Konovalov
Hi Andrew, Could you please squash the first one into "kasan: add and integrate kasan boot parameters". And instead of applying the second one, it's better to just drop "kasan, arm64: don't allow SW_TAGS with ARM64_MTE". Thanks! Andrey Konovalov (2): kasan: d

[PATCH mm 2/2] Revert "kasan, arm64: don't allow SW_TAGS with ARM64_MTE"

2020-12-09 Thread Andrey Konovalov
case: in-kernel MTE is never enabled unless the CONFIG_KASAN_HW_TAGS is enabled, so there are no more conflicts with CONFIG_KASAN_SW_TAGS. Allow CONFIG_KASAN_SW_TAGS to be enabled even when CONFIG_ARM64_MTE is enabled. Signed-off-by: Andrey Konovalov --- arch/arm64/Kconfig | 2 +- 1 file chang

[PATCH mm 1/2] kasan: don't use read-only static keys

2020-12-09 Thread Andrey Konovalov
__ro_after_init static keys are incompatible with usage in loadable kernel modules and cause crashes. Don't use those, use normal static keys. Signed-off-by: Andrey Konovalov --- This fix can be squashed into "kasan: add and integrate kasan boot parameters". --- mm/kasa

Re: [PATCH] kasan, mm: fix build issue with asmlinkage

2020-11-30 Thread Andrey Konovalov
On Mon, Nov 30, 2020 at 10:46 AM Marco Elver wrote: > > On Thu, 26 Nov 2020 at 16:00, Valdis Klētnieks > wrote: > > commit 2df573d2ca4c1ce6ea33cb7849222f771e759211 > > Author: Andrey Konovalov > > Date: Tue Nov 24 16:45:08 2020 +1100 > > > > kasan

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

2020-11-23 Thread Andrey Konovalov
On Tue, Nov 17, 2020 at 2:25 PM Dmitry Vyukov wrote: > > On Fri, Nov 13, 2020 at 11:20 PM Andrey Konovalov > wrote: > > > > The reason cache merging is disabled with KASAN is because KASAN puts its > > metadata right after the allocated object. When the merged caches

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

2020-11-23 Thread Andrey Konovalov
On Thu, Nov 19, 2020 at 11:16 PM kernel test robot wrote: > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > master > head: 3494d58865ad4a47611dbb427b214cc5227fa5eb > commit: cae9dc35ed9ff82a99754e51d57ff6c332e1f7e4 kasan: allow enabling stack > tagging for tag-ba

Re: Re: memory leak in hub_event

2020-11-23 Thread Andrey Konovalov
On Fri, Nov 20, 2020 at 6:00 PM Alan Stern wrote: > > On Fri, Nov 20, 2020 at 08:56:11AM -0800, syzbot wrote: > > > On Fri, Nov 20, 2020 at 07:15:20AM -0800, syzbot wrote: > > >> Hello, > > >> > > >> syzbot found the following issue on: > > >> > > >> HEAD commit:4d02da97 Merge tag 'net-5.10-rc

Re: [PATCH mm v3 17/19] kasan: clean up metadata allocation and usage

2020-11-23 Thread Andrey Konovalov
On Tue, Nov 17, 2020 at 2:12 PM Dmitry Vyukov wrote: > > > void __kasan_poison_slab(struct page *page) > > { > > @@ -272,11 +305,9 @@ void * __must_check __kasan_init_slab_obj(struct > > kmem_cache *cache, > > struct kasan_alloc_meta *alloc_meta; > > > > if (kasan_stack_collecti

Re: [PATCH mm v3 17/19] kasan: clean up metadata allocation and usage

2020-11-23 Thread Andrey Konovalov
On Mon, Nov 23, 2020 at 7:54 PM Andrey Konovalov wrote: > > > > @@ -168,6 +173,9 @@ void quarantine_put(struct kmem_cache *cache, void > > > *object) > > > struct qlist_head temp = QLIST_INIT; > > > struct kasan_free_meta *m

[PATCH mm v11 01/42] kasan: drop unnecessary GPL text from comment headers

2020-11-23 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 Reviewed-by: Alexander Pota

[PATCH mm v11 00/42] kasan: add hardware tag-based mode for arm64

2020-11-23 Thread Andrey Konovalov
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 from low-level arm64 code. - Move enabling TBI1 into __cpu_setup(). - Drop stale comment about c

[PATCH mm v11 02/42] kasan: KASAN_VMALLOC depends on KASAN_GENERIC

2020-11-23 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 Reviewed-by: Alexander Potapenko --- Change-Id: I1889e5b3bed28cc5d607802fb6ae43ba461c0dc1 --- lib/Kconfig.kasan | 2 +- 1

[PATCH mm v11 03/42] kasan: group vmalloc code

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. 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 mm v11 05/42] kasan: rename (un)poison_shadow to (un)poison_range

2020-11-23 Thread Andrey Konovalov
asan_ prefix). Co-developed-by: Marco Elver Signed-off-by: Marco Elver Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Alexander Potapenko --- Change-Id: Ia359f32815242c4704e49a5f1639ca2d2f8cba69 --- include/linux/kasan.h | 6 +++--- kernel/fork.c | 4 ++-

[PATCH mm v11 04/42] kasan: shadow declarations only for software modes

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. 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 mm v11 07/42] kasan: only build init.c for software modes

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. 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: A

[PATCH mm v11 06/42] kasan: rename KASAN_SHADOW_* to KASAN_GRANULE_*

2020-11-23 Thread Andrey Konovalov
ional changes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko --- Change-Id: Iac733e2248aa9d29f6fc425d8946ba07cca73ecf --- Documentation/dev-tools/kasan.rst | 2 +- lib/test_kasan.c | 2 +-

[PATCH mm v11 09/42] kasan: define KASAN_MEMORY_PER_SHADOW_PAGE

2020-11-23 Thread Andrey Konovalov
Define KASAN_MEMORY_PER_SHADOW_PAGE as (KASAN_GRANULE_SIZE << PAGE_SHIFT), which is the same as (KASAN_GRANULE_SIZE * PAGE_SIZE) for software modes that use shadow memory, and use it across KASAN code to simplify it. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Revie

[PATCH mm v11 08/42] kasan: split out shadow.c from common.c

2020-11-23 Thread Andrey Konovalov
s for software modes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko --- Change-Id: Ic1c32ce72d4649848e9e6a1f2c8dd269c77673f2 --- mm/kasan/Makefile | 6 +- mm/kasan/common.c | 498 +--

[PATCH mm v11 10/42] kasan: rename report and tags files

2020-11-23 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 mm v11 13/42] kasan: decode stack frame only with KASAN_STACK_ENABLE

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

[PATCH mm v11 15/42] kasan, arm64: only use kasan_depth for software modes

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 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: A

[PATCH mm v11 16/42] kasan, arm64: move initialization message

2020-11-23 Thread Andrey Konovalov
y printing functions; tag-based mode should use "kasan:" instead of KBUILD_MODNAME (which stands for file name). Signed-off-by: Andrey Konovalov Reviewed-by: Catalin Marinas Reviewed-by: Alexander Potapenko --- Change-Id: Iddca9764b30ff0fab1922f26ca9d4f39b6f22673 --- arch/arm64/incl

[PATCH mm v11 12/42] kasan: hide invalid free check implementation

2020-11-23 Thread Andrey Konovalov
_free(). Also simplify the code for software tag-based mode. No functional changes for software modes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko --- Change-Id: I5fae9531c9fc948eb4d4e0c589744032fc5a0789 --- mm/

[PATCH mm v11 14/42] kasan, arm64: only init shadow for software modes

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. Only initialize it when one of the software KASAN modes are enabled. No functional changes for software modes. Signed-off-by: A

[PATCH mm v11 17/42] kasan, arm64: rename kasan_init_tags and mark as __init

2020-11-23 Thread Andrey Konovalov
Rename kasan_init_tags() to kasan_init_sw_tags() as the upcoming hardware tag-based KASAN mode will have its own initialization routine. Also similarly to kasan_init() mark kasan_init_tags() as __init. Signed-off-by: Andrey Konovalov Reviewed-by: Catalin Marinas Reviewed-by: Alexander Potapenko

[PATCH mm v11 11/42] kasan: don't duplicate config dependencies

2020-11-23 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 Reviewed-by: Alexander Potapenko --- Change-Id: I77e475802e8f1750b9154fe4a6e6da4456054fcd --- lib/Kconfig.kasan | 8

[PATCH mm v11 19/42] kasan: rename print_shadow_for_address to print_memory_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 22/42] kasan, arm64: don't allow SW_TAGS with ARM64_MTE

2020-11-23 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 Reviewed-by: Alexander Pota

[PATCH mm v11 23/42] kasan: introduce CONFIG_KASAN_HW_TAGS

2020-11-23 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 mm v11 21/42] kasan: separate metadata_fetch_row for each mode

2020-11-23 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 Reviewed-by: Alexander Potapenko --- Chan

[PATCH mm v11 24/42] arm64: Enable armv8.5-a asm-arch option

2020-11-23 Thread Andrey Konovalov
Frascino Signed-off-by: Andrey Konovalov Reviewed-by: Catalin Marinas Reviewed-by: Alexander Potapenko --- Change-Id: I172e15e4c189f073e4c14a10276b276092e76536 --- arch/arm64/Kconfig | 4 arch/arm64/Makefile | 5 + 2 files changed, 9 insertions(+) diff --git a/arch/arm64/Kconfig b/arch

[PATCH mm v11 26/42] arm64: mte: Reset the page tag in page->flags

2020-11-23 Thread Andrey Konovalov
the same with PROT_MTE and becomes tagged the subsequent kernel access would fail. Signed-off-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov Reviewed-by: Catalin Marinas --- Change-Id: I8451d438bb63364de2a3e68041e3a27866921d4e --- arch/arm64/kernel/hibernate.c | 5 + arch/arm64/ker

[PATCH mm v11 25/42] arm64: mte: Add in-kernel MTE helpers

2020-11-23 Thread Andrey Konovalov
ed-by: Andrey Konovalov Signed-off-by: Andrey Konovalov Reviewed-by: Catalin Marinas --- Change-Id: I1b5230254f90dc21a913447cb17f07fea7944ece --- arch/arm64/include/asm/esr.h | 1 + arch/arm64/include/asm/mte-def.h | 15 arch/arm64/include/asm/mte-kasan.h

[PATCH mm v11 20/42] kasan: rename SHADOW layout macros to META

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 these macros. Rename "SHADOW" to implementation-neutral "META". No functional changes. Signed

[PATCH mm v11 35/42] kasan, x86, s390: update undef CONFIG_KASAN

2020-11-23 Thread Andrey Konovalov
KASAN runtime and shouldn't have any KASAN annotations. Also #undef CONFIG_KASAN_GENERIC with CONFIG_KASAN. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Marco Elver Acked-by: Vasily Gorbik Reviewed-by: Alexander Potapenko ---

[PATCH mm v11 36/42] kasan, arm64: expand CONFIG_KASAN checks

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

[PATCH mm v11 29/42] arm64: mte: Convert gcr_user into an exclude mask

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

[PATCH mm v11 39/42] kasan, mm: reset tags when accessing metadata

2020-11-23 Thread Andrey Konovalov
TE is disabled after the first one. Instead, reset tags when accessing metadata (currently only for SLUB). Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Acked-by: Marco Elver Reviewed-by: Alexander Potapenko --- Change-Id: I39f3c4d4f29299d4fbbda039bedf230db1c746fb --- mm/page_al

[PATCH mm v11 32/42] arm64: kasan: Align allocations for HW_TAGS

2020-11-23 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 mm v11 42/42] kselftest/arm64: Check GCR_EL1 after context switch

2020-11-23 Thread Andrey Konovalov
it is the same. If the values are not the same it reports a failure. Note: The test has been extended to verify that even SYNC and ASYNC mode setting is preserved correctly over context switching. Signed-off-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov Acked-by: Catalin Marinas

[PATCH mm v11 31/42] kasan, mm: untag page address in free_reserved_area

2020-11-23 Thread Andrey Konovalov
rious faults. Cc: Andrew Morton Signed-off-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko --- Change-Id: If12b4944383575b8bbd7d971decbd7f04be6748b --- mm/page_alloc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c

[PATCH mm v11 28/42] arm64: kasan: Allow enabling in-kernel MTE

2020-11-23 Thread Andrey Konovalov
: Vincenzo Frascino Co-developed-by: Andrey Konovalov Signed-off-by: Andrey Konovalov Reviewed-by: Catalin Marinas --- Change-Id: I4d67497268bb7f0c2fc5dcacefa1e273df4af71d --- arch/arm64/include/asm/mte-kasan.h | 6 ++ arch/arm64/kernel/mte.c| 7 +++ arch/arm64/mm/proc.S

[PATCH mm v11 40/42] kasan, arm64: enable CONFIG_KASAN_HW_TAGS

2020-11-23 Thread Andrey Konovalov
Hardware tag-based KASAN is now ready, enable the configuration option. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Acked-by: Catalin Marinas Reviewed-by: Alexander Potapenko --- Change-Id: I6eb1eea770e6b61ad71c701231b8d815a7ccc853 --- arch/arm64/Kconfig | 1 + 1 file

[PATCH mm v11 41/42] kasan: add documentation for hardware tag-based mode

2020-11-23 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 Reviewed-by: Alexander Potapenko --- Change-Id: Ib46cb444cfdee44054628940a82f5139e10d0258

[PATCH mm v11 27/42] arm64: mte: Add in-kernel tag fault handler

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

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