public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: make sure page protections are updated after changing vm_flags.
@ 2009-09-30 22:55 Jeremy Fitzhardinge
  2009-10-06 20:39 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Fitzhardinge @ 2009-09-30 22:55 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel, Jan Beulich, Linux Kernel Mailing List

Some architectures compute ->vm_page_prot depending on ->vm_flags, so
we need to update the protections after adjusting the flags.

Reported-by: Jan Beulich <JBeulich@novell.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>

diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 8104eca..9d3e39f 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -537,7 +537,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 	vma->vm_ops = obj->dev->driver->gem_vm_ops;
 	vma->vm_private_data = map->handle;
 	/* FIXME: use pgprot_writecombine when available */
-	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+	vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
 
 	/* Take a ref for this mapping of the object, so that the fault
 	 * handler can dereference the mmap offset's pointer to the object.



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: make sure page protections are updated after changing vm_flags.
  2009-09-30 22:55 [PATCH] drm: make sure page protections are updated after changing vm_flags Jeremy Fitzhardinge
@ 2009-10-06 20:39 ` Andrew Morton
  2009-10-06 21:31   ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2009-10-06 20:39 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: airlied, dri-devel, JBeulich, linux-kernel

On Wed, 30 Sep 2009 15:55:39 -0700
Jeremy Fitzhardinge <jeremy@goop.org> wrote:

> Some architectures compute ->vm_page_prot depending on ->vm_flags, so
> we need to update the protections after adjusting the flags.
> 
> Reported-by: Jan Beulich <JBeulich@novell.com>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> 
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 8104eca..9d3e39f 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -537,7 +537,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>  	vma->vm_ops = obj->dev->driver->gem_vm_ops;
>  	vma->vm_private_data = map->handle;
>  	/* FIXME: use pgprot_writecombine when available */
> -	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
> +	vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
>  
>  	/* Take a ref for this mapping of the object, so that the fault
>  	 * handler can dereference the mmap offset's pointer to the object.

u fail changelogology.

What were the consequences of the bug which you just fixed?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: make sure page protections are updated after changing vm_flags.
  2009-10-06 20:39 ` Andrew Morton
@ 2009-10-06 21:31   ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 3+ messages in thread
From: Jeremy Fitzhardinge @ 2009-10-06 21:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: airlied, dri-devel, JBeulich, linux-kernel

On 10/06/09 13:39, Andrew Morton wrote:
> On Wed, 30 Sep 2009 15:55:39 -0700
> Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
>   
>> Some architectures compute ->vm_page_prot depending on ->vm_flags, so
>> we need to update the protections after adjusting the flags.
>>
>> Reported-by: Jan Beulich <JBeulich@novell.com>
>> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
>>
>> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
>> index 8104eca..9d3e39f 100644
>> --- a/drivers/gpu/drm/drm_gem.c
>> +++ b/drivers/gpu/drm/drm_gem.c
>> @@ -537,7 +537,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>>  	vma->vm_ops = obj->dev->driver->gem_vm_ops;
>>  	vma->vm_private_data = map->handle;
>>  	/* FIXME: use pgprot_writecombine when available */
>> -	vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
>> +	vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
>>  
>>  	/* Take a ref for this mapping of the object, so that the fault
>>  	 * handler can dereference the mmap offset's pointer to the object.
>>     
> u fail changelogology.
>
> What were the consequences of the bug which you just fixed?
>   

AFAIK this only affects running X under Xen; without this patch you get
lots of coloured blobs on the screen, or maybe a complete lockup.  Or
anything really.

But that still depends on lots of out-of-tree stuff, so I don't think
there are any consequences for anyone else.  But it is wrong in principle.

    J

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-06 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-30 22:55 [PATCH] drm: make sure page protections are updated after changing vm_flags Jeremy Fitzhardinge
2009-10-06 20:39 ` Andrew Morton
2009-10-06 21:31   ` Jeremy Fitzhardinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox