Re: [PATCH v2] arm64: vdso32: drop -no-integrated-as flag

2021-04-15 Thread Vincenzo Frascino
looks fine, but I have one question: the kernel requires as a minimum Clang/LLVM version 10.0.1. Did you verify that with that version compat vDSOs still builds and works correctly? Otherwise: Reviewed-by: Vincenzo Frascino > --- > Changes V1 -> V2: > * Remove

Re: [PATCH RESEND v1 4/4] powerpc/vdso: Add support for time namespaces

2021-04-12 Thread Vincenzo Frascino
next page in vvar. > This avoids having to redo the mflr/bcl/mflr/mtlr dance to locate > the page relative to running code position. > > Signed-off-by: Christophe Leroy Reviewed-by: Vincenzo Frascino # vDSO parts > --- > arch/powerpc/Kconfig | 3

Re: [PATCH RESEND v1 3/4] powerpc/vdso: Separate vvar vma from vdso

2021-04-12 Thread Vincenzo Frascino
an > Cc: Paul Mackerras > Cc: linuxppc-...@lists.ozlabs.org > Cc: sta...@vger.kernel.org # v5.11 > [1]: https://github.com/checkpoint-restore/criu/issues/1417 > Signed-off-by: Dmitry Safonov > Tested-by: Christophe Leroy > Signed-off-by: Christophe Leroy Reviewed-by: Vinc

Re: [PATCH RESEND v1 2/4] lib/vdso: Add vdso_data pointer as input to __arch_get_timens_vdso_data()

2021-04-12 Thread Vincenzo Frascino
age to vdso_data, provide > vdso_data pointer to __arch_get_timens_vdso_data() in order > to ease the calculation on powerpc in following patches. > > Signed-off-by: Christophe Leroy Reviewed-by: Vincenzo Frascino > --- > arch/arm64/include/asm/vdso/compat_gettimeofda

Re: [PATCH RESEND v1 1/4] lib/vdso: Mark do_hres_timens() and do_coarse_timens() __always_inline()

2021-04-12 Thread Vincenzo Frascino
-gettime-monotonic-raw:vdso: 1100 nsec/call > clock-gettime-monotonic-coarse:vdso: 667 nsec/call > clock-gettime-monotonic:vdso: 1025 nsec/call > > Signed-off-by: Christophe Leroy Reviewed-by: Vincenzo Frascino > --- > lib/vdso/gettimeofday.c | 16 >

[PATCH v3] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-09 Thread Vincenzo Frascino
: Moving the check in entry-common allows to use set_thread_flag() which is safe. Fixes: 637ec831ea4f ("arm64: mte: Handle synchronous and asynchronous tag check faults") Cc: Catalin Marinas Cc: Will Deacon Cc: sta...@vger.kernel.org Reported-by: Will Deacon Signed-off-by: Vincenzo Frascino

[PATCH v2] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-09 Thread Vincenzo Frascino
: Moving the check in entry-common allows to use set_thread_flag() which is safe. Fixes: 637ec831ea4f ("arm64: mte: Handle synchronous and asynchronous tag check faults") Cc: Catalin Marinas Cc: Will Deacon Cc: sta...@vger.kernel.org Reported-by: Will Deacon Signed-off-by: Vincenzo Frascino

Re: [PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Vincenzo Frascino
On 4/8/21 4:18 PM, Mark Rutland wrote: > Hi Vincenzo, > > On Thu, Apr 08, 2021 at 03:37:23PM +0100, Vincenzo Frascino wrote: >> The check_mte_async_tcf macro sets the TIF flag non-atomically. This can >> race with another CPU doing a set_tsk_thread_flag() and th

Re: [PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Vincenzo Frascino
On 4/8/21 4:06 PM, Mark Rutland wrote: > On Thu, Apr 08, 2021 at 03:56:04PM +0100, Will Deacon wrote: >> On Thu, Apr 08, 2021 at 03:37:23PM +0100, Vincenzo Frascino wrote: >>> The check_mte_async_tcf macro sets the TIF flag non-atomically. This can >>>

[PATCH] arm64: mte: Move MTE TCF0 check in entry-common

2021-04-08 Thread Vincenzo Frascino
in entry-common allows to use set_thread_flag() which is safe. Fixes: 637ec831ea4f ("arm64: mte: Handle synchronous and asynchronous tag check faults") Cc: Catalin Marinas Cc: Will Deacon Reported-by: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.

[PATCH] arm64: mte: Remove unused mte_assign_mem_tag_range()

2021-04-07 Thread Vincenzo Frascino
d not delete the old function prototypes in mte.h. Remove the unused prototype from mte.h. Cc: Catalin Marinas Cc: Will Deacon Reported-by: Derrick McKee Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/arm64/include/as

Re: [PATCH v16 6/9] arm64: mte: Conditionally compile mte_enable_kernel_*()

2021-03-16 Thread Vincenzo Frascino
On 3/15/21 6:41 PM, Catalin Marinas wrote: > On Mon, Mar 15, 2021 at 01:20:16PM +0000, Vincenzo Frascino wrote: >> mte_enable_kernel_*() are not needed if KASAN_HW is disabled. >> >> Add ash defines around the functions to conditionally compile the >> functions. &g

[PATCH v16 9/9] kasan, arm64: tests supports for HW_TAGS async mode

2021-03-15 Thread Vincenzo Frascino
the test is over, check for faults as a part of the test handler. Acked-by: Catalin Marinas Acked-by: Andrey Konovalov Tested-by: Andrey Konovalov Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h | 1 + lib/test_kasan.c| 17

[PATCH v16 8/9] arm64: mte: Report async tag faults before suspend

2021-03-15 Thread Vincenzo Frascino
-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 4 arch/arm64/kernel/mte.c | 16 arch/arm64/kernel/suspend.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h index 9a929620ca5d..a38abc15186c

[PATCH v16 7/9] arm64: mte: Enable async tag check fault

2021-03-15 Thread Vincenzo Frascino
Konovalov Tested-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 29 + arch/arm64/kernel/entry-common.c | 6 ++ arch/arm64/kernel/mte.c | 36 3 files changed, 71 insertions(+) diff

[PATCH v16 4/9] kasan: Add report for async mode

2021-03-15 Thread Vincenzo Frascino
Signed-off-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov --- include/linux/kasan.h | 6 ++ mm/kasan/kasan.h | 16 mm/kasan/report.c | 17 - 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/include/linux/kasan.h b/include/linux

[PATCH v16 6/9] arm64: mte: Conditionally compile mte_enable_kernel_*()

2021-03-15 Thread Vincenzo Frascino
mte_enable_kernel_*() are not needed if KASAN_HW is disabled. Add ash defines around the functions to conditionally compile the functions. Signed-off-by: Vincenzo Frascino --- arch/arm64/kernel/mte.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kernel/mte.c b/arch/arm64

[PATCH v16 5/9] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-03-15 Thread Vincenzo Frascino
-by: Branislav Rankov Reviewed-by: Catalin Marinas Acked-by: Andrey Konovalov Tested-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h| 15 +++ arch/arm64/include/asm/uaccess.h| 22 ++ arch/arm64/include/asm/word

[PATCH v16 3/9] arm64: mte: Drop arch_enable_tagging()

2021-03-15 Thread Vincenzo Frascino
Tested-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index f6d1ae69ffb3..a07923eb33c5 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch

[PATCH v16 2/9] kasan: Add KASAN mode kernel parameter

2021-03-15 Thread Vincenzo Frascino
Konovalov Tested-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino [ Add a new var instead of exposing kasan_arg_mode to be consistent with flags for other command line arguments. ] Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 9 + lib/test_kasan.c

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

2021-03-15 Thread Vincenzo Frascino
Elver Cc: Evgenii Stepanov Cc: Branislav Rankov Cc: Andrey Konovalov Cc: Lorenzo Pieralisi Signed-off-by: Vincenzo Frascino Andrey Konovalov (1): kasan, arm64: tests supports for HW_TAGS async mode Vincenzo Frascino (8): arm64: mte: Add asynchronous mode support kasan: Add KASAN mode

[PATCH v16 1/9] arm64: mte: Add asynchronous mode support

2021-03-15 Thread Vincenzo Frascino
Reviewed-by: Andrey Konovalov Acked-by: Andrey Konovalov Tested-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h| 4 +++- arch/arm64/include/asm/mte-kasan.h | 9 +++-- arch/arm64/kernel/mte.c| 16 ++-- 3 files changed, 24

Re: [PATCH v15 5/8] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-03-12 Thread Vincenzo Frascino
On 3/12/21 3:29 PM, Catalin Marinas wrote: > On Fri, Mar 12, 2021 at 03:23:44PM +0000, Vincenzo Frascino wrote: >> On 3/12/21 3:13 PM, Catalin Marinas wrote: >>> On Fri, Mar 12, 2021 at 02:22:07PM +, Vincenzo Frascino wrote: >>>> diff --git a/arch/arm64/

Re: [PATCH v15 5/8] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-03-12 Thread Vincenzo Frascino
On 3/12/21 3:13 PM, Catalin Marinas wrote: > On Fri, Mar 12, 2021 at 02:22:07PM +0000, Vincenzo Frascino wrote: >> diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h >> index 9b557a457f24..8603c6636a7d 100644 >> --- a/arch/arm64/include/asm/mte.h >&g

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

2021-03-12 Thread Vincenzo Frascino
On 3/12/21 2:50 PM, Andrey Konovalov wrote: > On Fri, Mar 12, 2021 at 3:22 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 &g

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

2021-03-12 Thread Vincenzo Frascino
On 3/12/21 2:49 PM, Andrey Konovalov wrote: > On Fri, Mar 12, 2021 at 3:22 PM Vincenzo Frascino > wrote: >> >> From: Andrey Konovalov >> >> This change adds KASAN-KUnit tests support for the async HW_TAGS mode. >> >> In async mode, tag fault aren't b

[PATCH v15 7/8] arm64: mte: Report async tag faults before suspend

2021-03-12 Thread Vincenzo Frascino
asynchronous tag faults before suspend and clear the TFSR_EL1 register after resume to prevent this to happen. Cc: Catalin Marinas Cc: Will Deacon Cc: Lorenzo Pieralisi Reviewed-by: Catalin Marinas Reviewed-by: Lorenzo Pieralisi Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h

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

2021-03-12 Thread Vincenzo Frascino
From: Andrey Konovalov This change adds KASAN-KUnit tests support for the async HW_TAGS mode. In async mode, tag fault aren't being generated synchronously when a bad access happens, but are instead explicitly checked for by the kernel. As each KASAN-KUnit test expect a fault to happen before

[PATCH v15 4/8] kasan: Add report for async mode

2021-03-12 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 Signed-off-by: Andrey Konovalov --- include/linux

[PATCH v15 5/8] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-03-12 Thread Vincenzo Frascino
-by: Branislav Rankov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h| 15 +++ arch/arm64/include/asm/uaccess.h| 22 ++ arch/arm64/include/asm/word-at-a-time.h | 4 arch/arm64/kernel/mte.c | 22

[PATCH v15 6/8] arm64: mte: Enable async tag check fault

2021-03-12 Thread Vincenzo Frascino
Konovalov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 29 + arch/arm64/kernel/entry-common.c | 6 ++ arch/arm64/kernel/mte.c | 36 3 files changed, 71 insertions(+) diff --git a/arch/arm64/include/asm

[PATCH v15 3/8] arm64: mte: Drop arch_enable_tagging()

2021-03-12 Thread Vincenzo Frascino
arch_enable_tagging() was left in memory.h after the introduction of async mode to not break the bysectability of the KASAN KUNIT tests. Remove the function now that KASAN has been fully converted. Cc: Catalin Marinas Cc: Will Deacon Acked-by: Catalin Marinas Signed-off-by: Vincenzo Frascino

[PATCH v15 2/8] kasan: Add KASAN mode kernel parameter

2021-03-12 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 [ Add a new

[PATCH v15 1/8] arm64: mte: Add asynchronous mode support

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

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

2021-03-12 Thread Vincenzo Frascino
: Lorenzo Pieralisi Signed-off-by: Vincenzo Frascino Andrey Konovalov (1): kasan, arm64: tests supports for HW_TAGS async mode Vincenzo Frascino (7): arm64: mte: Add asynchronous mode support kasan: Add KASAN mode kernel parameter arm64: mte: Drop arch_enable_tagging() kasan: Add report

Re: [PATCH v14 8/8] kselftest/arm64: Verify that TCO is enabled in load_unaligned_zeropad()

2021-03-11 Thread Vincenzo Frascino
On 3/11/21 4:28 PM, Catalin Marinas wrote: > On Thu, Mar 11, 2021 at 03:00:26PM +0000, Vincenzo Frascino wrote: >> On 3/11/21 1:25 PM, Catalin Marinas wrote: >>> On Mon, Mar 08, 2021 at 04:14:34PM +, Vincenzo Frascino wrote: >>>> load_unaligned_zeropad(

Re: [PATCH v14 8/8] kselftest/arm64: Verify that TCO is enabled in load_unaligned_zeropad()

2021-03-11 Thread Vincenzo Frascino
On 3/11/21 1:25 PM, Catalin Marinas wrote: > On Mon, Mar 08, 2021 at 04:14:34PM +0000, Vincenzo Frascino wrote: >> load_unaligned_zeropad() and __get/put_kernel_nofault() functions can >> read passed some buffer limits which may include some MTE granule with a >> differen

Re: [PATCH v14 5/8] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-03-09 Thread Vincenzo Frascino
On 3/8/21 6:09 PM, Mark Rutland wrote: >> +DECLARE_STATIC_KEY_FALSE(mte_async_mode); > Can we please hide this behind something like: > > static inline bool system_uses_mte_async_mode(void) > { > return IS_ENABLED(CONFIG_KASAN_HW_TAGS) && > static_branch_unlikely(_async_mode);

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

2021-03-09 Thread Vincenzo Frascino
Hi Andrey, On 3/8/21 9:02 PM, Andrey Konovalov wrote: > On Mon, Mar 8, 2021 at 5:14 PM Vincenzo Frascino > wrote: >> >> This patchset implements the asynchronous mode support for ARMv8.5-A >> Memory Tagging Extension (MTE), which is a debugging feature that allows &g

[PATCH v14 5/8] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-03-08 Thread Vincenzo Frascino
-by: Branislav Rankov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/uaccess.h| 24 arch/arm64/include/asm/word-at-a-time.h | 4 arch/arm64/kernel/mte.c | 22 ++ 3 files changed, 50 insertions(+) diff --git a/arch

[PATCH v14 4/8] kasan: Add report for async mode

2021-03-08 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 Signed-off-by: Andrey Konovalov --- include/linux

[PATCH v14 7/8] arm64: mte: Report async tag faults before suspend

2021-03-08 Thread Vincenzo Frascino
asynchronous tag faults before suspend and clear the TFSR_EL1 register after resume to prevent this to happen. Cc: Catalin Marinas Cc: Will Deacon Cc: Lorenzo Pieralisi Reviewed-by: Catalin Marinas Reviewed-by: Lorenzo Pieralisi Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h

[PATCH v14 6/8] arm64: mte: Enable async tag check fault

2021-03-08 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 | 36 3 files changed, 74 insertions(+) diff --git a/arch/arm64/include/asm

[PATCH v14 3/8] arm64: mte: Drop arch_enable_tagging()

2021-03-08 Thread Vincenzo Frascino
arch_enable_tagging() was left in memory.h after the introduction of async mode to not break the bysectability of the KASAN KUNIT tests. Remove the function now that KASAN has been fully converted. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino --- arch/arm64/include

[PATCH v14 8/8] kselftest/arm64: Verify that TCO is enabled in load_unaligned_zeropad()

2021-03-08 Thread Vincenzo Frascino
== Verify that Tag Check Override (TCO) is enabled in these functions before the load and disable it afterwards to prevent this to happen. Note: The issue has been observed only with an MTE enabled userspace. Cc: Catalin Marinas Cc: Will Deacon Reported-by: Branislav Rankov Signed-off-by: Vincenzo

[PATCH v14 2/8] kasan: Add KASAN mode kernel parameter

2021-03-08 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 [ Add a new

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

2021-03-08 Thread Vincenzo Frascino
Potapenko Cc: Marco Elver Cc: Evgenii Stepanov Cc: Branislav Rankov Cc: Andrey Konovalov Cc: Lorenzo Pieralisi Signed-off-by: Vincenzo Frascino Vincenzo Frascino (8): arm64: mte: Add asynchronous mode support kasan: Add KASAN mode kernel parameter arm64: mte: Drop arch_enable_tagging

[PATCH v14 1/8] arm64: mte: Add asynchronous mode support

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

Re: [PATCH v13 4/7] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-02-23 Thread Vincenzo Frascino
On 2/23/21 12:49 PM, Will Deacon wrote: >>> I totally agree on this point. In the case of runtime switching we might >>> need >>> the rethink completely the strategy and depends a lot on what we want to >>> allow >>> and what not. For the kernel I imagine we will need to expose something in >>>

Re: [PATCH v13 4/7] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-02-23 Thread Vincenzo Frascino
On 2/23/21 12:05 PM, Catalin Marinas wrote: >> I totally agree on this point. In the case of runtime switching we might need >> the rethink completely the strategy and depends a lot on what we want to >> allow >> and what not. For the kernel I imagine we will need to expose something in >>

Re: [PATCH v13 4/7] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-02-23 Thread Vincenzo Frascino
On 2/22/21 5:58 PM, Catalin Marinas wrote: > That's because cpu_hotplug_lock is not a spinlock but a semaphore which > implies sleeping. I don't think avoiding taking this semaphore > altogether (as in the *_cpuslocked functions) is the correct workaround. > Thinking at it a second time I

Re: [PATCH v13 4/7] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-02-22 Thread Vincenzo Frascino
On 2/12/21 5:21 PM, Catalin Marinas wrote: >> + >> +/* >> + * This function is called on each active smp core at boot >> + * time, hence we do not need to take cpu_hotplug_lock again. >> + */ >> +static_branch_enable_cpuslocked(_async_mode); >> } > Sorry, I missed the

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

2021-02-22 Thread Vincenzo Frascino
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. > > I have a prototype of async support for tests working. I'll apply it > on top of the next version Vincenzo posts and

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

2021-02-22 Thread Vincenzo Frascino
On 2/12/21 9:21 PM, Andrey Konovalov wrote: > On Thu, Feb 11, 2021 at 4:34 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 >> register which

Re: [PATCH v13 6/7] arm64: mte: Report async tag faults before suspend

2021-02-12 Thread Vincenzo Frascino
On 2/12/21 12:30 PM, Lorenzo Pieralisi wrote: >> However, I have a question. We are relying on context switch to set >> sctlr_el1_tfc0 right ? If that's the case, till the thread resuming from >> low power switches context we are running with SCTLR_EL1_TCF0 not >> reflecting the actual value. >

Re: [PATCH v13 2/7] kasan: Add KASAN mode kernel parameter

2021-02-12 Thread Vincenzo Frascino
On 2/11/21 5:50 PM, Andrey Konovalov wrote: > Let's default to KASAN_ARG_MODE_DEFAULT like for other args: > > if (!arg) > return -EINVAL; > > kasan_init_hw_tags_cpu()/kasan_init_hw_tags() already handle > KASAN_ARG_MODE_DEFAULT properly. Ok, no problem, I will take care of it in the next

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

2021-02-12 Thread Vincenzo Frascino
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 something like this (untested): > > https://github.com/xairy/linux/commit/91354d34b30ceedbc1b6417f1ff253de90618a97 Could you reproduce

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

2021-02-11 Thread Vincenzo Frascino
On 2/11/21 3:33 PM, Vincenzo Frascino wrote: > The series is based on linux-next/akpm. > > To simplify the testing a tree with the new patches on top has been made > available at [1]. > > [1] https://git.gitlab.arm.com/linux-arm/linux-vf.git mte/v11.async.akpm akpm tree seem

[PATCH v13 6/7] arm64: mte: Report async tag faults before suspend

2021-02-11 Thread Vincenzo Frascino
asynchronous tag faults before suspend and clear the TFSR_EL1 register after resume to prevent this to happen. Cc: Catalin Marinas Cc: Will Deacon Cc: Lorenzo Pieralisi Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 4 arch/arm64/kernel/mte.c | 20

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

2021-02-11 Thread Vincenzo Frascino
From: Andrey Konovalov Asynchronous KASAN mode doesn't guarantee that a tag fault will be detected immediately and causes tests to fail. Forbid running them in asynchronous mode. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- lib/test_kasan.c | 4 1 file changed, 4

[PATCH v13 5/7] arm64: mte: Enable async tag check fault

2021-02-11 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 | 36 3 files changed, 74 insertions(+) diff --git a/arch/arm64/include/asm

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

2021-02-11 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 Signed-off-by: Andrey Konovalov --- include/linux

[PATCH v13 2/7] kasan: Add KASAN mode kernel parameter

2021-02-11 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 [ Add a new

[PATCH v13 4/7] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-02-11 Thread Vincenzo Frascino
-by: Branislav Rankov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/uaccess.h| 24 arch/arm64/include/asm/word-at-a-time.h | 4 arch/arm64/kernel/mte.c | 16 3 files changed, 44 insertions(+) diff --git a/arch/arm64

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

2021-02-11 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| 19 --- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/arch/arm64

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

2021-02-11 Thread Vincenzo Frascino
: Will Deacon Cc: Dmitry Vyukov Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Marco Elver Cc: Evgenii Stepanov Cc: Branislav Rankov Cc: Andrey Konovalov Cc: Lorenzo Pieralisi Signed-off-by: Vincenzo Frascino Andrey Konovalov (1): kasan: don't run tests in async mode Vincenzo Frascino (6

[PATCH v2] arm64: Fix warning in mte_get_random_tag()

2021-02-11 Thread Vincenzo Frascino
ot;arm64: kasan: simplify and inline MTE functions") Cc: Catalin Marinas Cc: Will Deacon Cc: Andrey Konovalov Cc: Andrew Morton Signed-off-by: Vincenzo Frascino --- This patch is based on linux-next/akpm arch/arm64/include/asm/mte-kasan.h | 2 +- 1 file changed, 1 insertion(+), 1 deleti

Re: [PATCH] arm64: Fix warning in mte_get_random_tag()

2021-02-11 Thread Vincenzo Frascino
On 2/11/21 1:35 PM, Ard Biesheuvel wrote: > On Thu, 11 Feb 2021 at 13:57, Vincenzo Frascino > wrote: >> >> The simplification of mte_get_random_tag() caused the introduction of the >> warning below: >> >> In file included from arch/arm64/include/asm/kasan.h

[PATCH] arm64: Fix warning in mte_get_random_tag()

2021-02-11 Thread Vincenzo Frascino
d it never dereferences the address, hence 'addr' can be safely initialized to NULL. Fixes: c8f8de4c0887 ("arm64: kasan: simplify and inline MTE functions") Cc: Catalin Marinas Cc: Will Deacon Cc: Andrey Konovalov Cc: Andrew Morton Signed-off-by: Vincenzo Frascino --- This patch is base

Re: [PATCH v12 6/7] arm64: mte: Save/Restore TFSR_EL1 during suspend

2021-02-09 Thread Vincenzo Frascino
On 2/9/21 5:28 PM, Catalin Marinas wrote: >> I don't think though you can "check" with IRQs disabled so I suspect >> that TFSR_EL1 has to be saved/restored (which means that there is a >> black out period where we run kernel code without being able to detect >> faults but there is no solution to

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

2021-02-09 Thread Vincenzo Frascino
Hi Andrey, On 2/9/21 5:26 PM, Andrey Konovalov wrote: > 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: >>&g

Re: [PATCH v12 6/7] arm64: mte: Save/Restore TFSR_EL1 during suspend

2021-02-09 Thread Vincenzo Frascino
On 2/9/21 2:33 PM, Lorenzo Pieralisi wrote: >> Do we need a similar fix for TFSRE0_EL1? We get away with this if >> suspend is only entered on the idle (kernel) thread but I recall we >> could also enter suspend on behalf of a user process (I may be wrong >> though). > Yes, when we suspend the

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

2021-02-09 Thread Vincenzo Frascino
On 2/9/21 12:02 PM, Catalin Marinas wrote: > On Mon, Feb 08, 2021 at 04:56:17PM +0000, Vincenzo Frascino wrote: >> From: Andrey Konovalov >> >> Asynchronous KASAN mode doesn't guarantee that a tag fault will be >> detected immediately and causes tests t

Re: [PATCH v12 4/7] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-02-09 Thread Vincenzo Frascino
On 2/9/21 11:35 AM, Catalin Marinas wrote: > On Mon, Feb 08, 2021 at 04:56:14PM +0000, Vincenzo Frascino wrote: >> diff --git a/arch/arm64/include/asm/uaccess.h >> b/arch/arm64/include/asm/uaccess.h >> index 0deb88467111..f43d78aee593 100644 >> --- a/arch/arm64/inc

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

2021-02-09 Thread Vincenzo Frascino
; [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: > https://github.com/0day-ci/linux/commits/Vincenzo-Frascino/arm64-ARMv8-5-A-MTE-Add

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

2021-02-09 Thread Vincenzo Frascino
tch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: > https://github.com/0day-ci/linux/commits/Vincenzo-Frascino/arm64-ARMv8-5-A-MTE-Add

Re: [PATCH v12 6/7] arm64: mte: Save/Restore TFSR_EL1 during suspend

2021-02-09 Thread Vincenzo Frascino
Hi Lorenzo, thank you for your review. On 2/8/21 6:56 PM, Lorenzo Pieralisi wrote: >> u64 gcr_kernel_excl __ro_after_init; >> >> +static u64 mte_suspend_tfsr_el1; > IIUC you need this per-CPU (core loses context on suspend-to-RAM but also > CPUidle, S2R is single threaded but CPUidle runs on

[PATCH v12 5/7] arm64: mte: Enable async tag check fault

2021-02-08 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 | 36 3 files changed, 74 insertions(+) diff --git a/arch/arm64/include/asm

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

2021-02-08 Thread Vincenzo Frascino
From: Andrey Konovalov Asynchronous KASAN mode doesn't guarantee that a tag fault will be detected immediately and causes tests to fail. Forbid running them in asynchronous mode. Signed-off-by: Andrey Konovalov --- lib/test_kasan.c | 4 1 file changed, 4 insertions(+) diff --git

[PATCH v12 2/7] kasan: Add KASAN mode kernel parameter

2021-02-08 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 [ Add a new

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

2021-02-08 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 v12 6/7] arm64: mte: Save/Restore TFSR_EL1 during suspend

2021-02-08 Thread Vincenzo Frascino
/restore the state of the TFSR_EL1 register during the suspend/resume operations to prevent this to happen. Cc: Catalin Marinas Cc: Will Deacon Cc: Lorenzo Pieralisi Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/mte.h | 4 arch/arm64/kernel/mte.c | 22

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

2021-02-08 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 Signed-off-by: Andrey Konovalov --- include/linux

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

2021-02-08 Thread Vincenzo Frascino
Cc: Marco Elver Cc: Evgenii Stepanov Cc: Branislav Rankov Cc: Andrey Konovalov Cc: Lorenzo Pieralisi Signed-off-by: Vincenzo Frascino Andrey Konovalov (1): kasan: don't run tests in async mode Vincenzo Frascino (6): arm64: mte: Add asynchronous mode support kasan: Add KASAN mode kernel

[PATCH v12 4/7] arm64: mte: Enable TCO in functions that can read beyond buffer limits

2021-02-08 Thread Vincenzo Frascino
Marinas Cc: Will Deacon Reported-by: Branislav Rankov Tested-by: Branislav Rankov Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/uaccess.h| 19 +++ arch/arm64/include/asm/word-at-a-time.h | 4 arch/arm64/kernel/mte.c | 10 ++ 3 files

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

2021-02-05 Thread Vincenzo Frascino
On 2/5/21 3:49 PM, Andrey Konovalov wrote: > On Mon, Feb 1, 2021 at 9:04 PM Andrey Konovalov wrote: >> >> On Sat, Jan 30, 2021 at 5:52 PM Vincenzo Frascino >> wrote: >>> >>> @@ -45,6 +52,9 @@ static enum kasan_arg_fault kasan_arg_fault >>&g

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

2021-02-05 Thread Vincenzo Frascino
On 2/5/21 3:39 PM, Catalin Marinas wrote: > On Sat, Jan 30, 2021 at 04:52:24PM +0000, Vincenzo Frascino wrote: >> diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c >> index 92078e1eb627..7763ac1f2917 100644 >> --- a/arch/arm64/kernel/mte.c >> ++

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

2021-02-05 Thread Vincenzo Frascino
On 2/5/21 4:48 PM, Will Deacon wrote: > On Fri, Feb 05, 2021 at 04:00:07PM +0000, Vincenzo Frascino wrote: >> >> >> On 2/5/21 3:49 PM, Andrey Konovalov wrote: >>> On Mon, Feb 1, 2021 at 9:04 PM Andrey Konovalov >>> wrote: >>>> >>>>

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

2021-02-05 Thread Vincenzo Frascino
On 1/30/21 4:52 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

Re: [PATCH] selftests/vDSO: fix ABI selftest on riscv

2021-02-05 Thread Vincenzo Frascino
config.h >> b/tools/testing/selftests/vDSO/vdso_config.h >> index 6a6fe8d4ff55..6188b16827d1 100644 >> --- a/tools/testing/selftests/vDSO/vdso_config.h >> +++ b/tools/testing/selftests/vDSO/vdso_config.h >> @@ -47,10 +47,12 @@ >>  #elif defined(__x86_64__) >>  #defin

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

2021-02-04 Thread Vincenzo Frascino
t; >> This change also moves these functions into the asm/mte-kasan.h header >> and implements mte_set_mem_tag_range() via inline assembly to avoid >> unnecessary functions calls. >> >> Co-developed-by: Vincenzo Frascino >> Signed-off-by: Andrey Konovalov >

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

2021-02-04 Thread Vincenzo Frascino
ag_range() via inline assembly to avoid > unnecessary functions calls. > > 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 + &

Re: [PATCH v11 5/5] kasan: don't run tests in async mode

2021-01-30 Thread Vincenzo Frascino
On 1/30/21 4:52 PM, Vincenzo Frascino wrote: > From: Andrey Konovalov > > Asynchronous KASAN mode doesn't guarantee that a tag fault will be > detected immediately and causes tests to fail. Forbid running them > in asynchronous mode. > > Signed-off-by: Andrey

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

2021-01-30 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 v11 5/5] kasan: don't run tests in async mode

2021-01-30 Thread Vincenzo Frascino
From: Andrey Konovalov Asynchronous KASAN mode doesn't guarantee that a tag fault will be detected immediately and causes tests to fail. Forbid running them in asynchronous mode. Signed-off-by: Andrey Konovalov --- lib/test_kasan.c | 4 1 file changed, 4 insertions(+) diff --git

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

2021-01-30 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 [ Add a new

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

2021-01-30 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 Signed-off-by: Andrey Konovalov --- include/linux

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

2021-01-30 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 v11 0/5] arm64: ARMv8.5-A: MTE: Add async mode support

2021-01-30 Thread Vincenzo Frascino
: 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 Andrey Konovalov (1): kasan: don't run tests in async mode Vincenzo Frascino (4): arm64: mte: Add

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

2021-01-30 Thread Vincenzo Frascino
Hi Andrey, On 1/29/21 7:21 PM, Andrey Konovalov wrote: >> The series is based on linux-next/akpm. >> >> To simplify the testing a tree with the new patches on top has been made >> available at [1]. >> >> [1] https://git.gitlab.arm.com/linux-arm/linux-vf.git mte/v10.async.akpm >> >> Changes: >>

  1   2   3   4   5   6   >