xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mem_event: Return previous value of CR0/CR3/CR4 on change.
@ 2014-01-30 21:34 Tamas K Lengyel
  2014-02-06 10:14 ` Tim Deegan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tamas K Lengyel @ 2014-01-30 21:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Tamas K Lengyel, keir

This patch extends the information returned for CR0/CR3/CR4 register write events
with the previous value of the register. The old value was already passed to the trap
processing function, just never placed into the returned request. By returning     
this value, applications subscribing the CR events obtain additional context about
the event.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>

---
 xen/arch/x86/hvm/hvm.c         |    4 ++++
 xen/include/public/mem_event.h |    6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 69f7e74..d46abf2 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4682,6 +4682,10 @@ static int hvm_memory_event_traps(long p, uint32_t reason,
         req.gla = gla;
         req.gla_valid = 1;
     }
+    else
+    {
+        req.gla = old;
+    }
     
     mem_event_put_request(d, &d->mem_event->access, &req);
     
diff --git a/xen/include/public/mem_event.h b/xen/include/public/mem_event.h
index c9ed546..3831b41 100644
--- a/xen/include/public/mem_event.h
+++ b/xen/include/public/mem_event.h
@@ -40,9 +40,9 @@
 /* Reasons for the memory event request */
 #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */
 #define MEM_EVENT_REASON_VIOLATION   1    /* access violation, GFN is address */
-#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is CR0 value */
-#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is CR3 value */
-#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is CR4 value */
+#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is new CR0 value, gla is previous */
+#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is new CR3 value, gla is previous */
+#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is new CR4 value, gla is previous */
 #define MEM_EVENT_REASON_INT3        5    /* int3 was hit: gla/gfn are RIP */
 #define MEM_EVENT_REASON_SINGLESTEP  6    /* single step was invoked: gla/gfn are RIP */
 #define MEM_EVENT_REASON_MSR         7    /* MSR was hit: gfn is MSR value, gla is MSR address;
-- 
1.7.10.4

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

* Re: [PATCH] mem_event: Return previous value of CR0/CR3/CR4 on change.
  2014-01-30 21:34 [PATCH] mem_event: Return previous value of CR0/CR3/CR4 on change Tamas K Lengyel
@ 2014-02-06 10:14 ` Tim Deegan
  2014-02-25 10:54 ` Jan Beulich
  2014-02-27 10:46 ` Tim Deegan
  2 siblings, 0 replies; 5+ messages in thread
From: Tim Deegan @ 2014-02-06 10:14 UTC (permalink / raw)
  To: Tamas K Lengyel; +Cc: keir, xen-devel

At 22:34 +0100 on 30 Jan (1391117656), Tamas K Lengyel wrote:
> This patch extends the information returned for CR0/CR3/CR4 register write events
> with the previous value of the register. The old value was already passed to the trap
> processing function, just never placed into the returned request. By returning     
> this value, applications subscribing the CR events obtain additional context about
> the event.
> 
> Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>

Looks OK to me. (But for after 4.4.)

Acked-by: Tim Deegan <tim@xen.org>


> ---
>  xen/arch/x86/hvm/hvm.c         |    4 ++++
>  xen/include/public/mem_event.h |    6 +++---
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 69f7e74..d46abf2 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -4682,6 +4682,10 @@ static int hvm_memory_event_traps(long p, uint32_t reason,
>          req.gla = gla;
>          req.gla_valid = 1;
>      }
> +    else
> +    {
> +        req.gla = old;
> +    }
>      
>      mem_event_put_request(d, &d->mem_event->access, &req);
>      
> diff --git a/xen/include/public/mem_event.h b/xen/include/public/mem_event.h
> index c9ed546..3831b41 100644
> --- a/xen/include/public/mem_event.h
> +++ b/xen/include/public/mem_event.h
> @@ -40,9 +40,9 @@
>  /* Reasons for the memory event request */
>  #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */
>  #define MEM_EVENT_REASON_VIOLATION   1    /* access violation, GFN is address */
> -#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is CR0 value */
> -#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is CR3 value */
> -#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is CR4 value */
> +#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is new CR0 value, gla is previous */
> +#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is new CR3 value, gla is previous */
> +#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is new CR4 value, gla is previous */
>  #define MEM_EVENT_REASON_INT3        5    /* int3 was hit: gla/gfn are RIP */
>  #define MEM_EVENT_REASON_SINGLESTEP  6    /* single step was invoked: gla/gfn are RIP */
>  #define MEM_EVENT_REASON_MSR         7    /* MSR was hit: gfn is MSR value, gla is MSR address;
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

* Re: [PATCH] mem_event: Return previous value of CR0/CR3/CR4 on change.
  2014-01-30 21:34 [PATCH] mem_event: Return previous value of CR0/CR3/CR4 on change Tamas K Lengyel
  2014-02-06 10:14 ` Tim Deegan
@ 2014-02-25 10:54 ` Jan Beulich
  2014-02-25 11:35   ` Tim Deegan
  2014-02-27 10:46 ` Tim Deegan
  2 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2014-02-25 10:54 UTC (permalink / raw)
  To: Andres Lagar-Cavilla, Tim Deegan; +Cc: Tamas K Lengyel, keir, xen-devel

>>> On 30.01.14 at 22:34, Tamas K Lengyel <tamas.lengyel@zentific.com> wrote:
> This patch extends the information returned for CR0/CR3/CR4 register write 
> events
> with the previous value of the register. The old value was already passed to 
> the trap
> processing function, just never placed into the returned request. By 
> returning     
> this value, applications subscribing the CR events obtain additional context 
> about
> the event.
> 
> Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>

Tim, Andres,

this seems to fall in your area - any thoughts?

Thanks, Jan

> ---
>  xen/arch/x86/hvm/hvm.c         |    4 ++++
>  xen/include/public/mem_event.h |    6 +++---
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 69f7e74..d46abf2 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -4682,6 +4682,10 @@ static int hvm_memory_event_traps(long p, uint32_t 
> reason,
>          req.gla = gla;
>          req.gla_valid = 1;
>      }
> +    else
> +    {
> +        req.gla = old;
> +    }
>      
>      mem_event_put_request(d, &d->mem_event->access, &req);
>      
> diff --git a/xen/include/public/mem_event.h b/xen/include/public/mem_event.h
> index c9ed546..3831b41 100644
> --- a/xen/include/public/mem_event.h
> +++ b/xen/include/public/mem_event.h
> @@ -40,9 +40,9 @@
>  /* Reasons for the memory event request */
>  #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */
>  #define MEM_EVENT_REASON_VIOLATION   1    /* access violation, GFN is 
> address */
> -#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is CR0 value 
> */
> -#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is CR3 value 
> */
> -#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is CR4 value 
> */
> +#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is new CR0 
> value, gla is previous */
> +#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is new CR3 
> value, gla is previous */
> +#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is new CR4 
> value, gla is previous */
>  #define MEM_EVENT_REASON_INT3        5    /* int3 was hit: gla/gfn are RIP 
> */
>  #define MEM_EVENT_REASON_SINGLESTEP  6    /* single step was invoked: 
> gla/gfn are RIP */
>  #define MEM_EVENT_REASON_MSR         7    /* MSR was hit: gfn is MSR value, 
> gla is MSR address;
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org 
> http://lists.xen.org/xen-devel 

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

* Re: [PATCH] mem_event: Return previous value of CR0/CR3/CR4 on change.
  2014-02-25 10:54 ` Jan Beulich
@ 2014-02-25 11:35   ` Tim Deegan
  0 siblings, 0 replies; 5+ messages in thread
From: Tim Deegan @ 2014-02-25 11:35 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Tamas K Lengyel, keir, Andres Lagar-Cavilla, xen-devel

At 10:54 +0000 on 25 Feb (1393322055), Jan Beulich wrote:
> >>> On 30.01.14 at 22:34, Tamas K Lengyel <tamas.lengyel@zentific.com> wrote:
> > This patch extends the information returned for CR0/CR3/CR4 register write 
> > events
> > with the previous value of the register. The old value was already passed to 
> > the trap
> > processing function, just never placed into the returned request. By 
> > returning     
> > this value, applications subscribing the CR events obtain additional context 
> > about
> > the event.
> > 
> > Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
> 
> Tim, Andres,
> 
> this seems to fall in your area - any thoughts?

I already acked this; I was intending to apply it on Thursday.

Tim.

> > ---
> >  xen/arch/x86/hvm/hvm.c         |    4 ++++
> >  xen/include/public/mem_event.h |    6 +++---
> >  2 files changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> > index 69f7e74..d46abf2 100644
> > --- a/xen/arch/x86/hvm/hvm.c
> > +++ b/xen/arch/x86/hvm/hvm.c
> > @@ -4682,6 +4682,10 @@ static int hvm_memory_event_traps(long p, uint32_t 
> > reason,
> >          req.gla = gla;
> >          req.gla_valid = 1;
> >      }
> > +    else
> > +    {
> > +        req.gla = old;
> > +    }
> >      
> >      mem_event_put_request(d, &d->mem_event->access, &req);
> >      
> > diff --git a/xen/include/public/mem_event.h b/xen/include/public/mem_event.h
> > index c9ed546..3831b41 100644
> > --- a/xen/include/public/mem_event.h
> > +++ b/xen/include/public/mem_event.h
> > @@ -40,9 +40,9 @@
> >  /* Reasons for the memory event request */
> >  #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */
> >  #define MEM_EVENT_REASON_VIOLATION   1    /* access violation, GFN is 
> > address */
> > -#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is CR0 value 
> > */
> > -#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is CR3 value 
> > */
> > -#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is CR4 value 
> > */
> > +#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is new CR0 
> > value, gla is previous */
> > +#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is new CR3 
> > value, gla is previous */
> > +#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is new CR4 
> > value, gla is previous */
> >  #define MEM_EVENT_REASON_INT3        5    /* int3 was hit: gla/gfn are RIP 
> > */
> >  #define MEM_EVENT_REASON_SINGLESTEP  6    /* single step was invoked: 
> > gla/gfn are RIP */
> >  #define MEM_EVENT_REASON_MSR         7    /* MSR was hit: gfn is MSR value, 
> > gla is MSR address;
> > -- 
> > 1.7.10.4
> > 
> > 
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org 
> > http://lists.xen.org/xen-devel 
> 
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

* Re: [PATCH] mem_event: Return previous value of CR0/CR3/CR4 on change.
  2014-01-30 21:34 [PATCH] mem_event: Return previous value of CR0/CR3/CR4 on change Tamas K Lengyel
  2014-02-06 10:14 ` Tim Deegan
  2014-02-25 10:54 ` Jan Beulich
@ 2014-02-27 10:46 ` Tim Deegan
  2 siblings, 0 replies; 5+ messages in thread
From: Tim Deegan @ 2014-02-27 10:46 UTC (permalink / raw)
  To: Tamas K Lengyel; +Cc: keir, xen-devel

At 22:34 +0100 on 30 Jan (1391117656), Tamas K Lengyel wrote:
> This patch extends the information returned for CR0/CR3/CR4 register write events
> with the previous value of the register. The old value was already passed to the trap
> processing function, just never placed into the returned request. By returning     
> this value, applications subscribing the CR events obtain additional context about
> the event.
> 
> Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>

Applied, thanks.

Tim.

> ---
>  xen/arch/x86/hvm/hvm.c         |    4 ++++
>  xen/include/public/mem_event.h |    6 +++---
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 69f7e74..d46abf2 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -4682,6 +4682,10 @@ static int hvm_memory_event_traps(long p, uint32_t reason,
>          req.gla = gla;
>          req.gla_valid = 1;
>      }
> +    else
> +    {
> +        req.gla = old;
> +    }
>      
>      mem_event_put_request(d, &d->mem_event->access, &req);
>      
> diff --git a/xen/include/public/mem_event.h b/xen/include/public/mem_event.h
> index c9ed546..3831b41 100644
> --- a/xen/include/public/mem_event.h
> +++ b/xen/include/public/mem_event.h
> @@ -40,9 +40,9 @@
>  /* Reasons for the memory event request */
>  #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */
>  #define MEM_EVENT_REASON_VIOLATION   1    /* access violation, GFN is address */
> -#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is CR0 value */
> -#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is CR3 value */
> -#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is CR4 value */
> +#define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is new CR0 value, gla is previous */
> +#define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is new CR3 value, gla is previous */
> +#define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is new CR4 value, gla is previous */
>  #define MEM_EVENT_REASON_INT3        5    /* int3 was hit: gla/gfn are RIP */
>  #define MEM_EVENT_REASON_SINGLESTEP  6    /* single step was invoked: gla/gfn are RIP */
>  #define MEM_EVENT_REASON_MSR         7    /* MSR was hit: gfn is MSR value, gla is MSR address;
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2014-02-27 10:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-30 21:34 [PATCH] mem_event: Return previous value of CR0/CR3/CR4 on change Tamas K Lengyel
2014-02-06 10:14 ` Tim Deegan
2014-02-25 10:54 ` Jan Beulich
2014-02-25 11:35   ` Tim Deegan
2014-02-27 10:46 ` Tim Deegan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).