Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7846660imu; Thu, 15 Nov 2018 02:26:37 -0800 (PST) X-Google-Smtp-Source: AJdET5cSMm06018oh7cxbu+tSva/iAiRQlTwGH8HhcuvuPDggXJqNmPsGye71r6xYXHLIeEQA8vX X-Received: by 2002:a62:14d1:: with SMTP id 200mr5896604pfu.103.1542277597542; Thu, 15 Nov 2018 02:26:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542277597; cv=none; d=google.com; s=arc-20160816; b=DNddUvicNNhZ/jaDWXx4Gm5NYo5MI1sgg9cPbDgTOgR8HaUYYdLX1a5gwXJeaSfbIg +g7B+y5/jLaQsS4v3pzvM6Rob5juWolnFmiZ0rBR/jW7xkY+HnXIExvBnASIvJrjXWOo mr6BFSwVj/Q7kBrF5M9tyIrq4q17u7fGP/qiMGclggnvKigisZaazZonNav1CDrNd7aO jgAXR2ru9oG0Mni0d7w21fjkBbXBxxadf+T9006DlYRN+jujS+lihPcs+IpDIxIBwwV0 UGRPYsKbqtzWcBDiq5r9RKmNmNQUq12WZ0Q7FhiynOQFhqIrjp4VpjI5TJSuq7KGyf8A ewcg== 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=RieEWPDbVVuhvXfCt2RTFHAWhHu+pUjw7j8qo5SCcQc=; b=onfet6dHZaVyKs1WXcAryc2BJ02YT+l8pjxW8wDa0QpeIFHhHoIVZVbQk797TrD/eO kQ6Ztcvkgir8FYlwLIdNtBFPBTbP5zLw1azwFq6X+6iypJaktkL6DORqeEsqk1IwMyet 9uGiDNYnmIHI0KxNarrvoEV9ASGrKnBDP+ljHxnqS6Ga14SkMC0kom8YegJ2t5lNHaBd gIRwWLBwtvq3ap+7BvFGevX/h89EaUZyLD6JME+mLfmUE+BlFOIZ+AGLh7MTwgd11kbq C+cwNnyt3MGDvu6w2Jj8FZ+p2/qq99iHksy21CecAN83K+8lGKjAArbGqP8Vu3fuKXxA VOkg== 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 u30si26629206pgn.170.2018.11.15.02.26.21; Thu, 15 Nov 2018 02:26:37 -0800 (PST) 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 S1732655AbeKOUc7 (ORCPT + 99 others); Thu, 15 Nov 2018 15:32:59 -0500 Received: from foss.arm.com ([217.140.101.70]:59576 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728801AbeKOUc7 (ORCPT ); Thu, 15 Nov 2018 15:32:59 -0500 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 D716A80D; Thu, 15 Nov 2018 02:25:44 -0800 (PST) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 348FF3F718; Thu, 15 Nov 2018 02:25:42 -0800 (PST) Date: Thu, 15 Nov 2018 10:25:39 +0000 From: Dave Martin To: Will Deacon Cc: Catalin Marinas , linux-arch@vger.kernel.org, Jacob Bramley , Arnd Bergmann , Ard Biesheuvel , Marc Zyngier , linux-kernel@vger.kernel.org, Adam Wallis , Kristina Martsenko , gorcunov@openvz.org, Ramana Radhakrishnan , Amit Kachhap , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Kees Cook Subject: Re: [PATCH v5 07/17] arm64: add basic pointer authentication support Message-ID: <20181115102537.GL3505@e103592.cambridge.arm.com> References: <20181005084754.20950-1-kristina.martsenko@arm.com> <20181005084754.20950-8-kristina.martsenko@arm.com> <20181019111542.6wrvjguirglzg7vg@mbp> <20181019112404.GD14246@arm.com> <20181114181138.GB2580@brain-police> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181114181138.GB2580@brain-police> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 14, 2018 at 06:11:39PM +0000, Will Deacon wrote: [...] > On Fri, Oct 19, 2018 at 12:24:04PM +0100, Will Deacon wrote: [...] > > FWIW: I think we should be entertaining a prctl() interface to use a new > > key on a per-thread basis. Obviously, this would need to be used with care > > (e.g. you'd fork(); use the prctl() and then you'd better not return from > > the calling function!). > > > > Assuming we want this (Kees -- I was under the impression that everything in > > Android would end up with the same key otherwise?), then the question is > > do we want: > > > > - prctl() get/set operations for the key, or > > - prctl() set_random_key operation, or > > - both of the above? > > > > Part of the answer to that may lie in the requirements of CRIU, where I > > strongly suspect they need explicit get/set operations, although these > > could be gated on CONFIG_CHECKPOINT_RESTORE=y. > > I managed to speak to the CRIU developers at LPC. The good news is that > their preference is for a ptrace()-based interface for getting and setting > the keys, so the only prctl() operation we need is to set a random key > (separately for A and B). That's good if it works for them, and it seems the cleaner approach. _If_ they run the new thread up to a checkpoint, restoring the memory and doing all the setup that requires in-thread syscalls, then stop it in ptrace to finally inject the regs, then it makes sense to set the keys at that stop -- i.e., you set the keys atomically* with the final setting of the thread's PC. (* with respect to the target thread) So long as you're confident they've understood the implications of ptrauth for CRIU, I guess this can work. (In other news, they will also need to do some work to support SVE, but that's unrelated to ptrauth.) Cheers ---Dave