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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 70B23C48BE8 for ; Mon, 24 Jun 2019 15:02:53 +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 45C2620848 for ; Mon, 24 Jun 2019 15:02:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qBU1XAxS"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="e43eFy4u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45C2620848 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=rVFZh+LEmQpM7zamLUrU1rfDr52ZzRANWmdM9hcliOQ=; b=qBU1XAxSv/axda OPddxJoHeONv5OzipvSNQHUNtZgtlDP1AsKcuAY7ph3dHeuTIgfVJfjT48C3ryzUYTul5RlX+Dmco HaxEMFq+yrz9rHK9pG1rahLIk8Tqz4HTykDhT8quy4D1dcl9CAmJmg3DMOiBTQwUD673r8pHgzc9U 7vcDD0+sBxLlsGTPxXnEl3eUmmEgCnjifNKzC0Kv3g1NIlnZi8TEsTkoVBcGy2OeGskqlx7jcb5Ny CpcxpFuDiM+Df3tKChky0yV8vuoRURbNFijpU6mQm4aOKc/xdjYIC/z4W4r4zEeVXB2VhpRUDdXP+ yg4AwFj50A1E9abqegow==; 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 1hfQUc-0001MK-Bi; Mon, 24 Jun 2019 15:02:50 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfQUZ-0001L2-5I for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 15:02:48 +0000 Received: by mail-pg1-x543.google.com with SMTP id y72so7257847pgd.8 for ; Mon, 24 Jun 2019 08:02:46 -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=wtUCrmBvvtcTuAx+h8NVUvwzdIMNqCWWz94+pOdbySM=; b=e43eFy4uvro/u8g8OpaaLl6Rs0FW7SVQaUyRp7V2h5UXAJx5vDQq+s1gB9TZQuKsNt b4xMpJfn+9rwJ2wcampbkbNuD3kDE/KEYUEeVoAoarpxyF2ozWjPuoNnonjrArQW0IHL YwvsDeGKK9G/YnAhcFhuSat9a+4MSjjnix9W4= 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=wtUCrmBvvtcTuAx+h8NVUvwzdIMNqCWWz94+pOdbySM=; b=R+FwbUiup5XZhk20hmmvYV68lPmsuOWtkUb2BG5ikl0N8kPY/NWCP6wBG9/MIa6BSi S6YulcD/lymTncQ0iJb9EQGcecDAk3Gi5wo9W+EXSNxPwVzHwahP7HL1dExxCenGaAcq 7PPt19xucZwu5kIIeYiWNNw/PD1l4M6PyzgoPx5+qEmpn6pSNnr8njhH2FL2CL39NV32 w8jrBQSv19SkTEEtEv2Z2y+1V9roURGVKkkBGBsM3j+n9MwG6NqsngJJxbf1wB2jgnEb l0xw+3Yp+tF7cK4bubCR+hHS2tXvqFWrPZBUtSEOoky091YAA/NUJRQ1H7v14GXetKb7 dE4A== X-Gm-Message-State: APjAAAVkYiPAV+bzvhF4WbtF00coajcXzNrw1kVyqdMfCdFEhGOSIHS8 Cqo9M4mKAaAY8HKJCeufZzy8JQ== X-Google-Smtp-Source: APXvYqy4hQCrjSrRM7hi0X8gFT7Wh+JsuaL6AoOZPMb6KqSaIYh6bUPxpgpfjIoTWPj+3t8Nf6ik+g== X-Received: by 2002:a63:1d5:: with SMTP id 204mr34459271pgb.207.1561388566306; Mon, 24 Jun 2019 08:02:46 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id j1sm13025385pfe.101.2019.06.24.08.02.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jun 2019 08:02:45 -0700 (PDT) Date: Mon, 24 Jun 2019 08:02:44 -0700 From: Kees Cook To: Andrey Konovalov Subject: Re: [PATCH v18 10/15] drm/radeon: untag user pointers in radeon_gem_userptr_ioctl Message-ID: <201906240802.23FD5401@keescook> References: <61d800c35a4f391218fbca6f05ec458557d8d097.1561386715.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <61d800c35a4f391218fbca6f05ec458557d8d097.1561386715.git.andreyknvl@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_080247_207246_53AC25E6 X-CRM114-Status: GOOD ( 19.47 ) 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 , Catalin Marinas , 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 , 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 24, 2019 at 04:32:55PM +0200, Andrey Konovalov wrote: > This patch is a part of a series that extends kernel ABI to allow to pass > tagged user pointers (with the top byte set to something else other than > 0x00) as syscall arguments. > > In radeon_gem_userptr_ioctl() an MMU notifier is set up with a (tagged) > userspace pointer. The untagged address should be used so that MMU > notifiers for the untagged address get correctly matched up with the right > BO. This funcation also calls radeon_ttm_tt_pin_userptr(), which uses > provided user pointers for vma lookups, which can only by done with > untagged pointers. > > This patch untags user pointers in radeon_gem_userptr_ioctl(). > > Suggested-by: Felix Kuehling > Acked-by: Felix Kuehling > Signed-off-by: Andrey Konovalov Reviewed-by: Kees Cook -Kees > --- > drivers/gpu/drm/radeon/radeon_gem.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c > index 44617dec8183..90eb78fb5eb2 100644 > --- a/drivers/gpu/drm/radeon/radeon_gem.c > +++ b/drivers/gpu/drm/radeon/radeon_gem.c > @@ -291,6 +291,8 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data, > uint32_t handle; > int r; > > + args->addr = untagged_addr(args->addr); > + > if (offset_in_page(args->addr | args->size)) > return -EINVAL; > > -- > 2.22.0.410.gd8fdbe21b5-goog > -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel