ACK: [CVE-2017-15306][Zesty][SRU][PATCH 1/1] KVM: PPC: Fix oops when checking KVM_CAP_PPC_HTM
Stefan Bader
stefan.bader at canonical.com
Tue Dec 12 12:05:39 UTC 2017
On 12.12.2017 11:38, Po-Hsu Lin wrote:
> From: Greg Kurz <groug at kaod.org>
>
> CVE-2017-15306
>
> The following program causes a kernel oops:
>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <sys/ioctl.h>
> #include <linux/kvm.h>
>
> main()
> {
> int fd = open("/dev/kvm", O_RDWR);
> ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_PPC_HTM);
> }
>
> This happens because when using the global KVM fd with
> KVM_CHECK_EXTENSION, kvm_vm_ioctl_check_extension() gets
> called with a NULL kvm argument, which gets dereferenced
> in is_kvmppc_hv_enabled(). Spotted while reading the code.
>
> Let's use the hv_enabled fallback variable, like everywhere
> else in this function.
>
> Fixes: 23528bb21ee2 ("KVM: PPC: Introduce KVM_CAP_PPC_HTM")
> Cc: stable at vger.kernel.org # v4.7+
> Signed-off-by: Greg Kurz <groug at kaod.org>
> Reviewed-by: David Gibson <david at gibson.dropbear.id.au>
> Reviewed-by: Thomas Huth <thuth at redhat.com>
> Signed-off-by: Paul Mackerras <paulus at ozlabs.org>
> (cherry picked from commit ac64115a66c18c01745bbd3c47a36b124e5fd8c0)
> Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
Acked-by: Stefan Bader <stefan.bader at canonical.com>
> ---
> arch/powerpc/kvm/powerpc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index e584e99..2e0bf2a 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -616,8 +616,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> break;
> #endif
> case KVM_CAP_PPC_HTM:
> - r = cpu_has_feature(CPU_FTR_TM_COMP) &&
> - is_kvmppc_hv_enabled(kvm);
> + r = cpu_has_feature(CPU_FTR_TM_COMP) && hv_enabled;
> break;
> default:
> r = 0;
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20171212/cbd512df/attachment.sig>
More information about the kernel-team
mailing list