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=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH 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 757D3C43218 for ; Mon, 10 Jun 2019 20:36:15 +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 4C43B206E0 for ; Mon, 10 Jun 2019 20:36:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nhBgTox7"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="aypLgRrX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C43B206E0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org 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=lK55zFRYqpB0y01uDnesj5PXDp8MHx80o0sH9xuhGv4=; b=nhBgTox7xy5prI gENkKO3ShYaOHUwj3OH5OFKs6td71zuOQClz4FdQHdpr7Ht0pWHdK71/XFCynl2Ry+COujV8uNrAX kMQmi+uUEHN+dsB2mFygx/MY+GudKG0APAmXxfVGtQKF0ao1CdVkKlhctD93KiQp6a1jDn0ZzQjMQ 4DhUbuB9hygXG6lek3nJTTat9YMYTUuE2Ukh+OflSbkLxjTEFvuyLAx3zu6ReR/RwPoMhTLUy2Hax ZEwzOcYpILlg5ayURDlwFr+ibSnzmvTzLTWxif9RixPtyvgLIrA/I4yoIdKNs3ERfIE3VvHo6+7RW Rnr1i/bfnu8xglPuG7ug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1haR1W-00082i-Mv; Mon, 10 Jun 2019 20:36:10 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1haR1S-00082L-Re for linux-arm-kernel@lists.infradead.org; Mon, 10 Jun 2019 20:36:08 +0000 Received: by mail-pg1-x544.google.com with SMTP id 196so5635846pgc.6 for ; Mon, 10 Jun 2019 13:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=QIiaElKbYG7X2iRY6VXsdeM4+31zgx4vPIFfu4hUJug=; b=aypLgRrX0btLwkQ78UmSd30OW9UF0AUZJnAd3r2/5HqpTZB7t9pPjkr79taehwRSBe Uf3LjKJsRGeyWW7niEs4BHLmd/27Tp++YcV8xUIXVrHXkWkhfr39ad2bGk73/2ccXpRd Krrfs143htc/xGI+Ppm9VimNWGnjKhQyxh//k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QIiaElKbYG7X2iRY6VXsdeM4+31zgx4vPIFfu4hUJug=; b=FQKuorIuvG0vK9ESqqoL4CMmL6OKh6mBEwgYT4u3I6gnDOzUEh5VV4lG8gbLoeSVKG Kd0PQfDuDu7B3F9tsWPXDNYXuXtm9GGpsvDE2duOzVljQUXF170S7M/T+0IeSV/mO9C4 lx9wk66QvHL7dg+aw0PU5bDVP5fEiS/sSDwWdSPrOygyyWPBvpoKiGGYvGDlIBBw0Mx1 phhegN/wNDndL0fdykXHNHUjtQS6RlUKrAludxKhUFR6DqViU0qD5BVL7k+MDMKQyBwy d6iUQP/hHVThSMBMs15By3fSIHd5S4rvW3TOgjneE/i1pb40PmdqayYhonVuzjR8r9/I 5mVw== X-Gm-Message-State: APjAAAUjwq8YQ++eP7GLi4EGBeR4aJqWzIuMjcZ0zVTJe034v3fnQIS8 5kx3+sDeJ+TsHAeX9r5+iJFtFQ== X-Google-Smtp-Source: APXvYqz36v1zCKX0GRWb534Z9an9udGHI/NESxPlvuGqVOMCrwC97gsWY6mXQoFhLwcNndoWLde2ZA== X-Received: by 2002:a62:1b85:: with SMTP id b127mr76850297pfb.165.1560198965895; Mon, 10 Jun 2019 13:36:05 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id k22sm11148457pfk.178.2019.06.10.13.36.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jun 2019 13:36:04 -0700 (PDT) Date: Mon, 10 Jun 2019 13:36:04 -0700 From: Kees Cook To: Catalin Marinas Subject: Re: [PATCH v16 02/16] arm64: untag user pointers in access_ok and __uaccess_mask_ptr Message-ID: <201906101335.DF80D631@keescook> References: <4327b260fb17c4776a1e3c844f388e4948cfb747.1559580831.git.andreyknvl@google.com> <20190610175326.GC25803@arrakis.emea.arm.com> <201906101106.3CA50745E3@keescook> <20190610185329.xhjawzfy4uddrkrj@mbp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190610185329.xhjawzfy4uddrkrj@mbp> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190610_133606_928317_6FE2772D X-CRM114-Status: GOOD ( 16.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kvm@vger.kernel.org, Szabolcs Nagy , Will Deacon , dri-devel@lists.freedesktop.org, linux-mm@kvack.org, Khalid Aziz , linux-kselftest@vger.kernel.org, Felix Kuehling , Vincenzo Frascino , Jacob Bramley , Leon Romanovsky , linux-rdma@vger.kernel.org, amd-gfx@lists.freedesktop.org, Christoph Hellwig , Jason Gunthorpe , Dmitry Vyukov , Dave Martin , Evgeniy Stepanov , linux-media@vger.kernel.org, Kevin Brodsky , Ruben Ayrapetyan , Andrey Konovalov , Ramana Radhakrishnan , Alex Williamson , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, Kostya Serebryany , Greg Kroah-Hartman , Yishai Hadas , linux-kernel@vger.kernel.org, Jens Wiklander , Lee Smith , Alexander Deucher , Andrew Morton , enh , Robin Murphy , Christian Koenig , Luc Van Oostenryck 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 On Mon, Jun 10, 2019 at 07:53:30PM +0100, Catalin Marinas wrote: > On Mon, Jun 10, 2019 at 11:07:03AM -0700, Kees Cook wrote: > > On Mon, Jun 10, 2019 at 06:53:27PM +0100, Catalin Marinas wrote: > > > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > > > index 3767fb21a5b8..fd191c5b92aa 100644 > > > --- a/arch/arm64/kernel/process.c > > > +++ b/arch/arm64/kernel/process.c > > > @@ -552,3 +552,18 @@ void arch_setup_new_exec(void) > > > > > > ptrauth_thread_init_user(current); > > > } > > > + > > > +/* > > > + * Enable the relaxed ABI allowing tagged user addresses into the kernel. > > > + */ > > > +int untagged_uaddr_set_mode(unsigned long arg) > > > +{ > > > + if (is_compat_task()) > > > + return -ENOTSUPP; > > > + if (arg) > > > + return -EINVAL; > > > + > > > + set_thread_flag(TIF_UNTAGGED_UADDR); > > > + > > > + return 0; > > > +} > > > > I think this should be paired with a flag clearing in copy_thread(), > > yes? (i.e. each binary needs to opt in) > > It indeed needs clearing though not in copy_thread() as that's used on > clone/fork but rather in flush_thread(), called on the execve() path. Ah! Yes, thanks. > And a note to myself: I think PR_UNTAGGED_ADDR (not UADDR) looks better > in a uapi header, the user doesn't differentiate between uaddr and > kaddr. Good point. I would agree. :) -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel