All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen: Prevent buffer overflow in privcmd ioctl
@ 2019-04-04 15:12 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-04-04 15:12 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Juergen Gross, Stefano Stabellini, x86, kernel-janitors,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, xen-devel,
	Thomas Gleixner

The "call" variable comes from the user in privcmd_ioctl_hypercall().
It's an offset into the hypercall_page[] which has (PAGE_SIZE / 32)
elements.  We need to put an upper bound on it to prevent an out of
bounds access.

Fixes: 1246ae0bb992 ("xen: add variable hypercall caller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 arch/x86/include/asm/xen/hypercall.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index de6f0d59a24f..2863c2026655 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -206,6 +206,9 @@ xen_single_call(unsigned int call,
 	__HYPERCALL_DECLS;
 	__HYPERCALL_5ARG(a1, a2, a3, a4, a5);
 
+	if (call >= PAGE_SIZE / sizeof(hypercall_page[0]))
+		return -EINVAL;
+
 	asm volatile(CALL_NOSPEC
 		     : __HYPERCALL_5PARAM
 		     : [thunk_target] "a" (&hypercall_page[call])
-- 
2.17.1

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

* [PATCH] xen: Prevent buffer overflow in privcmd ioctl
@ 2019-04-04 15:12 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-04-04 15:12 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Juergen Gross, Stefano Stabellini, x86, kernel-janitors,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, xen-devel,
	Thomas Gleixner

The "call" variable comes from the user in privcmd_ioctl_hypercall().
It's an offset into the hypercall_page[] which has (PAGE_SIZE / 32)
elements.  We need to put an upper bound on it to prevent an out of
bounds access.

Fixes: 1246ae0bb992 ("xen: add variable hypercall caller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 arch/x86/include/asm/xen/hypercall.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index de6f0d59a24f..2863c2026655 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -206,6 +206,9 @@ xen_single_call(unsigned int call,
 	__HYPERCALL_DECLS;
 	__HYPERCALL_5ARG(a1, a2, a3, a4, a5);
 
+	if (call >= PAGE_SIZE / sizeof(hypercall_page[0]))
+		return -EINVAL;
+
 	asm volatile(CALL_NOSPEC
 		     : __HYPERCALL_5PARAM
 		     : [thunk_target] "a" (&hypercall_page[call])
-- 
2.17.1


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

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

* Re: [PATCH] xen: Prevent buffer overflow in privcmd ioctl
  2019-04-04 15:12 ` Dan Carpenter
@ 2019-04-04 16:07   ` Boris Ostrovsky
  -1 siblings, 0 replies; 8+ messages in thread
From: Boris Ostrovsky @ 2019-04-04 16:07 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Juergen Gross, Stefano Stabellini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, x86, xen-devel, kernel-janitors,
	stable

On 4/4/19 11:12 AM, Dan Carpenter wrote:
> The "call" variable comes from the user in privcmd_ioctl_hypercall().
> It's an offset into the hypercall_page[] which has (PAGE_SIZE / 32)
> elements.  We need to put an upper bound on it to prevent an out of
> bounds access.
>
> Fixes: 1246ae0bb992 ("xen: add variable hypercall caller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

I am also adding stable@vger.kernel.org

-boris

> ---
>  arch/x86/include/asm/xen/hypercall.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
> index de6f0d59a24f..2863c2026655 100644
> --- a/arch/x86/include/asm/xen/hypercall.h
> +++ b/arch/x86/include/asm/xen/hypercall.h
> @@ -206,6 +206,9 @@ xen_single_call(unsigned int call,
>  	__HYPERCALL_DECLS;
>  	__HYPERCALL_5ARG(a1, a2, a3, a4, a5);
>  
> +	if (call >= PAGE_SIZE / sizeof(hypercall_page[0]))
> +		return -EINVAL;
> +
>  	asm volatile(CALL_NOSPEC
>  		     : __HYPERCALL_5PARAM
>  		     : [thunk_target] "a" (&hypercall_page[call])

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

* Re: [PATCH] xen: Prevent buffer overflow in privcmd ioctl
@ 2019-04-04 16:07   ` Boris Ostrovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Boris Ostrovsky @ 2019-04-04 16:07 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Juergen Gross, Stefano Stabellini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, x86, xen-devel, kernel-janitors,
	stable

On 4/4/19 11:12 AM, Dan Carpenter wrote:
> The "call" variable comes from the user in privcmd_ioctl_hypercall().
> It's an offset into the hypercall_page[] which has (PAGE_SIZE / 32)
> elements.  We need to put an upper bound on it to prevent an out of
> bounds access.
>
> Fixes: 1246ae0bb992 ("xen: add variable hypercall caller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

I am also adding stable@vger.kernel.org

-boris

> ---
>  arch/x86/include/asm/xen/hypercall.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
> index de6f0d59a24f..2863c2026655 100644
> --- a/arch/x86/include/asm/xen/hypercall.h
> +++ b/arch/x86/include/asm/xen/hypercall.h
> @@ -206,6 +206,9 @@ xen_single_call(unsigned int call,
>  	__HYPERCALL_DECLS;
>  	__HYPERCALL_5ARG(a1, a2, a3, a4, a5);
>  
> +	if (call >= PAGE_SIZE / sizeof(hypercall_page[0]))
> +		return -EINVAL;
> +
>  	asm volatile(CALL_NOSPEC
>  		     : __HYPERCALL_5PARAM
>  		     : [thunk_target] "a" (&hypercall_page[call])


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

* Re: [PATCH] xen: Prevent buffer overflow in privcmd ioctl
  2019-04-04 15:12 ` Dan Carpenter
  (?)
  (?)
@ 2019-04-04 16:07 ` Boris Ostrovsky
  -1 siblings, 0 replies; 8+ messages in thread
From: Boris Ostrovsky @ 2019-04-04 16:07 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Juergen Gross, Stefano Stabellini, x86, kernel-janitors, stable,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, xen-devel,
	Thomas Gleixner

On 4/4/19 11:12 AM, Dan Carpenter wrote:
> The "call" variable comes from the user in privcmd_ioctl_hypercall().
> It's an offset into the hypercall_page[] which has (PAGE_SIZE / 32)
> elements.  We need to put an upper bound on it to prevent an out of
> bounds access.
>
> Fixes: 1246ae0bb992 ("xen: add variable hypercall caller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

I am also adding stable@vger.kernel.org

-boris

> ---
>  arch/x86/include/asm/xen/hypercall.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
> index de6f0d59a24f..2863c2026655 100644
> --- a/arch/x86/include/asm/xen/hypercall.h
> +++ b/arch/x86/include/asm/xen/hypercall.h
> @@ -206,6 +206,9 @@ xen_single_call(unsigned int call,
>  	__HYPERCALL_DECLS;
>  	__HYPERCALL_5ARG(a1, a2, a3, a4, a5);
>  
> +	if (call >= PAGE_SIZE / sizeof(hypercall_page[0]))
> +		return -EINVAL;
> +
>  	asm volatile(CALL_NOSPEC
>  		     : __HYPERCALL_5PARAM
>  		     : [thunk_target] "a" (&hypercall_page[call])


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

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

* Re: [PATCH] xen: Prevent buffer overflow in privcmd ioctl
  2019-04-04 15:12 ` Dan Carpenter
  (?)
@ 2019-04-05  6:47   ` Juergen Gross
  -1 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2019-04-05  6:47 UTC (permalink / raw)
  To: Dan Carpenter, Boris Ostrovsky
  Cc: Stefano Stabellini, x86, kernel-janitors, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, xen-devel, Thomas Gleixner

On 04/04/2019 17:12, Dan Carpenter wrote:
> The "call" variable comes from the user in privcmd_ioctl_hypercall().
> It's an offset into the hypercall_page[] which has (PAGE_SIZE / 32)
> elements.  We need to put an upper bound on it to prevent an out of
> bounds access.
> 
> Fixes: 1246ae0bb992 ("xen: add variable hypercall caller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Pushed to xen/tip.git for-linus-5.1b


Juergen

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

* Re: [PATCH] xen: Prevent buffer overflow in privcmd ioctl
@ 2019-04-05  6:47   ` Juergen Gross
  0 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2019-04-05  6:47 UTC (permalink / raw)
  To: Dan Carpenter, Boris Ostrovsky
  Cc: Stefano Stabellini, x86, kernel-janitors, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, xen-devel, Thomas Gleixner

On 04/04/2019 17:12, Dan Carpenter wrote:
> The "call" variable comes from the user in privcmd_ioctl_hypercall().
> It's an offset into the hypercall_page[] which has (PAGE_SIZE / 32)
> elements.  We need to put an upper bound on it to prevent an out of
> bounds access.
> 
> Fixes: 1246ae0bb992 ("xen: add variable hypercall caller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Pushed to xen/tip.git for-linus-5.1b


Juergen

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

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

* Re: [Xen-devel] [PATCH] xen: Prevent buffer overflow in privcmd ioctl
@ 2019-04-05  6:47   ` Juergen Gross
  0 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2019-04-05  6:47 UTC (permalink / raw)
  To: Dan Carpenter, Boris Ostrovsky
  Cc: Stefano Stabellini, x86, kernel-janitors, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, xen-devel, Thomas Gleixner

On 04/04/2019 17:12, Dan Carpenter wrote:
> The "call" variable comes from the user in privcmd_ioctl_hypercall().
> It's an offset into the hypercall_page[] which has (PAGE_SIZE / 32)
> elements.  We need to put an upper bound on it to prevent an out of
> bounds access.
> 
> Fixes: 1246ae0bb992 ("xen: add variable hypercall caller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Pushed to xen/tip.git for-linus-5.1b


Juergen

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

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

end of thread, other threads:[~2019-04-05  6:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04 15:12 [PATCH] xen: Prevent buffer overflow in privcmd ioctl Dan Carpenter
2019-04-04 15:12 ` Dan Carpenter
2019-04-04 16:07 ` Boris Ostrovsky
2019-04-04 16:07   ` Boris Ostrovsky
2019-04-04 16:07 ` Boris Ostrovsky
2019-04-05  6:47 ` Juergen Gross
2019-04-05  6:47   ` [Xen-devel] " Juergen Gross
2019-04-05  6:47   ` Juergen Gross

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.