Messages in this thread | | | From | David Laight <> | Subject | RE: [PATCH v5 0/3] close_range() | Date | Sun, 7 Jun 2020 12:31:19 +0000 |
| |
From: Christian Brauner > Sent: 04 June 2020 00:24 .. > -struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) > +struct files_struct *dup_fd(struct files_struct *oldf, unsigned int max_fds, int *errorp)
Shouldn't this get changed to use ERR_PTR() etc?
.. > -int __close_range(struct files_struct *files, unsigned fd, unsigned max_fd) > +int __close_range(unsigned fd, unsigned max_fd, unsigned int flags)
If the lowest fd that had ever has CLOEXEC (or CLOFORK) set were remembered a flag could be passed in to say 'only close the fd with CLOEXEC set'.
Given that CLOEXEC is almost never cleared, and is typically set on all but a few fd the 'optimisation' of the bitmap is probably a pessimisation.
David
- Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
| |