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


Groups > linux.kernel > #1266669

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

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] iommu/vt-d: Do access checks before calling handle_mm_fault()
Date 2015-11-10 18:50 +0100
Message-ID <qtldn-86V-9@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


On Tue, Nov 10, 2015 at 5:26 AM, Joerg Roedel <joro@8bytes.org> wrote:
> +
> +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 seems odd.

Shouldn't it be

    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)));

instead?

Of course, if you just used the VM_xyz flags internally itself, this
would all be easier, and you'd end up with something like

    /* Do we have requested bits that aren't in the allowed set? */
    return (requested & ~vma->vm_flags) != 0;

instead..

              Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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