15 Oct, 2016

1 commit

  • Both import_iovec() and rw_copy_check_uvector() take an array
    (typically small and on-stack) which is used to hold an iovec array copy
    from userspace. This is to avoid an expensive memory allocation in the
    fast path (i.e. few iovec elements).

    The caller may have to check whether these functions actually used
    the provided buffer or allocated a new one -- but this differs between
    the too. Let's just add a kernel doc to clarify what the semantics are
    for each function.

    Signed-off-by: Vegard Nossum
    Signed-off-by: Al Viro

    Vegard Nossum
     

15 Jul, 2016

1 commit

  • Don't use the same syscall numbers for 2 different syscalls:

    534 x32 preadv compat_sys_preadv64
    535 x32 pwritev compat_sys_pwritev64
    534 x32 preadv2 compat_sys_preadv2
    535 x32 pwritev2 compat_sys_pwritev2

    Add compat_sys_preadv64v2() and compat_sys_pwritev64v2() so that 64-bit offset
    is passed in one 64-bit register on x32, similar to compat_sys_preadv64()
    and compat_sys_pwritev64().

    Signed-off-by: H.J. Lu
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Christoph Hellwig
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/CAMe9rOovCMf-RQfx_n1U_Tu_DX1BYkjtFr%3DQ4-_PFVSj9BCzUA@mail.gmail.com
    Signed-off-by: Ingo Molnar

    H.J. Lu
     

19 May, 2016

1 commit


18 May, 2016

1 commit

  • Pull vfs cleanups from Al Viro:
    "More cleanups from Christoph"

    * 'work.preadv2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    nfsd: use RWF_SYNC
    fs: add RWF_DSYNC aand RWF_SYNC
    ceph: use generic_write_sync
    fs: simplify the generic_write_sync prototype
    fs: add IOCB_SYNC and IOCB_DSYNC
    direct-io: remove the offset argument to dio_complete
    direct-io: eliminate the offset argument to ->direct_IO
    xfs: eliminate the pos variable in xfs_file_dio_aio_write
    filemap: remove the pos argument to generic_file_direct_write
    filemap: remove pos variables in generic_file_read_iter

    Linus Torvalds
     

03 May, 2016

1 commit


02 May, 2016

1 commit


04 Apr, 2016

1 commit


19 Mar, 2016

1 commit


05 Mar, 2016

3 commits

  • This adds a flag that tells the file system that this is a high priority
    request for which it's worth to poll the hardware. The flag is purely
    advisory and can be ignored if not supported.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Stephen Bates
    Tested-by: Stephen Bates
    Acked-by: Jeff Moyer
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • New syscalls that take an flag argument. No flags are added yet in this
    patch.

    Signed-off-by: Milosz Tanski
    [hch: rebased on top of my kiocb changes]
    Signed-off-by: Christoph Hellwig
    Reviewed-by: Stephen Bates
    Tested-by: Stephen Bates
    Acked-by: Jeff Moyer
    Signed-off-by: Al Viro

    Milosz Tanski
     
  • This way we can set kiocb flags also from the sync read/write path for
    the read_iter/write_iter operations. For now there is no way to pass
    flags to plain read/write operations as there is no real need for that,
    and all flags passed are explicitly rejected for these files.

    Signed-off-by: Milosz Tanski
    [hch: rebased on top of my kiocb changes]
    Signed-off-by: Christoph Hellwig
    Reviewed-by: Stephen Bates
    Tested-by: Stephen Bates
    Acked-by: Jeff Moyer
    Signed-off-by: Al Viro

    Christoph Hellwig
     

28 Feb, 2016

1 commit


20 Feb, 2016

1 commit

  • The user-visible impact of the issue is for example that without this
    patch sensors-detect breaks when trying to seek in /dev/cpu/0/cpuid.

    '~0ULL' is a 'unsigned long long' that when converted to a loff_t,
    which is signed, gets turned into -1. later in vfs_setpos we have
    'if (offset > maxsize)', which makes it always return EINVAL.

    Fixes: b25472f9b961 ("new helpers: no_seek_end_llseek{,_size}()")
    Signed-off-by: Wouter van Kesteren
    Reviewed-by: Andreas Dilger
    Signed-off-by: Al Viro

    Wouter van Kesteren
     

23 Jan, 2016

2 commits


13 Jan, 2016

1 commit

  • Pull misc vfs updates from Al Viro:
    "All kinds of stuff. That probably should've been 5 or 6 separate
    branches, but by the time I'd realized how large and mixed that bag
    had become it had been too close to -final to play with rebasing.

    Some fs/namei.c cleanups there, memdup_user_nul() introduction and
    switching open-coded instances, burying long-dead code, whack-a-mole
    of various kinds, several new helpers for ->llseek(), assorted
    cleanups and fixes from various people, etc.

    One piece probably deserves special mention - Neil's
    lookup_one_len_unlocked(). Similar to lookup_one_len(), but gets
    called without ->i_mutex and tries to avoid ever taking it. That, of
    course, means that it's not useful for any directory modifications,
    but things like getting inode attributes in nfds readdirplus are fine
    with that. I really should've asked for moratorium on lookup-related
    changes this cycle, but since I hadn't done that early enough... I
    *am* asking for that for the coming cycle, though - I'm going to try
    and get conversion of i_mutex to rwsem with ->lookup() done under lock
    taken shared.

    There will be a patch closer to the end of the window, along the lines
    of the one Linus had posted last May - mechanical conversion of
    ->i_mutex accesses to inode_lock()/inode_unlock()/inode_trylock()/
    inode_is_locked()/inode_lock_nested(). To quote Linus back then:

    -----
    | This is an automated patch using
    |
    | sed 's/mutex_lock(&\(.*\)->i_mutex)/inode_lock(\1)/'
    | sed 's/mutex_unlock(&\(.*\)->i_mutex)/inode_unlock(\1)/'
    | sed 's/mutex_lock_nested(&\(.*\)->i_mutex,[ ]*I_MUTEX_\([A-Z0-9_]*\))/inode_lock_nested(\1, I_MUTEX_\2)/'
    | sed 's/mutex_is_locked(&\(.*\)->i_mutex)/inode_is_locked(\1)/'
    | sed 's/mutex_trylock(&\(.*\)->i_mutex)/inode_trylock(\1)/'
    |
    | with a very few manual fixups
    -----

    I'm going to send that once the ->i_mutex-affecting stuff in -next
    gets mostly merged (or when Linus says he's about to stop taking
    merges)"

    * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits)
    nfsd: don't hold i_mutex over userspace upcalls
    fs:affs:Replace time_t with time64_t
    fs/9p: use fscache mutex rather than spinlock
    proc: add a reschedule point in proc_readfd_common()
    logfs: constify logfs_block_ops structures
    fcntl: allow to set O_DIRECT flag on pipe
    fs: __generic_file_splice_read retry lookup on AOP_TRUNCATED_PAGE
    fs: xattr: Use kvfree()
    [s390] page_to_phys() always returns a multiple of PAGE_SIZE
    nbd: use ->compat_ioctl()
    fs: use block_device name vsprintf helper
    lib/vsprintf: add %*pg format specifier
    fs: use gendisk->disk_name where possible
    poll: plug an unused argument to do_poll
    amdkfd: don't open-code memdup_user()
    cdrom: don't open-code memdup_user()
    rsxx: don't open-code memdup_user()
    mtip32xx: don't open-code memdup_user()
    [um] mconsole: don't open-code memdup_user_nul()
    [um] hostaudio: don't open-code memdup_user()
    ...

    Linus Torvalds
     

01 Jan, 2016

2 commits


23 Dec, 2015

1 commit


08 Dec, 2015

2 commits

  • The btrfs clone ioctls are now adopted by other file systems, with NFS
    and CIFS already having support for them, and XFS being under active
    development. To avoid growth of various slightly incompatible
    implementations, add one to the VFS. Note that clones are different from
    file copies in several ways:

    - they are atomic vs other writers
    - they support whole file clones
    - they support 64-bit legth clones
    - they do not allow partial success (aka short writes)
    - clones are expected to be a fast metadata operation

    Because of that it would be rather cumbersome to try to piggyback them on
    top of the recent clone_file_range infrastructure. The converse isn't
    true and the clone_file_range system call could try clone file range as
    a first attempt to copy, something that further patches will enable.

    Based on earlier work from Peng Tao.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • Pass a loff_t end for the last byte instead of the 32-bit count
    parameter to allow full file clones even on 32-bit architectures.
    While we're at it also simplify the read/write selection.

    Signed-off-by: Christoph Hellwig
    Acked-by: J. Bruce Fields
    Signed-off-by: Al Viro

    Christoph Hellwig
     

02 Dec, 2015

2 commits

  • This allows us to have an in-kernel copy mechanism that avoids frequent
    switches between kernel and user space. This is especially useful so
    NFSD can support server-side copies.

    The default (flags=0) means to first attempt copy acceleration, but use
    the pagecache if that fails.

    Signed-off-by: Anna Schumaker
    Reviewed-by: Darrick J. Wong
    Reviewed-by: Padraig Brady
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Anna Schumaker
     
  • Add a copy_file_range() system call for offloading copies between
    regular files.

    This gives an interface to underlying layers of the storage stack which
    can copy without reading and writing all the data. There are a few
    candidates that should support copy offloading in the nearer term:

    - btrfs shares extent references with its clone ioctl
    - NFS has patches to add a COPY command which copies on the server
    - SCSI has a family of XCOPY commands which copy in the device

    This system call avoids the complexity of also accelerating the creation
    of the destination file by operating on an existing destination file
    descriptor, not a path.

    Currently the high level vfs entry point limits copy offloading to files
    on the same mount and super (and not in the same file). This can be
    relaxed if we get implementations which can copy between file systems
    safely.

    Signed-off-by: Zach Brown
    [Anna Schumaker: Change -EINVAL to -EBADF during file verification,
    Change flags parameter from int to unsigned int,
    Add function to include/linux/syscalls.h,
    Check copy len after file open mode,
    Don't forbid ranges inside the same file,
    Use rw_verify_area() to veriy ranges,
    Use file_out rather than file_in,
    Add COPY_FR_REFLINK flag]
    Signed-off-by: Anna Schumaker
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Zach Brown
     

12 Apr, 2015

8 commits


26 Mar, 2015

1 commit


14 Mar, 2015

1 commit

  • The AIO interface is fairly complex because it tries to allow
    filesystems to always work async and then wakeup a synchronous
    caller through aio_complete. It turns out that basically no one
    was doing this to avoid the complexity and context switches,
    and we've already fixed up the remaining users and can now
    get rid of this case.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

13 Mar, 2015

1 commit


18 Feb, 2015

1 commit


29 Jan, 2015

1 commit


17 Jan, 2015

1 commit


15 Dec, 2014

1 commit

  • Pull security layer updates from James Morris:
    "In terms of changes, there's general maintenance to the Smack,
    SELinux, and integrity code.

    The IMA code adds a new kconfig option, IMA_APPRAISE_SIGNED_INIT,
    which allows IMA appraisal to require signatures. Support for reading
    keys from rootfs before init is call is also added"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (23 commits)
    selinux: Remove security_ops extern
    security: smack: fix out-of-bounds access in smk_parse_smack()
    VFS: refactor vfs_read()
    ima: require signature based appraisal
    integrity: provide a hook to load keys when rootfs is ready
    ima: load x509 certificate from the kernel
    integrity: provide a function to load x509 certificate from the kernel
    integrity: define a new function integrity_read_file()
    Security: smack: replace kzalloc with kmem_cache for inode_smack
    Smack: Lock mode for the floor and hat labels
    ima: added support for new kernel cmdline parameter ima_template_fmt
    ima: allocate field pointers array on demand in template_desc_init_fields()
    ima: don't allocate a copy of template_fmt in template_desc_init_fields()
    ima: display template format in meas. list if template name length is zero
    ima: added error messages to template-related functions
    ima: use atomic bit operations to protect policy update interface
    ima: ignore empty and with whitespaces policy lines
    ima: no need to allocate entry for comment
    ima: report policy load status
    ima: use path names cache
    ...

    Linus Torvalds
     

18 Nov, 2014

1 commit

  • integrity_kernel_read() duplicates the file read operations code
    in vfs_read(). This patch refactors vfs_read() code creating a
    helper function __vfs_read(). It is used by both vfs_read() and
    integrity_kernel_read().

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     

09 Oct, 2014

1 commit