From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 6C33815C15C for ; Tue, 14 Jan 2025 15:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736867024; cv=none; b=Vbw0pxyBvUJpS2gxUn9RmeTNRqGmmt5VKkazTJLqFuqQBHIazncH3YD7vqNugn8mxw2HSa3Y88YxZhSBpIfDjkRxSJPrkUG3mWDLJCoAkQvdxZQbJxBZxxdyV4AylJ680H1UxK1dkSaybgyFxDDQwQG1pwIal0745AfuZy2e1Tk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736867024; c=relaxed/simple; bh=L0m2hO5GDz/6RXvIPW29Bm3Papzh/ACjoqWJuz/Pkqg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZMPREFn9naGaOtzHdVj4svHlaw9ll61/Iqp/eeoY23n6guz5w+GcJHhYsPR0wZIXzqR9k+RsyfMHq2RidTGxQP6Y2lg2pCipt/Lerjfje58wK4yclurFn+L6fLCUq6Ll1IegKXmmL+BzOSpwLn+YCvuW+veQekS0pI33Wco8VyE= 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=yZUUqN64; arc=none smtp.client-ip=209.85.128.51 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="yZUUqN64" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4361d5730caso44505e9.1 for ; Tue, 14 Jan 2025 07:03:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736867021; x=1737471821; 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=r3uX9sXBfAGLVLkprPT9LjGtR+jH3MZBlHxc/29olV4=; b=yZUUqN64QB03KrhLJzTn5U6RnwegEzs37bjct8lzlxYbI0yksG2IKQVASVW82BOvzb MoAPnzJtIORBietHuOOreSvuhABFHw/FlVNe+LLawlOarY+TUIl5PE/CbKeXy8P7EmRw 9rIl7HrONW1GmHtJQT42j9GLunsIQqUKuy/cnEcEpUabExDLTC+41uXiOQ81PylvvX6G aFPepepTVJJAOexMHBVfnM00/51uTVWFnB+zAn70Ck93hc5VukYD0cyvaW3wDbWJ4vJt Zlgfs15KslNSZe76MZ5nWbd1V61mzkqPaPqyJ5RJ2RcBghYWTCesuoCb3OzjI63cb7VG 4SHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736867021; x=1737471821; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=r3uX9sXBfAGLVLkprPT9LjGtR+jH3MZBlHxc/29olV4=; b=hD2kaGuEzd8nwrwQ+Z9oS/YUMqdPj1eaEnmGIh2qvC9pbDpV6ZrN4S0sdGDiP7K/Jo AcFhZ1w/teG4k2AKCVP+xoMwlwzm6nMMTgDm8Gmeoxr2KWYTuCyC/bn0XjT5iydJ2On9 B0J/qEdq/XjDHmkSPE2RsojpTwhQ6qyDE/kr8O8MICbMs/s+aOm5ZfRJEyYe00kpSvWg +00ne00yM6t/e3AdSRaCrMdV39yv+/MHr0ogv+YKu4ftoyaP8/eNJ0N1cESfeSq5iaJe zAfqaQBMBeMdGlUgDRZ7MdoUYCvzEewkosyUfBTACirOtA10XwaD51/hY0FdD/IYKueu a1Kg== X-Forwarded-Encrypted: i=1; AJvYcCWj5Btc420+s1HUVYxnRcLMyHlMlGwVt5RhHRiiJbJtbBHWZVQ/qme63swRagSNmWdGvvCyDwf8DQmXlig=@vger.kernel.org X-Gm-Message-State: AOJu0YwwNltZxS/Fdzg8Y+3QAti38a4QcuuNQ88tqJd5q5qMwyf6vpOh I63c6pGi+DkJkorDqjwAZMYIuiU+mOoDkdjJKDPhAcaS5mOdg6JirYKp1XK7Bg== X-Gm-Gg: ASbGncuPvY+5Wup6J8sb4kzQBTEYaCEU1c5Dz6sYaGgzf+51uOiNKZiydddbFrgHROY 66AzOFBzK/vTKMBcYxa9Kr3tca2Pmy+ha38FaMGOlYZxtrgtRiKJ1oKT+xG5T7hX8DEdWVIBNSi xTqpObN3PLfMwWUHuNfHiGUd/WArJADV9aZOdijWYu4pLE5kx00CxG2pfPKQNuqZgiwRRADSgOC eFhUON+KosGZwwWK2bFdnBm2i3seZh59nvjljb+/2Say65MwWU/01hX+PvFIpLcfXRuDsJiB392 GXQNpZN9vadvw4nHadaC8uw4 X-Google-Smtp-Source: AGHT+IGYqkoeO9rhW5ofYX5hkCQ3axs1adHzVPrXSPhBirum2F1DdwApMWgQvcwBhmV8s97iNigOAw== X-Received: by 2002:a05:600c:22d4:b0:434:9fac:3408 with SMTP id 5b1f17b1804b1-4376cbbdea5mr1143785e9.2.1736867020368; Tue, 14 Jan 2025 07:03:40 -0800 (PST) Received: from google.com (47.246.140.34.bc.googleusercontent.com. [34.140.246.47]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d2f5sm15218121f8f.17.2025.01.14.07.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 07:03:39 -0800 (PST) Date: Tue, 14 Jan 2025 15:03:37 +0000 From: Sebastian Ene To: Marc Zyngier Cc: catalin.marinas@arm.com, joey.gouly@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, oliver.upton@linux.dev, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com Subject: Re: [PATCH] KVM: arm64: Fix the upper limit of the walker range Message-ID: References: <20250114145050.563658-2-sebastianene@google.com> <86frllwilm.wl-maz@kernel.org> 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: <86frllwilm.wl-maz@kernel.org> On Tue, Jan 14, 2025 at 02:55:17PM +0000, Marc Zyngier wrote: > On Tue, 14 Jan 2025 14:50:51 +0000, > Sebastian Ene wrote: > > > > Prevent the walker from running into weeds when walking an > > entire address range. > > > > Signed-off-by: Sebastian Ene > > --- > > arch/arm64/kvm/hyp/pgtable.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > > index 40bd55966..2ffb5571e 100644 > > --- a/arch/arm64/kvm/hyp/pgtable.c > > +++ b/arch/arm64/kvm/hyp/pgtable.c > > @@ -260,7 +260,7 @@ static int _kvm_pgtable_walk(struct kvm_pgtable *pgt, struct kvm_pgtable_walk_da > > { > > u32 idx; > > int ret = 0; > > - u64 limit = BIT(pgt->ia_bits); > > + u64 limit = BIT(pgt->ia_bits) - 1; > > > > if (data->addr > limit || data->end > limit) > > return -ERANGE; > > Huh, nice catch. I guess this deserves a > > Fixes: b1e57de62cfb4 ("KVM: arm64: Add stand-alone page-table walker infrastructure") > Cc: stable@vger.kernel.org > > right? > > M. Hi Marc, Thanks for the prompt review. Adding the missing bits now and re-spinnig v2. > > -- > Without deviation from the norm, progress is not possible. Cheers Sebastian