xen: Prevent buffer overflow in privcmd ioctl
Subsystems (4)
PATCH 1/1 xen: Prevent buffer overflow in privcmd ioctl
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.
--- arch/x86/include/asm/xen/hypercall.h | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/include/asm/xen/hypercall.h +3 -0
@@ -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 ; + asmvolatile (CALL_NOSPEC : __HYPERCALL_5PARAM : [thunk_target] "a" (&hypercall_page[call])
Signature · 1 line
2.17.1
Quoted 7 lines · Dan Carpenter
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 <[email protected]>
I am also adding [email protected]
-boris
Quoted 18 lines
--- arch/x86/include/asm/xen/hypercall.h | 3 +++ 1 file changed, 3 insertions(+)arch/x86/include/asm/xen/hypercall.h +3
-0@@ -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 ; + asmvolatile (CALL_NOSPEC : __HYPERCALL_5PARAM : [thunk_target] "a" (&hypercall_page[call])
Quoted 7 lines · Dan Carpenter
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 <[email protected]>
I am also adding [email protected]
-boris
Quoted 9 lines
--- arch/x86/include/asm/xen/hypercall.h | 3 +++ 1 file changed, 3 insertions(+)arch/x86/include/asm/xen/hypercall.h +0
-0
arch/x86/include/asm/xen/hypercall.h xen_single_call(unsigned int call, · line 214
Quoted 9 lines
arch/x86/include/asm/xen/hypercall.h +3
-0@@ -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 ; + asmvolatile (CALL_NOSPEC : __HYPERCALL_5PARAM : [thunk_target] "a" (&hypercall_page[call])
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Dan Carpenter
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 <[email protected]>
Pushed to xen/tip.git for-linus-5.1b
Juergen