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: <c63auxjhv2lanvir4rryy3kp6qpni4q7p62ng6hnvoo4w4idvf@i4mx3asblvis>
Date: Tue, 13 May 2025 13:45:32 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: laokz <laokz@...mail.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, 
	Petr Mladek <pmladek@...e.com>, Miroslav Benes <mbenes@...e.cz>, 
	Joe Lawrence <joe.lawrence@...hat.com>, live-patching@...r.kernel.org, Song Liu <song@...nel.org>, 
	Jiri Kosina <jikos@...nel.org>, Marcos Paulo de Souza <mpdesouza@...e.com>, 
	Weinan Liu <wnliu@...gle.com>, Fazla Mehrab <a.mehrab@...edance.com>, 
	Chen Zhongjin <chenzhongjin@...wei.com>, Puranjay Mohan <puranjay@...nel.org>
Subject: Re: [PATCH v2 52/62] objtool/klp: Introduce klp diff subcommand for
 diffing object files

On Tue, May 13, 2025 at 10:49:59PM +0800, laokz wrote:
> On 5/10/2025 4:17 AM, Josh Poimboeuf wrote:
> > +
> > +#define sym_for_each_reloc(elf, sym, reloc)				\
> > +	for (reloc = find_reloc_by_dest_range(elf, sym->sec,		\
> > +					      sym->offset, sym->len);	\
> > +	     reloc && reloc_offset(reloc) <  sym->offset + sym->len;	\
> > +	     reloc = rsec_next_reloc(sym->sec->rsec, reloc))
> 
> This macro intents to walk through ALL relocations for the 'sym'. It seems
> we have the assumption that, there is at most one single relocation for the
> same offset and find_reloc_by_dest_range only needs to do 'less than' offset
> comparison:
> 
> 	elf_hash_for_each_possible(reloc, reloc, hash,
> 				   sec_offset_hash(rsec, o)) {
> 		if (reloc->sec != rsec)
> 			continue;
> 		if (reloc_offset(reloc) >= offset &&
> 		    reloc_offset(reloc) < offset + len) {
> less than ==>		if (!r || reloc_offset(reloc) < reloc_offset(r))
> 					r = reloc;
> 
> Because if there were multiple relocations for the same offset, the returned
> one would be the last one in section entry order(hash list has reverse order
> against section order), then broken the intention.

Right.  Is that a problem?  I don't believe I've ever seen two
relocations for the same offset.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ