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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 Feb 2021 12:48:19 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     jpoimboe@...hat.com, mbenes@...e.cz, linux-kernel@...r.kernel.org,
        x86@...nel.org
Subject: Re: [PATCH 1/3] objtool: Add --backup

On Fri, Feb 26, 2021 at 11:57:43AM +0100, Peter Zijlstra wrote:
> +static bool objtool_create_backup(const char *_objname)
> +{
> +	int len = strlen(_objname);
> +	char *buf, *base, *name = malloc(len+3);
> +	int s, d, l, t;
> +
> +	if (!name) {
> +		WARN("failed backup name malloc");
> +		return false;
> +	}
> +
> +	strcpy(name, _objname);
> +	strcpy(name + len, "bj");
> +
> +	d = open(name, O_CREAT|O_WRONLY|O_TRUNC);

Yah, as mentioned on IRC and let me paste it here too, you need to
supply mode with O_CREAT:

	d = open(name, O_CREAT|O_RDWR|O_TRUNC,S_IRUSR);

or so. Also you could add perror("open") to those error paths so that it
can say why it failed creating the backup file.

With that, thanks for doing those!

Acked-by: Borislav Petkov <bp@...e.de>

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ