Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp69567pxj; Thu, 20 May 2021 04:47:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMzG70+KWv/fbvKqSLGs8b6h2uwbvdqoQt5pS8UG3MR9ZPPra0cW9pRcJjjEDxIA9MrObv X-Received: by 2002:a05:6402:34d5:: with SMTP id w21mr4589013edc.38.1621511273802; Thu, 20 May 2021 04:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621511273; cv=none; d=google.com; s=arc-20160816; b=hnEZx7yH6Wi/RndmHOXGVQbcimG1/Kgpk5YqKtn7DS/I2FihCTvd+rA77K7iQ2L0u7 QcawRdVj8f6YdFWQBzyk1239R6rZfcNKll9gy8pMC1MTS1t8qGGxG1USvYMkJHKTQHMS RVqHiza5ekDGLlFCfvOcbSLg2ZVVZh7R/fzqAlME4CQGVfXr7EJiBIiwedHd4g1Yyec7 VKZmRewl+RbmRlk5CX9zIE+8Jv8maXSZ0kqfqKDWSnT3owFcUpCzXFL8vowmmgo8w8uy AjJc9YQXlaa0VWTzrGJkzhEG7YwGW177U9Pd2wPejNb3gM2HL7kx8t4JpSrIaZvKKYpt O73w== 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=bJXbzaFiK/NpEvmGI5qOBTCmwNlORs/abn0Rc9d3zGM=; b=eVLXFGFBjMbzZkWwjjAiQJQBqb/53e9HTJeEC58LWKJ1AiO0rfRI7nqjF0jnhrLfGy lussmgbRgJ0jrk8HBtXfpOAnCEqeejYFPeTSsWxbsPSQ5WStifn/ieVTghn91kZQStNR /XdlsbOieMeKGKsHB6Q7qhtbKpAK4IVRm4wLT/6wiBBxygXTIadPiq29RNihl3ozWLQN XchrpLZT7/Av1kGRXUCpp8H3opDuEWP+TwSjkBsc6MTS13yOYTsGB2uVLXnHxU6kUSyg sYsId5ogtu6/eQYSH3pewar0iiFZrkI2VgFj7HvJzyq/yX4G5KCYFaO9Z6WqhLPEfSHU CKVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sUXU55Gf; 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 j6si2359597ejv.315.2021.05.20.04.47.28; Thu, 20 May 2021 04:47:53 -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=sUXU55Gf; 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 S241955AbhETLqj (ORCPT + 99 others); Thu, 20 May 2021 07:46:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:43606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240404AbhETLWg (ORCPT ); Thu, 20 May 2021 07:22:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E9296143B; Thu, 20 May 2021 10:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505514; bh=0TobhOhGqIN3KUTQo324aLsaE1xxpO7oxPxdAzznYN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sUXU55Gf7uc81RiGUqq8AiKKXKfOhaOWTaLiTEW4aUAc3n+15692oPuYxKeNijXrv gaGYzEB433qURX9mlIeKLBnZNeNF7Bwj9Ew6T7YDyA4CRnwAc/obuNfPltQ2sMlHm3 sKsoDY+kSPjYYUUW4mSNPUIdlIt7cCTf+swyF4QI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Paolo Bonzini Subject: [PATCH 4.4 169/190] KVM: x86: Cancel pvclock_gtod_work on module removal Date: Thu, 20 May 2021 11:23:53 +0200 Message-Id: <20210520092107.764024315@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 commit 594b27e677b35f9734b1969d175ebc6146741109 upstream. 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: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6016,6 +6016,7 @@ void kvm_arch_exit(void) unregister_hotcpu_notifier(&kvmclock_cpu_notifier_block); #ifdef CONFIG_X86_64 pvclock_gtod_unregister_notifier(&pvclock_gtod_notifier); + cancel_work_sync(&pvclock_gtod_work); #endif kvm_x86_ops = NULL; kvm_mmu_module_exit();