Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6335071ybi; Wed, 29 May 2019 06:26:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMZ8ld1lts5HN6e4i/6WJx6KfPmgefapzPJ8P1qMOZUNmafcA1Nuufj7C2skC4FjuHZEHC X-Received: by 2002:a17:902:1621:: with SMTP id g30mr100070166plg.326.1559136378781; Wed, 29 May 2019 06:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559136378; cv=none; d=google.com; s=arc-20160816; b=b+PEdsU7iWofmfrLpUlosfP5//5YpENRPTrdqpNlmoSQKjXn8Pbqc/Asr1X5fIN5RE GKbVPNmgKb+tuL0spxTDw8Vg0Q8HJgF8bpuQzzasViYklZQHUl6aBVjr3TZbmR+JYxlk JBgzO5JdeXUAXa3QVlPIzJj++DneLN3/CfQZS1teGO2gZavLjTnt3HuW0NnshPejotaH 0OscsLGQpnhQ+Qrd83vTimIz39Z1QlanrQn5OsyVfu09xbCsHXNPeUh+gsTXx14oDgSr atAr7wNZfMlHMxmArD60uHSg1Pi0oETtqHKVE62Ayqnj3z20G6JrWpV39AWyPotXNmgU 6XYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=euesoUjkSQJ2miEAPNfPDRSCP16azLpN27jylWUcuXQ=; b=w8JyGiJJEmahq2GDrwfRfF3LHEd4165f2imA3SK5BF7FUNcS/RxKyloUvOsKpID9w4 10rAgx5Vujk87c8b2y+T8sBwpS1EbDn9Em7DjD8pc3MGkfJQL1N4We7r6FOVTA59oqbm 90PDY1k66tGvLdzB81pQIDfLYUvxVNHhIq1Fu05ThXHl8Q1RJQpOGu46JOa8+D0N2trb T4OIw1KCJTWT6MXUNRCZXU0lgObUxXU/qzohpYTiolmokWhm89OIKtiwwSFFnklINhB6 knoRWqEMYWP+IBtGr9ltMZSPoiyAouACzbs7wed3522iyBtNWzaSxvCIC+6q1+lSD3IF qubA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si26667252pla.60.2019.05.29.06.26.02; Wed, 29 May 2019 06:26:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727100AbfE2NXv (ORCPT + 99 others); Wed, 29 May 2019 09:23:51 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45920 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbfE2NXv (ORCPT ); Wed, 29 May 2019 09:23:51 -0400 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 E0EF180D; Wed, 29 May 2019 06:23:50 -0700 (PDT) Received: from mbp (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E5BC23F59C; Wed, 29 May 2019 06:23:44 -0700 (PDT) Date: Wed, 29 May 2019 14:23:42 +0100 From: Catalin Marinas To: Dave Martin Cc: Mark Rutland , kvm@vger.kernel.org, Szabolcs Nagy , Will Deacon , dri-devel@lists.freedesktop.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Vincenzo Frascino , Jacob Bramley , Leon Romanovsky , linux-rdma@vger.kernel.org, amd-gfx@lists.freedesktop.org, Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov , linux-media@vger.kernel.org, Kees Cook , Ruben Ayrapetyan , Andrey Konovalov , Kevin Brodsky , Alex Williamson , Yishai Hadas , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, Kostya Serebryany , Greg Kroah-Hartman , Felix Kuehling , linux-kernel@vger.kernel.org, Jens Wiklander , Lee Smith , Alexander Deucher , Andrew Murray , Andrew Morton , Robin Murphy , Christian Koenig , Luc Van Oostenryck Subject: Re: [PATCH v15 05/17] arms64: untag user pointers passed to memory syscalls Message-ID: <20190529132341.27t3knoxpb7t7y3g@mbp> References: <00eb4c63fefc054e2c8d626e8fedfca11d7c2600.1557160186.git.andreyknvl@google.com> <20190527143719.GA59948@MBP.local> <20190528145411.GA709@e119886-lin.cambridge.arm.com> <20190528154057.GD32006@arrakis.emea.arm.com> <20190528155644.GD28398@e103592.cambridge.arm.com> <20190528163400.GE32006@arrakis.emea.arm.com> <20190529124224.GE28398@e103592.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190529124224.GE28398@e103592.cambridge.arm.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 29, 2019 at 01:42:25PM +0100, Dave P Martin wrote: > On Tue, May 28, 2019 at 05:34:00PM +0100, Catalin Marinas wrote: > > On Tue, May 28, 2019 at 04:56:45PM +0100, Dave P Martin wrote: > > > On Tue, May 28, 2019 at 04:40:58PM +0100, Catalin Marinas wrote: > > > > > > [...] > > > > > > > My thoughts on allowing tags (quick look): > > > > > > > > brk - no > > > > > > [...] > > > > > > > mlock, mlock2, munlock - yes > > > > mmap - no (we may change this with MTE but not for TBI) > > > > > > [...] > > > > > > > mprotect - yes > > > > > > I haven't following this discussion closely... what's the rationale for > > > the inconsistencies here (feel free to refer me back to the discussion > > > if it's elsewhere). > > > > _My_ rationale (feel free to disagree) is that mmap() by default would > > not return a tagged address (ignoring MTE for now). If it gets passed a > > tagged address or a "tagged NULL" (for lack of a better name) we don't > > have clear semantics of whether the returned address should be tagged in > > this ABI relaxation. I'd rather reserve this specific behaviour if we > > overload the non-zero tag meaning of mmap() for MTE. Similar reasoning > > for mremap(), at least on the new_address argument (not entirely sure > > about old_address). > > > > munmap() should probably follow the mmap() rules. > > > > As for brk(), I don't see why the user would need to pass a tagged > > address, we can't associate any meaning to this tag. > > > > For the rest, since it's likely such addresses would have been tagged by > > malloc() in user space, we should allow tagged pointers. > > Those arguments seem reasonable. We should try to capture this > somewhere when documenting the ABI. > > To be clear, I'm not sure that we should guarantee anywhere that a > tagged pointer is rejected: rather the behaviour should probably be > left unspecified. Then we can tidy it up incrementally. > > (The behaviour is unspecified today, in any case.) What is specified (or rather de-facto ABI) today is that passing a user address above TASK_SIZE (e.g. non-zero top byte) would fail in most cases. If we relax this with the TBI we may end up with some de-facto ABI before we actually get MTE hardware. Tightening it afterwards may be slightly more problematic, although MTE needs to be an explicit opt-in. IOW, I wouldn't want to unnecessarily relax the ABI if we don't need to. -- Catalin