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-next>] [day] [month] [year] [list]
Date:	Fri, 14 Nov 2014 01:11:59 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	David Drysdale <drysdale@...gle.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Meredydd Luff <meredydd@...atehouse.org>,
	Shuah Khan <shuahkh@....samsung.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Andy Lutomirski <luto@...capital.net>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Kees Cook <keescook@...omium.org>,
	Arnd Bergmann <arnd@...db.de>, Rich Felker <dalias@...ifal.cx>,
	Christoph Hellwig <hch@...radead.org>,
	Michael Kerrisk <mtk.manpages@...il.com>,
	linux-kernel@...r.kernel.org
Subject: Re: + syscallsx86-implement-execveat-system-call.patch added to
	-mm tree

> @@ -1479,7 +1489,26 @@ static int do_execve_common(struct filen
>
>  	bprm->file = file;
> -	bprm->filename = bprm->interp = filename->name;
> +	if (fd == AT_FDCWD || filename->name[0] == '/') {
> +		bprm->filename = filename->name;
> +	} else {
> +		if (filename->name[0] == '\0')
> +			pathbuf = kasprintf(GFP_TEMPORARY, "/dev/fd/%d", fd);
> +		else
> +			pathbuf = kasprintf(GFP_TEMPORARY, "/dev/fd/%d/%s",
> +					    fd, filename->name);
> +		if (!pathbuf) {
> +			retval = -ENOMEM;
> +			goto out_unmark;
> +		}
> +		/* Record that a name derived from an O_CLOEXEC fd will be
> +		 * inaccessible after exec. Relies on having exclusive access to
> +		 * current->files (due to unshare_files above). */
> +		if (close_on_exec(fd, current->files->fdt))
> +			bprm->interp_flags |= BINPRM_FLAGS_PATH_INACCESSIBLE;
> +		bprm->filename = pathbuf;
+	}
+	bprm->interp = bprm->filename;

Not sure I understand this patch, will try to read later...

Just once question, don't we leak pathbuf if exec() succeeds?

OTOH, if it fails,

>  out_free:
>  	free_bprm(bprm);
> +	kfree(pathbuf);

Is it correct if we fail after bprm_change_interp() was called? It seems
that we can free interp == pathbuf twice?

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ