Re: [PATCH v2 01/16] MAINTAINERS: Add vDSO selftests

2025-02-28 Thread Vincenzo Frascino
F: kernel/time/vsyscall.c > F: lib/vdso/ > +F: tools/testing/selftests/vDSO/ > > GENWQE (IBM Generic Workqueue Card) > M: Frank Haverkamp > Reviewed-by: Vincenzo Frascino -- Regards, Vincenzo

Re: [PATCH v2 03/16] elf, uapi: Add definition for DT_GNU_HASH

2025-02-28 Thread Vincenzo Frascino
ffdff > #define DT_ADDRRNGLO 0x6e00 > +#define DT_GNU_HASH 0x6ef5 > #define DT_ADDRRNGHI 0x6eff > #define DT_VERSYM 0x6ff0 > #define DT_RELACOUNT 0x6ff9 > Reviewed-by: Vincenzo Frascino -- Regards, Vincenzo

Re: [PATCH v2 14/16] selftests: vDSO: vdso_test_gettimeofday: Clean up includes

2025-02-28 Thread Vincenzo Frascino
On 26/02/2025 11:44, Thomas Weißschuh wrote: > Some unnecessary headers are included, remove them. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Vincenzo Frascino > --- > tools/testing/selftests/vDSO/vdso_test_gettimeofday.c | 2 -- > 1 file changed, 2 deletions(-)

Re: [PATCH v2 08/16] selftests: Add headers target

2025-02-28 Thread Vincenzo Frascino
ly no way to populate such a tree automatically. > > Provide a target that the tests can depend on to get access to usable > UAPI headers. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Vincenzo Frascino > --- > tools/testing/selftests/lib.mk | 5 - > 1 file

Re: [PATCH v2 16/16] selftests: vDSO: vdso_standalone_test_x86: Switch to nolibc

2025-02-28 Thread Vincenzo Frascino
tcase can be built from the exact same codebase as the > non-standalone version. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Vincenzo Frascino > --- > tools/testing/selftests/vDSO/Makefile | 8 +- > .../selftests/vDSO/vdso_standalone_test_x86.c | 168

Re: [PATCH v2 15/16] selftests: vDSO: vdso_test_gettimeofday: Make compatible with nolibc

2025-02-28 Thread Vincenzo Frascino
On 26/02/2025 11:44, Thomas Weißschuh wrote: > nolibc does not provide sys/time.h and sys/auxv.h, > instead their definitions are available unconditionally. > > Guard the includes so they are not attempted on nolibc. > > Signed-off-by: Thomas Weißschuh Reviewed-by:

Re: [PATCH v2 13/16] selftests: vDSO: parse_vdso: Test __SIZEOF_LONG__ instead of ULONG_MAX

2025-02-28 Thread Vincenzo Frascino
ted > by the preprocessor. To provide compatibility with nolibc, check with > __SIZEOF_LONG__ instead, with is provided directly by the preprocessor > and therefore always a symbolic constant. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Vincenzo Frascino > --- > tools/testin

Re: [PATCH v2 12/16] selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers

2025-02-28 Thread Vincenzo Frascino
On 26/02/2025 11:44, Thomas Weißschuh wrote: > To allow the usage of parse_vdso.c together with a limited libc like > nolibc, use the kernels own elf.h and auxvec.h headers. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Vincenzo Frascino > --- > tools/testing/selft

Re: [PATCH v2 11/16] selftests: vDSO: parse_vdso: Drop vdso_init_from_auxv()

2025-02-28 Thread Vincenzo Frascino
On 26/02/2025 11:44, Thomas Weißschuh wrote: > There are no users left. > > This also removes the usage of ElfXX_auxv_t, > which is not formally standardized. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Vincenzo Frascino > --- > tools/testing/selftest

Re: [PATCH v2 10/16] selftests: vDSO: vdso_standalone_test_x86: Use vdso_init_form_sysinfo_ehdr

2025-02-28 Thread Vincenzo Frascino
(). > > The implementation of getauxval() is taken from > tools/include/nolibc/stdlib.h. > > Signed-off-by: Thomas Weißschuh > Reviewed-by: Vincenzo Frascino > --- > All of this code will be deleted later again. > --- > .../selftests/vDSO/vdso_standalone_test_x86.c

Re: [PATCH v2 09/16] tools/nolibc: add limits.h shim header

2025-02-28 Thread Vincenzo Frascino
Signed-off-by: Thomas Weißschuh Reviewed-by: Vincenzo Frascino > --- > tools/include/nolibc/Makefile | 1 + > tools/include/nolibc/limits.h | 7 +++ > 2 files changed, 8 insertions(+) > > diff --git a/tools/include/nolibc/Makefile

Re: [PATCH v2 07/16] tools/include: Add uapi/linux/elf.h

2025-02-28 Thread Vincenzo Frascino
On 26/02/2025 11:44, Thomas Weißschuh wrote: > It will be used by the vDSO selftests. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Vincenzo Frascino > --- > tools/include/uapi/linux/elf.h | 524 > + > 1 file changed, 524 in

Re: [PATCH v2 06/16] elf, uapi: Add types ElfXX_Verdef and ElfXX_Veraux

2025-02-28 Thread Vincenzo Frascino
rdef; > + > +typedef struct { > + Elf32_Wordvda_name; > + Elf32_Wordvda_next; > +} Elf32_Verdaux; > + > +typedef struct { > + Elf64_Wordvda_name; > + Elf64_Wordvda_next; > +} Elf64_Verdaux; > + > #endif /* _UAPI_LINUX_ELF_H */ > Reviewed-by: Vincenzo Frascino -- Regards, Vincenzo

Re: [PATCH v2 05/16] elf, uapi: Add type ElfXX_Versym

2025-02-28 Thread Vincenzo Frascino
Elf64_Versym; > > /* These constants are for the segment types stored in the image headers */ > #define PT_NULL0 > Reviewed-by: Vincenzo Frascino -- Regards, Vincenzo

Re: [PATCH v2 04/16] elf, uapi: Add definitions for VER_FLG_BASE and VER_FLG_WEAK

2025-02-28 Thread Vincenzo Frascino
_BASE 0x1 > +#define VER_FLG_WEAK 0x2 > + > #define ELF_ST_BIND(x) ((x) >> 4) > #define ELF_ST_TYPE(x) ((x) & 0xf) > #define ELF32_ST_BIND(x) ELF_ST_BIND(x) > Reviewed-by: Vincenzo Frascino -- Regards, Vincenzo

Re: [PATCH v2 02/16] elf, uapi: Add definition for STN_UNDEF

2025-02-28 Thread Vincenzo Frascino
> #define STT_NOTYPE 0 > #define STT_OBJECT 1 > #define STT_FUNC2 > Reviewed-by: Vincenzo Frascino -- Regards, Vincenzo

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

2021-04-15 Thread Vincenzo Frascino
s 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 --pr

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
Michael Ellerman > 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 Re

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 the flag

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 >>> ra

[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
efore 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

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

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

[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 t

[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
: 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(&mte_async_mod

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 >&

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

2021-03-08 Thread Vincenzo Frascino
: 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 >> sysf

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 agree

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(&mte_async_mode); >> } > Sorry, I missed the cp

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 share

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 v

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 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 chang

[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 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 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
: 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 Frasci

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

2021-02-11 Thread Vincenzo Frascino
rm64: 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 pat

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 th

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 m

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 to

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
our 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

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

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 e

[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 a/lib/te

[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 k

  1   2   3   4   5   6   >