Re: [PATCH v10 08/22] kasan, arm64: untag address in __kimg_to_phys and _virt_addr_is_linear

2018-11-14 Thread Andrey Konovalov
On Wed, Nov 7, 2018 at 5:52 PM, Mark Rutland wrote: > Hi Andrey, > > On Tue, Nov 06, 2018 at 06:30:23PM +0100, Andrey Konovalov wrote: >> __kimg_to_phys (which is used by virt_to_phys) and _virt_addr_is_linear >> (which is used by virt_addr_valid) assume that the top byte

Re: mmotm 2018-11-29-13-37 uploaded (kasan)

2018-12-06 Thread Andrey Konovalov
On Fri, Nov 30, 2018 at 1:32 AM Randy Dunlap wrote: > > On 11/29/18 1:38 PM, a...@linux-foundation.org wrote: > > The mm-of-the-moment snapshot 2018-11-29-13-37 has been uploaded to > > > >http://www.ozlabs.org/~akpm/mmotm/ > > > > mmotm-readme.txt says > > > > README for mm-of-the-moment: > >

Re: [PATCH v12 20/25] kasan, arm64: add brk handler for inline instrumentation

2018-12-06 Thread Andrey Konovalov
On Thu, Nov 29, 2018 at 7:01 PM Will Deacon wrote: > > On Tue, Nov 27, 2018 at 05:55:38PM +0100, Andrey Konovalov wrote: > > Tag-based KASAN inline instrumentation mode (which embeds checks of shadow > > memory into the generated code, instead of inserting a callback) g

Re: [PATCH v8 2/8] uaccess: add untagged_addr definition for other arches

2018-12-06 Thread Andrey Konovalov
On Thu, Nov 29, 2018 at 7:23 PM Catalin Marinas wrote: > > On Thu, Nov 08, 2018 at 03:36:09PM +0100, Andrey Konovalov wrote: > > diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h > > index efe79c1cdd47..c045b4eff95e 100644 > > --- a/include/linux/uaccess.h

[PATCH v13 08/25] kasan: initialize shadow to 0xff for tag-based mode

2018-12-06 Thread Andrey Konovalov
Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- arch/arm64/mm/kasan_init.c | 15 +-- include/linux/kasan.h | 8 mm/kasan/common.c | 3 ++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/arch/arm64/mm/kasan_init.c b/arch

[PATCH v13 09/25] arm64: move untagged_addr macro from uaccess.h to memory.h

2018-12-06 Thread Andrey Konovalov
macro is used. This is done by using __typeof__. Acked-by: Mark Rutland Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/memory.h | 8 arch/arm64/include/asm/uaccess.h | 7 --- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b

[PATCH v13 04/25] kasan: rename source files to reflect the new naming scheme

2018-12-06 Thread Andrey Konovalov
We now have two KASAN modes: generic KASAN and tag-based KASAN. Rename kasan.c to generic.c to reflect that. Also rename kasan_init.c to init.c as it contains initialization code for both KASAN modes. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov

[PATCH v13 01/25] kasan, mm: change hooks signatures

2018-12-06 Thread Andrey Konovalov
: Andrey Konovalov --- include/linux/kasan.h | 43 +-- include/linux/slab.h | 4 ++-- mm/kasan/kasan.c | 30 ++ mm/slab.c | 12 ++-- mm/slab.h | 2 +- mm/slab_common.c | 4 ++-- mm

[PATCH v13 05/25] kasan: add CONFIG_KASAN_GENERIC and CONFIG_KASAN_SW_TAGS

2018-12-06 Thread Andrey Konovalov
commit adds the CONFIG_KASAN_SW_TAGS config option, this option is not selectable, as it depends on HAVE_ARCH_KASAN_SW_TAGS, which we will enable once all the infrastracture code has been added. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- include/linux

[PATCH v13 02/25] kasan, slub: handle pointer tags in early_kmem_cache_node_alloc

2018-12-06 Thread Andrey Konovalov
is assigned by kasan_kmalloc. Signed-off-by: Andrey Konovalov --- mm/slub.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index fdd4a86aa882..8561a32910dd 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3364,16 +3364,16 @@ static void

[PATCH v13 03/25] kasan: move common generic and tag-based code to common.c

2018-12-06 Thread Andrey Konovalov
Tag-based KASAN reuses a significant part of the generic KASAN code, so move the common parts to common.c without any functional changes. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- mm/kasan/Makefile | 5 +- mm/kasan/common.c | 603

Re: [PATCH v8 1/8] arm64: add type casts to untagged_addr macro

2018-12-06 Thread Andrey Konovalov
On Thu, Nov 29, 2018 at 7:22 PM Catalin Marinas wrote: > > On Thu, Nov 08, 2018 at 03:36:08PM +0100, Andrey Konovalov wrote: > > This patch makes the untagged_addr macro accept all kinds of address types > > (void *, unsigned long, etc.) and allows not to specify type casts

Re: [PATCH v8 0/8] arm64: untag user pointers passed to the kernel

2018-12-06 Thread Andrey Konovalov
On Thu, Nov 29, 2018 at 7:16 PM Catalin Marinas wrote: > > Hi Andrey, > > On Thu, Nov 08, 2018 at 03:48:10PM +0100, Andrey Konovalov wrote: > > On Thu, Nov 8, 2018 at 3:36 PM, Andrey Konovalov > > wrote: > > > Changes in v8: > > > - Rebased onto 651022

Re: [PATCH v4 00/17] khwasan: kernel hardware assisted address sanitizer

2018-06-29 Thread Andrey Konovalov
On Fri, Jun 29, 2018 at 3:01 PM, Mark Rutland wrote: > On Fri, Jun 29, 2018 at 02:45:08PM +0200, Andrey Konovalov wrote: >> So with clean kernel after boot we get 40 kb memory usage. With KASAN >> it is ~120 kb, which is 200% overhead. With KHWASAN it's 50 kb, which >

[PATCH v3 2/6] uaccess: add untagged_addr definition for other arches

2018-05-25 Thread Andrey Konovalov
architectures besides arm64. Signed-off-by: Andrey Konovalov --- include/linux/uaccess.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index efe79c1cdd47..c045b4eff95e 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h

[PATCH v3 0/6] arm64: untag user pointers passed to the kernel

2018-05-25 Thread Andrey Konovalov
on/arm64/tagged-pointers.txt. - Dropped “mm, arm64: untag user addresses in memory syscalls”. - Rebased onto 3eb2ce82 (4.16-rc7). Andrey Konovalov (6): arm64: add type casts to untagged_addr macro uaccess: add untagged_addr definition for other arches arm64: untag user addresses in access_ok and __u

[PATCH v3 5/6] lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user

2018-05-25 Thread Andrey Konovalov
strncpy_from_user and strnlen_user accept user addresses as arguments, and do not go through the same path as copy_from_user and others, so here we need to handle the case of tagged user addresses separately. Untag user pointers passed to these functions. Signed-off-by: Andrey Konovalov

[PATCH v3 6/6] arm64: update Documentation/arm64/tagged-pointers.txt

2018-05-25 Thread Andrey Konovalov
Add a note that work on passing tagged user pointers to the kernel via syscalls has started, but might not be complete yet. Signed-off-by: Andrey Konovalov --- Documentation/arm64/tagged-pointers.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/arm64

[PATCH v3 3/6] arm64: untag user addresses in access_ok and __uaccess_mask_ptr

2018-05-25 Thread Andrey Konovalov
in access_ok and in __uaccess_mask_ptr, before performing access validity checks. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/uaccess.h | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm

[PATCH v3 4/6] mm, arm64: untag user addresses in mm/gup.c

2018-05-25 Thread Andrey Konovalov
lookup. Signed-off-by: Andrey Konovalov --- mm/gup.c | 4 1 file changed, 4 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index 541904a7c60f..5d0e9715bab7 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -650,6 +650,8 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm

[PATCH v3 1/6] arm64: add type casts to untagged_addr macro

2018-05-25 Thread Andrey Konovalov
This patch makes the untagged_addr macro accept all kinds of address types (void *, unsigned long, etc.) and allows not to specify type casts in each place where it is used. This is done by using __typeof__. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/uaccess.h | 3 ++- 1 file

Re: [PATCH 4/6] mm, arm64: untag user addresses in mm/gup.c

2018-05-11 Thread Andrey Konovalov
On Tue, May 8, 2018 at 5:11 PM, Catalin Marinas wrote: > On Wed, May 02, 2018 at 07:25:17PM +0200, Andrey Konovalov wrote: >> On Wed, May 2, 2018 at 5:36 PM, Kirill A. Shutemov >> wrote: >> > On Wed, May 02, 2018 at 02:38:42PM +, Andrey Konovalov wrote: >> >

Re: [RFC][PATCH 0/3] arm64 relaxed ABI

2018-12-12 Thread Andrey Konovalov
m.doc.ihi0044f/IHI0044F_aaelf.pdf > SPARC ABI: http://math-atlas.sourceforge.net/devel/assembly/abi_sysV_sparc.pdf > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Mark Rutland > Cc: Robin Murphy > Cc: Kees Cook > Cc: Kate Stewart > Cc: Greg Kroah-Hartman > Cc:

Re: [PATCH v13 19/25] kasan: add hooks implementation for tag-based mode

2018-12-12 Thread Andrey Konovalov
On Tue, Dec 11, 2018 at 5:22 PM Vincenzo Frascino wrote: > > Hi Andrey, > > On 06/12/2018 12:24, Andrey Konovalov wrote: > > This commit adds tag-based KASAN specific hooks implementation and > > adjusts common generic and tag-based KASAN ones. > > > > 1. W

Re: [PATCH v13 19/25] kasan: add hooks implementation for tag-based mode

2018-12-17 Thread Andrey Konovalov
On Fri, Dec 14, 2018 at 1:34 PM Vincenzo Frascino wrote: > > On 12/12/18 3:04 PM, Andrey Konovalov wrote: > > On Tue, Dec 11, 2018 at 5:22 PM Vincenzo Frascino > > wrote: > >> > >> Hi Andrey, > >> > >> On 06/12/2018 12:24, Andrey Konovalov

[PATCH mm] kasan, arm64: use ARCH_SLAB_MINALIGN instead of manual aligning

2018-12-18 Thread Andrey Konovalov
Instead of changing cache->align to be aligned to KASAN_SHADOW_SCALE_SIZE in kasan_cache_create() we can reuse the ARCH_SLAB_MINALIGN macro. Suggested-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/kasan.h | 4 mm/kasan/common.c | 2 --

Re: [PATCH v13 19/25] kasan: add hooks implementation for tag-based mode

2018-12-18 Thread Andrey Konovalov
On Mon, Dec 17, 2018 at 9:38 PM Andrew Morton wrote: > > On Mon, 17 Dec 2018 20:33:42 +0100 Andrey Konovalov > wrote: > > > > Curiosity, did you try your patches with SLUB red zoning enabled? > > > Since the area used for the Redzone is just after th

Re: [RFC][PATCH 0/3] arm64 relaxed ABI

2018-12-18 Thread Andrey Konovalov
On Wed, Dec 12, 2018 at 4:02 PM Catalin Marinas wrote: > > Hi Andrey, > > On Wed, Dec 12, 2018 at 03:23:25PM +0100, Andrey Konovalov wrote: > > On Mon, Dec 10, 2018 at 3:31 PM Vincenzo Frascino > > wrote: > > > On arm64 the TCR_EL1.TBI0 bit has been set since Li

Re: [PATCH v9 0/8] arm64: untag user pointers passed to the kernel

2018-12-18 Thread Andrey Konovalov
On Wed, Dec 12, 2018 at 6:01 PM Dave Martin wrote: > > On Mon, Dec 10, 2018 at 01:50:57PM +0100, Andrey Konovalov wrote: > > arm64 has a feature called Top Byte Ignore, which allows to embed pointer > > tags into the top byte of each pointer. Userspace programs (such as &g

Re: [PATCH v13 08/25] kasan: initialize shadow to 0xff for tag-based mode

2018-12-10 Thread Andrey Konovalov
On Mon, Dec 10, 2018 at 2:35 AM Paul Gortmaker wrote: > > On Thu, Dec 6, 2018 at 7:25 AM Andrey Konovalov wrote: >> >> A tag-based KASAN shadow memory cell contains a memory tag, that >> corresponds to the tag in the top byte of the pointer, that points to that >&g

[PATCH v9 1/8] arm64: add type casts to untagged_addr macro

2018-12-10 Thread Andrey Konovalov
This patch makes the untagged_addr macro accept all kinds of address types (void *, unsigned long, etc.) and allows not to specify type casts in each place where it is used. This is done by using __typeof__. Acked-by: Catalin Marinas Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm

[PATCH v9 4/8] mm, arm64: untag user addresses in mm/gup.c

2018-12-10 Thread Andrey Konovalov
for vma lookup. Signed-off-by: Andrey Konovalov --- mm/gup.c | 4 1 file changed, 4 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index 8cb68a50dbdf..409aedb1e2d5 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -683,6 +683,8 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct

[PATCH v9 8/8] selftests, arm64: add a selftest for passing tagged pointers to kernel

2018-12-10 Thread Andrey Konovalov
This patch adds a simple test, that calls the uname syscall with a tagged user pointer as an argument. Without the kernel accepting tagged user pointers the test fails with EFAULT. Signed-off-by: Andrey Konovalov --- tools/testing/selftests/arm64/.gitignore | 1 + tools/testing/selftests

[PATCH v9 7/8] arm64: update Documentation/arm64/tagged-pointers.txt

2018-12-10 Thread Andrey Konovalov
Document the changes in Documentation/arm64/tagged-pointers.txt. Signed-off-by: Andrey Konovalov --- Documentation/arm64/tagged-pointers.txt | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Documentation/arm64/tagged-pointers.txt b/Documentation

[PATCH v9 0/8] arm64: untag user pointers passed to the kernel

2018-12-10 Thread Andrey Konovalov
mm, arm64: untag user addresses in memory syscalls". - Rebased onto 3eb2ce82 (4.16-rc7). Reviewed-by: Luc Van Oostenryck Signed-off-by: Andrey Konovalov Andrey Konovalov (8): arm64: add type casts to untagged_addr macro uaccess: add untagged_addr definition for other arches arm64:

[PATCH v9 2/8] uaccess: add untagged_addr definition for other arches

2018-12-10 Thread Andrey Konovalov
arm64. Acked-by: Catalin Marinas Signed-off-by: Andrey Konovalov --- include/linux/uaccess.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index efe79c1cdd47..42b7a4ac65e2 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h

[PATCH v9 5/8] lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user

2018-12-10 Thread Andrey Konovalov
strncpy_from_user and strnlen_user accept user addresses as arguments, and do not go through the same path as copy_from_user and others, so here we need to handle the case of tagged user addresses separately. Untag user pointers passed to these functions. Signed-off-by: Andrey Konovalov

[PATCH v9 6/8] fs, arm64: untag user address in copy_mount_options

2018-12-10 Thread Andrey Konovalov
the address before subtracting. Signed-off-by: Andrey Konovalov --- fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/namespace.c b/fs/namespace.c index a7f91265ea67..694dcedb7e7d 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2686,7 +2686,7 @@ void

[PATCH v9 3/8] arm64: untag user addresses in access_ok and __uaccess_mask_ptr

2018-12-10 Thread Andrey Konovalov
in access_ok and in __uaccess_mask_ptr, before performing access validity checks. Reviewed-by: Catalin Marinas Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/uaccess.h | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/uaccess.h b

Re: [PATCH] kasan: add missing Kconfig dependencies

2018-12-10 Thread Andrey Konovalov
On Mon, Dec 10, 2018 at 9:59 PM Arnd Bergmann wrote: > > Building with CONFIG_KASAN=y when neither KASAN_GENERIC nor KASAN_SW_TAGS > can be selected leads to a build error: > > arch/arm64/mm/kasan_init.c: In function 'kasan_pte_populate': > arch/arm64/mm/kasan_init.c:106:28: error: 'KASAN_SHADOW_I

Re: [PATCH v13 00/25] kasan: add software tag-based mode for arm64

2018-12-11 Thread Andrey Konovalov
On Tue, Dec 11, 2018 at 4:18 PM Will Deacon wrote: > > Hi Andrey, > > On Thu, Dec 06, 2018 at 01:24:18PM +0100, Andrey Konovalov wrote: > > This patchset adds a new software tag-based mode to KASAN [1]. > > (Initially this mode was called KHWASAN, but it got renamed, >

Re: [PATCH v13 05/25] kasan: add CONFIG_KASAN_GENERIC and CONFIG_KASAN_SW_TAGS

2018-12-11 Thread Andrey Konovalov
On Tue, Dec 11, 2018 at 4:28 PM Luc Van Oostenryck wrote: > > On Thu, Dec 06, 2018 at 01:24:23PM +0100, Andrey Konovalov wrote: > > diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h > > index 3e7dafb3ea80..39f668d5066b 100644 > > --- a/includ

Re: [PATCH mm] kasan, arm64: use ARCH_SLAB_MINALIGN instead of manual aligning

2018-12-20 Thread Andrey Konovalov
On Tue, Dec 18, 2018 at 9:55 PM Andrew Morton wrote: > > On Tue, 18 Dec 2018 14:30:33 +0100 Andrey Konovalov > wrote: > > > Instead of changing cache->align to be aligned to KASAN_SHADOW_SCALE_SIZE > > in kasan_cache_create() we can reuse the ARCH_SLAB_MINALIGN macro

Re: [PATCH] NFC: fix attrs checks in netlink interface

2019-01-02 Thread Andrey Konovalov
On Mon, Jun 4, 2018 at 6:29 AM Samuel Ortiz wrote: > > Hi Andrey, > > On Thu, Apr 12, 2018 at 06:56:56PM +0200, Andrey Konovalov wrote: > > nfc_genl_deactivate_target() relies on the NFC_ATTR_TARGET_INDEX > > attribute being present, but doesn't check whether it is

[PATCH v2 0/3] kasan: tag-based mode fixes

2019-01-02 Thread Andrey Konovalov
Hi Andrew, This patchset includes an updated "kasan, arm64: use ARCH_SLAB_MINALIGN instead of manual aligning" patch and fixes for two more issues that were uncovered while testing with a variety of different config options enabled. Thanks! Andrey Konovalov (3): kasan,

[PATCH v2 3/3] kasan: fix krealloc handling for tag-based mode

2019-01-02 Thread Andrey Konovalov
eping the same tag if the memory don't actually gets reallocated during krealloc. Signed-off-by: Andrey Konovalov --- include/linux/kasan.h | 14 +- include/linux/slab.h | 4 ++-- mm/kasan/common.c | 20 mm/slab.c | 8 mm/sla

[PATCH v2 1/3] kasan, arm64: use ARCH_SLAB_MINALIGN instead of manual aligning

2019-01-02 Thread Andrey Konovalov
Instead of changing cache->align to be aligned to KASAN_SHADOW_SCALE_SIZE in kasan_cache_create() we can reuse the ARCH_SLAB_MINALIGN macro. Suggested-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/kasan.h | 4 include/linux/slab.h | 1 +

[PATCH v2 2/3] kasan: make tag based mode work with CONFIG_HARDENED_USERCOPY

2019-01-02 Thread Andrey Konovalov
operations. Signed-off-by: Andrey Konovalov --- mm/slub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 36c0befeebd8..1e3d0ec4e200 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3846,6 +3846,8 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page

[PATCH v3 0/3] kasan: tag-based mode fixes

2019-01-03 Thread Andrey Konovalov
with CONFIG_HARDENED_USERCOPY" patch. - Added "kasan: fix krealloc handling for tag-based mode" patch. Andrey Konovalov (3): kasan, arm64: use ARCH_SLAB_MINALIGN instead of manual aligning kasan: make tag based mode work with CONFIG_HARDENED_USERCOPY kasan: fix krealloc handling for tag-bas

[PATCH v3 3/3] kasan: fix krealloc handling for tag-based mode

2019-01-03 Thread Andrey Konovalov
eping the same tag if the memory don't actually gets reallocated during krealloc. Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 63 --- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/comm

[PATCH v3 2/3] kasan: make tag based mode work with CONFIG_HARDENED_USERCOPY

2019-01-03 Thread Andrey Konovalov
operations. Signed-off-by: Andrey Konovalov --- mm/slub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 36c0befeebd8..1e3d0ec4e200 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3846,6 +3846,8 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page

[PATCH v3 1/3] kasan, arm64: use ARCH_SLAB_MINALIGN instead of manual aligning

2019-01-03 Thread Andrey Konovalov
Instead of changing cache->align to be aligned to KASAN_SHADOW_SCALE_SIZE in kasan_cache_create() we can reuse the ARCH_SLAB_MINALIGN macro. Suggested-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/cache.h | 6 ++ mm/kasan/common.c | 2 --

Re: [PATCH v2 1/3] kasan, arm64: use ARCH_SLAB_MINALIGN instead of manual aligning

2019-01-03 Thread Andrey Konovalov
On Wed, Jan 2, 2019 at 9:14 PM Andrew Morton wrote: > > On Wed, 2 Jan 2019 18:36:06 +0100 Andrey Konovalov > wrote: > > > Instead of changing cache->align to be aligned to KASAN_SHADOW_SCALE_SIZE > > in kasan_cache_create() we can reuse the ARCH_SLAB_MINALIGN macro

Re: [PATCH -mmotm] arm64: skip kmemleak for KASAN again

2018-12-27 Thread Andrey Konovalov
Qian Cai Hi Qian, Sorry, didn't see your first kmemleak fix. I can merge this fix into my series if I end up resending it. In any case: Acked-by: Andrey Konovalov Thanks! > --- > arch/arm64/mm/kasan_init.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > dif

Re: [PATCH v10 00/22] kasan: add software tag-based mode for arm64

2018-11-07 Thread Andrey Konovalov
On Tue, Nov 6, 2018 at 6:30 PM, Andrey Konovalov wrote: > This patchset adds a new software tag-based mode to KASAN [1]. > (Initially this mode was called KHWASAN, but it got renamed, > see the naming rationale at the end of this section). [...] > Reviewed-by: Andrey Ryabinin &

Re: [PATCH v10 00/22] kasan: add software tag-based mode for arm64

2018-11-07 Thread Andrey Konovalov
On Wed, Nov 7, 2018 at 3:59 PM, Will Deacon wrote: > On Wed, Nov 07, 2018 at 03:56:03PM +0100, Andrey Konovalov wrote: >> On Tue, Nov 6, 2018 at 6:30 PM, Andrey Konovalov >> wrote: >> > This patchset adds a new software tag-based mode to KASAN [1]. >> > (Initi

Re: [PATCH v8 0/8] arm64: untag user pointers passed to the kernel

2018-11-08 Thread Andrey Konovalov
On Thu, Nov 8, 2018 at 3:36 PM, Andrey Konovalov wrote: [...] > Changes in v8: > - Rebased onto 65102238 (4.20-rc1). > - Added a note to the cover letter on why syscall wrappers/shims that untag > user pointers won't work. > - Added a note to the cover letter that th

Re: [PATCH v3 1/3] kasan: switch kunit tests to console tracepoints

2023-12-11 Thread Andrey Konovalov
On Mon, Dec 11, 2023 at 5:37 PM Paul Heidekrüger wrote: > > Hi all! > > On 05.05.2023 09:58, Steven Rostedt wrote: > > On Mon, 1 May 2023 15:02:37 -0700 > > Peter Collingbourne wrote: > > > > > > > "ftrace" is really for just the function tracing, but CONFIG_FTRACE > > > > > really should just be

Re: [PATCH v3 1/3] kasan: switch kunit tests to console tracepoints

2023-12-11 Thread Andrey Konovalov
On Mon, Dec 11, 2023 at 7:59 PM Paul Heidekrüger wrote: > > > Hi Paul, > > > > I've been successfully running KASAN tests with CONFIG_TRACEPOINTS > > enabled on arm64 since this patch landed. > > Interesting ... > > > What happens when you try running the tests with .kunitconfig? Does > > CONFIG_T

Re: [PATCH v3 1/3] kasan: switch kunit tests to console tracepoints

2023-12-11 Thread Andrey Konovalov
On Tue, Dec 12, 2023 at 12:35 AM Paul Heidekrüger wrote: > > Using CONFIG_FTRACE=y instead of CONFIG_TRACEPOINTS=y produces the same error > for me. > > So > > CONFIG_KUNIT=y > CONFIG_KUNIT_ALL_TESTS=n > CONFIG_FTRACE=y > CONFIG_KASAN=y > CONFIG_KASAN_GENERI

Re: [PATCH] slub: Introduce CONFIG_SLUB_RCU_DEBUG

2023-09-16 Thread Andrey Konovalov
On Mon, Aug 28, 2023 at 4:40 PM Jann Horn wrote: > > > Can't we unpoision this rcu_head right before call_rcu() and repoison > > after receiving the callback? > > Yeah, I think that should work. It looks like currently > kasan_unpoison() is exposed in include/linux/kasan.h but > kasan_poison() is

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

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

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

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

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

2021-02-14 Thread Andrey Konovalov
The first patch is the start of the work discussed in the "[RFC] Repurpose V4L2_CID_PIXEL_RATE for the sampling rate in the pixel array" thread [1]. I plan to send a few other similar patches for other CSI receiver drivers, and if the current patchset needs to wait for those before it can be merged

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

2021-02-15 Thread Andrey Konovalov
Actually, make that an Acked-by. Acked-by: Robert Foss OK, thanks! On Sun, 14 Feb 2021 at 22:34, Andrey Konovalov wrote: There are places in the camss driver where camss_get_pixel_clock() is called to get the pixel rate (using V4L2_CID_PIXEL_RATE control) and to calculate the link frequency from

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

2021-02-15 Thread Andrey Konovalov
Hi Jacopo, Thank you for the detailed review! On 15.02.2021 15:00, Jacopo Mondi wrote: Hi Andrey, nice to see progress in this direction On Mon, Feb 15, 2021 at 12:34:03AM +0300, Andrey Konovalov wrote: There are places in the camss driver where camss_get_pixel_clock() is called to get

Re: Clang arm64 build is broken

2018-05-22 Thread Andrey Konovalov
On Mon, May 14, 2018 at 6:24 PM, Nick Desaulniers wrote: > On Fri, Apr 20, 2018 at 7:59 AM Andrey Konovalov > wrote: >> On Fri, Apr 20, 2018 at 10:13 AM, Marc Zyngier > wrote: >> >> The issue is that >> >> clang doesn't know about the "S" a

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-22 Thread Andrey Konovalov
: Initialization of device kvm-arm-gicv3 failed: error creating in-kernel VGIC: No such device) PASS gicv2-active (1 tests) SKIP gicv3-active (qemu-system-aarch64: Initialization of device kvm-arm-gicv3 failed: error creating in-kernel VGIC: No such device) PASS psci (4 tests) PASS timer (8 tests)

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-23 Thread Andrey Konovalov
On Tue, May 22, 2018 at 8:28 PM, Nick Desaulniers wrote: > On Fri, May 18, 2018 at 11:13 AM Marc Zyngier wrote: >> > - you have checked that with a released version of the compiler, you > > On Tue, May 22, 2018 at 10:58 AM Andrey Konovalov > wrote: >> Tested-by: Andr

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-23 Thread Andrey Konovalov
On Wed, May 23, 2018 at 7:47 PM, Nick Desaulniers wrote: > On Wed, May 23, 2018 at 4:54 AM Andrey Konovalov > wrote: >> On Tue, May 22, 2018 at 8:28 PM, Nick Desaulniers >> wrote: >> > On Fri, May 18, 2018 at 11:13 AM Marc Zyngier > wrote: >> >>

Clang build of arm64 kernel fails

2018-02-28 Thread Andrey Konovalov
Hi Marc! I've tried to pull in new upstream commits and the kernel build started failing for me with the following errors (see below). It seems that the reason is your commit "arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support". It seems that Clang doesn't like 32 bits registers being us

Re: Clang build of arm64 kernel fails

2018-03-01 Thread Andrey Konovalov
On Thu, Mar 1, 2018 at 11:47 AM, Marc Zyngier wrote: > Hi Andrey, > > On 28/02/18 19:32, Andrey Konovalov wrote: >> Hi Marc! >> >> I've tried to pull in new upstream commits and the kernel build >> started failing for me with the following errors (see bel

[PATCH] kasan, arm64: clean up KASAN_SHADOW_SCALE_SHIFT usage

2018-03-01 Thread Andrey Konovalov
KASAN_SHADOW_SCALE_SHIFT in arch/arm64/Makefile, an appropriate variable is declared and used. Signed-off-by: Andrey Konovalov --- arch/arm64/Makefile | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index b481b4a7c011..4bb18aee4846 100644

[PATCH 1/2] kasan: fix invalid-free test crashing the kernel

2018-03-01 Thread Andrey Konovalov
roper object address after the call that triggers invalid-free. Signed-off-by: Andrey Konovalov --- lib/test_kasan.c | 8 1 file changed, 8 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 98854a64b014..ec657105edbf 100644 --- a/lib/test_kasan.c +++ b/lib/test_ka

[PATCH 2/2] kasan: disallow compiler to optimize away memset in tests

2018-03-01 Thread Andrey Konovalov
A compiler can optimize away memset calls by replacing them with mov instructions. There are KASAN tests, that specifically test that KASAN correctly handles memset calls, we don't want this optimization to happen. The solution is to add -fno-builtin flag to test_kasan.ko Signed-off-by: A

[PATCH 0/2] kasan: a couple of test fixes

2018-03-01 Thread Andrey Konovalov
The first one fixes the invalid-free test crashing the kernel, and the second one fixes the memset tests working incorrectly due to compiler optimizations. Andrey Konovalov (2): kasan: fix invalid-free test crashing the kernel kasan: disallow compiler to optimize away memset in tests lib

Re: [PATCH 1/2] kasan: fix invalid-free test crashing the kernel

2018-03-01 Thread Andrey Konovalov
On Thu, Mar 1, 2018 at 6:15 PM, Andrey Konovalov wrote: > When an invalid-free is triggered by one of the KASAN tests, the object > doesn't actually get freed. This later leads to a BUG failure in > kmem_cache_destroy that checks that there are no allocated objects in the > ca

[RFC PATCH v2 2/6] uaccess: add untagged_addr definition for other arches

2018-03-27 Thread Andrey Konovalov
architectures besides arm64. Signed-off-by: Andrey Konovalov --- include/linux/uaccess.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index efe79c1cdd47..c045b4eff95e 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h

[RFC PATCH v2 3/6] arm64: untag user addresses in copy_from_user and others

2018-03-27 Thread Andrey Konovalov
in access_ok and in __uaccess_mask_ptr. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/uaccess.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index 2d6451cbaa86..24a221678fe3 100644 --- a

[RFC PATCH v2 4/6] mm, arm64: untag user addresses in mm/gup.c

2018-03-27 Thread Andrey Konovalov
mm/gup.c provides a kernel interface that accepts user addresses and manipulates user pages directly (for example get_user_pages, that is used by the futex syscall). Here we also need to handle the case of tagged user pointers. Untag addresses passed to this interface. Signed-off-by: Andrey

[RFC PATCH v2 6/6] arm64: update Documentation/arm64/tagged-pointers.txt

2018-03-27 Thread Andrey Konovalov
Add a note that work on passing tagged user pointers to the kernel via syscalls has started, but might not be complete yet. Signed-off-by: Andrey Konovalov --- Documentation/arm64/tagged-pointers.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/arm64

[RFC PATCH v2 5/6] lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user

2018-03-27 Thread Andrey Konovalov
strncpy_from_user and strnlen_user accept user addresses as arguments, and do not go through the same path as copy_from_user and others, so here we need to separately handle the case of tagged user addresses as well. Untag user pointers passed to these functions. Signed-off-by: Andrey Konovalov

[RFC PATCH v2 1/6] arm64: add type casts to untagged_addr macro

2018-03-27 Thread Andrey Konovalov
This patch makes the untagged_addr macro accept all kinds of address types (void *, unsigned long, etc.) and allows not to specify type casts in each place where it is used. This is done by using __typeof__. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/uaccess.h | 3 ++- 1 file

[RFC PATCH v2 0/6] arm64: untag user pointers passed to the kernel

2018-03-27 Thread Andrey Konovalov
on/arm64/tagged-pointers.txt. - Dropped “mm, arm64: untag user addresses in memory syscalls”. - Rebased onto 3eb2ce82 (4.16-rc7). Andrey Konovalov (6): arm64: add type casts to untagged_addr macro uaccess: add untagged_addr definition for other arches arm64: untag user addresses in copy_from_

Re: [PATCH 4/6] mm, arm64: untag user addresses in mm/gup.c

2018-05-02 Thread Andrey Konovalov
On Thu, Apr 26, 2018 at 7:47 PM, Catalin Marinas wrote: My approach with this was to add untagging to every gup.c function that is exposed for external use, but perhaps adding untagging only where it is actually required is a better approach. > On Wed, Apr 18, 2018 at 08:53:13PM +0200, And

Re: [PATCH 3/6] arm64: untag user addresses in copy_from_user and others

2018-05-02 Thread Andrey Konovalov
On Thu, Apr 26, 2018 at 5:47 PM, Catalin Marinas wrote: > On Wed, Apr 18, 2018 at 08:53:12PM +0200, Andrey Konovalov wrote: >> @@ -238,12 +239,15 @@ static inline void uaccess_enable_not_uao(void) >> /* >> * Sanitise a uaccess pointer such that it becomes NULL if abo

Re: [PATCH 4/6] mm, arm64: untag user addresses in mm/gup.c

2018-05-02 Thread Andrey Konovalov
On Wed, May 2, 2018 at 5:36 PM, Kirill A. Shutemov wrote: > On Wed, May 02, 2018 at 02:38:42PM +0000, Andrey Konovalov wrote: >> > Does having a tagged address here makes any difference? I couldn't hit a >> > failure with my simple tests (LD_PRELOAD a library that

Re: [PATCH 0/6] arm64: untag user pointers passed to the kernel

2018-04-25 Thread Andrey Konovalov
On Thu, Apr 19, 2018 at 11:33 AM, Kirill A. Shutemov wrote: > On Wed, Apr 18, 2018 at 08:53:09PM +0200, Andrey Konovalov wrote: >> Hi! >> >> arm64 has a feature called Top Byte Ignore, which allows to embed pointer >> tags into the top byte of each pointer. Userspace

Re: [PATCH AUTOSEL 4.14 22/33] kasan, slab: make freelist stored without tags

2019-03-13 Thread Andrey Konovalov
On Wed, Mar 13, 2019 at 8:16 PM Sasha Levin wrote: > > From: Andrey Konovalov > > [ Upstream commit 51dedad06b5f6c3eea7ec1069631b1ef7796912a ] Hi Sasha, None of the 4.9, 4.14, 4.19 or 4.20 have tag-based KASAN, so backporting these 3 KASAN related patches doesn't make mu

Re: [PATCH v13 04/20] mm, arm64: untag user pointers passed to memory syscalls

2019-04-02 Thread Andrey Konovalov
On Fri, Mar 29, 2019 at 11:30 AM Catalin Marinas wrote: > > (I trimmed down the cc list a bit since it's always bouncing) > > On Thu, Mar 28, 2019 at 02:19:34PM -0400, Steven Rostedt wrote: > > On Thu, 28 Mar 2019 19:10:07 +0100 > > Andrey Konovalov wrote: > &

Re: [PATCH] slab: store tagged freelist for off-slab slabmgmt

2019-04-03 Thread Andrey Konovalov
On Wed, Apr 3, 2019 at 4:29 AM Qian Cai wrote: > > The commit 51dedad06b5f ("kasan, slab: make freelist stored without > tags") calls kasan_reset_tag() for off-slab slab management object > leading to freelist being stored non-tagged. However, cache_grow_begin() > -> alloc_slabmgmt() -> kmem_cache

Re: [PATCH] slab: store tagged freelist for off-slab slabmgmt

2019-04-03 Thread Andrey Konovalov
On Wed, Apr 3, 2019 at 3:07 PM Qian Cai wrote: > > On Wed, 2019-04-03 at 13:23 +0200, Andrey Konovalov wrote: > > On Wed, Apr 3, 2019 at 4:29 AM Qian Cai wrote: > > > > > > The commit 51dedad06b5f ("kasan, slab: make freelist stored without > > > tags

Re: [PATCH v10 06/12] fs, arm64: untag user pointers in copy_mount_options

2019-02-26 Thread Andrey Konovalov
On Sat, Feb 23, 2019 at 12:03 AM Dave Hansen wrote: > > On 2/22/19 4:53 AM, Andrey Konovalov wrote: > > --- a/fs/namespace.c > > +++ b/fs/namespace.c > > @@ -2730,7 +2730,7 @@ void *copy_mount_options(const void __user * data) > >

Re: [PATCH v10 07/12] fs, arm64: untag user pointers in fs/userfaultfd.c

2019-02-26 Thread Andrey Konovalov
On Sat, Feb 23, 2019 at 12:06 AM Dave Hansen wrote: > > On 2/22/19 4:53 AM, Andrey Konovalov wrote: > > userfaultfd_register() and userfaultfd_unregister() use provided user > > pointers for vma lookups, which can only by done with untagged pointers. > > So, we have

Re: [PATCH v10 04/12] mm, arm64: untag user pointers passed to memory syscalls

2019-02-26 Thread Andrey Konovalov
On Sat, Feb 23, 2019 at 12:07 AM Dave Hansen wrote: > > On 2/22/19 4:53 AM, Andrey Konovalov wrote: > > --- a/mm/mprotect.c > > +++ b/mm/mprotect.c > > @@ -578,6 +578,7 @@ static int do_mprotect_pkey(unsigned long start, size_t > > len, > > SYSCALL_DEFINE3(mp

Re: [PATCH v10 00/12] arm64: untag user pointers passed to the kernel

2019-02-26 Thread Andrey Konovalov
On Fri, Feb 22, 2019 at 5:10 PM Szabolcs Nagy wrote: > > On 22/02/2019 15:40, Andrey Konovalov wrote: > > On Fri, Feb 22, 2019 at 4:35 PM Szabolcs Nagy wrote: > >> > >> On 22/02/2019 12:53, Andrey Konovalov wrote: > >>> This patchset is meant to be m

Re: [PATCH v10 00/12] arm64: untag user pointers passed to the kernel

2019-02-26 Thread Andrey Konovalov
On Fri, Feb 22, 2019 at 11:55 PM Dave Hansen wrote: > > On 2/22/19 4:53 AM, Andrey Konovalov wrote: > > The following testing approaches has been taken to find potential issues > > with user pointer untagging: > > > > 1. Static testing (with sparse [3] and s

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

2021-02-11 Thread Andrey Konovalov
On Tue, Feb 9, 2021 at 7:45 PM Andrew Morton wrote: > > On Tue, 9 Feb 2021 17:02:56 + Catalin Marinas > wrote: > > > On Tue, Feb 09, 2021 at 04:32:30PM +0100, Andrey Konovalov wrote: > > > diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c > > &

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

2021-02-11 Thread Andrey Konovalov
ot; > | > > Fix the warning using "=r" for the address in the asm inline. > > Fixes: c8f8de4c0887 ("arm64: kasan: simplify and inline MTE functions") > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Andrey Konovalov > Cc: Andrew Morton > Signe

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

2021-02-11 Thread Andrey Konovalov
> Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Andrey Konovalov > Reviewed-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. ] > Si

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