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: <bef11c18fa234948bcab0316418f04aa@AcuMS.aculab.com>
Date:   Thu, 2 Mar 2023 22:21:11 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'aloktiagi' <aloktiagi@...il.com>,
        "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
        "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     "keescook@...omium.org" <keescook@...omium.org>,
        "hch@...radead.org" <hch@...radead.org>,
        Tycho Andersen <tycho@...ho.pizza>
Subject: RE: [RFC 2/3] file: allow callers to free the old file descriptor
 after dup2

From: aloktiagi
> Sent: 02 March 2023 18:22
> 
> Allow callers of do_dup2 to free the old file descriptor in case they need to
> make additional operations on it.

That doesn't read right at all.

Whether or not this is a good idea (or can be done differently)
the interface is horrid.

>  	if (tofree)
> -		filp_close(tofree, files);
> +		*fdfile = tofree;

Why not:

	if (fdfile) [
		*fdfile = tofree;
	} else {
		if (tofree)
			filp_close(tofree, files);
	}

Then existing code just passes NULL and the caller can't 'forget'
to intitalise fdfile.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ