Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp466272pxj; Thu, 20 May 2021 13:38:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsaWQZvsrP6/yP+Zld4sXyCBTklehw03TG3q+w6XnKsO4TtClh0QdmCgUDIaeqGVKnBXM8 X-Received: by 2002:a05:6e02:527:: with SMTP id h7mr7297054ils.93.1621543118454; Thu, 20 May 2021 13:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621543118; cv=none; d=google.com; s=arc-20160816; b=tkWJux2NksiuYGJ2D74eJ6mIafd4QEBpPVpCQDOKSINa7IVaXyw+6G0N+IbLj32pAd fCv9ENkBgN+vHf/USfS6esju2+TUWf5lbl07ddovwo4YbMD/IR+xjWwmhcO8HKcFGXHu GfmsQquUP6ojlYoVaCQq7jZJZH3iy7F5VxNC/xC7oQBJtyrXZsAvhTEFGE1078rslAGa xOhMkcHz7pUABKN+TLS1ZCMYWH/OQrG2ZtdMy7tG1ybpmLAjuGXVGPW2htcsobroYECr jEDI9A/tinqymXmdod+jAK4fvkIyjBive10gxLeZ96KsRIQUhUUhJ1IA3FCE1QOKsalE 8srg== 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=PGqZOzGTlpGtLBHqL565GGvh2aqVOeM3Oju/Jg2gy0o=; b=ZJAUqLdrIBKFUDWqU2c46TpMOZoo6S66lVCFK/cNLL+c6o2vD6LVpJViolDLrLdeq8 oiDLitlPO6RVeriIWy6xCDnCoexS1LLX2y+AJwwSv6UG9aYvu6B562J0c2nSWhk9A91e KYg/ZKNpXcY7YVvbatmzGGOqf3WskciCp3xdZuuWaOKFxc1mGGDu/6x3YYpvr9PmF6f8 6VT3C7vBOkcS4VJH52R5r21hM5hUaDaWcVv3Ubp6EZKcQ/9JBrfbfo9GxwAV6pQceDEY 5zhTyk8P/3ReguUhhX53bU3rXinSiH+Fmoa8EiCdspYIe3ERSOEpcvwNRHcag/a5bS25 0kSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VKxOwsxn; 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 l11si3420438jah.65.2021.05.20.13.38.25; Thu, 20 May 2021 13:38:38 -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=VKxOwsxn; 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 S238528AbhETK4E (ORCPT + 99 others); Thu, 20 May 2021 06:56:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:43872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237283AbhETKkm (ORCPT ); Thu, 20 May 2021 06:40:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7B26161C85; Thu, 20 May 2021 09:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504538; bh=l2vINwjNzD/kL0d2dHFIoMKDvlhQqugNOsCZAc01pYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKxOwsxnzyMnAMlpnZ39WI5U5yFhf0DEA1/BIRdVJOnOibXunCoCJZdxmBV4+FP1z yGtYrfmO+W54MQ3HLcwxB4lu7RTjZlQBeAtHuv068urpkfLAe3kSDqqtNzOiRiD57j h3ATu6vq5o0ox5rywlOg3ICdkp5w3Uj+C06ZXZ7E= 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.14 292/323] KVM: x86: Cancel pvclock_gtod_work on module removal Date: Thu, 20 May 2021 11:23:04 +0200 Message-Id: <20210520092130.220378035@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 @@ -6420,6 +6420,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 = NULL; kvm_mmu_module_exit();