lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aW3FPbd7Dw0Rdqtc@zatzit>
Date: Mon, 19 Jan 2026 16:46:37 +1100
From: David Gibson <david@...son.dropbear.id.au>
To: Herve Codina <herve.codina@...tlin.com>
Cc: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Ayush Singh <ayush@...gleboard.org>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	devicetree-compiler@...r.kernel.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, devicetree-spec@...r.kernel.org,
	Hui Pu <hui.pu@...ealthcare.com>,
	Ian Ray <ian.ray@...ealthcare.com>,
	Luca Ceresoli <luca.ceresoli@...tlin.com>,
	Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [RFC PATCH 09/77] dtc: Introduce mark_local_phandles()

On Fri, Jan 16, 2026 at 02:09:12PM +0100, Herve Codina wrote:
> Hi David,
> 
> On Thu, 15 Jan 2026 11:48:44 +1100
> David Gibson <david@...son.dropbear.id.au> wrote:
> 
> > On Mon, Jan 12, 2026 at 03:18:59PM +0100, Herve Codina wrote:
> > > In order to have the new FDT_REF_LOCAL tag present in a dtb, the phandle
> > > reference needs to be identify as a local reference.
> > > 
> > > This is the purpose of mark_local_phandles().
> > > 
> > > It identifies a phandle reference as a local reference when this
> > > reference points to a local node.
> > > 
> > > With that node, the related FDT_REF_LOCAL tag is set in the dtb.  
> > 
> > I dislike caching redundant information (whether the ref is local) -
> > it's an opportunity for them to get out of sync and cause bugs.  Is
> > there a strong case that you can't just determine whether it's local
> > only when you actually go to use it?
> 
> Well, I can't find any strong case.
> 
> I would like to avoid passing the full dti (struct dt_info) to flatten_tree()
> in order to determine if the ref is local or not to set a FDT_REF_LOCAL or
> a FDT_REF_PHANDLE tag.
> 
> Also, this flag, set when a FDT_REF_LOCAL tag is parsed from a dtb, is
> useful later when the ref has to be found based on the phandle value.
> 
> Indeed, because the is_local flag is set, the phandle value available in the
> property *must* reference an existing node in the dtb.
> 
> In other word, in update_phandles_ref_internal(),

Hmm, I see.  As with the "known phandle, unknown ref" vs. "known ref,
unknown phandle" cases, I think this might be clearer with different
marker types.  During parse we make everything "known ref, unknown
phandle", then later change to either "known ref, resolved to local
phandle" or "known ref, needs external resolution" markers.



> --- 8< ---
> 	if (m->is_local) {
> 		phandle = propval_cell_n(prop,
> 					 m->offset / sizeof(cell_t));
> 		refnode = dti_get_node_by_phandle(dti, phandle);
> 		if (!refnode)
> 			die("Node not found for phandle 0x%"PRIx32"\n", phandle);
> 
> 		m->ref = refnode->fullpath;
> 		continue;
> 	} else {
> 		...
> --- 8< ---
> 
> Best regards,
> Hervé
> 

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ