From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta1.migadu.com (mta1.migadu.com [37.59.57.117]) (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 4393143CEDD for ; Tue, 11 Aug 2026 10:55:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.59.57.117 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786445729; cv=none; b=mtqMPReZEyjegx3EczbAvJU47BgX5FKptHvLZBboFHqXTzbet5yQsf/xNS9esmn4mZ0kWV5EB5N1Ha+9W2uZC6c1hc76AT+AppWiAS8EijhSKVbZ+qDqFhx7YcyXDeKQoRwBPr6rIXfTzEal/t3ZUuBH/zt0Ygqotz/Uz5D3h9U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786445729; c=relaxed/simple; bh=0AnCb7WMDQ9EbEojuv90MqintI3JCH1wajjQESrFENI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Jkk0o2hbAkBunxO9D69vh38NEBpCRU2R/xTXIHlVeQzLW7WQRU0lhA6Gl3BRijJAq1HcsEDv2vywSC+MvW2vtcmIPAbcFppl33+9ISlbHthAQNgBpNaX76dnlkeJoSFvQ30+HE/35X/ZdG6EIfkYFkpp/XteLqPkTXVHGUpwzuk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=B1a0pCwG; arc=none smtp.client-ip=37.59.57.117 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="B1a0pCwG" Date: Tue, 11 Aug 2026 12:55:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1786445722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=La4waMT4rs7aXnTV66yZwYLc3c+bIPKvhMi8gMs4mD8=; b=B1a0pCwGMiObe8FUyVrFx3+csoClXuKOjOWE3GC90OUdZiZIp6DmyhBfUdR4rmNxclN9nG GJe9hUtMII6cBeZF9W0soUALxhFXOqBheu8BN6rvc0uI9vAZvqU6EKFSrkw3U2HkwljDIK a762D6zdoDrpP8JR1bOQLgpYCtY3TWQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum To: Sourabh Jain Cc: Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Hari Bathini , Aditya Gupta , Jinjie Ruan , Thiago Jung Bauermann , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/kexec_file: Use inclusive range checks in add_usable_mem() Message-ID: References: <20260809162403.18142-2-thorsten.blum@linux.dev> 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: X-Migadu-Flow: FLOW_OUT On Tue, Aug 11, 2026 at 11:51:46AM +0530, Sourabh Jain wrote: > On 09/08/26 21:54, Thorsten Blum wrote: > > add_usable_mem() adds usable memory ranges for the kdump kernel. > > > > The ranges are inclusive, but the partial overlap check uses exclusive > > comparisons. This skips ranges with base == loc_end or end == loc_base. > > Use inclusive comparisons instead. > > > > Fixes: 7c64e21a1c5a ("powerpc/kexec_file: Restrict memory usage of kdump kernel") > > Signed-off-by: Thorsten Blum > > --- > > arch/powerpc/kexec/file_load_64.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c > > index 8c72e12ea44e..f9e872693ca7 100644 > > --- a/arch/powerpc/kexec/file_load_64.c > > +++ b/arch/powerpc/kexec/file_load_64.c > > @@ -113,7 +113,7 @@ static int add_usable_mem(struct umem_info *um_info, u64 base, u64 end) > > loc_end = um_info->ranges[i].end; > > if (loc_base >= base && loc_end <= end) > > add = true; > > - else if (base < loc_end && end > loc_base) { > > + else if (base <= loc_end && end >= loc_base) { > > This is interesting. The updated condition basically handles exactly a > one-byte overlap on either side of the usable memory ranges. In practice, > it is very unlikely that we would have such usable memory and LMB ranges. > > Thorsten, have you encountered any problem that led you to propose this fix? Found by inspection only and I agree that this is unlikely in practice, which is why I didn't cc stable. Same for the other patch [1]. Thanks for the review. [1] https://lore.kernel.org/r/20260810145827.157972-3-thorsten.blum@linux.dev/