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: <1386845150.9959.3.camel@localhost.localdomain>
Date:	Thu, 12 Dec 2013 11:45:50 +0100
From:	Yann Droneaud <ydroneaud@...eya.com>
To:	Mateusz Guzik <mguzik@...hat.com>
Cc:	Al Viro <viro@...iv.linux.org.uk>, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org, Yann Droneaud <ydroneaud@...eya.com>
Subject: Re: [PATCH] fs: clear close-on-exec flag as part of put_unused_fd()

Hi,

Le mercredi 11 décembre 2013 à 23:36 +0100, Mateusz Guzik a écrit :
> On Wed, Dec 11, 2013 at 10:08:27PM +0100, Yann Droneaud wrote:
> > @@ -806,8 +803,6 @@ static int do_dup2(struct files_struct *files,
> >  	__set_open_fd(fd, fdt);
> >  	if (flags & O_CLOEXEC)
> >  		__set_close_on_exec(fd, fdt);
> > -	else
> > -		__clear_close_on_exec(fd, fdt);
> >  	spin_unlock(&files->file_lock);
> >  
> >  	if (tofree)
> 
> From my reading this will break at least the following:
> fd = open(..., .. | O_CLOEXEC);
> dup2(whatever, fd);
> 
> now fd has O_CLOEXEC even though it should not
> 

Thanks for the review.

You're right.

I've misunderstood the portion of the code handling the case where the
destination fd is already marked as used: -EBUSY is only returned when
the file descriptor is allocaged but not yet installed.

So close-on-exec flag must be cleared in do_dup2().

Regards.

-- 
Yann Droneaud
OPTEYA


--
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