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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 12 Jun 2020 15:26:56 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Matt Helsley <mhelsley@...are.com>
Cc:     linux-kernel@...r.kernel.org, Josh Poimboeuf <jpoimboe@...hat.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Sami Tolvanen <samitolvanen@...gle.com>,
        Julien Thierry <jthierry@...hat.com>,
        Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>
Subject: Re: [RFC][PATCH v4 18/32] objtool: mcount: Move nop_mcount()

On Tue, Jun 02, 2020 at 12:50:11PM -0700, Matt Helsley wrote:
> +static int nop_mcount(struct section * const rels,
> +		      const char *const txtname)
> +{
> +	struct reloc *reloc;
> +	struct section *txts = find_section_by_index(lf, rels->sh.sh_info);
> +	unsigned mcountsym = 0;
> +	int once = 0;
> +
> +	list_for_each_entry(reloc, &rels->reloc_list, list) {
> +		int ret = -1;
> +
> +		if (!mcountsym)
> +			mcountsym = get_mcountsym(reloc);
> +
> +		if (mcountsym == GELF_R_INFO(reloc->sym->idx, reloc->type) && !is_fake_mcount(reloc)) {

This makes no sense to me; why not have mcountsym be a 'struct symbol
*' and have get_mcountsym() return one of those.

	if (reloc->sym == mcountsym && ... )

is much nicer, no?

> +			if (make_nop) {
> +				ret = make_nop(txts, reloc->offset);
> +				if (ret < 0)
> +					return -1;
> +			}
> +			if (warn_on_notrace_sect && !once) {
> +				printf("Section %s has mcount callers being ignored\n",
> +				       txtname);
> +				once = 1;
> +				/* just warn? */
> +				if (!make_nop)
> +					return 0;
> +			}
> +		}
> +
> +		/*
> +		 * If we successfully removed the mcount, mark the relocation
> +		 * as a nop (don't do anything with it).
> +		 */
> +		if (!ret) {
> +			reloc->type = rel_type_nop;
> +			rels->changed = true;

I have an elf_write_rela(), I'll make sure to Cc you.

> +		}
> +	}
> +	return 0;
> +}

Powered by blists - more mailing lists