From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BDA72FF179 for ; Fri, 21 Nov 2025 18:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763751369; cv=none; b=QktNrm7WKAZH7yCP3Hwj2/ZcgGXaV8/YaJoVLpjHhZNolSNXP5NCyOoVTqhhfBHDKx2fpHBqibxyDR8ycyV3MfS23VHJmuszRL5toe55JQZ2P/QGwT7sYvcw7AF80m24A3MHN+jwYSXDXVR7o+A+xiNayMnC5nCAGQ2cBI1frHo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763751369; c=relaxed/simple; bh=yqJq4nxqm4hdhXnz3iFnmvE2wXLFRti9zrk/vdKD7UA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=XYIvQQITbMFEDBTFH5I8JmFMg9N/wWPcU+QC4UCJU39ORb+sJtEIE0S3uxGrPFHDyjln4iqz+8ES41MzFJP89mW++HZyv0SU02/k1Ng42N/BHOYPOMSz+Ski7jLFMWTBNTD1liQ5KW5FNla3MeOjE7BmvaYpLJoEssxe6Z/7Ak8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=LLx78sYE; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="LLx78sYE" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-342701608e2so2639593a91.1 for ; Fri, 21 Nov 2025 10:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763751367; x=1764356167; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=A3QWlNVy57LnqwEzBf3LMc9SbGPppmAbNX2qZtCwvLM=; b=LLx78sYEger4TFU8AY9g66h1xIzn3A02kLAUJWKx2a4tvIkLClVX778xCDo93qB1J8 BnBBGS1Ntvyy6RQAnV00rvXun1XnNGV8j/ltthacJLpl6pTw91CUODiKqb0G3Bi0qPIg QbE3BO5vdcrqYW3uPkjoOofBxB/LdySHd4FAVbMpnPNOp3vGWLrouQpjeqfYrwH3TiUn VsIMuVAse30UkEbXBp8R9Oju2BIynZchbEqpdOaLmL5p14S3mqPaGSQnRJzcbLKdTi/w imrDH1qsPNCmMvDu/kT+D1MVDdGCG77mhVXSAXRDnO1OPKO+9AII8uP0YXZsTILCUqzP 0HvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763751367; x=1764356167; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=A3QWlNVy57LnqwEzBf3LMc9SbGPppmAbNX2qZtCwvLM=; b=vnbHdIgNRrfh0UJyM7JpLEBBwYIm2snAuKKkm/PHe3PHAdNzysc5ufa0Vnqfc6rnVL 9n+LDRVT9Fr39Uhm9Z9raAsdF9QLkcTJh5DZN3nVJCsqGZ4jmrhdyDgj5wmrXqekXkqh eEamf2j1jIcaPQ1xiYjlMGxd0TUMFyJL3m2RSQRytJN+q5EHyfePiPUMMsTfj4va5WsL 0nHsMPXJ3uw2bmsQU5cKZB3Wp0OajiNQRT4QibRzsSbKClENsOt0pE/ajVvjT9fL6RcO ujUWnJ6XfYdlQ2rcXiGMmtWBi0BKUhF9Ox8iwYk7AWY9PedAS+qd9CjjIZmU4NG2/SEZ CB+g== X-Forwarded-Encrypted: i=1; AJvYcCVCyyN6Lty+PYfPA0CdlqKnhQhVia2JVPOr91/AKUAsapTbg4fGC8i7yfBW9r1EkR4v+YfV9KfGeqdeX+M=@vger.kernel.org X-Gm-Message-State: AOJu0YwfVMZyZPvF3tS+CHZIkfhmzB9LisqCES3SYQSOZdpyAM3nJexl LMbU8mpatlAch7pxcimbfxuYXhJp1iwJ4oc7WihZw/0gXpzilGJM+QFWzevDQccx42pX5QClRp7 ffWU5gA== X-Google-Smtp-Source: AGHT+IGNWHWjX7e535/RFmTpoqIaiYvqySpkUhhgXs4Lf2QgB2ZqjoWFAIJ27q0K38Ohj4QelXWDC9ZUbVM= X-Received: from pjo1.prod.google.com ([2002:a17:90b:5661:b0:340:c1bf:6e2d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:ec8f:b0:340:66f9:381 with SMTP id 98e67ed59e1d1-34733e59272mr3932957a91.10.1763751367301; Fri, 21 Nov 2025 10:56:07 -0800 (PST) Date: Fri, 21 Nov 2025 10:55:29 -0800 In-Reply-To: <20251108013601.902918-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251108013601.902918-1-seanjc@google.com> X-Mailer: git-send-email 2.52.0.rc2.455.g230fcf2819-goog Message-ID: <176375129249.290125.10701416647980581775.b4-ty@google.com> Subject: Re: [PATCH] KVM: x86: Allocate/free user_return_msrs at kvm.ko (un)loading time From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Gao Content-Type: text/plain; charset="utf-8" On Fri, 07 Nov 2025 17:36:01 -0800, Sean Christopherson wrote: > Move user_return_msrs allocation/free from vendor modules (kvm-intel.ko and > kvm-amd.ko) (un)loading time to kvm.ko's to make it less risky to access > user_return_msrs in kvm.ko. Tying the lifetime of user_return_msrs to > vendor modules makes every access to user_return_msrs prone to > use-after-free issues as vendor modules may be unloaded at any time. > > Opportunistically turn the per-CPU variable into full structs, as there's > no practical difference between statically allocating the memory and > allocating it unconditionally during module_init(). > > [...] Applied to kvm-x86 misc, thanks! [1/1] KVM: x86: Allocate/free user_return_msrs at kvm.ko (un)loading time https://github.com/kvm-x86/linux/commit/11d984633f7f -- https://github.com/kvm-x86/linux/tree/next