From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 12B973B634E for ; Fri, 29 May 2026 08:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780041777; cv=none; b=coZD3FCARpif5MgvDXd+Kw+2AY5vO6nyFlh58ihpkOguUCbxzTcyXf2eFpaFKkOx0mha5qHsKn5bxTOmy05fJ+74IwZEmsIPiIsGaZVaRcLsiSBG8j2osya/KbH9JM5AXOi6Ip0araTQgPs39Xsst+evJhPtzzxPC7f0yG5mmNM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780041777; c=relaxed/simple; bh=/1pir3LF79JOz5u0/10ODgRwehHuX74Gb0sQ5Udr+nU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oBQFNnmYPnPbQEk7hTgzd0AG795RAt/8C4OftYsadmczoY1hog8uvglCqP5u4L+4l+KTlG8ny+cCZNHgrfElwQcU0mb/b+kT+DI2bqFzTGr0o35ToObZ20lK6Nonzptelf+uuSX+QCi1daz5TB82BDPvb3SOew0hfHSe/oGo4D8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TyaE8wJB; arc=none smtp.client-ip=209.85.221.54 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TyaE8wJB" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-43d77f6092eso7690106f8f.2 for ; Fri, 29 May 2026 01:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780041773; x=1780646573; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=EEpP20QLYbUafDoJ1/D4YHhW2s2jVmPtJASihmV02YE=; b=TyaE8wJBNz/uOiWRfM/BSTzMYiCBgkwBt7aCiRBs65yNTKl+Xf4doQxNUmANzIkpuw RcoQsdugC/IhyLJhLijJ8DYNdn8yQAAiLcRBzSwSzxdPvEmsNcjqwCiF4uFQCQ25SER1 LcN8E7zOL1PIqAAVhyj9FL/s4Vo/3Rb7k+Isaqv6uC+Km/4qt4jnfcsPVfjloZQbidkS 87IPp1YvZMxEEv7t0hLGpjolUZ76MZRNhecDs10i+C2HqM+b9vYfeMRhyRKglavfFojr X5atsMtLzDCCk8GApGn959fTOVENVq3j5IEgBNQFfe0m2Vv5JcfD8ae5GPDUd7vbMflr vdrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780041773; x=1780646573; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EEpP20QLYbUafDoJ1/D4YHhW2s2jVmPtJASihmV02YE=; b=c6frid2Y5LSogwyG5nLUMFSzs2wOaFUZiF/k21WmSbnunpmtQMUcWU9XcUl+e4eWfW AvkiuyQzrDIYGLTlLL74uBmIYIrWWXYhZDPAUoh4JPPwHfrZ+SkVvaBa/UkbEqy3b95w 4UdPrtQjA71xSIaciemsSE09C1eDQVtosrVfqUxWbSKWUbf7CEbvZ+5R9rlXAqqcpPcx NdLCXxII9nPh+jFJ08pPKTeYmESIsJbfS2f++BbK4Jy/ptxpHoyWJFxvpf7CsCI1YY2o iRaFr96smjRK5RTYGp4zlkkPUSeaUL2nCd7x21zzMu2FhYoKIQ6mD4CdK+8eJe6Cmfo4 mpSw== X-Forwarded-Encrypted: i=1; AFNElJ/FP+Jj9/MZ6WXz8fpNbRkjQ7SM+wjbpa3+VfXZVKHtdutyuqmU0FvNwy5KkZ2EPUtGOL4HLodgffXqPYk=@vger.kernel.org X-Gm-Message-State: AOJu0YzPs3KrqsD72nH2iAua5r9ywxle7ayWNw7LhD4JlJCx3mcAOC0p JkygDzK2HbctS4pwLg5yDcvhUCf2+6OGKsnaFBdp5zs4pNs3ur398P3J8+gjMyETUA== X-Gm-Gg: Acq92OH3KNdG8J8xtluWxW+hAZXemVcBGTx4DgFgOrAS+cCkhmyZwOjrKZCfNzqaQsi Hkbm1ZjFLhUvMhsXV+0z1Hf7FZg0dPKLLXWI79c5wXKHybolbTd2voMUCUdB2frXiPrlKN5s2kQ 1oUbOWDw/9mrWxdrp2a7ApvFOJ6M+vSrl/l7iVvkcvnFKvLv9cTttjzJn8oI34nAXZ9Az4Owp+s 69YvuZD9XDZy7eLeGF3MjjW0bKkOAY83HbdrfI0VElUQDv54ATuK//jgZhiAWoJoiEQIZTd0+T5 dCbzmnXW1M2Y8LY3Jnd8PJHu6Paqi2kqBzumg5QZN2g4lFZ8TTv1gNmjIb72TAf9zv7B7p81HB7 aH261GfpSpq8hCn4+GF2eMMxXIlfzf0AiMmqmn0exwrWI3kLZaFV8RBLa6Ye9zGq9XbvPrSl7VE pkN3X/86Idd2FdlmZJURerOwb23RheMqtUh4ZaXiNxlQnMJogZDS3+E5bWMpc7x6ZjC6M7dHlE3 Un3Tw== X-Received: by 2002:a05:600c:c16b:b0:48a:563c:c8c0 with SMTP id 5b1f17b1804b1-4909d2e8ff7mr29149015e9.7.1780041772883; Fri, 29 May 2026 01:02:52 -0700 (PDT) Received: from google.com (135.91.155.104.bc.googleusercontent.com. [104.155.91.135]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4909c12b6ddsm8900445e9.33.2026.05.29.01.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 01:02:51 -0700 (PDT) Date: Fri, 29 May 2026 09:02:45 +0100 From: Vincent Donnefort To: tabba@google.com Cc: Marc Zyngier , Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Quentin Perret , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/2] KVM: arm64: Fix host/hyp tracking on share/unshare hypercall failure Message-ID: References: <20260529074341.2271950-1-tabba@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260529074341.2271950-1-tabba@google.com> On Fri, May 29, 2026 at 08:43:39AM +0100, tabba@google.com wrote: > Hi folks, > > Yet another bug I found while testing Sashiko locally with fixes to > review-prompts. > > share_pfn_hyp() and unshare_pfn_hyp() in arch/arm64/kvm/mmu.c > maintain a host-side RB-tree mirroring the set of pages shared with > EL2. Both invoke a hypercall that can fail (page-state mismatch, > EL2 refcount still held), but neither cleans up on failure: > > - share_pfn_hyp() inserts the tracking node before the hypercall > and leaves it in the tree on failure, leaking the allocation and > presenting a phantom share to a later unshare. > > - unshare_pfn_hyp() erases the tracking node before the hypercall; > on failure the host loses its record while EL2 still owns the > share, breaking later operations on the same pfn. > > Severity is low (no isolation impact) and the failure paths are rare > in practice, but the desync is real. Both patches are independent and > apply cleanly to current mainline. In other words, this can wait for > 7.2. I believe I fixed that here lore.kernel.org/all/acyKhZL2di_QQ9xm@google.com but as Quentin pointed-out, there's absolutely no reason for the hypercall to fail. So I haven't sent a v2. > > Cheers, > /fuad > > Fuad Tabba (2): > KVM: arm64: Free hyp-share tracking node when share hypercall fails > KVM: arm64: Avoid host/hyp share desync on unshare hypercall failure > > arch/arm64/kvm/mmu.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > -- > 2.54.0.929.g9b7fa37559-goog >