[Spice-devel] [PATCH qxl-wddm-dod v5 1/7] Use MmMapIoSpaceEx instead of MmMapIoSpace

Frediano Ziglio fziglio at redhat.com
Mon Sep 26 13:35:01 UTC 2016


> 
> Disable execution bit on mapping improving security.
> 
> MmMapIoSpaceEx is available only in Windows 10 thus
> the macros are used.
> 
> Based on a patch by Sandy Stutsman <sstutsma at redhat.com>
> 
> Signed-off-by: Sameeh Jubran <sameeh at daynix.com>

Acked-by: Frediano Ziglio <fziglio at redhat.com>

I'll wait couple if days, there were different comments on this patch.

Frediano

> ---
>  qxldod/QxlDod.cpp | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index accf895..798b2f0 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -2009,17 +2009,28 @@ MapFrameBuffer(
>          return STATUS_INVALID_PARAMETER;
>      }
>  
> +#if NTDDI_VERSION >= NTDDI_WIN10
> +    *VirtualAddress = MmMapIoSpaceEx(PhysicalAddress,
> +        Length,
> +        PAGE_WRITECOMBINE | PAGE_READWRITE);
> +#else
>      *VirtualAddress = MmMapIoSpace(PhysicalAddress,
>                                     Length,
>                                     MmWriteCombined);
> +#endif
>      if (*VirtualAddress == NULL)
>      {
>          // The underlying call to MmMapIoSpace failed. This may be because,
>          MmWriteCombined
>          // isn't supported, so try again with MmNonCached
> -
> +#if NTDDI_VERSION >= NTDDI_WIN10
> +        *VirtualAddress = MmMapIoSpaceEx(PhysicalAddress,
> +            Length,
> +            (PAGE_NOCACHE | PAGE_READWRITE));
> +#else
>          *VirtualAddress = MmMapIoSpace(PhysicalAddress,
>                                         Length,
>                                         MmNonCached);
> +#endif
>          if (*VirtualAddress == NULL)
>          {
>              DbgPrint(TRACE_LEVEL_ERROR, ("MmMapIoSpace returned a NULL
>              buffer when trying to allocate %lu bytes", Length));


More information about the Spice-devel mailing list