Re: [PATCH v13 3/7] kasan: Add report for async mode

2021-02-11 Thread Andrey Konovalov
On Thu, Feb 11, 2021 at 9:04 PM kernel test robot wrote: > > Hi Vincenzo, > > I love your patch! Yet something to improve: > > [auto build test ERROR on next-20210211] > [cannot apply to arm64/for-next/core xlnx/master arm/for-next soc/for-next > kvmarm/next linus/master hnaz-linux-mm/master v5.1

Re: [PATCH v13 3/7] kasan: Add report for async mode

2021-02-12 Thread Andrey Konovalov
On Fri, Feb 12, 2021 at 12:21 PM Vincenzo Frascino wrote: > > Hi Andrey, > > On 2/11/21 8:13 PM, Andrey Konovalov wrote: > >>>> riscv64-linux-ld: report.c:(.text+0x5c4): undefined reference to > >>>> `kasan_flag_async' > > Let's do someth

[PATCH 1/3] MAINTAINERS: update KASAN file list

2021-02-12 Thread Andrey Konovalov
Account for the following files: - lib/Kconfig.kasan - lib/test_kasan_module.c - arch/arm64/include/asm/mte-kasan.h Signed-off-by: Andrey Konovalov --- MAINTAINERS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 64c7169db617

[PATCH 3/3] MAINTAINERS: add Andrey Konovalov to KASAN reviewers

2021-02-12 Thread Andrey Konovalov
Add my personal email address to KASAN reviewers list. Signed-off-by: Andrey Konovalov --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7b3d374c858d..e9fccfb27e2d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9561,6 +9561,7 @@ F

[PATCH 2/3] MAINTAINERS: update Andrey Konovalov's email address

2021-02-12 Thread Andrey Konovalov
Use my personal email address. Signed-off-by: Andrey Konovalov --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a58e56f91ed7..7b3d374c858d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9584,7 +9584,7 @@ F:scripts

[PATCH mm] kasan: export HW_TAGS symbols for KUnit tests

2021-02-12 Thread Andrey Konovalov
e() and only defines and exports them when KASAN-KUnit tests are enabled. The wrappers aren't defined when tests aren't enabled to avoid misuse. The mte_() functions aren't exported directly to avoid having low-level KASAN ifdefs in the arch code. Signed-off-by: Andrey Konovalov

Re: [PATCH mm] kasan: export HW_TAGS symbols for KUnit tests

2021-02-12 Thread Andrey Konovalov
On Fri, Feb 12, 2021 at 9:16 PM Andrew Morton wrote: > > On Fri, 12 Feb 2021 21:08:52 +0100 Andrey Konovalov > wrote: > > > Currently, building KASAN-KUnit tests as a module fails with: > > > > ERROR: modpost: "mte_enable_kernel" [lib/test

Re: [PATCH mm] kasan: export HW_TAGS symbols for KUnit tests

2021-02-12 Thread Andrey Konovalov
On Fri, Feb 12, 2021 at 9:54 PM Andrew Morton wrote: > > On Fri, 12 Feb 2021 21:21:39 +0100 Andrey Konovalov > wrote: > > > > > The wrappers aren't defined when tests aren't enabled to avoid misuse. > > > > The mte_() functions aren't export

Re: [PATCH mm] kasan: export HW_TAGS symbols for KUnit tests

2021-02-12 Thread Andrey Konovalov
On Fri, Feb 12, 2021 at 10:08 PM Andrew Morton wrote: > > On Fri, 12 Feb 2021 22:01:38 +0100 Andrey Konovalov > wrote: > > > On Fri, Feb 12, 2021 at 9:54 PM Andrew Morton > > wrote: > > > > > > On Fri, 12 Feb 2021 21:21:39 +0100 Andrey Konovalov &g

Re: [PATCH v13 1/7] arm64: mte: Add asynchronous mode support

2021-02-12 Thread Andrey Konovalov
status of TFSR_EL1 will be added with a > future patch. > > Cc: Catalin Marinas > Cc: Will Deacon > Reviewed-by: Catalin Marinas > Reviewed-by: Andrey Konovalov > Signed-off-by: Vincenzo Frascino > --- > arch/arm64/include/asm/memory.h| 3 ++- > arch/ar

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

2021-02-12 Thread Andrey Konovalov
On Fri, Feb 12, 2021 at 6:22 PM Catalin Marinas wrote: > > On Thu, Feb 11, 2021 at 03:33:53PM +, Vincenzo Frascino wrote: > > From: Andrey Konovalov > > > > Asynchronous KASAN mode doesn't guarantee that a tag fault will be > > detected immediately and c

Re: BUG: unable to handle kernel NULL pointer dereference in call_rcu

2021-02-24 Thread Andrey Konovalov
On Wed, Feb 24, 2021 at 1:58 PM syzbot wrote: > > syzbot has bisected this issue to: > > commit 97593cad003c668e2532cb2939a24a031f8de52d > Author: Andrey Konovalov > Date: Tue Dec 22 20:03:28 2020 + > > kasan: sanitize objects when metadata doesn't

Re: [PATCH] mm/kasan: switch from strlcpy to strscpy

2021-02-24 Thread Andrey Konovalov
strscpy(token, *frame_descr, tok_len + 1); > > } > > > > /* Advance frame_descr past separator. */ > > -- > > 1.8.3.1 > > Reviewed-by: Andrey Konovalov Thanks!

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

2021-02-10 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! In the patchset summary email you are saying that camss does not support the PIX interface for this generation of ISPs. But this patch still carries quite a lot of code handling the PIX interface. Like: -8<- #define REG_UPDATE_line_n(n)

Re: [PATCH v4 00/22] Add support for the SDM845 Camera Subsystem

2021-02-10 Thread Andrey Konovalov
Hi Robert, On 05.02.2021 13:43, Robert Foss wrote: This series implements support for the camera subsystem found in the SDM845 SOCs and the Titan 170 ISP. The support is partial in that it implements CSIPHY, CSID, and partial VFE support. The Titan generation of the ISP diverges a fair amount f

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

2021-02-11 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! On 05.02.2021 13:44, 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 different ISP hardware architectures. Signed-off-

[PATCH] mm, kasan: don't poison boot memory

2021-02-17 Thread Andrey Konovalov
that was never allocated. This is taken as an acceptable trade-off. All memory allocated normally when the boot is over keeps getting poisoned as usual. Signed-off-by: Andrey Konovalov Change-Id: Iae6b1e4bb8216955ffc14af255a7eaaa6f35324d --- mm/page_alloc.c

[PATCH RESEND] mm, kasan: don't poison boot memory

2021-02-17 Thread Andrey Konovalov
that was never allocated. This is taken as an acceptable trade-off. All memory allocated normally when the boot is over keeps getting poisoned as usual. Signed-off-by: Andrey Konovalov --- Resending with Change-Id dropped. --- mm/page_alloc.c | 43 --- 1

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

2021-02-17 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 v2 1/3] v4l: common: v4l2_get_link_freq: add printing a warning

2021-02-17 Thread Andrey Konovalov
Print a warning if V4L2_CID_LINK_FREQ control is not implemented. Signed-off-by: Andrey Konovalov --- drivers/media/v4l2-core/v4l2-common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 133d20e40f82

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

2021-02-17 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

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

2021-02-17 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 ---

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

2021-02-18 Thread Andrey Konovalov
Hi Jacopo, On 18.02.2021 11:07, Jacopo Mondi wrote: Hi Andrey, On Thu, Feb 18, 2021 at 01:11:33AM +0300, Andrey Konovalov wrote: There are places in the camss driver where camss_get_pixel_clock() is called to get the pixel rate (using V4L2_CID_PIXEL_RATE control) and to calculate the link

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

2021-02-18 Thread Andrey Konovalov
Hi Jacopo, On 18.02.2021 10:55, Jacopo Mondi wrote: Hi Andrey, On Thu, Feb 18, 2021 at 01:11:32AM +0300, Andrey Konovalov wrote: Print a warning if V4L2_CID_LINK_FREQ control is not implemented. Signed-off-by: Andrey Konovalov --- drivers/media/v4l2-core/v4l2-common.c | 2 ++ 1 file

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

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

Re: [PATCH] kcov: Remove kcov include from sched.h and move it to its users.

2021-02-18 Thread Andrey Konovalov
t; #include > #include "ieee80211_i.h" > diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c > index 972895e9f22dc..3527b17f235a8 100644 > --- a/net/mac80211/rx.c > +++ b/net/mac80211/rx.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > -- > 2.30.0 Acked-by: Andrey Konovalov

Re: [PATCH] mm, kasan: don't poison boot memory

2021-02-18 Thread Andrey Konovalov
On Thu, Feb 18, 2021 at 9:55 AM David Hildenbrand wrote: > > On 17.02.21 21:56, Andrey Konovalov wrote: > > During boot, all non-reserved memblock memory is exposed to the buddy > > allocator. Poisoning all that memory with KASAN lengthens boot time, > > especially on syst

Re: [PATCH v5 05/22] media: camss: Make ISPIF subdevice optional

2021-02-18 Thread Andrey Konovalov
the CAMSS generation of the architecture. In order to support the Titan generation, make the ISPIF an optional subdevice. Signed-off-by: Robert Foss Reviewed-by: Andrey Konovalov Thanks, Andrey --- Changes since v1: - Björn: Improved commit message - Björn: Use local 'dev' p

Re: [PATCH RESEND] mm, kasan: don't poison boot memory

2021-02-18 Thread Andrey Konovalov
On Thu, Feb 18, 2021 at 11:46 AM Catalin Marinas wrote: > > The approach looks fine to me. If you don't like the trade-off, I think > you could still leave the kasan poisoning in if CONFIG_DEBUG_KERNEL. This won't work, Android enables CONFIG_DEBUG_KERNEL in GKI as it turns out :) > Reviewed-by:

Re: [PATCH] mm, kasan: don't poison boot memory

2021-02-18 Thread Andrey Konovalov
On Thu, Feb 18, 2021 at 8:46 PM David Hildenbrand wrote: > > > 1. For KASAN_GENERIC: leave everything as is to be able to detect > > these boot-time bugs. > > > > 2. For KASAN_SW_TAGS: remove boot-time poisoning via > > kasan_free_pages(), but use the "invalid" tag as the default shadow > > value.

Re: [PATCH] mm, kasan: don't poison boot memory

2021-02-18 Thread Andrey Konovalov
On Fri, Feb 19, 2021 at 1:06 AM George Kennedy wrote: > > > > On 2/18/2021 3:55 AM, David Hildenbrand wrote: > > On 17.02.21 21:56, Andrey Konovalov wrote: > >> During boot, all non-reserved memblock memory is exposed to the buddy > >> allocator. Poisoning

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

2021-02-18 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 v1->v2: - Only drop memblock poisoning for tag-based KASAN modes. --- mm/page_alloc.c | 45 ++

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

2021-02-18 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 14f72ec96492..44c147dae7e3 100644 --- a/include/li

Re: [PATCH 02/12] kasan, mm: optimize kmalloc poisoning

2021-02-02 Thread Andrey Konovalov
On Tue, Feb 2, 2021 at 5:25 PM Marco Elver wrote: > > > +#ifdef CONFIG_KASAN_GENERIC > > + > > +/** > > + * kasan_poison_last_granule - mark the last granule of the memory range as > > + * unaccessible > > + * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE > > + * @size - range

Re: [PATCH 01/12] kasan, mm: don't save alloc stacks twice

2021-02-02 Thread Andrey Konovalov
On Tue, Feb 2, 2021 at 5:06 PM Marco Elver wrote: > > On Mon, Feb 01, 2021 at 08:43PM +0100, Andrey Konovalov wrote: > > Currently KASAN saves allocation stacks in both kasan_slab_alloc() and > > kasan_kmalloc() annotations. This patch changes KASAN to save allocation > >

Re: [PATCH 10/12] arm64: kasan: simplify and inline MTE functions

2021-02-02 Thread Andrey Konovalov
On Tue, Feb 2, 2021 at 4:42 PM Catalin Marinas wrote: > > On Mon, Feb 01, 2021 at 08:43:34PM +0100, Andrey Konovalov wrote: > > +/* > > + * Assign allocation tags for a region of memory based on the pointer tag. > > + * Note: The address must be non-NULL and MTE_

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

2021-01-29 Thread Andrey Konovalov
On Tue, Jan 26, 2021 at 2:46 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 v9 3/4] kasan: Add report for async mode

2021-01-29 Thread Andrey Konovalov
On Fri, Jan 29, 2021 at 6:44 PM Vincenzo Frascino wrote: > > > > On 1/29/21 5:40 PM, Andrey Konovalov wrote: > > On Tue, Jan 26, 2021 at 2:46 PM Vincenzo Frascino > > wrote: > >> > >> KASAN provides an asynchronous mode of execution. > >

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

2021-01-29 Thread Andrey Konovalov
On Fri, Jan 29, 2021 at 6:56 PM Vincenzo Frascino wrote: > > Hi Andrey, > > On 1/29/21 5:40 PM, Andrey Konovalov wrote: > > I suggest to call end_report(&flags, 0) here and check addr !=0 in > > end_report() before calling trace_error_report_end(). > > >

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

2021-01-29 Thread Andrey Konovalov
On Fri, Jan 29, 2021 at 6:57 PM Vincenzo Frascino wrote: > +#ifdef CONFIG_KASAN_HW_TAGS > +void kasan_report_async(void) > +{ > + unsigned long flags; > + > + start_report(&flags); > + pr_err("BUG: KASAN: invalid-access\n"); > + pr_er

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

2021-01-29 Thread Andrey Konovalov
On Fri, Jan 29, 2021 at 7:42 PM Vincenzo Frascino wrote: > > Hi Andrey, > > On 1/29/21 6:16 PM, Vincenzo Frascino wrote: > > What I meant is instead of: > > > > if (addr) trace_error_report_end(...); > > > > you might want to do: > > > > if (!IS_ENABLED(CONFIG_KASAN_HW_TAGS)) trace_error_report_en

[PATCH mm] kasan: untag addresses for KFENCE

2021-01-29 Thread Andrey Konovalov
KFENCE annotations operate on untagged addresses. Untag addresses in KASAN runtime where they might be tagged. Signed-off-by: Andrey Konovalov --- This can be squashed into: revert kasan-remove-kfence-leftovers kfence, kasan: make KFENCE compatible with KASA --- mm/kasan/common.c | 2

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

2021-01-29 Thread Andrey Konovalov
On Fri, Jan 29, 2021 at 7:49 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

[PATCH 01/12] kasan, mm: don't save alloc stacks twice

2021-02-01 Thread Andrey Konovalov
kasan_kmalloc() knowing whether the object belongs to a kmalloc cache. This is implemented by adding a flag field to the kasan_info structure. That flag is only set for kmalloc caches via a new kasan_cache_create_kmalloc() annotation. Signed-off-by: Andrey Konovalov --- include/linux/kasan.h

[PATCH 03/12] kasan: optimize large kmalloc poisoning

2021-02-01 Thread Andrey Konovalov
Similarly to kasan_kmalloc(), kasan_kmalloc_large() doesn't need to unpoison the object as it as already unpoisoned by alloc_pages() (or by ksize() for krealloc()). This patch changes kasan_kmalloc_large() to only poison the redzone. Signed-off-by: Andrey Konovalov --- mm/kasan/common.c

[PATCH 04/12] kasan: clean up setting free info in kasan_slab_free

2021-02-01 Thread Andrey Konovalov
outweights saving a few instructions. Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index a7eb553c8e91..086bb77292b6 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -350,13

[PATCH 05/12] kasan: unify large kfree checks

2021-02-01 Thread Andrey Konovalov
Unify checks in kasan_kfree_large() and in kasan_slab_free_mempool() for large allocations as it's done for small kfree() allocations. With this change, kasan_slab_free_mempool() starts checking that the first byte of the memory that's being freed is accessible. Signed-off-by: Andrey

[PATCH 07/12] kasan, mm: remove krealloc side-effect

2021-02-01 Thread Andrey Konovalov
ds an accessibility check into __do_krealloc(). If the check fails, krealloc() returns NULL. This check duplicates the one in ksize(); this is fixed in the following patch. This patch also adds a KASAN-KUnit test to check krealloc() behaviour when it's called on a freed object. Signed-off-by: Andrey

[PATCH 06/12] kasan: rework krealloc tests

2021-02-01 Thread Andrey Konovalov
This patch reworks KASAN-KUnit tests for krealloc() to: 1. Check both slab and page_alloc based krealloc() implementations. 2. Allow at least one full granule to fit between old and new sizes for each KASAN mode, and check accesses to that granule accordingly. Signed-off-by: Andrey Konovalov

[PATCH 09/12] kasan: ensure poisoning size alignment

2021-02-01 Thread Andrey Konovalov
s patch removes round_up() of size from kasan_poison() and ensures that all callers round_up() the size explicitly. This patch also adds WARN_ON() alignment checks for address and size to kasan_poison() and kasan_unpoison(). Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 9 ++--- mm/kasa

[PATCH 10/12] arm64: kasan: simplify and inline MTE functions

2021-02-01 Thread Andrey Konovalov
Frascino Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/cache.h | 1 - arch/arm64/include/asm/kasan.h | 1 + arch/arm64/include/asm/mte-def.h | 2 + arch/arm64/include/asm/mte-kasan.h | 64 ++ arch/arm64/include/asm/mte.h | 2 - arch/arm64

[PATCH 11/12] kasan: always inline HW_TAGS helper functions

2021-02-01 Thread Andrey Konovalov
Mark all static functions in common.c and kasan.h that are used for hardware tag-based KASAN as __always_inline to avoid unnecessary function calls. Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 13 +++-- mm/kasan/kasan.h | 6 +++--- 2 files changed, 10 insertions(+), 9

[PATCH 08/12] kasan, mm: optimize krealloc poisoning

2021-02-01 Thread Andrey Konovalov
x27;t unpoison the memory. Instead, kasan_kreallos() is changed to unpoison the memory excluding the redzone. For objects that don't fit into the old allocation, this patch disables KASAN accessibility checks when copying memory into a new object instead of unpoisoning it. Signed-off-

[PATCH 12/12] arm64: kasan: export MTE symbols for KASAN tests

2021-02-01 Thread Andrey Konovalov
Export mte_enable_kernel() and mte_set_report_once() to fix: ERROR: modpost: "mte_enable_kernel" [lib/test_kasan.ko] undefined! ERROR: modpost: "mte_set_report_once" [lib/test_kasan.ko] undefined! Signed-off-by: Andrey Konovalov --- arch/arm64/kernel/mte.c | 2 ++ 1 file c

[PATCH 02/12] kasan, mm: optimize kmalloc poisoning

2021-02-01 Thread Andrey Konovalov
s the same, as kmem_cache_node->object_size is equal to sizeof(struct kmem_cache_node). Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 93 +++ mm/kasan/kasan.h | 43 +- mm/kasan/shadow.c | 28 +++--- m

[PATCH 00/12] kasan: optimizations and fixes for HW_TAGS

2021-02-01 Thread Andrey Konovalov
the overhead of HW_TAGS annotations excluding setting and checking memory tags is ~3%. The performance impact caused by tags will be unknown until we have hardware that supports MTE. As a side-effect, this patchset speeds up generic KASAN by ~15%. Andrey Konovalov (12): kasan, mm: don't sav

Re: [PATCH v11 2/5] kasan: Add KASAN mode kernel parameter

2021-02-01 Thread Andrey Konovalov
On Sat, Jan 30, 2021 at 5:52 PM Vincenzo Frascino wrote: > > @@ -45,6 +52,9 @@ static enum kasan_arg_fault kasan_arg_fault __ro_after_init; > DEFINE_STATIC_KEY_FALSE(kasan_flag_enabled); > EXPORT_SYMBOL(kasan_flag_enabled); > > +/* Whether the asynchronous mode is enabled. */ > +bool kasan_flag_

Re: [PATCH 12/12] arm64: kasan: export MTE symbols for KASAN tests

2021-02-02 Thread Andrey Konovalov
On Tue, Feb 2, 2021 at 11:46 AM Will Deacon wrote: > > On Mon, Feb 01, 2021 at 08:43:36PM +0100, Andrey Konovalov wrote: > > Export mte_enable_kernel() and mte_set_report_once() to fix: > > > > ERROR: modpost: "mte_enable_kernel" [lib/test_kasan

[PATCH v2 12/12] arm64: kasan: export MTE symbols for KASAN tests

2021-02-05 Thread Andrey Konovalov
Export mte_enable_kernel_sync() and mte_set_report_once() to fix: ERROR: modpost: "mte_enable_kernel_sync" [lib/test_kasan.ko] undefined! ERROR: modpost: "mte_set_report_once" [lib/test_kasan.ko] undefined! Reviewed-by: Catalin Marinas Signed-off-by: Andrey Konovalov --

[PATCH v2 08/12] kasan, mm: optimize krealloc poisoning

2021-02-05 Thread Andrey Konovalov
x27;t unpoison the memory. Instead, kasan_kreallos() is changed to unpoison the memory excluding the redzone. For objects that don't fit into the old allocation, this patch disables KASAN accessibility checks when copying memory into a new object instead of unpoisoning it. Signed-off-

Re: [PATCH v2 1/4] arm64: kasan: don't populate vmalloc area for CONFIG_KASAN_VMALLOC

2021-02-05 Thread Andrey Konovalov
On Fri, Feb 5, 2021 at 6:19 PM Will Deacon wrote: > > On Fri, Feb 05, 2021 at 12:37:21AM +0800, Lecopzer Chen wrote: > > > > > On Thu, Feb 04, 2021 at 10:46:12PM +0800, Lecopzer Chen wrote: > > > > > On Sat, Jan 09, 2021 at 06:32:49PM +0800, Lecopzer Chen wrote: > > > > > > Linux support KAsan for

[PATCH v3 mm 01/13] kasan, mm: don't save alloc stacks twice

2021-02-05 Thread Andrey Konovalov
kasan_kmalloc() knowing whether the object belongs to a kmalloc cache. This is implemented by adding a flag field to the kasan_info structure. That flag is only set for kmalloc caches via a new kasan_cache_create_kmalloc() annotation. Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov

[PATCH v3 mm 07/13] kasan, mm: fail krealloc on freed objects

2021-02-05 Thread Andrey Konovalov
er Signed-off-by: Andrey Konovalov --- lib/test_kasan.c | 20 mm/slab_common.c | 3 +++ 2 files changed, 23 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index ffebad2f0e6e..1328c468fdb5 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -353,6 +353,25

[PATCH v3 mm 06/13] kasan: rework krealloc tests

2021-02-05 Thread Andrey Konovalov
-off-by: Andrey Konovalov --- lib/test_kasan.c | 91 ++-- 1 file changed, 81 insertions(+), 10 deletions(-) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index d16ec9e66806..ffebad2f0e6e 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -252,11

[PATCH v3 mm 05/13] kasan: unify large kfree checks

2021-02-05 Thread Andrey Konovalov
er Signed-off-by: Andrey Konovalov --- include/linux/kasan.h | 16 mm/kasan/common.c | 36 ++-- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/include/linux/kasan.h b/include/linux/kasan.h index e6ed969e74b3..14f72ec96492 10

[PATCH v3 mm 04/13] kasan: clean up setting free info in kasan_slab_free

2021-02-05 Thread Andrey Konovalov
outweights saving a few instructions. Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index f2a6bae13053..da24b144d46c 100644 --- a/mm/kasan/common.c +++ b/mm

[PATCH v3 mm 02/13] kasan, mm: optimize kmalloc poisoning

2021-02-05 Thread Andrey Konovalov
s the same, as kmem_cache_node->object_size is equal to sizeof(struct kmem_cache_node). Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 93 +++ mm/kasan/kasan.h | 43 +- mm/kasan/shado

[PATCH v3 mm 03/13] kasan: optimize large kmalloc poisoning

2021-02-05 Thread Andrey Konovalov
Similarly to kasan_kmalloc(), kasan_kmalloc_large() doesn't need to unpoison the object as it as already unpoisoned by alloc_pages() (or by ksize() for krealloc()). This patch changes kasan_kmalloc_large() to only poison the redzone. Reviewed-by: Marco Elver Signed-off-by: Andrey Kono

[PATCH v3 mm 13/13] kasan: clarify that only first bug is reported in HW_TAGS

2021-02-05 Thread Andrey Konovalov
Hwardware tag-based KASAN only reports the first found bug. After that MTE tag checking gets disabled. Clarify this in comments and documentation. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 8 ++-- mm/kasan/hw_tags.c| 2 +- 2 files changed, 7

[PATCH v3 mm 12/13] arm64: kasan: export MTE symbols for KASAN tests

2021-02-05 Thread Andrey Konovalov
Export mte_enable_kernel() and mte_set_report_once() to fix: ERROR: modpost: "mte_enable_kernel" [lib/test_kasan.ko] undefined! ERROR: modpost: "mte_set_report_once" [lib/test_kasan.ko] undefined! Reviewed-by: Catalin Marinas Signed-off-by: Andrey Konovalov --- arch/ar

[PATCH v3 mm 11/13] kasan: inline HW_TAGS helper functions

2021-02-05 Thread Andrey Konovalov
Mark all static functions in common.c and kasan.h that are used for hardware tag-based KASAN as inline to avoid unnecessary function calls. Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/kasan/common.c b

[PATCH v3 mm 09/13] kasan: ensure poisoning size alignment

2021-02-05 Thread Andrey Konovalov
s patch removes round_up() of size from kasan_poison() and ensures that all callers round_up() the size explicitly. This patch also adds WARN_ON() alignment checks for address and size to kasan_poison() and kasan_unpoison(). Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- mm/kasa

[PATCH v3 mm 10/13] arm64: kasan: simplify and inline MTE functions

2021-02-05 Thread Andrey Konovalov
Co-developed-by: Vincenzo Frascino Signed-off-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/cache.h | 1 - arch/arm64/include/asm/kasan.h | 1 + arch/arm64/include/asm/mte-def.h | 2 + arch/arm64/include/asm/mte-kasan.h | 65

[PATCH v3 mm 08/13] kasan, mm: optimize krealloc poisoning

2021-02-05 Thread Andrey Konovalov
x27;t unpoison the memory. Instead, kasan_kreallos() is changed to unpoison the memory excluding the redzone. For objects that don't fit into the old allocation, this patch disables KASAN accessibility checks when copying memory into a new object instead of unpoisoning it. Signed-off-

[PATCH v3 mm 00/13] kasan: optimizations and fixes for HW_TAGS

2021-02-05 Thread Andrey Konovalov
ead of __always_inline. Andrey Konovalov (13): kasan, mm: don't save alloc stacks twice kasan, mm: optimize kmalloc poisoning kasan: optimize large kmalloc poisoning kasan: clean up setting free info in kasan_slab_free kasan: unify large kfree checks kasan: rework krealloc tests kasa

Re: [PATCH v2 00/12] kasan: optimizations and fixes for HW_TAGS

2021-02-05 Thread Andrey Konovalov
On Fri, Feb 5, 2021 at 4:39 PM Andrey Konovalov wrote: > > This patchset goes on top of: > > 1. Vincenzo's async support patches [1], and Nevermind this, Vincenzo is planning to do more work on the async patches, so I'll post v3 of this patchset based on the mm tree

Re: [PATCH v2 1/4] arm64: kasan: don't populate vmalloc area for CONFIG_KASAN_VMALLOC

2021-02-05 Thread Andrey Konovalov
On Fri, Feb 5, 2021 at 6:43 PM Will Deacon wrote: > > On Fri, Feb 05, 2021 at 06:30:44PM +0100, Andrey Konovalov wrote: > > On Fri, Feb 5, 2021 at 6:19 PM Will Deacon wrote: > > > > > > On Fri, Feb 05, 2021 at 12:37:21AM +0800, Lecopzer Chen wrote: > > > &g

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

2021-02-08 Thread Andrey Konovalov
Hi Robert, Thank you for your patchset! On 05.02.2021 13:44, 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 --- .../qcom/camss/camss-csiphy-3ph-1-0.c | 182 +

[PATCH] kasan: fix stack traces dependency for HW_TAGS

2021-02-08 Thread Andrey Konovalov
: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 3 +-- mm/kasan/hw_tags.c| 8 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index 1651d961f06a..a248ac3941be 100644 --- a

Re: [PATCH v3 mm 08/13] kasan, mm: optimize krealloc poisoning

2021-02-09 Thread Andrey Konovalov
On Mon, Feb 8, 2021 at 11:48 AM Marco Elver wrote: > > On Fri, Feb 05, 2021 at 06:34PM +0100, Andrey Konovalov wrote: > > Currently, krealloc() always calls ksize(), which unpoisons the whole > > object including the redzone. This is inefficient, as kasan_krealloc() > > r

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

2021-02-09 Thread Andrey Konovalov
On Tue, Feb 9, 2021 at 1:16 PM Vincenzo Frascino wrote: > > > > On 2/9/21 12:02 PM, Catalin Marinas wrote: > > On Mon, Feb 08, 2021 at 04:56:17PM +, Vincenzo Frascino wrote: > >> From: Andrey Konovalov > >> > >> Asynchronous KASAN mode doesn'

Re: [PATCH v2 12/12] arm64: kasan: export MTE symbols for KASAN tests

2021-02-09 Thread Andrey Konovalov
On Mon, Feb 8, 2021 at 6:42 PM Christoph Hellwig wrote: > > On Fri, Feb 05, 2021 at 04:39:13PM +0100, Andrey Konovalov wrote: > > Export mte_enable_kernel_sync() and mte_set_report_once() to fix: > > > > ERROR: modpost: "mte_enable_kernel_sync" [lib/test_kasan

[PATCH mm] arm64: kasan: fix MTE symbols exports

2021-02-09 Thread Andrey Konovalov
Only export MTE symbols when KASAN-KUnit tests are enabled. Signed-off-by: Andrey Konovalov --- Andrew, please squash this into: "arm64: kasan: export MTE symbols for KASAN tests" --- arch/arm64/kernel/mte.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kern

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

2021-02-09 Thread Andrey Konovalov
On Tue, Feb 9, 2021 at 6:07 PM Catalin Marinas wrote: > > On Tue, Feb 09, 2021 at 04:02:25PM +0100, Andrey Konovalov wrote: > > On Tue, Feb 9, 2021 at 1:16 PM Vincenzo Frascino > > wrote: > > > On 2/9/21 12:02 PM, Catalin Marinas wrote: > > > > On Mon, Feb

Re: [PATCH v4 05/22] media: camss: Make ISPIF subdevice optional

2021-02-09 Thread Andrey Konovalov
Hi Robert, Thank you for your patch! On 05.02.2021 13:43, Robert Foss wrote: This driver supports multiple architecture versions of the Qualcomm ISP. The CAMSS architecure which this driver is name after, and with the introduction of this series, the Titan architecture. The ISPIF is an IP-bloc

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

2021-02-25 Thread Andrey Konovalov
ap_pages(). Besides fixing the crash, this also makes the annotation order consistent with debug_pagealloc_map_pages() preceding kasan_alloc_pages(). Signed-off-by: Andrey Konovalov --- mm/page_alloc.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/page_allo

Re: WARNING in snd_usbmidi_submit_urb/usb_submit_urb

2020-06-01 Thread Andrey Konovalov
On Mon, Jun 1, 2020 at 10:43 AM Greg KH wrote: > > On Mon, Jun 01, 2020 at 12:24:03AM -0700, syzbot wrote: > > syzbot has bisected this bug to: > > > > commit f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10 > > Author: Andrey Konovalov > > Date: Mon Feb 24 16:13:0

Re: [PATCH v4 1/4] rcu/kasan: record and print call_rcu() call stack

2020-05-19 Thread Andrey Konovalov
On Tue, May 19, 2020 at 4:24 AM Walter Wu wrote: > > This feature will record the last two call_rcu() call stacks and > prints up to 2 call_rcu() call stacks in KASAN report. > > When call_rcu() is called, we store the call_rcu() call stack into > slub alloc meta-data, so that the KASAN report can

Re: [PATCH] kasan: Disable branch tracing for core runtime

2020-05-19 Thread Andrey Konovalov
$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o > diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c > index 56ff8885fe2e..098a7dbaced6 100644 > --- a/mm/kasan/generic.c > +++ b/mm/kasan/generic.c > @@ -15,7 +15,6 @@ > */ > > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > -#define DISABLE_BRANCH_PROFILING > > #include > #include > -- > 2.26.2.761.g0e0b3e54be-goog > Reviewed-by: Andrey Konovalov Thanks!

Re: [PATCH v5 1/4] rcu/kasan: record and print call_rcu() call stack

2020-05-20 Thread Andrey Konovalov
y: Dmitry Vyukov > Acked-by: Paul E. McKenney > Cc: Andrey Ryabinin > Cc: Dmitry Vyukov > Cc: Alexander Potapenko > Cc: Andrew Morton > Cc: Josh Triplett > Cc: Mathieu Desnoyers > Cc: Lai Jiangshan > Cc: Joel Fernandes > Cc: Andrey Konovalov > --- > in

Re: INFO: task hung in locks_remove_posix

2020-05-21 Thread Andrey Konovalov
On Thu, May 21, 2020 at 4:48 PM Jeff Layton wrote: > > On Thu, 2020-05-21 at 23:09 +0900, Tetsuo Handa wrote: > > On 2020/05/21 5:53, syzbot wrote: > > > Hello, > > > > > > syzbot found the following crash on: > > > > > > HEAD commit:806d8acc USB: dummy-hcd: use configurable endpoint naming >

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 t

[PATCH 0/4] kasan: support stack instrumentation for tag-based mode

2020-07-31 Thread Andrey Konovalov
This goes on top of Walter's patch titled "kasan: fix KASAN unit tests for tag-based KASAN" (already in mm tree). Bugzilla link: https://bugzilla.kernel.org/show_bug.cgi?id=203497 Thanks to Walter Wu for debugging and testing. Andrey Konovalov (4): kasan: don't tag s

[PATCH 2/4] kasan, arm64: don't instrument functions that enable kasan

2020-07-31 Thread Andrey Konovalov
e it for arm64's setup_arch() as a precaution (it doesn't have any stack variables right now). Signed-off-by: Andrey Konovalov --- arch/arm64/kernel/setup.c | 2 +- init/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/se

[PATCH 1/4] kasan: don't tag stacks allocated with pagealloc

2020-07-31 Thread Andrey Konovalov
ds to false-positive reports. Fix by resetting the tag of kernel stack pointers after allocation. Signed-off-by: Andrey Konovalov --- kernel/fork.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/fork.c b/kernel/fork.c index d03c9586d342..9cea2265e677 100644 --- a/k

[PATCH 3/4] kasan: allow enabling stack tagging for tag-based mode

2020-07-31 Thread Andrey Konovalov
Use CONFIG_KASAN_STACK to enable stack tagging. Note, that HWASAN short granules [1] are disabled. Supporting those will require more kernel changes. [1] https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Signed-off-by: Andrey Konovalov --- scripts/Makefile.kasan | 3

[PATCH 4/4] kasan: adjust kasan_stack_oob for tag-based mode

2020-07-31 Thread Andrey Konovalov
Use OOB_TAG_OFF as access offset to land the access into the next granule. Suggested-by: Walter Wu Signed-off-by: Andrey Konovalov --- lib/test_kasan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index f362f2662938..53e953bb1d1d

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

2020-07-31 Thread Andrey Konovalov
On Fri, Jul 31, 2020 at 6:43 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 t

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 th

Re: [PATCH v11 3/6] KASAN: Port KASAN Tests to KUnit

2020-08-07 Thread Andrey Konovalov
ere is a > separate test file for those tests, which can be run as before as a > module. > > Signed-off-by: Patricia Alfonso > Signed-off-by: David Gow > Reviewed-by: Brendan Higgins > Reviewed-by: Andrey Konovalov > Reviewed-by: Dmitry Vyukov > ---

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