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: <20241209195413.gpq7t3nacsnx3xo3@jpoimboe>
Date: Mon, 9 Dec 2024 11:54:13 -0800
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: Huacai Chen <chenhuacai@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>, loongarch@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 02/10] objtool: Handle different entry size of rodata

On Sat, Dec 07, 2024 at 09:59:07AM +0800, Tiezhu Yang wrote:
> +__weak unsigned int arch_reloc_size(struct reloc *reloc)
> +{
> +	return 8;
> +}

Instead of making a weak function, each arch should have an explicit
definition of this function, as it's not always 8:

- x86 has R_X86_64_PC32 and R_X86_64_PLT32 which are 4 bytes.

- 32-bit powerpc

- 64-bit powerpc has R_PPC64_REL32

> @@ -1967,8 +1973,10 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn,
>  		if (reloc != table && reloc == next_table)
>  			break;
>  
> +		entry_size = arch_reloc_size(reloc);
> +
>  		/* Make sure the table entries are consecutive: */
> -		if (prev_offset && reloc_offset(reloc) != prev_offset + 8)
> +		if (prev_offset && reloc_offset(reloc) != prev_offset + entry_size)
>  			break;

No need to use a variable here, just call arch_reloc_size() directly.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ