Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266553

Re: [PATCH 4/4] iommu/vt-d: Do access checks before calling handle_mm_fault()

From David Woodhouse <dwmw2@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] iommu/vt-d: Do access checks before calling handle_mm_fault()
Date 2015-11-10 15:50 +0100
Message-ID <qtipc-6iz-19@gated-at.bofh.it> (permalink)
References <qth9M-5Bq-9@gated-at.bofh.it> <qth9N-5Bq-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, 2015-11-10 at 14:26 +0100, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.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@suse.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@intel.com                              Intel Corporation

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] Implement access checks in iommu page fault paths Joerg Roedel <joro@8bytes.org> - 2015-11-10 14:30 +0100
  [PATCH 2/4] iommu/amd: Correctly set flags for handle_mm_fault call Joerg Roedel <joro@8bytes.org> - 2015-11-10 14:30 +0100
  [PATCH 4/4] iommu/vt-d: Do access checks before calling handle_mm_fault() Joerg Roedel <joro@8bytes.org> - 2015-11-10 14:30 +0100
    Re: [PATCH 4/4] iommu/vt-d: Do access checks before calling  handle_mm_fault() David Woodhouse <dwmw2@infradead.org> - 2015-11-10 15:50 +0100
      Re: [PATCH 4/4] iommu/vt-d: Do access checks before calling  handle_mm_fault() Joerg Roedel <jroedel@suse.de> - 2015-11-10 16:00 +0100
    Re: [PATCH 4/4] iommu/vt-d: Do access checks before calling handle_mm_fault() Linus Torvalds <torvalds@linux-foundation.org> - 2015-11-10 18:50 +0100
      Re: [PATCH 4/4] iommu/vt-d: Do access checks before calling  handle_mm_fault() Joerg Roedel <joro@8bytes.org> - 2015-11-10 19:10 +0100
  [PATCH 3/4] iommu/amd: Cleanup error handling in do_fault() Joerg Roedel <joro@8bytes.org> - 2015-11-10 14:30 +0100
  [PATCH 1/4] iommu/amd: Do proper access checking before calling handle_mm_fault() Joerg Roedel <joro@8bytes.org> - 2015-11-10 14:30 +0100

csiph-web