From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932435AbdJZNpx (ORCPT ); Thu, 26 Oct 2017 09:45:53 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:45025 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932234AbdJZNpv (ORCPT ); Thu, 26 Oct 2017 09:45:51 -0400 X-Google-Smtp-Source: ABhQp+SmpR3zsdBNsuaH30KEJ5bgW5LFeC9R09ezdWELmYCMVzpTPuv62ndpzx5PYGcGFCjXl0tDxA== From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Christoffer Dall , Marc Zyngier , Christian Borntraeger , Cornelia Huck , James Hogan , Paul Mackerras , kernel-hardening@lists.openwall.com, Kees Cook , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH v2 0/2] KVM: fixes for the kernel-hardening tree Date: Thu, 26 Oct 2017 15:45:45 +0200 Message-Id: <20171026134547.23664-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Four KVM ioctls (KVM_GET/SET_CPUID2 on x86, KVM_GET/SET_ONE_REG on ARM and s390) directly access the kvm_vcpu_arch struct. Therefore, the new usercopy hardening work in linux-next, which forbids copies from and to slab objects unless they are from kmalloc or explicitly whitelisted, breaks KVM on those architectures. The kvm_vcpu_arch struct is embedded in the kvm_vcpu struct and the corresponding slab cache is allocated by architecture-independent code. It is enough, for simplicity, to whitelist the whole sub-struct and only touch one place of the KVM code. Later, any further restrictions can be applied in the KVM tree. Paolo Bonzini (2): kvm: whitelist struct kvm_vcpu_arch kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl arch/x86/kvm/x86.c | 7 ++++--- virt/kvm/kvm_main.c | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) -- 2.14.2