[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201013210925.GJ3576660@ZenIV.linux.org.uk>
Date: Tue, 13 Oct 2020 22:09:25 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Giuseppe Scrivano <gscrivan@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
christian.brauner@...ntu.com, containers@...ts.linux-foundation.org
Subject: Re: [PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC
On Tue, Oct 13, 2020 at 04:06:08PM +0200, Giuseppe Scrivano wrote:
> + spin_lock(&cur_fds->file_lock);
> + fdt = files_fdtable(cur_fds);
> + cur_max = fdt->max_fds - 1;
> + max_fd = min(max_fd, cur_max);
> + while (fd <= max_fd)
> + __set_close_on_exec(fd++, fdt);
> + spin_unlock(&cur_fds->file_lock);
First of all, this is an atrocious way to set all bits
in a range. What's more, you don't want to set it for *all*
bits - only for the ones present in open bitmap. It's probably
harmless at the moment, but let's not create interesting surprises
for the future.
Powered by blists - more mailing lists