[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1447166756.81031.66.camel@infradead.org>
Date: Tue, 10 Nov 2015 14:45:56 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: Joerg Roedel <joro@...tes.org>, iommu@...ts.linux-foundation.org
Cc: Oded Gabbay <oded.gabbay@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Joerg Roedel <jroedel@...e.de>,
jbarnes@...tuousgeek.org
Subject: Re: [PATCH 4/4] iommu/vt-d: Do access checks before calling
handle_mm_fault()
On Tue, 2015-11-10 at 14:26 +0100, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@...e.de>
>
> Not doing so is a bug and might trigger a BUG_ON in
> handle_mm_fault(). So add the proper permission checks
> before calling into mm code.
>
> Signed-off-by: Joerg Roedel <jroedel@...e.de>
> +static bool access_error(struct vm_area_struct *vma, struct
> page_req_dsc *req)
> +{
> + return !((req->rd_req && (vma->vm_flags & VM_READ)) ||
> + (req->wr_req && (vma->vm_flags & VM_WRITE)) ||
> + (req->exe_req && (vma->vm_flags & VM_EXEC)));
> +}
> +
This is a TLB fill request from the device — can it not be asking for
*all* of read, write and exec privs? And you allow it to succeed if any
*one* of the permissions that it asks for is available?
Even if we don't see read+write in the same request, the VT-d spec does
seem quite clear that we *will* see read+exec (§7.5.1.1 p7-17 of v2.3:
• Execute Requested: If the PASID Present, Read Requested and Execute
Requested fields are all 1, the request-with-PASID that encountered
the recoverable fault that resulted in this page request, requires
execute access to the page.
Also, I'm afraid my Skylake box blew up the day I sent the pull request
to Linus so I'm unable to test until I've sorted out a replacement.
Jesse should be able to though...
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@...el.com Intel Corporation
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (5691 bytes)
Powered by blists - more mailing lists