Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp525590lqb; Thu, 29 Feb 2024 07:41:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUAXVblNqq6ZRrCzZce9Jbxi4yFhlkf0aoHEF5rlDVFJXG84mceLFwuNSwkDzwhHsyfshX5NPBTLB3azU8xvDWzK4qaOk6zn8TxU8rXvQ== X-Google-Smtp-Source: AGHT+IGZYDgJ+h7uIM3Ay/d7nnCLeeeNXXd1FXrWs70L57vtrw5KsMhFVaPaRhVc9bnkwmz7aWhP X-Received: by 2002:a05:6a21:3405:b0:1a0:ecb4:d79d with SMTP id yn5-20020a056a21340500b001a0ecb4d79dmr2622260pzb.4.1709221303011; Thu, 29 Feb 2024 07:41:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709221302; cv=pass; d=google.com; s=arc-20160816; b=CHXBCI2s6jD/YxHlOd2z+Dmi6cGi/2YqfKMJvbVibfzo39PM+tdUQJ/nYEyj8wmXuZ 4Ccijl0KDauj8m0WQSiKikj12GYtHnr/fhtJb7TFaF8EjO6mc5MzUwMOs+iUCRNEjTI6 ysv/1/yUd6cIY4Se8U5qAN5rsmlxfdSJPdc4suT4uY/KAWcK+6Bg/Yvsixoe1M057Ybz 0fFEMOC3BdOiWRgQ1ywnwjP+ygMy0pPEVzGMB8M85Gq4fMTPSjoMWpnlZWRbOV9b4Y9L megXV+SMGMgbXckchRH12j+p10H0012XBWpOczaEpXIRVBwyDVjm3OhI1tRxFbgKBvdA q90Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=sIXwN+5WnK4Vru4tehkrsP9cXerm9lBDB32RGkdSv9M=; fh=jwx9jviQcYX+1lMzX5oGcLpDj/ELbc50RayyMXUz4SE=; b=OJOSLh1pz4DotGgmTgUEJOqTcO1AqfFORBUQNSwERo4L2jcpIZEVG2e71s7MwTvcRc pugybFGvsbzpqyrtVHL1D7i8+s8DMC5TkQxoRz1ruReL5No2JL9CB2juXylllKo8ztNp pHixe2SvG03EGn6qz3ovGZ0IuWcTybSyxafIvJhBODslDzaGSMsnm3dTNhMRz9TPNLGD wMwnPQIsMtDyNkJURefYx5SEUBf5VzxCYroPm8b/DDUkIjyOKGkKorGu5S6o/l5whoTo /z3OFhP+yQrQiRhjMdw0upjIxyKIdMpaOS7qaqLBZ/o3sLroQGynCVQIidPDBK0cwQY1 TPsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-86937-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86937-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d6-20020a63fd06000000b005cecc6097f2si1512217pgh.895.2024.02.29.07.41.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 07:41:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86937-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-86937-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86937-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A33E7B24005 for ; Thu, 29 Feb 2024 15:39:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF38F145B32; Thu, 29 Feb 2024 15:39:07 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 566C21386A8 for ; Thu, 29 Feb 2024 15:39:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709221147; cv=none; b=t26bwJIqh2o97inrM397avi8uzVeT4gNkAlXjlvcDTRACho9jKSL7tMUbHTyNZnlyZz2OnldaP52FhhIiETM6OXB1ebR7E/IlUI2ZLIrOnnLBVI8/v6Q2agZdB+b4d4UaAakwzQf1rnv/TNwkitdhWPREFkmBaQHTUhJ8EPQHBU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709221147; c=relaxed/simple; bh=iOgbEivwbbXs3WXqpWMHM08jWcL18JmzqpU2dzE4bjc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lj5LaZPcwE1O4jLEq3QJywvfIlgCbV5iLXvx5Y2NDbiX8SE7mwK3gvhIhp+sdnyzpwJxc6ppIFtIuNIFwV9GC7DU4yTIsfuHo51rsqPw7b/Q4uf7nzC9tUKlmQBMuOzjt5UouIMRlWXWLt3QR+YTAx01Yj+QKnldcRnzUwma+78= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr; spf=pass smtp.mailfrom=ghiti.fr; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ghiti.fr Received: by mail.gandi.net (Postfix) with ESMTPSA id 4F7B720008; Thu, 29 Feb 2024 15:38:59 +0000 (UTC) Message-ID: <97fec9bc-3b19-4b4e-8627-81c6f9298c4c@ghiti.fr> Date: Thu, 29 Feb 2024 16:38:59 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH -fixes] riscv: Sparse-Memory/vmemmap out-of-bounds fix Content-Language: en-US To: Dimitris Vlachos , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, palmer@dabbelt.com, alexghiti@rivosinc.com, paul.walmsley@sifive.com Cc: clameter@sgi.com, akpm@linux-foundation.org, rppt@kernel.org, arnd@arndb.de, mick@ics.forth.gr, csd4492@csd.uoc.gr, maraz@ics.forth.gr References: <20240229143833.107724-1-dvlachos@ics.forth.gr> From: Alexandre Ghiti In-Reply-To: <20240229143833.107724-1-dvlachos@ics.forth.gr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: alex@ghiti.fr Hi Dimitri, On 29/02/2024 15:38, Dimitris Vlachos wrote: > Offset vmemmap so that the first page of vmemmap will be mapped > to the first page of physical memory in order to ensure that > vmemmap’s bounds will be respected during > pfn_to_page()/page_to_pfn() operations. > The conversion macros will produce correct SV39/48/57 addresses > for every possible/valid DRAM_BASE inside the physical memory limits. > > This is the link to the relevant conversation and bug report. > Link :https://lore.kernel.org/linux-riscv/20240202135030.42265-1-csd4492@csd.uoc.gr > > Co-developed-by: Alexandre Ghiti You can switch that to a Suggested-by, I did not write the code nor test anything :) > Signed-off-by: Dimitris Vlachos > Reported-by: Dimitris Vlachos I think checkpatch will complain that a Link or Closes tag should follow a Reported-by: I would move the Link tag in your commit message here. And we miss a Fixes tag too, I would go for: Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem") > --- > arch/riscv/include/asm/pgtable.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h > index 0c94260b5..875c9a079 100644 > --- a/arch/riscv/include/asm/pgtable.h > +++ b/arch/riscv/include/asm/pgtable.h > @@ -84,7 +84,7 @@ > * Define vmemmap for pfn_to_page & page_to_pfn calls. Needed if kernel > * is configured with CONFIG_SPARSEMEM_VMEMMAP enabled. > */ > -#define vmemmap ((struct page *)VMEMMAP_START) > +#define vmemmap ((struct page *)VMEMMAP_START - (phys_ram_base >> PAGE_SHIFT)) > > #define PCI_IO_SIZE SZ_16M > #define PCI_IO_END VMEMMAP_START You can add: Reviewed-by: Alexandre Ghiti Thanks, Alex