From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE223C43381 for ; Fri, 29 Mar 2019 10:30:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A808206B8 for ; Fri, 29 Mar 2019 10:30:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mxYTAUy+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A808206B8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sUjWDj/ZJp1xmLQkAySDTjlCm0RbYQIMM3kOwhItG3c=; b=mxYTAUy+Dp1245 LPduPaGfmpXuafvEn7J17h/lPj26ejbkr4ykdy27wpbqJJFnArAKBhJwZgAdJeR4lqcqHxPjXDwyB PcXFu1SCHAsR3W9VoWvG8jx4fAsn5rbDDvA58OgBiPeXnT3kYWpXkbw1hjyN/cZkS8qvUuP3IVmKl XAyXQWak2wMfjNtH7DzYUEH1UDx3PtjBwaojO0SYF91wi+9E/5E3Y8W4+qdYkOhUHZ4BavT27wzKE qnh/mJOvYDS/tcCADBWlGvF1KspvHRjFmHDmED5scf4+APdFru4SR93s4v+ddpHZwQtrTNVMyS5Kc xm7nIl5TF0UShzJzn2jg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9omi-0008D2-8F; Fri, 29 Mar 2019 10:30:52 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9omg-0008Ca-2h for linux-arm-kernel@lists.infradead.org; Fri, 29 Mar 2019 10:30:51 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F756A78; Fri, 29 Mar 2019 03:30:47 -0700 (PDT) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 817863F575; Fri, 29 Mar 2019 03:30:42 -0700 (PDT) Date: Fri, 29 Mar 2019 10:30:40 +0000 From: Catalin Marinas To: Steven Rostedt Subject: Re: [PATCH v13 04/20] mm, arm64: untag user pointers passed to memory syscalls Message-ID: <20190329103039.GA44339@arrakis.emea.arm.com> References: <44ad2d0c55dbad449edac23ae46d151a04102a1d.1553093421.git.andreyknvl@google.com> <20190322114357.GC13384@arrakis.emea.arm.com> <20190328141934.38960af0@gandalf.local.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190328141934.38960af0@gandalf.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190329_033050_128574_E6D02089 X-CRM114-Status: GOOD ( 21.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Peter Zijlstra , Will Deacon , Alexei Starovoitov , Linux Memory Management List , Eric Dumazet , Vincenzo Frascino , Ingo Molnar , linux-arch , Daniel Borkmann , Szabolcs Nagy , Dmitry Vyukov , Dave Martin , Evgeniy Stepanov , Kevin Brodsky , Kees Cook , Ruben Ayrapetyan , Andrey Konovalov , Ramana Radhakrishnan , Arnaldo Carvalho de Melo , Alex Williamson , Mauro Carvalho Chehab , Linux ARM , Kostya Serebryany , Greg Kroah-Hartman , LKML , Jens Wiklander , Luc Van Oostenryck , Lee Smith , Andrew Morton , "David S. Miller" , "Kirill A . Shutemov" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org (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: > > > > > Signed-off-by: Andrey Konovalov > > > > --- > > > > ipc/shm.c | 2 ++ > > > > mm/madvise.c | 2 ++ > > > > mm/mempolicy.c | 5 +++++ > > > > mm/migrate.c | 1 + > > > > mm/mincore.c | 2 ++ > > > > mm/mlock.c | 5 +++++ > > > > mm/mmap.c | 7 +++++++ > > > > mm/mprotect.c | 1 + > > > > mm/mremap.c | 2 ++ > > > > mm/msync.c | 2 ++ > > > > 10 files changed, 29 insertions(+) > > > > > > I wonder whether it's better to keep these as wrappers in the arm64 > > > code. > > > > I don't think I understand what you propose, could you elaborate? > > I believe Catalin is saying that instead of placing things like: > > @@ -1593,6 +1593,7 @@ SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg) > unsigned long ret; > long err; > > + shmaddr = untagged_addr(shmaddr); > > To instead have the shmaddr set to the untagged_addr() before calling > the system call, and passing the untagged addr to the system call, as > that goes through the arm64 architecture specific code first. Indeed. For example, we already have a SYSCALL_DEFINE6(mmap, ...) in arch/arm64/kernel/sys.c, just add the untagging there. We could do something similar for the other syscalls. I don't mind doing this in the generic code but if it's only needed for arm64, I'd rather keep the generic changes to a minimum. (I had a hack overriding __SC_CAST to do this automatically for pointer arguments but this wouldn't work on mmap() and friends as the argument is unsigned long) -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel