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] [day] [month] [year] [list]
Message-ID: <20241124031640.GA3646332@thelio-3990X>
Date: Sat, 23 Nov 2024 20:16:40 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: jpoimboe@...hat.com, linux-kernel@...r.kernel.org,
	Fangrui Song <i@...kray.me>, llvm@...ts.linux.dev
Subject: Re: [PATCH 1/9] objtool: Generic annotation infrastructure

On Fri, Nov 22, 2024 at 01:10:17PM +0100, Peter Zijlstra wrote:
> Avoid endless .discard.foo sections for each annotation, create a
> single .discard.annotate section that takes an annotation type along
> with the instruction.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
...
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -2373,6 +2373,49 @@ static int read_unwind_hints(struct objt
>  	return 0;
>  }
>  
> +static int read_annotate(struct objtool_file *file, void (*func)(int type, struct instruction *insn))
> +{
> +	struct section *sec;
> +	struct instruction *insn;
> +	struct reloc *reloc;
> +	int type;
> +
> +	sec = find_section_by_name(file->elf, ".discard.annotate");
> +	if (!sec)
> +		return 0;
> +
> +	if (!sec->rsec)
> +		return 0;
> +
> +	if (sec->sh.sh_entsize != 8) {
> +		static bool warned = false;
> +		if (!warned) {
> +			WARN("%s: dodgy linker, sh_entsize != 8", sec->name);

Thanks to Fangrui, this has been resolved in LLVM main:

https://github.com/llvm/llvm-project/commit/d4bed617f4378873d7ddf4b53c041e7b39d1a9ca
https://github.com/ClangBuiltLinux/linux/issues/2057#issuecomment-2495675374

I have built a version of LLVM from main and verified that this warning
does not trigger with that version, while it does with LLVM 19.1.4.

> +			warned = true;
> +		}
> +		sec->sh.sh_entsize = 8;
> +	}
> +
> +	for_each_reloc(sec->rsec, reloc) {
> +		type = *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4);
> +
> +		insn = find_insn(file, reloc->sym->sec,
> +				 reloc->sym->offset + reloc_addend(reloc));
> +		if (!insn) {
> +			WARN("bad .discard.annotate entry: %d of type %d", reloc_idx(reloc), type);
> +			return -1;
> +		}
> +
> +		func(type, insn);
> +	}
> +
> +	return 0;
> +}

Cheers,
Nathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ