diff options
author | Yann Droneaud <ydroneaud@opteya.com> | 2014-12-11 00:45:47 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-11 02:41:10 +0100 |
commit | f938612dd97d481b8b5bf960c992ae577f081c17 (patch) | |
tree | ba1e620455a87fb25502ee3b8be7193c1ed9e5a9 /kernel/panic.c | |
parent | fs/file.c: replace get_unused_fd() with get_unused_fd_flags(0) (diff) | |
download | linux-f938612dd97d481b8b5bf960c992ae577f081c17.tar.xz linux-f938612dd97d481b8b5bf960c992ae577f081c17.zip |
include/linux/file.h: remove get_unused_fd() macro
Macro get_unused_fd() is used to allocate a file descriptor with default
flags. Those default flags (0) don't enable close-on-exec.
This can be seen as an unsafe default: in most case close-on-exec should
be enabled to not leak file descriptor across exec().
It would be better to have a "safer" default set of flags, eg. O_CLOEXEC
must be used to enable close-on-exec.
Instead this patch removes get_unused_fd() so that out of tree modules
won't be affect by a runtime behavor change which might introduce other
kind of bugs: it's better to catch the change at build time, making it
easier to fix.
Removing the macro will also promote use of get_unused_fd_flags() (or
anon_inode_getfd()) with flags provided by userspace. Or, if flags cannot
be given by userspace, with flags set to O_CLOEXEC by default.
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/panic.c')
0 files changed, 0 insertions, 0 deletions