All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/traps: replace ASSERT() checking array bounds
@ 2016-11-07  9:25 Jan Beulich
  2016-11-07 10:22 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2016-11-07  9:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Wei Liu

[-- Attachment #1: Type: text/plain, Size: 698 bytes --]

Avoid out of bounds accesses on non-debug builds.

Coverity ID: 1055744

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -3764,7 +3764,11 @@ void async_exception_cleanup(struct vcpu
             if ( (curr->async_exception_mask ^
                   curr->async_exception_state(trap).old_mask) == (1 << trap) )
                 break;
-    ASSERT(trap <= VCPU_TRAP_LAST);
+    if ( unlikely(trap > VCPU_TRAP_LAST) )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
 
     /* Restore previous asynchronous exception mask. */
     curr->async_exception_mask = curr->async_exception_state(trap).old_mask;




[-- Attachment #2: x86-async-exception-assert.patch --]
[-- Type: text/plain, Size: 745 bytes --]

x86/traps: replace ASSERT() checking array bounds

Avoid out of bounds accesses on non-debug builds.

Coverity ID: 1055744

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -3764,7 +3764,11 @@ void async_exception_cleanup(struct vcpu
             if ( (curr->async_exception_mask ^
                   curr->async_exception_state(trap).old_mask) == (1 << trap) )
                 break;
-    ASSERT(trap <= VCPU_TRAP_LAST);
+    if ( unlikely(trap > VCPU_TRAP_LAST) )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
 
     /* Restore previous asynchronous exception mask. */
     curr->async_exception_mask = curr->async_exception_state(trap).old_mask;

[-- Attachment #3: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] x86/traps: replace ASSERT() checking array bounds
  2016-11-07  9:25 [PATCH] x86/traps: replace ASSERT() checking array bounds Jan Beulich
@ 2016-11-07 10:22 ` Andrew Cooper
  2016-11-07 10:41   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2016-11-07 10:22 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Wei Liu

On 07/11/16 09:25, Jan Beulich wrote:
> Avoid out of bounds accesses on non-debug builds.
>
> Coverity ID: 1055744
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -3764,7 +3764,11 @@ void async_exception_cleanup(struct vcpu
>              if ( (curr->async_exception_mask ^
>                    curr->async_exception_state(trap).old_mask) == (1 << trap) )
>                  break;
> -    ASSERT(trap <= VCPU_TRAP_LAST);
> +    if ( unlikely(trap > VCPU_TRAP_LAST) )
> +    {
> +        ASSERT_UNREACHABLE();
> +        return;
> +    }
>  
>      /* Restore previous asynchronous exception mask. */
>      curr->async_exception_mask = curr->async_exception_state(trap).old_mask;
>
>
>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] x86/traps: replace ASSERT() checking array bounds
  2016-11-07 10:22 ` Andrew Cooper
@ 2016-11-07 10:41   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2016-11-07 10:41 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel, Wei Liu, Jan Beulich

On Mon, Nov 07, 2016 at 10:22:56AM +0000, Andrew Cooper wrote:
> On 07/11/16 09:25, Jan Beulich wrote:
> > Avoid out of bounds accesses on non-debug builds.
> >
> > Coverity ID: 1055744
> >
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 

Release-acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-11-07 10:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-07  9:25 [PATCH] x86/traps: replace ASSERT() checking array bounds Jan Beulich
2016-11-07 10:22 ` Andrew Cooper
2016-11-07 10:41   ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.