27 Jan, 2021

3 commits

  • Wire up the splice_read and splice_write methods to the default
    helpers using ->read_iter and ->write_iter now that those are
    implemented for kernfs. This restores support to use splice and
    sendfile on kernfs files.

    Fixes: 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")
    Reported-by: Siddharth Gupta
    Tested-by: Siddharth Gupta
    Signed-off-by: Christoph Hellwig
    Link: https://lore.kernel.org/r/20210120204631.274206-4-hch@lst.de
    Signed-off-by: Greg Kroah-Hartman
    (cherry picked from commit f2d6c2708bd84ca953fa6b6ca5717e79eb0140c7)
    Bug: 176079972
    Signed-off-by: Greg Kroah-Hartman
    Change-Id: I80f09db0b8569fa63db59ada9c3d45d6600b2d70

    Christoph Hellwig
     
  • Switch kernfs to implement the write_iter method instead of plain old
    write to prepare to supporting splice and sendfile again.

    Signed-off-by: Christoph Hellwig
    Link: https://lore.kernel.org/r/20210120204631.274206-3-hch@lst.de
    Signed-off-by: Greg Kroah-Hartman
    (cherry picked from commit cc099e0b399889c6485c88368b19824b087c9f8c)
    Signed-off-by: Greg Kroah-Hartman
    Change-Id: I660c93c520169534c874cef2d246fef8c8fe2bbc

    Christoph Hellwig
     
  • Switch kernfs to implement the read_iter method instead of plain old
    read to prepare to supporting splice and sendfile again.

    Signed-off-by: Christoph Hellwig
    Link: https://lore.kernel.org/r/20210120204631.274206-2-hch@lst.de
    Signed-off-by: Greg Kroah-Hartman
    (cherry picked from commit 4eaad21a6ac9865df7f31983232ed5928450458d)
    Signed-off-by: Greg Kroah-Hartman
    Change-Id: I75af3b3bae22de7ba46ec38b8182be335d6760e8

    Christoph Hellwig
     

07 Aug, 2020

1 commit


28 Jul, 2020

3 commits

  • The arguments of fsnotify() are overloaded and mean different things
    for different event types.

    Replace the to_tell argument with separate arguments @dir and @inode,
    because we may be sending to both dir and child. Using the @data
    argument to pass the child is not enough, because dirent events pass
    this argument (for audit), but we do not report to child.

    Document the new fsnotify() function argumenets.

    Link: https://lore.kernel.org/r/20200722125849.17418-7-amir73il@gmail.com
    Signed-off-by: Amir Goldstein
    Signed-off-by: Jan Kara

    Amir Goldstein
     
  • Simple helper to consolidate biolerplate code.

    Link: https://lore.kernel.org/r/20200722125849.17418-5-amir73il@gmail.com
    Signed-off-by: Amir Goldstein
    Signed-off-by: Jan Kara

    Amir Goldstein
     
  • Instead of calling fsnotify() twice, once with parent inode and once
    with child inode, if event should be sent to parent inode, send it
    with both parent and child inodes marks in object type iterator and call
    the backend handle_event() callback only once.

    The parent inode is assigned to the standard "inode" iterator type and
    the child inode is assigned to the special "child" iterator type.

    In that case, the bit FS_EVENT_ON_CHILD will be set in the event mask,
    the dir argument to handle_event will be the parent inode, the file_name
    argument to handle_event is non NULL and refers to the name of the child
    and the child inode can be accessed with fsnotify_data_inode().

    This will allow fanotify to make decisions based on child or parent's
    ignored mask. For example, when a parent is interested in a specific
    event on its children, but a specific child wishes to ignore this event,
    the event will not be reported. This is not what happens with current
    code, but according to man page, it is the expected behavior.

    Link: https://lore.kernel.org/r/20200716084230.30611-15-amir73il@gmail.com
    Signed-off-by: Amir Goldstein
    Signed-off-by: Jan Kara

    Amir Goldstein
     

15 Jul, 2020

1 commit

  • When creating an FS_MODIFY event on inode itself (not on parent)
    the file_name argument should be NULL.

    The change to send a non NULL name to inode itself was done on purpuse
    as part of another commit, as Tejun writes: "...While at it, supply the
    target file name to fsnotify() from kernfs_node->name.".

    But this is wrong practice and inconsistent with inotify behavior when
    watching a single file. When a child is being watched (as opposed to the
    parent directory) the inotify event should contain the watch descriptor,
    but not the file name.

    Fixes: df6a58c5c5aa ("kernfs: don't depend on d_find_any_alias()...")
    Link: https://lore.kernel.org/r/20200708111156.24659-5-amir73il@gmail.com
    Acked-by: Tejun Heo
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Amir Goldstein
    Signed-off-by: Jan Kara

    Amir Goldstein
     

24 Jun, 2020

2 commits


10 Jun, 2020

1 commit

  • Convert comments that reference mmap_sem to reference mmap_lock instead.

    [akpm@linux-foundation.org: fix up linux-next leftovers]
    [akpm@linux-foundation.org: s/lockaphore/lock/, per Vlastimil]
    [akpm@linux-foundation.org: more linux-next fixups, per Michel]

    Signed-off-by: Michel Lespinasse
    Signed-off-by: Andrew Morton
    Reviewed-by: Vlastimil Babka
    Reviewed-by: Daniel Jordan
    Cc: Davidlohr Bueso
    Cc: David Rientjes
    Cc: Hugh Dickins
    Cc: Jason Gunthorpe
    Cc: Jerome Glisse
    Cc: John Hubbard
    Cc: Laurent Dufour
    Cc: Liam Howlett
    Cc: Matthew Wilcox
    Cc: Peter Zijlstra
    Cc: Ying Han
    Link: http://lkml.kernel.org/r/20200520052908.204642-13-walken@google.com
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     

23 Apr, 2020

1 commit

  • The kernfs_node lockdep tracking is being done on kn->active, the
    active reference count. The other reference count (kn->count) is not
    tracked by lockdep. So change the lockdep name to reflect what it is
    tracking.

    Signed-off-by: Waiman Long
    Acked-by: Tejun Heo
    Link: https://lore.kernel.org/r/20200402171056.27871-1-longman@redhat.com
    Signed-off-by: Greg Kroah-Hartman

    Waiman Long
     

08 Apr, 2020

1 commit


17 Mar, 2020

2 commits

  • User extended attributes are useful as metadata storage for kernfs
    consumers like cgroups. Especially in the case of cgroups, it is useful
    to have a central metadata store that multiple processes/services can
    use to coordinate actions.

    A concrete example is for userspace out of memory killers. We want to
    let delegated cgroup subtree owners (running as non-root) to be able to
    say "please avoid killing this cgroup". This is especially important for
    desktop linux as delegated subtrees owners are less likely to run as
    root.

    This patch introduces a new flag, KERNFS_ROOT_SUPPORT_USER_XATTR, that
    lets kernfs consumers enable user xattr support. An initial limit of 128
    entries or 128KB -- whichever is hit first -- is placed per cgroup
    because xattrs come from kernel memory and we don't want to let
    unprivileged users accidentally eat up too much kernel memory.

    Signed-off-by: Daniel Xu
    Acked-by: Chris Down
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Tejun Heo

    Daniel Xu
     
  • This helps set up size accounting in the next commit. Without this out
    param, it's difficult to find out the removed xattr size without taking
    a lock for longer and walking the xattr linked list twice.

    Signed-off-by: Daniel Xu
    Acked-by: Chris Down
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Tejun Heo

    Daniel Xu
     

09 Feb, 2020

1 commit


05 Feb, 2020

1 commit

  • Pull vfs timestamp updates from Al Viro:
    "More 64bit timestamp work"

    * 'imm.timestamp' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    kernfs: don't bother with timestamp truncation
    fs: Do not overload update_time
    fs: Delete timespec64_trunc()
    fs: ubifs: Eliminate timespec64_trunc() usage
    fs: ceph: Delete timespec64_trunc() usage
    fs: cifs: Delete usage of timespec64_trunc
    fs: fat: Eliminate timespec64_trunc() usage
    utimes: Clamp the timestamps in notify_change()

    Linus Torvalds
     

03 Feb, 2020

1 commit


14 Jan, 2020

1 commit

  • Previously there was an additional check if variable pos is not null.
    However, this check happens after entering while loop and only then,
    which can happen only if pos is not null.
    Therefore the additional check is redundant and can be removed.

    Signed-off-by: Mateusz Nosek
    Acked-by: Tejun Heo
    Link: https://lore.kernel.org/r/20191230191628.21099-1-mateusznosek0@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Mateusz Nosek
     

09 Dec, 2019

2 commits


07 Dec, 2019

1 commit

  • Pull vfs d_inode/d_flags memory ordering fixes from Al Viro:
    "Fallout from tree-wide audit for ->d_inode/->d_flags barriers use.
    Basically, the problem is that negative pinned dentries require
    careful treatment - unless ->d_lock is locked or parent is held at
    least shared, another thread can make them positive right under us.

    Most of the uses turned out to be safe - the main surprises as far as
    filesystems are concerned were

    - race in dget_parent() fastpath, that might end up with the caller
    observing the returned dentry _negative_, due to insufficient
    barriers. It is positive in memory, but we could end up seeing the
    wrong value of ->d_inode in CPU cache. Fixed.

    - manual checks that result of lookup_one_len_unlocked() is positive
    (and rejection of negatives). Again, insufficient barriers (we
    might end up with inconsistent observed values of ->d_inode and
    ->d_flags). Fixed by switching to a new primitive that does the
    checks itself and returns ERR_PTR(-ENOENT) instead of a negative
    dentry. That way we get rid of boilerplate converting negatives
    into ERR_PTR(-ENOENT) in the callers and have a single place to
    deal with the barrier-related mess - inside fs/namei.c rather than
    in every caller out there.

    The guts of pathname resolution *do* need to be careful - the race
    found by Ritesh is real, as well as several similar races.
    Fortunately, it turns out that we can take care of that with fairly
    local changes in there.

    The tree-wide audit had not been fun, and I hate the idea of repeating
    it. I think the right approach would be to annotate the places where
    we are _not_ guaranteed ->d_inode/->d_flags stability and have sparse
    catch regressions. But I'm still not sure what would be the least
    invasive way of doing that and it's clearly the next cycle fodder"

    * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs/namei.c: fix missing barriers when checking positivity
    fix dget_parent() fastpath race
    new helper: lookup_positive_unlocked()
    fs/namei.c: pull positivity check into follow_managed()

    Linus Torvalds
     

27 Nov, 2019

1 commit

  • Pull locking updates from Ingo Molnar:
    "The main changes in this cycle were:

    - A comprehensive rewrite of the robust/PI futex code's exit handling
    to fix various exit races. (Thomas Gleixner et al)

    - Rework the generic REFCOUNT_FULL implementation using
    atomic_fetch_* operations so that the performance impact of the
    cmpxchg() loops is mitigated for common refcount operations.

    With these performance improvements the generic implementation of
    refcount_t should be good enough for everybody - and this got
    confirmed by performance testing, so remove ARCH_HAS_REFCOUNT and
    REFCOUNT_FULL entirely, leaving the generic implementation enabled
    unconditionally. (Will Deacon)

    - Other misc changes, fixes, cleanups"

    * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits)
    lkdtm: Remove references to CONFIG_REFCOUNT_FULL
    locking/refcount: Remove unused 'refcount_error_report()' function
    locking/refcount: Consolidate implementations of refcount_t
    locking/refcount: Consolidate REFCOUNT_{MAX,SATURATED} definitions
    locking/refcount: Move saturation warnings out of line
    locking/refcount: Improve performance of generic REFCOUNT_FULL code
    locking/refcount: Move the bulk of the REFCOUNT_FULL implementation into the header
    locking/refcount: Remove unused refcount_*_checked() variants
    locking/refcount: Ensure integer operands are treated as signed
    locking/refcount: Define constants for saturation and max refcount values
    futex: Prevent exit livelock
    futex: Provide distinct return value when owner is exiting
    futex: Add mutex around futex exit
    futex: Provide state handling for exec() as well
    futex: Sanitize exit state handling
    futex: Mark the begin of futex exit explicitly
    futex: Set task::futex_state to DEAD right after handling futex exit
    futex: Split futex_mm_release() for exit/exec
    exit/exec: Seperate mm_release()
    futex: Replace PF_EXITPIDONE with a state
    ...

    Linus Torvalds
     

16 Nov, 2019

1 commit

  • Most of the callers of lookup_one_len_unlocked() treat negatives are
    ERR_PTR(-ENOENT). Provide a helper that would do just that. Note
    that a pinned positive dentry remains positive - it's ->d_inode is
    stable, etc.; a pinned _negative_ dentry can become positive at any
    point as long as you are not holding its parent at least shared.
    So using lookup_one_len_unlocked() needs to be careful;
    lookup_positive_unlocked() is safer and that's what the callers
    end up open-coding anyway.

    Signed-off-by: Al Viro

    Al Viro
     

13 Nov, 2019

7 commits

  • Each kernfs_node is identified with a 64bit ID. The low 32bit is
    exposed as ino and the high gen. While this already allows using inos
    as keys by looking up with wildcard generation number of 0, it's
    adding unnecessary complications for 64bit ino archs which can
    directly use kernfs_node IDs as inos to uniquely identify each cgroup
    instance.

    This patch exposes IDs directly as inos on 64bit ino archs. The
    conversion is mostly straight-forward.

    * 32bit ino archs behave the same as before. 64bit ino archs now use
    the whole 64bit ID as ino and the generation number is fixed at 1.

    * 64bit inos still use the same idr allocator which gurantees that the
    lower 32bits identify the current live instance uniquely and the
    high 32bits are incremented whenever the low bits wrap. As the
    upper 32bits are no longer used as gen and we don't wanna start ino
    allocation with 33rd bit set, the initial value for highbits
    allocation is changed to 0 on 64bit ino archs.

    * blktrace exposes two 32bit numbers - (INO,GEN) pair - to identify
    the issuing cgroup. Userland builds FILEID_INO32_GEN fids from
    these numbers to look up the cgroups. To remain compatible with the
    behavior, always output (LOW32,HIGH32) which will be constructed
    back to the original 64bit ID by __kernfs_fh_to_dentry().

    Signed-off-by: Tejun Heo
    Reviewed-by: Greg Kroah-Hartman
    Cc: Namhyung Kim

    Tejun Heo
     
  • The current kernfs exportfs implementation uses the generic_fh_*()
    helpers and FILEID_INO32_GEN[_PARENT] which limits ino to 32bits.
    Let's implement custom exportfs operations and fid type to remove the
    restriction.

    * FILEID_KERNFS is a single u64 value whose content is
    kernfs_node->id. This is the only native fid type.

    * For backward compatibility with blk_log_action() path which exposes
    (ino,gen) pairs which userland assembles into FILEID_INO32_GEN keys,
    combine the generic keys into 64bit IDs in the same order.

    Signed-off-by: Tejun Heo
    Reviewed-by: Greg Kroah-Hartman
    Cc: Namhyung Kim

    Tejun Heo
     
  • kernfs_find_and_get_node_by_ino() looks the kernfs_node matching the
    specified ino. On top of that, kernfs_get_node_by_id() and
    kernfs_fh_get_inode() implement full ID matching by testing the rest
    of ID.

    On surface, confusingly, the two are slightly different in that the
    latter uses 0 gen as wildcard while the former doesn't - does it mean
    that the latter can't uniquely identify inodes w/ 0 gen? In practice,
    this is a distinction without a difference because generation number
    starts at 1. There are no actual IDs with 0 gen, so it can always
    safely used as wildcard.

    Let's simplify the code by renaming kernfs_find_and_get_node_by_ino()
    to kernfs_find_and_get_node_by_id(), moving all lookup logics into it,
    and removing now unnecessary kernfs_get_node_by_id().

    Signed-off-by: Tejun Heo
    Reviewed-by: Greg Kroah-Hartman

    Tejun Heo
     
  • kernfs_node->id is currently a union kernfs_node_id which represents
    either a 32bit (ino, gen) pair or u64 value. I can't see much value
    in the usage of the union - all that's needed is a 64bit ID which the
    current code is already limited to. Using a union makes the code
    unnecessarily complicated and prevents using 64bit ino without adding
    practical benefits.

    This patch drops union kernfs_node_id and makes kernfs_node->id a u64.
    ino is stored in the lower 32bits and gen upper. Accessors -
    kernfs[_id]_ino() and kernfs[_id]_gen() - are added to retrieve the
    ino and gen. This simplifies ID handling less cumbersome and will
    allow using 64bit inos on supported archs.

    This patch doesn't make any functional changes.

    Signed-off-by: Tejun Heo
    Reviewed-by: Greg Kroah-Hartman
    Cc: Namhyung Kim
    Cc: Jens Axboe
    Cc: Alexei Starovoitov

    Tejun Heo
     
  • kernfs node can be created in two separate steps - allocation and
    activation. This is used to make kernfs nodes visible only after the
    internal states attached to the node are fully initialized.
    kernfs_find_and_get_node_by_id() currently allows lookups of nodes
    which aren't activated yet and thus can expose nodes are which are
    still being prepped by kernfs users.

    Fix it by disallowing lookups of nodes which aren't activated yet.

    kernfs_find_and_get_node_by_ino()

    Signed-off-by: Tejun Heo
    Reviewed-by: Greg Kroah-Hartman
    Cc: Namhyung Kim

    Tejun Heo
     
  • kernfs_find_and_get_node_by_ino() uses RCU protection. It's currently
    a bit buggy because it can look up a node which hasn't been activated
    yet and thus may end up exposing a node that the kernfs user is still
    prepping.

    While it can be fixed by pushing it further in the current direction,
    it's already complicated and isn't clear whether the complexity is
    justified. The main use of kernfs_find_and_get_node_by_ino() is for
    exportfs operations. They aren't super hot and all the follow-up
    operations (e.g. mapping to path) use normal locking anyway.

    Let's switch to a dumber locking scheme and protect the lookup with
    kernfs_idr_lock.

    Signed-off-by: Tejun Heo
    Reviewed-by: Greg Kroah-Hartman
    Cc: Namhyung Kim

    Tejun Heo
     
  • When the 32bit ino wraps around, kernfs increments the generation
    number to distinguish reused ino instances. The wrap-around detection
    tests whether the allocated ino is lower than what the cursor but the
    cursor is pointing to the next ino to allocate so the condition never
    triggers.

    Fix it by remembering the last ino and comparing against that.

    Signed-off-by: Tejun Heo
    Reviewed-by: Greg Kroah-Hartman
    Fixes: 4a3ef68acacf ("kernfs: implement i_generation")
    Cc: Namhyung Kim
    Cc: stable@vger.kernel.org # v4.14+

    Tejun Heo
     

06 Nov, 2019

1 commit

  • Add a flag option to get xattr method that could have a bit flag of
    XATTR_NOSECURITY passed to it. XATTR_NOSECURITY is generally then
    set in the __vfs_getxattr path when called by security
    infrastructure.

    This handles the case of a union filesystem driver that is being
    requested by the security layer to report back the xattr data.

    For the use case where access is to be blocked by the security layer.

    The path then could be security(dentry) ->
    __vfs_getxattr(dentry...XATTR_NOSECURITY) ->
    handler->get(dentry...XATTR_NOSECURITY) ->
    __vfs_getxattr(lower_dentry...XATTR_NOSECURITY) ->
    lower_handler->get(lower_dentry...XATTR_NOSECURITY)
    which would report back through the chain data and success as
    expected, the logging security layer at the top would have the
    data to determine the access permissions and report back the target
    context that was blocked.

    Without the get handler flag, the path on a union filesystem would be
    the errant security(dentry) -> __vfs_getxattr(dentry) ->
    handler->get(dentry) -> vfs_getxattr(lower_dentry) -> nested ->
    security(lower_dentry, log off) -> lower_handler->get(lower_dentry)
    which would report back through the chain no data, and -EACCES.

    For selinux for both cases, this would translate to a correctly
    determined blocked access. In the first case with this change a correct avc
    log would be reported, in the second legacy case an incorrect avc log
    would be reported against an uninitialized u:object_r:unlabeled:s0
    context making the logs cosmetically useless for audit2allow.

    This patch series is inert and is the wide-spread addition of the
    flags option for xattr functions, and a replacement of __vfs_getxattr
    with __vfs_getxattr(...XATTR_NOSECURITY).

    Signed-off-by: Mark Salyzyn
    Reviewed-by: Jan Kara
    Acked-by: Jan Kara
    Acked-by: Jeff Layton
    Acked-by: David Sterba
    Acked-by: Darrick J. Wong
    Acked-by: Mike Marshall
    Cc: Stephen Smalley
    Cc: linux-kernel@vger.kernel.org
    Cc: kernel-team@android.com
    Cc: linux-security-module@vger.kernel.org

    (cherry picked from (rejected from archive because of too many recipients))
    Signed-off-by: Mark Salyzyn
    Bug: 133515582
    Bug: 136124883
    Bug: 129319403
    Change-Id: Iabbb8771939d5f66667a26bb23ddf4c562c349a1

    Mark Salyzyn
     

09 Oct, 2019

1 commit

  • Since the following commit:

    b4adfe8e05f1 ("locking/lockdep: Remove unused argument in __lock_release")

    @nested is no longer used in lock_release(), so remove it from all
    lock_release() calls and friends.

    Signed-off-by: Qian Cai
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Will Deacon
    Acked-by: Daniel Vetter
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: airlied@linux.ie
    Cc: akpm@linux-foundation.org
    Cc: alexander.levin@microsoft.com
    Cc: daniel@iogearbox.net
    Cc: davem@davemloft.net
    Cc: dri-devel@lists.freedesktop.org
    Cc: duyuyang@gmail.com
    Cc: gregkh@linuxfoundation.org
    Cc: hannes@cmpxchg.org
    Cc: intel-gfx@lists.freedesktop.org
    Cc: jack@suse.com
    Cc: jlbec@evilplan.or
    Cc: joonas.lahtinen@linux.intel.com
    Cc: joseph.qi@linux.alibaba.com
    Cc: jslaby@suse.com
    Cc: juri.lelli@redhat.com
    Cc: maarten.lankhorst@linux.intel.com
    Cc: mark@fasheh.com
    Cc: mhocko@kernel.org
    Cc: mripard@kernel.org
    Cc: ocfs2-devel@oss.oracle.com
    Cc: rodrigo.vivi@intel.com
    Cc: sean@poorly.run
    Cc: st@kernel.org
    Cc: tj@kernel.org
    Cc: tytso@mit.edu
    Cc: vdavydov.dev@gmail.com
    Cc: vincent.guittot@linaro.org
    Cc: viro@zeniv.linux.org.uk
    Link: https://lkml.kernel.org/r/1568909380-32199-1-git-send-email-cai@lca.pw
    Signed-off-by: Ingo Molnar

    Qian Cai
     

20 Sep, 2019

1 commit

  • Pull y2038 vfs updates from Arnd Bergmann:
    "Add inode timestamp clamping.

    This series from Deepa Dinamani adds a per-superblock minimum/maximum
    timestamp limit for a file system, and clamps timestamps as they are
    written, to avoid random behavior from integer overflow as well as
    having different time stamps on disk vs in memory.

    At mount time, a warning is now printed for any file system that can
    represent current timestamps but not future timestamps more than 30
    years into the future, similar to the arbitrary 30 year limit that was
    added to settimeofday().

    This was picked as a compromise to warn users to migrate to other file
    systems (e.g. ext4 instead of ext3) when they need the file system to
    survive beyond 2038 (or similar limits in other file systems), but not
    get in the way of normal usage"

    * tag 'y2038-vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground:
    ext4: Reduce ext4 timestamp warnings
    isofs: Initialize filesystem timestamp ranges
    pstore: fs superblock limits
    fs: omfs: Initialize filesystem timestamp ranges
    fs: hpfs: Initialize filesystem timestamp ranges
    fs: ceph: Initialize filesystem timestamp ranges
    fs: sysv: Initialize filesystem timestamp ranges
    fs: affs: Initialize filesystem timestamp ranges
    fs: fat: Initialize filesystem timestamp ranges
    fs: cifs: Initialize filesystem timestamp ranges
    fs: nfs: Initialize filesystem timestamp ranges
    ext4: Initialize timestamps limits
    9p: Fill min and max timestamps in sb
    fs: Fill in max and min timestamps in superblock
    utimes: Clamp the timestamps before update
    mount: Add mount warning for impending timestamp expiry
    timestamp_truncate: Replace users of timespec64_trunc
    vfs: Add timestamp_truncate() api
    vfs: Add file timestamp range support

    Linus Torvalds
     

30 Aug, 2019

1 commit

  • Update the inode timestamp updates to use timestamp_truncate()
    instead of timespec64_trunc().

    The change was mostly generated by the following coccinelle
    script.

    virtual context
    virtual patch

    @r1 depends on patch forall@
    struct inode *inode;
    identifier i_xtime =~ "^i_[acm]time$";
    expression e;
    @@

    inode->i_xtime =
    - timespec64_trunc(
    + timestamp_truncate(
    ...,
    - e);
    + inode);

    Signed-off-by: Deepa Dinamani
    Acked-by: Greg Kroah-Hartman
    Acked-by: Jeff Layton
    Cc: adrian.hunter@intel.com
    Cc: dedekind1@gmail.com
    Cc: gregkh@linuxfoundation.org
    Cc: hch@lst.de
    Cc: jaegeuk@kernel.org
    Cc: jlbec@evilplan.org
    Cc: richard@nod.at
    Cc: tj@kernel.org
    Cc: yuchao0@huawei.com
    Cc: linux-f2fs-devel@lists.sourceforge.net
    Cc: linux-ntfs-dev@lists.sourceforge.net
    Cc: linux-mtd@lists.infradead.org

    Deepa Dinamani
     

25 Jul, 2019

2 commits

  • In kernfs_path_from_node_locked(), there is an if statement on line 147
    to check whether buf is NULL:
    if (buf)

    When buf is NULL, it is used on line 151:
    len += strlcpy(buf + len, parent_str, ...)
    and line 158:
    len += strlcpy(buf + len, "/", ...)
    and line 160:
    len += strlcpy(buf + len, kn->name, ...)

    Thus, possible null-pointer dereferences may occur.

    To fix these possible bugs, buf is checked before being used.
    If it is NULL, -EINVAL is returned.

    These bugs are found by a static analysis tool STCheck written by us.

    Signed-off-by: Jia-Ju Bai
    Link: https://lore.kernel.org/r/20190724022242.27505-1-baijiaju1990@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Jia-Ju Bai
     
  • Get root safely after kn is ensureed to be not null.

    Signed-off-by: Peng Wang
    Acked-by: Tejun Heo
    Link: https://lore.kernel.org/r/20190708151611.13242-1-rocking@whu.edu.cn
    Signed-off-by: Greg Kroah-Hartman

    Peng Wang
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this file is released under the gplv2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 68 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Armijn Hemel
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190531190114.292346262@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


08 May, 2019

1 commit

  • Pull misc dcache updates from Al Viro:
    "Most of this pile is putting name length into struct name_snapshot and
    making use of it.

    The beginning of this series ("ovl_lookup_real_one(): don't bother
    with strlen()") ought to have been split in two (separate switch of
    name_snapshot to struct qstr from overlayfs reaping the trivial
    benefits of that), but I wanted to avoid a rebase - by the time I'd
    spotted that it was (a) in -next and (b) close to 5.1-final ;-/"

    * 'work.dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    audit_compare_dname_path(): switch to const struct qstr *
    audit_update_watch(): switch to const struct qstr *
    inotify_handle_event(): don't bother with strlen()
    fsnotify: switch send_to_group() and ->handle_event to const struct qstr *
    fsnotify(): switch to passing const struct qstr * for file_name
    switch fsnotify_move() to passing const struct qstr * for old_name
    ovl_lookup_real_one(): don't bother with strlen()
    sysv: bury the broken "quietly truncate the long filenames" logics
    nsfs: unobfuscate
    unexport d_alloc_pseudo()

    Linus Torvalds