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: <Z9fxGnRq041ZNLdw@google.com>
Date: Mon, 17 Mar 2025 09:53:30 +0000
From: Brendan Jackman <jackmanb@...gle.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
	Peter Zijlstra <peterz@...radead.org>,
	Nathan Chancellor <nathan@...nel.org>
Subject: Re: [PATCH 12/13] objtool: Create backup on error and print args

On Fri, Mar 14, 2025 at 12:29:10PM -0700, Josh Poimboeuf wrote:
> Recreating objtool errors can be a manual process.  Kbuild removes the
> object, so it has to be compiled or linked again before running objtool.
> Then the objtool args need to be reversed engineered.
> 
> Make that all easier by automatically making a backup of the object file
> on error, and print a modified version of the args which can be used to
> recreate.
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
>  		unlink(opts.output);
> +		goto err_msg;
> +	}
> +
> +	/*
> +	 * Make a backup before kbuild deletes the file so the error
> +	 * can be recreated without recompiling or relinking.
> +	 */
> +	backup = malloc(strlen(objname) + strlen(ORIG_SUFFIX) + 1);
> +	if (!backup) {
> +		perror("malloc");
> +		return 1;
> +	}
> +
> +	strcpy(backup, objname);
> +	strcat(backup, ORIG_SUFFIX);
> +	if (copy_file(objname, backup))
> +		return 1;
> +

I think there should be a comment here like

/*
 * Dump a command line with the original filename replaced with the
 * backup filename.
 */

With the context from the comment above it's obvious enough _why_
the code would do this, but it still takes a few unnecessary brain
cycles to figure out _that_ it's doing that.

Or alternatively just print "command line to reproduce:" before the
modfified argv or whatever.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ