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

2018-05-25 Thread Andrey Konovalov
m64/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 __uacces

[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 <andreyk...@google.com> --- arch/arm64/inclu

[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 <andreyk...@google.com> --- arch/arm64/include/asm/uaccess.h | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/uaccess.h

[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 <andreyk...@google.com> --- 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_struc

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

[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 <andreyk...@google.com> --- Documentation/arm64/tagged-pointers.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff

[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 <andreyk...@google.com> --- 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/i

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 <catalin.mari...@arm.com> 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 >> <kirill.shute...@linux.intel.com> wrote: >> > On W

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

2018-05-03 Thread Andrey Konovalov
On Thu, May 3, 2018 at 5:24 PM, Kirill A. Shutemov <kir...@shutemov.name> wrote: > On Thu, May 03, 2018 at 04:09:56PM +0200, Andrey Konovalov wrote: >> On Wed, May 2, 2018 at 7:25 PM, Andrey Konovalov <andreyk...@google.com> >> wrote: >> I wasn't able to fin

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

2018-05-03 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 <andreyk...@google.com> --- arch/arm64/inclu

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

2018-05-03 Thread Andrey Konovalov
lookup. Signed-off-by: Andrey Konovalov <andreyk...@google.com> --- mm/gup.c | 4 1 file changed, 4 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index 76af4cfeaf68..65a9566c96d3 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -647,6 +647,8 @@ static long __get_user_pages(struct task_struc

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

2018-05-03 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 <andreyk...@google.com> --- Documentation/arm64/tagged-pointers.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff

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

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

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

2018-05-03 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 <andr

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

2018-05-03 Thread Andrey Konovalov
o 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 __uaccess_mask_ptr mm, arm64: untag user addresses in mm/gup.c lib, arm64: untag ad

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

2018-05-03 Thread Andrey Konovalov
architectures besides arm64. Signed-off-by: Andrey Konovalov <andreyk...@google.com> --- 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/i

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

2018-05-03 Thread Andrey Konovalov
On Wed, May 2, 2018 at 7:25 PM, Andrey Konovalov <andreyk...@google.com> wrote: > On Wed, May 2, 2018 at 5:36 PM, Kirill A. Shutemov > <kirill.shute...@linux.intel.com> wrote: >> On Wed, May 02, 2018 at 02:38:42PM +, Andrey Konovalov wrote: >>> > Does ha

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 <kirill.shute...@linux.intel.com> 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

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 <catalin.mari...@arm.com> 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 th

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

2018-05-02 Thread Andrey Konovalov
18, 2018 at 08:53:13PM +0200, Andrey Konovalov wrote: >> diff --git a/mm/gup.c b/mm/gup.c >> index 76af4cfeaf68..fb375de7d40d 100644 >> --- a/mm/gup.c >> +++ b/mm/gup.c >> @@ -386,6 +386,8 @@ struct page *follow_page_mask(struct vm_area_struct *vma, >> struct pa

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 <kir...@shutemov.name> 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 to

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

2018-04-18 Thread Andrey Konovalov
dividually. - Updated Documentation/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:

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

2018-04-18 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 <andreyk...@google.com> --- arch/arm64/inclu

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

2018-04-18 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 <andreyk...@google.com> --- Documentation/arm64/tagged-pointers.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff

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

2018-04-18 Thread Andrey Konovalov
in access_ok and in __uaccess_mask_ptr. Signed-off-by: Andrey Konovalov <andreyk...@google.com> --- 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 2d6451

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

2018-04-18 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

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

2018-04-18 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 0/6] arm64: untag user pointers passed to the kernel

2018-03-27 Thread Andrey Konovalov
m64/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_user

[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 <andreyk...@google.com> --- arch/arm64/inclu

[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 <andreyk...@google.com> --- 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 2d6451

[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 2/6] uaccess: add untagged_addr definition for other arches

2018-03-27 Thread Andrey Konovalov
architectures besides arm64. Signed-off-by: Andrey Konovalov <andreyk...@google.com> --- 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/i

[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 <andreyk...@google.com> --- Documentation/arm64/tagged-pointers.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff