Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp597788pxj; Tue, 18 May 2021 09:58:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2aOSeDPU4gUtmTjSaG3Cy0p9PoXyt3StKUA5MQRFo69mDQzTmijiXeDY69R3+tsyAKn59 X-Received: by 2002:aa7:c349:: with SMTP id j9mr8118388edr.135.1621357091256; Tue, 18 May 2021 09:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621357091; cv=none; d=google.com; s=arc-20160816; b=vK5o9y8Ur34lcuFgl6GjweTEC9yMzJIV5S8iycxRmkrXGgcxyJMH0DT5q7xaO9i7zO mlXIzl/jNJgVGbW03gO8Ku0+WuUz9Y3Uv/ePTjNzxVkjZB+ssBxlv3lB0/0GQBs1KYFE 8sWsfH7wGHsk8OnTtUsKMo4LgOJXbmjxrzni2dmmjx8Vvjjn8Kj69xpTD+g1ObIWlmK7 1KwLfrEjo15niMzwygtGJp3q7OIPbWcGoemN0IBhfSvSBTwXOQvajgn+iPPVPA/KJqJb sbSWRKs+UbTIKRNFOzT+NPkooq0Vrx8Asn9kiRD8FT5cQves3k+LCX/YGUU1R1Rp/EyX fOBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+1hu4e5Qmk8r6tDCmrkoklPOvleZ8mKixc1SiifOULc=; b=xJ92k/8voebQB/81bWzYTu02aflG8OsZ25aoMF3g7KtsVYP+bSB9kjnFOKUlbcvJ+5 bN7ip9BfreP0EfXSYQcKMnWF8vUXFxe+QPV4K1TNuYvWnafLIsQ7Cga7+DKogef/R8P6 dJ9IxMZ6tWpFLNLl0ew3B2Pv4754To/QwPSm2ab6iv6F79tF1DI782zrDrRSNEdWfmOu 6XbMjZ8G1ut7qqKec7gyFKK10QVoUQKruoZmZpUW34FyKUR52MK3F0U/rZ7+O2vs4u84 z9tWBid+a5pPFwM1U8AvXH8nACx5/qVLzW75A4+SQxW+l3OxrqjZ9ZDohOWvC5SEcCWi EPvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J6NcRj56; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg13si87209ejc.288.2021.05.18.09.56.56; Tue, 18 May 2021 09:58:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J6NcRj56; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245347AbhEQQDJ (ORCPT + 99 others); Mon, 17 May 2021 12:03:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:55058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343818AbhEQPnM (ORCPT ); Mon, 17 May 2021 11:43:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E647E61D25; Mon, 17 May 2021 14:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262560; bh=uoLj/5aCVhXdL3ZoWo6XXF4jKr0TLp5ea7ZK4wYO7/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J6NcRj56brrM4mDlgPnKFkzsNX6YIEVyxx1+OdBwIml1QX1bZmB2v7KfshRS/OKJ5 yzsu60jE4Fy7Lshvlfby/KRqmE79VKqhVxgH9XY1ngWSvpDccQSf5nLogJejWMc/cN j7LnPqcMlGdP8KlPTlTlKn5ZEhGeXx/x3GR3MquY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.10 214/289] KVM: x86: Cancel pvclock_gtod_work on module removal Date: Mon, 17 May 2021 16:02:19 +0200 Message-Id: <20210517140312.330671454@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner [ Upstream commit 594b27e677b35f9734b1969d175ebc6146741109 ] Nothing prevents the following: pvclock_gtod_notify() queue_work(system_long_wq, &pvclock_gtod_work); ... remove_module(kvm); ... work_queue_run() pvclock_gtod_work() <- UAF Ditto for any other operation on that workqueue list head which touches pvclock_gtod_work after module removal. Cancel the work in kvm_arch_exit() to prevent that. Fixes: 16e8d74d2da9 ("KVM: x86: notifier for clocksource changes") Signed-off-by: Thomas Gleixner Message-Id: <87czu4onry.ffs@nanos.tec.linutronix.de> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 25660cac6ad4..4bd99f046b0c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7981,6 +7981,7 @@ void kvm_arch_exit(void) cpuhp_remove_state_nocalls(CPUHP_AP_X86_KVM_CLK_ONLINE); #ifdef CONFIG_X86_64 pvclock_gtod_unregister_notifier(&pvclock_gtod_notifier); + cancel_work_sync(&pvclock_gtod_work); #endif kvm_x86_ops.hardware_enable = NULL; kvm_mmu_module_exit(); -- 2.30.2