02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

03 Apr, 2017

1 commit

  • Return enhanced file attributes from the Ext4 filesystem. This includes
    the following:

    (1) The inode creation time (i_crtime) as stx_btime, setting STATX_BTIME.

    (2) Certain FS_xxx_FL flags are mapped to stx_attribute flags.

    This requires that all ext4 inodes have a getattr call, not just some of
    them, so to this end, split the ext4_getattr() function and only call part
    of it where appropriate.

    Example output:

    [root@andromeda ~]# touch foo
    [root@andromeda ~]# chattr +ai foo
    [root@andromeda ~]# /tmp/test-statx foo
    statx(foo) = 0
    results=fff
    Size: 0 Blocks: 0 IO Block: 4096 regular file
    Device: 08:12 Inode: 2101950 Links: 1
    Access: (0644/-rw-r--r--) Uid: 0 Gid: 0
    Access: 2016-02-11 17:08:29.031795451+0000
    Modify: 2016-02-11 17:08:29.031795451+0000
    Change: 2016-02-11 17:11:11.987790114+0000
    Birth: 2016-02-11 17:08:29.031795451+0000
    Attributes: 0000000000000030 (-------- -------- -------- -------- -------- -------- -------- --ai----)

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     

09 Dec, 2016

1 commit


11 Oct, 2016

1 commit

  • Pull vfs xattr updates from Al Viro:
    "xattr stuff from Andreas

    This completes the switch to xattr_handler ->get()/->set() from
    ->getxattr/->setxattr/->removexattr"

    * 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    vfs: Remove {get,set,remove}xattr inode operations
    xattr: Stop calling {get,set,remove}xattr inode operations
    vfs: Check for the IOP_XATTR flag in listxattr
    xattr: Add __vfs_{get,set,remove}xattr helpers
    libfs: Use IOP_XATTR flag for empty directory handling
    vfs: Use IOP_XATTR flag for bad-inode handling
    vfs: Add IOP_XATTR inode operations flag
    vfs: Move xattr_resolve_name to the front of fs/xattr.c
    ecryptfs: Switch to generic xattr handlers
    sockfs: Get rid of getxattr iop
    sockfs: getxattr: Fail with -EOPNOTSUPP for invalid attribute names
    kernfs: Switch to generic xattr handlers
    hfs: Switch to generic xattr handlers
    jffs2: Remove jffs2_{get,set,remove}xattr macros
    xattr: Remove unnecessary NULL attribute name check

    Linus Torvalds
     

08 Oct, 2016

1 commit


30 Sep, 2016

1 commit


16 Sep, 2016

2 commits

  • Several filename crypto functions: fname_decrypt(),
    fscrypt_fname_disk_to_usr(), and fscrypt_fname_usr_to_disk(), returned
    the output length on success or -errno on failure. However, the output
    length was redundant with the value written to 'oname->len'. It is also
    potentially error-prone to make callers have to check for '< 0' instead
    of '!= 0'.

    Therefore, make these functions return 0 instead of a length, and make
    the callers who cared about the return value being a length use
    'oname->len' instead. For consistency also make other callers check for
    a nonzero result rather than a negative result.

    This change also fixes the inconsistency of fname_encrypt() actually
    already returning 0 on success, not a length like the other filename
    crypto functions and as documented in its function comment.

    Signed-off-by: Eric Biggers
    Signed-off-by: Theodore Ts'o
    Reviewed-by: Andreas Dilger
    Acked-by: Jaegeuk Kim

    Eric Biggers
     
  • This bug was introduced in v4.8-rc1.

    Signed-off-by: Eric Biggers
    Signed-off-by: Theodore Ts'o
    Cc: stable@vger.kernel.org

    Eric Biggers
     

11 Jul, 2016

1 commit


05 Apr, 2016

1 commit

  • PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
    ago with promise that one day it will be possible to implement page
    cache with bigger chunks than PAGE_SIZE.

    This promise never materialized. And unlikely will.

    We have many places where PAGE_CACHE_SIZE assumed to be equal to
    PAGE_SIZE. And it's constant source of confusion on whether
    PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
    especially on the border between fs and mm.

    Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
    breakage to be doable.

    Let's stop pretending that pages in page cache are special. They are
    not.

    The changes are pretty straight-forward:

    - << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

    - page_cache_get() -> get_page();

    - page_cache_release() -> put_page();

    This patch contains automated changes generated with coccinelle using
    script below. For some reason, coccinelle doesn't patch header files.
    I've called spatch for them manually.

    The only adjustment after coccinelle is revert of changes to
    PAGE_CAHCE_ALIGN definition: we are going to drop it later.

    There are few places in the code where coccinelle didn't reach. I'll
    fix them manually in a separate patch. Comments and documentation also
    will be addressed with the separate patch.

    virtual patch

    @@
    expression E;
    @@
    - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    expression E;
    @@
    - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    @@
    - PAGE_CACHE_SHIFT
    + PAGE_SHIFT

    @@
    @@
    - PAGE_CACHE_SIZE
    + PAGE_SIZE

    @@
    @@
    - PAGE_CACHE_MASK
    + PAGE_MASK

    @@
    expression E;
    @@
    - PAGE_CACHE_ALIGN(E)
    + PAGE_ALIGN(E)

    @@
    expression E;
    @@
    - page_cache_get(E)
    + get_page(E)

    @@
    expression E;
    @@
    - page_cache_release(E)
    + put_page(E)

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

12 Jan, 2016

1 commit

  • Pull vfs RCU symlink updates from Al Viro:
    "Replacement of ->follow_link/->put_link, allowing to stay in RCU mode
    even if the symlink is not an embedded one.

    No changes since the mailbomb on Jan 1"

    * 'work.symlinks' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    switch ->get_link() to delayed_call, kill ->put_link()
    kill free_page_put_link()
    teach nfs_get_link() to work in RCU mode
    teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode
    teach shmem_get_link() to work in RCU mode
    teach page_get_link() to work in RCU mode
    replace ->follow_link() with new method that could stay in RCU mode
    don't put symlink bodies in pagecache into highmem
    namei: page_getlink() and page_follow_link_light() are the same thing
    ufs: get rid of ->setattr() for symlinks
    udf: don't duplicate page_symlink_inode_operations
    logfs: don't duplicate page_symlink_inode_operations
    switch befs long symlinks to page_symlink_operations

    Linus Torvalds
     

31 Dec, 2015

1 commit


09 Dec, 2015

2 commits

  • new method: ->get_link(); replacement of ->follow_link(). The differences
    are:
    * inode and dentry are passed separately
    * might be called both in RCU and non-RCU mode;
    the former is indicated by passing it a NULL dentry.
    * when called that way it isn't allowed to block
    and should return ERR_PTR(-ECHILD) if it needs to be called
    in non-RCU mode.

    It's a flagday change - the old method is gone, all in-tree instances
    converted. Conversion isn't hard; said that, so far very few instances
    do not immediately bail out when called in RCU mode. That'll change
    in the next commits.

    Signed-off-by: Al Viro

    Al Viro
     
  • kmap() in page_follow_link_light() needed to go - allowing to hold
    an arbitrary number of kmaps for long is a great way to deadlocking
    the system.

    new helper (inode_nohighmem(inode)) needs to be used for pagecache
    symlinks inodes; done for all in-tree cases. page_follow_link_light()
    instrumented to yell about anything missed.

    Signed-off-by: Al Viro

    Al Viro
     

27 Nov, 2015

1 commit


18 Oct, 2015

1 commit


26 Jun, 2015

1 commit

  • Pull ext4 updates from Ted Ts'o:
    "A very large number of cleanups and bug fixes --- in particular for
    the ext4 encryption patches, which is a new feature added in the last
    merge window. Also fix a number of long-standing xfstest failures.
    (Quota writes failing due to ENOSPC, a race between truncate and
    writepage in data=journalled mode that was causing generic/068 to
    fail, and other corner cases.)

    Also add support for FALLOC_FL_INSERT_RANGE, and improve jbd2
    performance eliminating locking when a buffer is modified more than
    once during a transaction (which is very common for allocation
    bitmaps, for example), in which case the state of the journalled
    buffer head doesn't need to change"

    [ I renamed "ext4_follow_link()" to "ext4_encrypted_follow_link()" in
    the merge resolution, to make it clear that that function is _only_
    used for encrypted symlinks. The function doesn't actually work for
    non-encrypted symlinks at all, and they use the generic helpers
    - Linus ]

    * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (52 commits)
    ext4: set lazytime on remount if MS_LAZYTIME is set by mount
    ext4: only call ext4_truncate when size t retry file block mapping on bigalloc fs with non-extent file
    ext4: prevent ext4_quota_write() from failing due to ENOSPC
    ext4: call sync_blockdev() before invalidate_bdev() in put_super()
    jbd2: speedup jbd2_journal_dirty_metadata()
    jbd2: get rid of open coded allocation retry loop
    ext4: improve warning directory handling messages
    jbd2: fix ocfs2 corrupt when updating journal superblock fails
    ext4: mballoc: avoid 20-argument function call
    ext4: wait for existing dio workers in ext4_alloc_file_blocks()
    ext4: recalculate journal credits as inode depth changes
    jbd2: use GFP_NOFS in jbd2_cleanup_journal_tail()
    ext4: use swap() in mext_page_double_lock()
    ext4: use swap() in memswap()
    ext4: fix race between truncate and __ext4_journalled_writepage()
    ext4 crypto: fail the mount if blocksize != pagesize
    ext4: Add support FALLOC_FL_INSERT_RANGE for fallocate
    ...

    Linus Torvalds
     

01 Jun, 2015

1 commit

  • As suggested by Herbert Xu, we shouldn't allocate a new tfm each time
    we read or write a page. Instead we can use a single tfm hanging off
    the inode's crypt_info structure for all of our encryption needs for
    that inode, since the tfm can be used by multiple crypto requests in
    parallel.

    Also use cmpxchg() to avoid races that could result in crypt_info
    structure getting doubly allocated or doubly freed.

    Signed-off-by: Theodore Ts'o

    Theodore Ts'o
     

19 May, 2015

2 commits

  • This is a pretty massive patch which does a number of different things:

    1) The per-inode encryption information is now stored in an allocated
    data structure, ext4_crypt_info, instead of directly in the node.
    This reduces the size usage of an in-memory inode when it is not
    using encryption.

    2) We drop the ext4_fname_crypto_ctx entirely, and use the per-inode
    encryption structure instead. This remove an unnecessary memory
    allocation and free for the fname_crypto_ctx as well as allowing us
    to reuse the ctfm in a directory for multiple lookups and file
    creations.

    3) We also cache the inode's policy information in the ext4_crypt_info
    structure so we don't have to continually read it out of the
    extended attributes.

    4) We now keep the keyring key in the inode's encryption structure
    instead of releasing it after we are done using it to derive the
    per-inode key. This allows us to test to see if the key has been
    revoked; if it has, we prevent the use of the derived key and free
    it.

    5) When an inode is released (or when the derived key is freed), we
    will use memset_explicit() to zero out the derived key, so it's not
    left hanging around in memory. This implies that when a user logs
    out, it is important to first revoke the key, and then unlink it,
    and then finally, to use "echo 3 > /proc/sys/vm/drop_caches" to
    release any decrypted pages and dcache entries from the system
    caches.

    6) All this, and we also shrink the number of lines of code by around
    100. :-)

    Signed-off-by: Theodore Ts'o

    Theodore Ts'o
     
  • Signed-off-by: Theodore Ts'o

    Theodore Ts'o
     

11 May, 2015

4 commits


04 May, 2015

1 commit

  • Pull ext4 fixes from Ted Ts'o:
    "Some miscellaneous bug fixes and some final on-disk and ABI changes
    for ext4 encryption which provide better security and performance"

    * tag 'for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
    ext4: fix growing of tiny filesystems
    ext4: move check under lock scope to close a race.
    ext4: fix data corruption caused by unwritten and delayed extents
    ext4 crypto: remove duplicated encryption mode definitions
    ext4 crypto: do not select from EXT4_FS_ENCRYPTION
    ext4 crypto: add padding to filenames before encrypting
    ext4 crypto: simplify and speed up filename encryption

    Linus Torvalds
     

02 May, 2015

1 commit


27 Apr, 2015

1 commit

  • Pull fourth vfs update from Al Viro:
    "d_inode() annotations from David Howells (sat in for-next since before
    the beginning of merge window) + four assorted fixes"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    RCU pathwalk breakage when running into a symlink overmounting something
    fix I_DIO_WAKEUP definition
    direct-io: only inc/dec inode->i_dio_count for file systems
    fs/9p: fix readdir()
    VFS: assorted d_backing_inode() annotations
    VFS: fs/inode.c helpers: d_inode() annotations
    VFS: fs/cachefiles: d_backing_inode() annotations
    VFS: fs library helpers: d_inode() annotations
    VFS: assorted weird filesystems: d_inode() annotations
    VFS: normal filesystems (and lustre): d_inode() annotations
    VFS: security/: d_inode() annotations
    VFS: security/: d_backing_inode() annotations
    VFS: net/: d_inode() annotations
    VFS: net/unix: d_backing_inode() annotations
    VFS: kernel/: d_inode() annotations
    VFS: audit: d_backing_inode() annotations
    VFS: Fix up some ->d_inode accesses in the chelsio driver
    VFS: Cachefiles should perform fs modifications on the top layer only
    VFS: AF_UNIX sockets should call mknod on the top layer only

    Linus Torvalds
     

16 Apr, 2015

2 commits


03 Apr, 2015

1 commit


11 Dec, 2012

1 commit

  • Ted has sent out a RFC about removing this feature. Eric and Jan
    confirmed that both RedHat and SUSE enable this feature in all their
    product. David also said that "As far as I know, it's enabled in all
    Android kernels that use ext4." So it seems OK for us.

    And what's more, as inline data depends its implementation on xattr,
    and to be frank, I don't run any test again inline data enabled while
    xattr disabled. So I think we should add inline data and remove this
    config option in the same release.

    [ The savings if you disable CONFIG_EXT4_FS_XATTR is only 27k, which
    isn't much in the grand scheme of things. Since no one seems to be
    testing this configuration except for some automated compile farms, on
    balance we are better removing this config option, and so that it is
    effectively always enabled. -- tytso ]

    Cc: David Brown
    Cc: Eric Sandeen
    Reviewed-by: Jan Kara
    Signed-off-by: Tao Ma
    Signed-off-by: "Theodore Ts'o"

    Tao Ma
     

16 May, 2010

1 commit


11 Oct, 2008

1 commit


09 Sep, 2008

1 commit


30 Apr, 2008

1 commit


13 Feb, 2007

1 commit

  • Many struct inode_operations in the kernel can be "const". Marking them const
    moves these to the .rodata section, which avoids false sharing with potential
    dirty data. In addition it'll catch accidental writes at compile time to
    these shared resources.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

12 Oct, 2006

3 commits