1. 04 8月, 2012 1 次提交
  2. 31 7月, 2012 2 次提交
  3. 30 7月, 2012 1 次提交
  4. 23 7月, 2012 1 次提交
  5. 14 7月, 2012 12 次提交
  6. 08 7月, 2012 1 次提交
  7. 02 6月, 2012 4 次提交
  8. 03 5月, 2012 2 次提交
  9. 10 4月, 2012 1 次提交
  10. 20 2月, 2012 1 次提交
    • D
      Wrap accesses to the fd_sets in struct fdtable · 1dce27c5
      David Howells 提交于
      Wrap accesses to the fd_sets in struct fdtable (for recording open files and
      close-on-exec flags) so that we can move away from using fd_sets since we
      abuse the fd_set structs by not allocating the full-sized structure under
      normal circumstances and by non-core code looking at the internals of the
      fd_sets.
      
      The first abuse means that use of FD_ZERO() on these fd_sets is not permitted,
      since that cannot be told about their abnormal lengths.
      
      This introduces six wrapper functions for setting, clearing and testing
      close-on-exec flags and fd-is-open flags:
      
      	void __set_close_on_exec(int fd, struct fdtable *fdt);
      	void __clear_close_on_exec(int fd, struct fdtable *fdt);
      	bool close_on_exec(int fd, const struct fdtable *fdt);
      	void __set_open_fd(int fd, struct fdtable *fdt);
      	void __clear_open_fd(int fd, struct fdtable *fdt);
      	bool fd_is_open(int fd, const struct fdtable *fdt);
      
      Note that I've prepended '__' to the names of the set/clear functions because
      they require the caller to hold a lock to use them.
      
      Note also that I haven't added wrappers for looking behind the scenes at the
      the array.  Possibly that should exist too.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Link: http://lkml.kernel.org/r/20120216174942.23314.1364.stgit@warthog.procyon.org.ukSigned-off-by: NH. Peter Anvin <hpa@zytor.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      1dce27c5
  11. 07 1月, 2012 1 次提交
  12. 04 1月, 2012 3 次提交
  13. 28 10月, 2011 1 次提交
  14. 27 7月, 2011 1 次提交
    • A
      merge fchmod() and fchmodat() guts, kill ancient broken kludge · e57712eb
      Al Viro 提交于
      The kludge in question is undocumented and doesn't work for 32bit
      binaries on amd64, sparc64 and s390.  Passing (mode_t)-1 as
      mode had (since 0.99.14v and contrary to behaviour of any
      other Unix, prescriptions of POSIX, SuS and our own manpages)
      was kinda-sorta no-op.  Note that any software relying on
      that (and looking for examples shows none) would be visibly
      broken on sparc64, where practically all userland is built
      32bit.  No such complaints noticed...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e57712eb
  15. 23 7月, 2011 1 次提交
  16. 21 3月, 2011 1 次提交
  17. 15 3月, 2011 2 次提交
    • A
      readlinkat(), fchownat() and fstatat() with empty relative pathnames · 65cfc672
      Al Viro 提交于
      For readlinkat() we simply allow empty pathname; it will fail unless
      we have dfd equal to O_PATH-opened symlink, so we are outside of
      POSIX scope here.  For fchownat() and fstatat() we allow AT_EMPTY_PATH;
      let the caller explicitly ask for such behaviour.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      65cfc672
    • A
      New kind of open files - "location only". · 1abf0c71
      Al Viro 提交于
      New flag for open(2) - O_PATH.  Semantics:
      	* pathname is resolved, but the file itself is _NOT_ opened
      as far as filesystem is concerned.
      	* almost all operations on the resulting descriptors shall
      fail with -EBADF.  Exceptions are:
      	1) operations on descriptors themselves (i.e.
      		close(), dup(), dup2(), dup3(), fcntl(fd, F_DUPFD),
      		fcntl(fd, F_DUPFD_CLOEXEC, ...), fcntl(fd, F_GETFD),
      		fcntl(fd, F_SETFD, ...))
      	2) fcntl(fd, F_GETFL), for a common non-destructive way to
      		check if descriptor is open
      	3) "dfd" arguments of ...at(2) syscalls, i.e. the starting
      		points of pathname resolution
      	* closing such descriptor does *NOT* affect dnotify or
      posix locks.
      	* permissions are checked as usual along the way to file;
      no permission checks are applied to the file itself.  Of course,
      giving such thing to syscall will result in permission checks (at
      the moment it means checking that starting point of ....at() is
      a directory and caller has exec permissions on it).
      
      fget() and fget_light() return NULL on such descriptors; use of
      fget_raw() and fget_raw_light() is needed to get them.  That protects
      existing code from dealing with those things.
      
      There are two things still missing (they come in the next commits):
      one is handling of symlinks (right now we refuse to open them that
      way; see the next commit for semantics related to those) and another
      is descriptor passing via SCM_RIGHTS datagrams.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      1abf0c71
  18. 14 3月, 2011 2 次提交
    • A
      open-style analog of vfs_path_lookup() · 73d049a4
      Al Viro 提交于
      new function: file_open_root(dentry, mnt, name, flags) opens the file
      vfs_path_lookup would arrive to.
      
      Note that name can be empty; in that case the usual requirement that
      dentry should be a directory is lifted.
      
      open-coded equivalents switched to it, may_open() got down exactly
      one caller and became static.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      73d049a4
    • A
      switch do_filp_open() to struct open_flags · 47c805dc
      Al Viro 提交于
      take calculation of open_flags by open(2) arguments into new helper
      in fs/open.c, move filp_open() over there, have it and do_sys_open()
      use that helper, switch exec.c callers of do_filp_open() to explicit
      (and constant) struct open_flags.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      47c805dc
  19. 10 3月, 2011 1 次提交
  20. 12 2月, 2011 1 次提交
    • L
      Fix possible filp_cachep memory corruption · 2dab5974
      Linus Torvalds 提交于
      In commit 31e6b01f ("fs: rcu-walk for path lookup") we started doing
      path lookup using RCU, which then falls back to a careful non-RCU lookup
      in case of problems (LOOKUP_REVAL).  So do_filp_open() has this "re-do
      the lookup carefully" looping case.
      
      However, that means that we must not release the open-intent file data
      if we are going to loop around and use it once more!
      
      Fix this by moving the release of the open-intent data to the function
      that allocates it (do_filp_open() itself) rather than the helper
      functions that can get called multiple times (finish_open() and
      do_last()).  This makes the logic for the lifetime of that field much
      more obvious, and avoids the possible double free.
      Reported-by: NJ. R. Okajima <hooanon05@yahoo.co.jp>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2dab5974