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

2021-01-20 Thread Vincenzo Frascino
On 1/20/21 4:04 PM, Catalin Marinas wrote: > On Tue, Jan 19, 2021 at 08:35:49PM +0000, Vincenzo Frascino wrote: >> On 1/19/21 6:52 PM, Catalin Marinas wrote: >>> On Tue, Jan 19, 2021 at 07:27:43PM +0100, Andrey Konovalov wrote: >>>> On Tue, Jan 19, 2021 at 6:26 PM

Re: [PATCH v4 3/5] kasan: Add report for async mode

2021-01-20 Thread Vincenzo Frascino
On 1/19/21 6:12 PM, Andrey Konovalov wrote: > On Tue, Jan 19, 2021 at 3:46 PM Mark Rutland wrote: >> >> Given there's no information available, I think it's simpler and >> preferable to handle the logging separately, as is done for >> kasan_report_invalid_free(). For example, we could do

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

2021-01-19 Thread Vincenzo Frascino
On 1/19/21 2:34 PM, Catalin Marinas wrote: > On Mon, Jan 18, 2021 at 06:30:32PM +0000, Vincenzo Frascino wrote: >> static void update_sctlr_el1_tcf0(u64 tcf0) >> { >> /* ISB required for the kernel uaccess routines */ >> @@ -235,6 +273,15 @@ void mte_threa

Re: [PATCH v4 5/5] arm64: mte: Inline mte_assign_mem_tag_range()

2021-01-19 Thread Vincenzo Frascino
Hi Catalin, On 1/19/21 2:45 PM, Catalin Marinas wrote: > On Mon, Jan 18, 2021 at 06:30:33PM +0000, Vincenzo Frascino wrote: >> mte_assign_mem_tag_range() is called on production KASAN HW hot >> paths. It makes sense to inline it in an attempt to reduce the >> o

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

2021-01-21 Thread Vincenzo Frascino
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 for > HW_TAGS. It is not necessary but it does not hurt, since we are going to add vmalloc anyway at some

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

2021-01-21 Thread Vincenzo Frascino
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. If Andrew decides to send all of them > during RC, then this should be good to go through arm64. Otherwise, I > guess

Re: [PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Vincenzo Frascino
On 1/21/21 3:12 PM, Mark Rutland wrote: > [adding Ard] > Thanks for this, it is related to his patch and I forgot to Cc: him directly. > On Thu, Jan 21, 2021 at 01:19:55PM +, Vincenzo Frascino wrote: >> Currently, the __is_lm_address() check just masks out

[PATCH v2 0/2] kasan: Fix metadata detection for KASAN_HW_TAGS

2021-01-21 Thread Vincenzo Frascino
: Will Deacon Signed-off-by: Vincenzo Frascino Vincenzo Frascino (2): arm64: Fix kernel address detection of __is_lm_address() kasan: Add explicit preconditions to kasan_report() arch/arm64/include/asm/memory.h | 2 +- mm/kasan/kasan.h| 2 +- mm/kasan/report.c | 7

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

2021-01-21 Thread Vincenzo Frascino
to a kernel panic. Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Leon Romanovsky Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- mm/kasan/kasan.h | 2 +- mm/kasan/report.c | 7 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mm/kasan/kasan.h

[PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Vincenzo Frascino
a kernel address starting at PAGE_OFFSET. Fixes: f4693c2716b35 ("arm64: mm: extend linear region for 52-bit VA configurations") Cc: Catalin Marinas Cc: Will Deacon Suggested-by: Catalin Marinas Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h | 2 +- 1 file changed, 1

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

2021-01-21 Thread Vincenzo Frascino
at exception entry to EL1. On the context switch path the synchronization is guarantied by the dsb() in __switch_to(). The dsb(nsh) in mte_check_tfsr_exit() is provisional pending confirmation by the architects. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64

Re: [PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Vincenzo Frascino
On 1/21/21 3:49 PM, Mark Rutland wrote: > On Thu, Jan 21, 2021 at 03:30:51PM +0000, Vincenzo Frascino wrote: >> On 1/21/21 3:12 PM, Mark Rutland wrote: >>> On Thu, Jan 21, 2021 at 01:19:55PM +, Vincenzo Frascino wrote: >>>> Currently, the __is_lm_address() c

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

2021-01-21 Thread Vincenzo Frascino
: - Fixed a compilation issue reported by krobot. - General cleanup. Cc: Catalin Marinas Cc: Will Deacon Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Marco Elver Cc: Evgenii Stepanov Cc: Branislav Rankov Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino Vincenzo

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

2021-01-21 Thread Vincenzo Frascino
Hi Andrey, On 1/19/21 6:10 PM, Andrey Konovalov wrote: > I'll later add a patch on top that forbids running the tests with the > async mode. Sorry, I misread this part, I thought you wanted me to do this. Anyway I added the check to my last series. Please have a look. -- Regards, Vincenzo

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

2021-01-21 Thread Vincenzo Frascino
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 Signed-off-by: Vincenzo Frascino --- include/linux/kasan.h | 2 ++ mm/kasan/report.c | 11 +++ 2

[PATCH v5 1/6] arm64: mte: Add asynchronous mode support

2021-01-21 Thread Vincenzo Frascino
Reviewed-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h| 3 ++- arch/arm64/include/asm/mte-kasan.h | 9 +++-- arch/arm64/kernel/mte.c| 16 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/arch/arm64

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

2021-01-21 Thread Vincenzo Frascino
. Note: This patch adds the kasan.mode kernel parameter and the sync/async kernel command line options to enable the described features. Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Documentation/dev-tools/kasan.rst | 7

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

2021-01-21 Thread Vincenzo Frascino
the corresponding bits periodically. Introduce an API that exposes the mode of execution to the kernel. Note: This API will be used by KASAN KUNIT tests to forbid the execution when async mode is enable. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm

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

2021-01-21 Thread Vincenzo Frascino
: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- lib/test_kasan.c | 5 + mm/kasan/kasan.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 7285dcf9fcc1..1306f707b4fe 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -52,6 +52,11

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

2021-01-14 Thread Vincenzo Frascino
On 1/14/21 2:25 PM, Catalin Marinas wrote: > On Thu, Jan 14, 2021 at 10:24:25AM +0000, Vincenzo Frascino wrote: >> On 1/13/21 6:11 PM, Catalin Marinas wrote: >>> On Thu, Jan 07, 2021 at 05:29:07PM +, Vincenzo Frascino wrote: >>>> static inline void mte_sy

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

2021-01-14 Thread Vincenzo Frascino
On 1/13/21 6:11 PM, Catalin Marinas wrote: > On Thu, Jan 07, 2021 at 05:29:07PM +0000, Vincenzo Frascino wrote: >> diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h >> index d02aff9f493d..a60d3718baae 100644 >> --- a/arch/arm64/include/asm/mte.h >&g

Re: [PATCH v2 1/4] kasan, arm64: Add KASAN light mode

2021-01-14 Thread Vincenzo Frascino
On 1/13/21 5:16 PM, Catalin Marinas wrote: > On Thu, Jan 07, 2021 at 05:29:05PM +0000, Vincenzo Frascino wrote: >> Architectures supported by KASAN HW can provide a light mode of >> execution. On an MTE enabled arm64 hw for example this can be identified >> with the asy

Re: [PATCH v2 2/4] arm64: mte: Add asynchronous mode support

2021-01-14 Thread Vincenzo Frascino
On 1/13/21 5:22 PM, Catalin Marinas wrote: > On Thu, Jan 07, 2021 at 05:29:06PM +0000, Vincenzo Frascino wrote: >> MTE provides an asynchronous mode for detecting tag exceptions. In >> particular instead of triggering a fault the arm64 core updates a >> register which is

Re: [PATCH v3 1/4] kasan, arm64: Add KASAN light mode

2021-01-16 Thread Vincenzo Frascino
Hi Andrey, On 1/15/21 6:59 PM, Andrey Konovalov wrote: > On Fri, Jan 15, 2021 at 1:00 PM Vincenzo Frascino > wrote: >> [...] >> @@ -60,6 +61,8 @@ static int __init early_kasan_mode(char *arg) >> >> if (!strcmp(arg, "off")) >>

Re: [PATCH v3 1/4] kasan, arm64: Add KASAN light mode

2021-01-16 Thread Vincenzo Frascino
Hi Mark, On 1/15/21 3:08 PM, Mark Rutland wrote: > On Fri, Jan 15, 2021 at 12:00:40PM +0000, Vincenzo Frascino wrote: >> Architectures supported by KASAN HW can provide a light mode of >> execution. On an MTE enabled arm64 hw for example this can be identified >> with the asy

Re: [PATCH] kasan: fix HW_TAGS boot parameters

2021-01-16 Thread Vincenzo Frascino
rce.com/id/Ib3694ed90b1e8ccac6cf77dfd301847af4aba7b8 > Signed-off-by: Andrey Konovalov Since it is a fix could you please add the "Fixes:" tag. Otherwise: Reviewed-by: Vincenzo Frascino > --- > Documentation/dev-tools/kasan.rst | 27 +++ > mm/kasan/hw_tags.c

Re: [PATCH v3 1/4] kasan, arm64: Add KASAN light mode

2021-01-16 Thread Vincenzo Frascino
On 1/16/21 1:59 PM, Andrey Konovalov wrote: > On Sat, Jan 16, 2021 at 2:37 PM Vincenzo Frascino > wrote: >> >>> [1] https://lkml.org/lkml/2021/1/15/1242 >>> >> >> Thanks for this. I will have a look into it today. In the meantime, could you &g

Re: [PATCH v3 2/4] arm64: mte: Add asynchronous mode support

2021-01-16 Thread Vincenzo Frascino
On 1/15/21 3:13 PM, Mark Rutland wrote: > On Fri, Jan 15, 2021 at 12:00:41PM +0000, Vincenzo Frascino wrote: >> MTE provides an asynchronous mode for detecting tag exceptions. In >> particular instead of triggering a fault the arm64 core updates a >> register which is checke

Re: [PATCH v3 4/4] arm64: mte: Optimize mte_assign_mem_tag_range()

2021-01-16 Thread Vincenzo Frascino
Hi Mark, On 1/15/21 3:45 PM, Mark Rutland wrote: > On Fri, Jan 15, 2021 at 12:00:43PM +0000, Vincenzo Frascino wrote: >> mte_assign_mem_tag_range() is called on production KASAN HW hot >> paths. It makes sense to optimize it in an attempt to reduce the >> ove

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-25 Thread Vincenzo Frascino
Hi Mark, On 1/25/21 1:02 PM, Mark Rutland wrote: > Hi Vincenzo, > > On Fri, Jan 22, 2021 at 03:56:40PM +, Vincenzo Frascino wrote: >> Currently, the __is_lm_address() check just masks out the top 12 bits >> of the address, but if they are 0, it still yields a tru

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-25 Thread Vincenzo Frascino
On 1/25/21 2:59 PM, Catalin Marinas wrote: > On Mon, Jan 25, 2021 at 02:36:34PM +0000, Vincenzo Frascino wrote: >> On 1/25/21 1:02 PM, Mark Rutland wrote: >>> On Fri, Jan 22, 2021 at 03:56:40PM +, Vincenzo Frascino wrote: >>>> Currently, the __is_lm_address() c

Re: [PATCH] kasan: export kasan_poison

2021-01-25 Thread Vincenzo Frascino
le to loadable modules. > > Fixes: b9b322c2bba9 ("kasan: add match-all tag tests") > Signed-off-by: Arnd Bergmann Thanks I just stumbled on the same issue ;) Reviewed-by: Vincenzo Frascino > --- > mm/kasan/shadow.c | 1 + > 1 file changed, 1 insertion(+) &

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

2021-01-22 Thread Vincenzo Frascino
On 1/21/21 5:38 PM, Andrey Konovalov wrote: >> + if (unlikely(tfsr_el1 & SYS_TFSR_EL1_TF1)) { >> + /* >> +* Note: isb() is not required after this direct write >> +* because there is no indirect read subsequent to it >> +* (per

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

2021-01-22 Thread Vincenzo Frascino
On 1/21/21 5:40 PM, Andrey Konovalov wrote: >> diff --git a/lib/test_kasan.c b/lib/test_kasan.c >> index 7285dcf9fcc1..1306f707b4fe 100644 >> --- a/lib/test_kasan.c >> +++ b/lib/test_kasan.c >> @@ -52,6 +52,11 @@ static int kasan_test_init(struct kunit *test) >> return -1; >>

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

2021-01-22 Thread Vincenzo Frascino
On 1/21/21 5:34 PM, Andrey Konovalov wrote: >> +- ``kasan.mode=sync`` or ``=async`` controls whether KASAN is configured in >> + synchronous or asynchronous mode of execution (default: ``sync``). >> + ``synchronous mode``: an exception is triggered if a tag check fault >> occurs. >

Re: rcu-torture: Internal error: Oops: 96000006

2021-01-22 Thread Vincenzo Frascino
On 1/22/21 10:02 AM, Mark Rutland wrote: > On Thu, Jan 21, 2021 at 01:43:14PM -0800, Paul E. McKenney wrote: >> On Thu, Jan 21, 2021 at 09:31:10PM +, Will Deacon wrote: >>> On Thu, Jan 21, 2021 at 10:55:21AM -0800, Paul E. McKenney wrote: On Thu, Jan 21, 2021 at 10:37:21PM +0530,

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

2021-01-22 Thread Vincenzo Frascino
Ryabinin Cc: Alexander Potapenko Cc: Marco Elver Cc: Evgenii Stepanov Cc: Branislav Rankov Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino Vincenzo Frascino (4): arm64: mte: Add asynchronous mode support kasan: Add KASAN mode kernel parameter kasan: Add report for async mode

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

2021-01-22 Thread Vincenzo Frascino
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-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- include/linux/kasan.h | 2 ++ mm/kasan

[PATCH v6 1/4] arm64: mte: Add asynchronous mode support

2021-01-22 Thread Vincenzo Frascino
Reviewed-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h| 3 ++- arch/arm64/include/asm/mte-kasan.h | 9 +++-- arch/arm64/kernel/mte.c| 16 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/arch/arm64

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

2021-01-22 Thread Vincenzo Frascino
at exception entry to EL1. On the context switch path the synchronization is guarantied by the dsb() in __switch_to(). The dsb(nsh) in mte_check_tfsr_exit() is provisional pending confirmation by the architects. Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas Signed-off-by: Vincenzo

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

2021-01-22 Thread Vincenzo Frascino
. Note: This patch adds the kasan.mode kernel parameter and the sync/async kernel command line options to enable the described features. Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Documentation/dev-tools/kasan.rst | 9

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

2021-01-22 Thread Vincenzo Frascino
On 1/22/21 1:19 PM, Catalin Marinas wrote: > On Thu, Jan 21, 2021 at 04:39:40PM +0000, Vincenzo Frascino wrote: >> diff --git a/include/linux/kasan.h b/include/linux/kasan.h >> index bb862d1f0e15..b0a1d9dfa85c 100644 >> --- a/include/linux/kasan.h >> +++ b/include

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

2021-01-22 Thread Vincenzo Frascino
On 1/22/21 1:59 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

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

2021-01-22 Thread Vincenzo Frascino
to a kernel panic. 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 insertions(+), 1 deletion(-) diff --git a/include

[PATCH v3 1/2] arm64: Improve kernel address detection of __is_lm_address()

2021-01-22 Thread Vincenzo Frascino
a kernel address starting at PAGE_OFFSET. Cc: Catalin Marinas Cc: Will Deacon Suggested-by: Catalin Marinas Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64

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

2021-01-22 Thread Vincenzo Frascino
On 1/22/21 2:46 PM, Andrey Konovalov wrote: > On Fri, Jan 22, 2021 at 3:38 PM Vincenzo Frascino > wrote: >> >> With the introduction of KASAN_HW_TAGS, kasan_report() dereferences >> the address passed as a parameter. > > It doesn't dereference the address, it a

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

2021-01-22 Thread Vincenzo Frascino
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-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- include/linux/kasan.h | 6 ++ mm/kasan

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

2021-01-22 Thread Vincenzo Frascino
. Note: This patch adds the kasan.mode kernel parameter and the sync/async kernel command line options to enable the described features. Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Reviewed-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino

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

2021-01-22 Thread Vincenzo Frascino
reported by krobot. - General cleanup. Cc: Catalin Marinas Cc: Will Deacon Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Marco Elver Cc: Evgenii Stepanov Cc: Branislav Rankov Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino Vincenzo Frascino (4): arm64: mte

[PATCH v3 0/2] kasan: Fix metadata detection for KASAN_HW_TAGS

2021-01-22 Thread Vincenzo Frascino
: Will Deacon Cc: Mark Rutland Cc: Paul E. McKenney Cc: Naresh Kamboju Signed-off-by: Vincenzo Frascino Vincenzo Frascino (2): arm64: Improve kernel address detection of __is_lm_address() kasan: Add explicit preconditions to kasan_report() arch/arm64/include/asm/memory.h | 6 -- include/linux

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

2021-01-22 Thread Vincenzo Frascino
Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 32 +++ arch/arm64/kernel/entry-common.c | 6 + arch/arm64/kernel/mte.c | 44 3 files changed, 82 insertions(+) diff --git a/arch/arm64/include/asm/mte.h

[PATCH v8 1/4] arm64: mte: Add asynchronous mode support

2021-01-22 Thread Vincenzo Frascino
Reviewed-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h| 3 ++- arch/arm64/include/asm/mte-kasan.h | 9 +++-- arch/arm64/kernel/mte.c| 16 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/arch/arm64

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

2021-01-22 Thread Vincenzo Frascino
On 1/22/21 2:42 PM, Andrey Konovalov wrote: > 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: An

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

2021-01-22 Thread Vincenzo Frascino
Hi Andrey, All done. Reposting shortly. Thank you! On 1/21/21 5:20 PM, Andrey Konovalov wrote: > And please move this to include/kasan/kasan.h. I guess you meant include/linux/kasan.h. -- Regards, Vincenzo

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

2021-01-22 Thread Vincenzo Frascino
On 1/22/21 1:27 PM, Vincenzo Frascino wrote: >> It looks like the original kasan_report() prototype is declared in two >> places (second one in mm/kasan/kasan.h). I'd remove the latter and try >> to have a consistent approach for kasan_report() and >> kasan_re

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

2021-01-22 Thread Vincenzo Frascino
Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- include/linux/kasan.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/include/linux/kasan.h b/include/linux/kasan.h index fe1ae73ff8b5..0aea9e2a2a01 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -333,6 +333,13

[PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-22 Thread Vincenzo Frascino
a kernel address starting at PAGE_OFFSET. Cc: Catalin Marinas Cc: Will Deacon Suggested-by: Catalin Marinas Reviewed-by: Catalin Marinas Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64

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

2021-01-22 Thread Vincenzo Frascino
with a future patch. Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Leon Romanovsky Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- mm/kasan/kasan.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index

[PATCH v4 0/3] kasan: Fix metadata detection for KASAN_HW_TAGS

2021-01-22 Thread Vincenzo Frascino
: Will Deacon Cc: Mark Rutland Cc: Paul E. McKenney Cc: Naresh Kamboju Signed-off-by: Vincenzo Frascino Vincenzo Frascino (3): arm64: Improve kernel address detection of __is_lm_address() kasan: Add explicit preconditions to kasan_report() kasan: Make addr_has_metadata() return true for valid

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

2021-01-20 Thread Vincenzo Frascino
Hi Andrey, On 1/19/21 6:10 PM, Andrey Konovalov wrote: > On Mon, Jan 18, 2021 at 7:30 PM Vincenzo Frascino > wrote: >> --- a/Documentation/dev-tools/kasan.rst >> +++ b/Documentation/dev-tools/kasan.rst >> @@ -162,6 +162,9 @@ particular KASAN features. >> >>

Re: [PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Vincenzo Frascino
On 1/21/21 4:02 PM, Vincenzo Frascino wrote: >> I think it'd be worth checking, if we're going to use this in common >> code. >> > Ok, I will run some tests and let you know. > I checked on x86_64 and ppc64 (they both have KASAN implementation): I added the foll

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

2021-01-19 Thread Vincenzo Frascino
Hi Andrey, On 1/19/21 6:27 PM, Andrey Konovalov wrote: > On Tue, Jan 19, 2021 at 6:26 PM Vincenzo Frascino > wrote: >> >> With the introduction of KASAN_HW_TAGS, kasan_report() dereferences >> the address passed as a parameter. >> >> Add a comment

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

2021-01-19 Thread Vincenzo Frascino
On 1/19/21 6:52 PM, Catalin Marinas wrote: > On Tue, Jan 19, 2021 at 07:27:43PM +0100, Andrey Konovalov wrote: >> On Tue, Jan 19, 2021 at 6:26 PM Vincenzo Frascino >> wrote: >>> >>> With the introduction of KASAN_HW_TAGS, kasan_report() dereferences >

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

2021-01-19 Thread Vincenzo Frascino
On 1/19/21 7:02 PM, Catalin Marinas wrote: > On Tue, Jan 19, 2021 at 07:00:57PM +0000, Vincenzo Frascino wrote: >> On 1/19/21 6:52 PM, Catalin Marinas wrote: >>> On Tue, Jan 19, 2021 at 07:27:43PM +0100, Andrey Konovalov wrote: >>>> On Tue, Jan 19, 2021 at 6:26 PM

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

2021-01-19 Thread Vincenzo Frascino
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 --- mm/kasan/report.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/mm/kasan/report.c b/mm/kasan/report.c

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

2021-01-18 Thread Vincenzo Frascino
Hi Mark, On 1/18/21 2:14 PM, Mark Rutland wrote: > On Mon, Jan 18, 2021 at 01:37:35PM +0000, Vincenzo Frascino wrote: >> On 1/18/21 12:57 PM, Catalin Marinas wrote: > >>>> + if (tfsr_el1 & SYS_TFSR_EL1_TF1) { >>>> + write_sysreg_s(0, SYS_TFS

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

2021-01-18 Thread Vincenzo Frascino
On 1/18/21 2:48 PM, Vincenzo Frascino wrote: >> Are you aware of cases where the TFSR_EL1 value is read other than by an >> MRS? e.g. are there any cases where checks are elided if TF1 is set? If >> so, we may need the ISB to order the direct write against subsequent

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

2021-01-18 Thread Vincenzo Frascino
On 1/18/21 1:37 PM, Vincenzo Frascino wrote: >> If a speculated load is allowed to update this reg, we'd probably need an >> ISB+DSB (I don't think it does, something to check with the architects). >> > I will check this with the architects and let you know. I sp

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

2021-01-18 Thread Vincenzo Frascino
On 1/18/21 12:57 PM, Catalin Marinas wrote: >> +#ifdef CONFIG_KASAN_HW_TAGS >> +void mte_check_tfsr_el1_no_sync(void) >> +{ >> +u64 tfsr_el1; >> + >> +if (!system_supports_mte()) >> +return; >> + >> +tfsr_el1 = read_sysreg_s(SYS_TFSR_EL1); >> + >> +/* >> + * The

Re: [PATCH v4 3/5] kasan: Add report for async mode

2021-01-19 Thread Vincenzo Frascino
On 1/19/21 1:04 PM, Catalin Marinas wrote: > On Mon, Jan 18, 2021 at 06:30:31PM +0000, Vincenzo Frascino wrote: >> KASAN provides an asynchronous mode of execution. >> >> Add reporting functionality for this mode. >> >> Cc: Dmitry Vyukov >> Cc: Andr

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

2021-01-19 Thread Vincenzo Frascino
On 1/19/21 6:52 PM, Catalin Marinas wrote: > On Tue, Jan 19, 2021 at 07:27:43PM +0100, Andrey Konovalov wrote: >> On Tue, Jan 19, 2021 at 6:26 PM Vincenzo Frascino >> wrote: >>> >>> With the introduction of KASAN_HW_TAGS, kasan_report() dereferences >

Re: [PATCH v4 3/5] kasan: Add report for async mode

2021-01-19 Thread Vincenzo Frascino
On 1/19/21 2:46 PM, Mark Rutland wrote: > On Tue, Jan 19, 2021 at 02:23:03PM +0000, Vincenzo Frascino wrote: >> On 1/19/21 1:04 PM, Catalin Marinas wrote: >>> On Mon, Jan 18, 2021 at 06:30:31PM +, Vincenzo Frascino wrote: > >>>> +bool kasan_report_asyn

[PATCH v4 4/5] arm64: mte: Enable async tag check fault

2021-01-18 Thread Vincenzo Frascino
at exception entry to EL1. On the context switch path the synchronization is guarantied by the dsb() in __switch_to(). The dsb(nsh) in mte_check_tfsr_exit() is provisional pending confirmation by the architects. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64

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

2021-01-18 Thread Vincenzo Frascino
: Andrey Ryabinin Cc: Alexander Potapenko Cc: Marco Elver Cc: Evgenii Stepanov Cc: Branislav Rankov Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino Vincenzo Frascino (5): arm64: mte: Add asynchronous mode support kasan: Add KASAN mode kernel parameter kasan: Add report for async mode

[PATCH v4 5/5] arm64: mte: Inline mte_assign_mem_tag_range()

2021-01-18 Thread Vincenzo Frascino
...@mail.gmail.com/ Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 26 +- arch/arm64/lib/mte.S | 15 --- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/arch/arm64/include/asm/mte.h

[PATCH v4 3/5] kasan: Add report for async mode

2021-01-18 Thread Vincenzo Frascino
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 Signed-off-by: Vincenzo Frascino --- include/linux/kasan.h | 3 +++ mm/kasan/report.c | 16

[PATCH v4 1/5] arm64: mte: Add asynchronous mode support

2021-01-18 Thread Vincenzo Frascino
mechanism will be added with a future patch. Note: KASAN HW activates async mode via kasan.mode kernel parameter. The default mode is set to synchronous. The code that verifies the status of TFSR_EL1 will be added with a future patch. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino

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

2021-01-18 Thread Vincenzo Frascino
: This patch adds the kasan.mode kernel parameter and the sync/async kernel command line options to enable the described features. Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Documentation/dev-tools/kasan.rst | 3

[PATCH 1/4] kasan, arm64: Add KASAN light mode

2021-01-06 Thread Vincenzo Frascino
introduces the kasan_def.h header to make easier to propagate the relevant enumerations to the architectural code. Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h| 2 +- arch/arm64/include/asm/m

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

2021-01-06 Thread Vincenzo Frascino
at exception entry to EL1. On the context switch path the synchronization is guarantied by the dsb() in __switch_to(). Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 1 + arch/arm64/kernel/entry-common.c | 6 ++ arch/arm64/kernel

[PATCH 4/4] arm64: mte: Optimize mte_assign_mem_tag_range()

2021-01-06 Thread Vincenzo Frascino
...@mail.gmail.com/ Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 26 +- arch/arm64/lib/mte.S | 15 --- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/arch/arm64/include/asm

[PATCH 2/4] arm64: mte: Add asynchronous mode support

2021-01-06 Thread Vincenzo Frascino
mechanism will be added with a future patch. Note: KASAN HW activates async mode via kasan.mode kernel parameter. The default mode is set to synchronous. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/kernel/mte.c | 31 +-- 1 file

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

2021-01-06 Thread Vincenzo Frascino
Cc: Branislav Rankov Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino Vincenzo Frascino (4): kasan, arm64: Add KASAN light mode arm64: mte: Add asynchronous mode support arm64: mte: Enable async tag check fault arm64: mte: Optimize mte_assign_mem_tag_range() arch/arm64/include

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

2021-01-06 Thread Vincenzo Frascino
On 1/6/21 11:55 AM, 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

Re: [PATCH 2/4] arm64: mte: Add asynchronous mode support

2021-01-07 Thread Vincenzo Frascino
Hi Andrey, On 1/7/21 4:29 PM, Andrey Konovalov wrote: > On Wed, Jan 6, 2021 at 12:56 PM Vincenzo Frascino > wrote: >> >> MTE provides an asynchronous mode for detecting tag exceptions. In >> particular instead of triggering a fault the arm64 core updates a >

[PATCH v2 1/4] kasan, arm64: Add KASAN light mode

2021-01-07 Thread Vincenzo Frascino
introduces the kasan_def.h header to make easier to propagate the relevant enumerations to the architectural code. Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h| 2 +- arch/arm64/include/asm/m

[PATCH v2 2/4] arm64: mte: Add asynchronous mode support

2021-01-07 Thread Vincenzo Frascino
mechanism will be added with a future patch. Note: KASAN HW activates async mode via kasan.mode kernel parameter. The default mode is set to synchronous. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/kernel/mte.c | 31 +-- 1 file

[PATCH v2 3/4] arm64: mte: Enable async tag check fault

2021-01-07 Thread Vincenzo Frascino
at exception entry to EL1. On the context switch path the synchronization is guarantied by the dsb() in __switch_to(). Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 4 arch/arm64/kernel/entry-common.c | 6 ++ arch/arm64/kernel

[PATCH v2 4/4] arm64: mte: Optimize mte_assign_mem_tag_range()

2021-01-07 Thread Vincenzo Frascino
...@mail.gmail.com/ Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 26 +- arch/arm64/lib/mte.S | 15 --- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/arch/arm64/include/asm

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

2021-01-07 Thread Vincenzo Frascino
: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Marco Elver Cc: Evgenii Stepanov Cc: Branislav Rankov Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino Vincenzo Frascino (4): kasan, arm64: Add KASAN light mode arm64: mte: Add asynchronous mode support arm64: mte: Enable

[PATCH v3 3/4] arm64: mte: Enable async tag check fault

2021-01-15 Thread Vincenzo Frascino
at exception entry to EL1. On the context switch path the synchronization is guarantied by the dsb() in __switch_to(). Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 21 +++ arch/arm64/kernel/entry-common.c | 11

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

2021-01-15 Thread Vincenzo Frascino
Konovalov Signed-off-by: Vincenzo Frascino Vincenzo Frascino (4): kasan, arm64: Add KASAN light mode arm64: mte: Add asynchronous mode support arm64: mte: Enable async tag check fault arm64: mte: Optimize mte_assign_mem_tag_range() arch/arm64/include/asm/memory.h| 2 +- arch/arm64/include

[PATCH v3 2/4] arm64: mte: Add asynchronous mode support

2021-01-15 Thread Vincenzo Frascino
mechanism will be added with a future patch. Note: KASAN HW activates async mode via kasan.mode kernel parameter. The default mode is set to synchronous. The code that verifies the status of TFSR_EL1 will be added with a future patch. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino

[PATCH v3 4/4] arm64: mte: Optimize mte_assign_mem_tag_range()

2021-01-15 Thread Vincenzo Frascino
...@mail.gmail.com/ Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 26 +- arch/arm64/lib/mte.S | 15 --- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/arch/arm64/include/asm

[PATCH v3 1/4] kasan, arm64: Add KASAN light mode

2021-01-15 Thread Vincenzo Frascino
introduces the kasan_def.h header to make easier to propagate the relevant enumerations to the architectural code. Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h| 2 +- arch/arm64/inclu

Re: [PATCH 05/11] kasan, arm64: allow using KUnit tests with HW_TAGS mode

2021-01-15 Thread Vincenzo Frascino
to tag checking being disabled. > > With this patch KASAN tests are still failing for the hardware tag-based > mode; fixes come in the next few patches. > A part what Catalin noticed already: Reviewed-by: Vincenzo Frascino > Signed-off-by: Andrey Konovalov > Link: > http

Re: [PATCH v3 2/2] kasan, arm64: fix pointer tags in KASAN reports

2021-01-15 Thread Vincenzo Frascino
9ced973866036d8679e8f4ae325de547eb969649 > Fixes: dceec3ff7807 ("arm64: expose FAR_EL1 tag bits in siginfo") > Fixes: 4291e9ee6189 ("kasan, arm64: print report from tag fault handler") > Signed-off-by: Andrey Konovalov Reviewed-by: Vincenzo Frascino > --- > arch/a

Re: [PATCH v3 4/4] arm64: mte: Optimize mte_assign_mem_tag_range()

2021-01-17 Thread Vincenzo Frascino
Hi Mark, On 1/16/21 2:22 PM, Vincenzo Frascino wrote: >> Is there any chance that this can be used for the last bytes of the >> virtual address space? This might need to change to `_addr == _end` if >> that is possible, otherwise it'll terminate early in that case.

Re: [PATCH v3 4/4] arm64: mte: Optimize mte_assign_mem_tag_range()

2021-01-18 Thread Vincenzo Frascino
On 1/18/21 10:41 AM, Mark Rutland wrote: > On Sun, Jan 17, 2021 at 12:27:08PM +0000, Vincenzo Frascino wrote: >> Hi Mark, >> >> On 1/16/21 2:22 PM, Vincenzo Frascino wrote: >>>> Is there any chance that this can be used for the last bytes of the >>&g

Re: [PATCH v4 18/52] math64.h: kernel-docs: Convert some markups into normal comments

2020-09-30 Thread Vincenzo Frascino
ngs about duplication, change the kernel-doc > markups to just comments at math64.h. > Reviewed-by: Vincenzo Frascino > Signed-off-by: Mauro Carvalho Chehab > --- > include/linux/math64.h | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/incl

  1   2   3   4   5   6   >