From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751244AbeCIPxX (ORCPT ); Fri, 9 Mar 2018 10:53:23 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54170 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751187AbeCIPxV (ORCPT ); Fri, 9 Mar 2018 10:53:21 -0500 Date: Fri, 9 Mar 2018 15:53:16 +0000 From: Catalin Marinas To: Andrey Konovalov Cc: Will Deacon , Mark Rutland , Robin Murphy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Arnd Bergmann , linux-arch@vger.kernel.org, Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan Subject: Re: [RFC PATCH 3/6] mm, arm64: untag user addresses in memory syscalls Message-ID: <20180309155315.4x44sbp3darractt@armageddon.cambridge.arm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 09, 2018 at 03:02:01PM +0100, Andrey Konovalov wrote: > Memory subsystem syscalls accept user addresses as arguments, but don't use > copy_from_user and other similar functions, so we need to handle this case > separately. > > Untag user pointers passed to madvise, mbind, get_mempolicy, mincore, > mlock, mlock2, brk, mmap_pgoff, old_mmap, munmap, remap_file_pages, > mprotect, pkey_mprotect, mremap and msync. > > Signed-off-by: Andrey Konovalov Please keep the cc list small (maybe linux-arch, linux-arm-kernel) as I'm sure some lists would consider this spam. > mm/madvise.c | 2 ++ > mm/mempolicy.c | 6 ++++++ > mm/mincore.c | 2 ++ > mm/mlock.c | 5 +++++ > mm/mmap.c | 9 +++++++++ > mm/mprotect.c | 2 ++ > mm/mremap.c | 2 ++ > mm/msync.c | 3 +++ I'm not yet convinced these functions need to allow tagged pointers. They are not doing memory accesses but rather dealing with the memory range, hence an untagged pointer is better suited. There is probably a reason why the "start" argument is "unsigned long" vs "void __user *" (in the kernel, not the man page). -- Catalin From mboxrd@z Thu Jan 1 00:00:00 1970 From: catalin.marinas@arm.com (Catalin Marinas) Date: Fri, 9 Mar 2018 15:53:16 +0000 Subject: [RFC PATCH 3/6] mm, arm64: untag user addresses in memory syscalls In-Reply-To: References: Message-ID: <20180309155315.4x44sbp3darractt@armageddon.cambridge.arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, Mar 09, 2018 at 03:02:01PM +0100, Andrey Konovalov wrote: > Memory subsystem syscalls accept user addresses as arguments, but don't use > copy_from_user and other similar functions, so we need to handle this case > separately. > > Untag user pointers passed to madvise, mbind, get_mempolicy, mincore, > mlock, mlock2, brk, mmap_pgoff, old_mmap, munmap, remap_file_pages, > mprotect, pkey_mprotect, mremap and msync. > > Signed-off-by: Andrey Konovalov Please keep the cc list small (maybe linux-arch, linux-arm-kernel) as I'm sure some lists would consider this spam. > mm/madvise.c | 2 ++ > mm/mempolicy.c | 6 ++++++ > mm/mincore.c | 2 ++ > mm/mlock.c | 5 +++++ > mm/mmap.c | 9 +++++++++ > mm/mprotect.c | 2 ++ > mm/mremap.c | 2 ++ > mm/msync.c | 3 +++ I'm not yet convinced these functions need to allow tagged pointers. They are not doing memory accesses but rather dealing with the memory range, hence an untagged pointer is better suited. There is probably a reason why the "start" argument is "unsigned long" vs "void __user *" (in the kernel, not the man page). -- Catalin