Received: by 2002:a05:6a10:6f26:0:0:0:0 with SMTP id jd38csp1752962pxb; Mon, 17 May 2021 19:09:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiRHLPNp9xxpcMBNmy4igQ3vRPxaoAFzBJq5uI+4prdn20WEH7ojdX47HjOoqpWCYy0l2g X-Received: by 2002:a17:906:e294:: with SMTP id gg20mr3343075ejb.227.1621303774001; Mon, 17 May 2021 19:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621303773; cv=none; d=google.com; s=arc-20160816; b=BQXUwI4I0ABS8W6GziH99whfg7frZEvgBBg3w/YhlJsEOIrH+GvlTt+KE01DOwlLCs HfuXrGe5hchpmUDaOKw/OICY8QdauihXb+VDjVBiLYYxuRCy/J1/QeWFG7IbB2KMX1vG ms2F3DD8R4syrjRtPy0oJ1mqBzKf9XeYQSGz60k7T+J9BSrOaFn9Y7dlXsT2ppWNLNBA Y3yb8V4dqC40sNgV9U/4gj7suPyWR8FOiiItya69JnAVt7MEGak3jDhzjUVeqIhAeke0 oaQTk+TLF/k4yVeB10NxQsGJ6T11gOkL/RrRzMid786YXj5uA0vFFMbcPSpm5VMyzbAu +F1Q== 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=ITTFkHCAo2OtLhFYNwzV7ZNYTGHmp3uKYSBKwthJnss=; b=LoCNfRA/mlOaHDRNzTbrOZ0LDhPBOpCs9u8Fyg8BOMfCBGp3hdx7lmHVbdURCN63Jx L1LRFsjQ2aCAqDMmBSvWZhtpBQ/pLvIT+Cb02KFZYLTvuG30pvCVMVCCWCsdkyYAQurn SZoUgHKrGJTDGVIR6lxWkq/uA3NL8clbUTVEpo0e2Qk8T8yWvKITnqRBXI68jpsGTUJ/ e2JS8z+wxmPq/J8Hpf+5pY41ZMHWC1P6OBN6bbXq0SQKNcFJWnKpIuzuISniyUm+Fr/B 4c5yAyijANLcpW8YdNBRL4C6sEvST2ePD9gHMAP1uaFVsvXgwlDNuBbezkiAQF/wixER uegQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g2emMDC2; 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 hb7si16078507ejc.507.2021.05.17.19.09.07; Mon, 17 May 2021 19:09:33 -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=g2emMDC2; 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 S238395AbhEQOhT (ORCPT + 99 others); Mon, 17 May 2021 10:37:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:43164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240121AbhEQOdk (ORCPT ); Mon, 17 May 2021 10:33:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BAA42613F0; Mon, 17 May 2021 14:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260968; bh=aDl7CI31KRCpujTGlycyuxBH8b2aZG9xBJYxehUrVRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g2emMDC2wUsFcKtkdlahFu1CKRDXoHGVJkUuUpjTdLSbQ8RiC6Y7WY6mqkyVHSp3A MTjE4KRoOi5qRS9ZMlmecBHGCLQRG3nUHY3zeCKXEvc7pFnGvKhV8K/HD2exW4Ci3t YNMeN6bjy4Ip0he4esh8dACDojuhTPTnoPzOtXEE= 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.12 277/363] KVM: x86: Cancel pvclock_gtod_work on module removal Date: Mon, 17 May 2021 16:02:23 +0200 Message-Id: <20210517140311.983195418@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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 3406ff421c1a..f1fd52eddabf 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8096,6 +8096,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