20 Jul, 2019

1 commit

  • Pull vfs mount updates from Al Viro:
    "The first part of mount updates.

    Convert filesystems to use the new mount API"

    * 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits)
    mnt_init(): call shmem_init() unconditionally
    constify ksys_mount() string arguments
    don't bother with registering rootfs
    init_rootfs(): don't bother with init_ramfs_fs()
    vfs: Convert smackfs to use the new mount API
    vfs: Convert selinuxfs to use the new mount API
    vfs: Convert securityfs to use the new mount API
    vfs: Convert apparmorfs to use the new mount API
    vfs: Convert openpromfs to use the new mount API
    vfs: Convert xenfs to use the new mount API
    vfs: Convert gadgetfs to use the new mount API
    vfs: Convert oprofilefs to use the new mount API
    vfs: Convert ibmasmfs to use the new mount API
    vfs: Convert qib_fs/ipathfs to use the new mount API
    vfs: Convert efivarfs to use the new mount API
    vfs: Convert configfs to use the new mount API
    vfs: Convert binfmt_misc to use the new mount API
    convenience helper: get_tree_single()
    convenience helper get_tree_nodev()
    vfs: Kill sget_userns()
    ...

    Linus Torvalds
     

03 Jun, 2019

1 commit

  • Adding sysfs_update_groups function to update
    multiple groups.

    sysfs_update_groups - given a directory kobject, create a bunch of attribute groups
    @kobj: The kobject to update the group on
    @groups: The attribute groups to update, NULL terminated

    This function update a bunch of attribute groups. If an error occurs when
    updating a group, all previously updated groups will be removed together
    with already existing (not updated) attributes.

    Signed-off-by: Jiri Olsa
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Greg Kroah-Hartman
    Cc: Alexander Shishkin
    Cc: Arnaldo Carvalho de Melo
    Cc: Linus Torvalds
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20190512155518.21468-2-jolsa@kernel.org
    Signed-off-by: Ingo Molnar

    Jiri Olsa
     

26 May, 2019

1 commit


21 May, 2019

1 commit


17 Mar, 2019

1 commit


16 Mar, 2019

1 commit


13 Mar, 2019

1 commit

  • Pull vfs mount infrastructure updates from Al Viro:
    "The rest of core infrastructure; no new syscalls in that pile, but the
    old parts are switched to new infrastructure. At that point
    conversions of individual filesystems can happen independently; some
    are done here (afs, cgroup, procfs, etc.), there's also a large series
    outside of that pile dealing with NFS (quite a bit of option-parsing
    stuff is getting used there - it's one of the most convoluted
    filesystems in terms of mount-related logics), but NFS bits are the
    next cycle fodder.

    It got seriously simplified since the last cycle; documentation is
    probably the weakest bit at the moment - I considered dropping the
    commit introducing Documentation/filesystems/mount_api.txt (cutting
    the size increase by quarter ;-), but decided that it would be better
    to fix it up after -rc1 instead.

    That pile allows to do followup work in independent branches, which
    should make life much easier for the next cycle. fs/super.c size
    increase is unpleasant; there's a followup series that allows to
    shrink it considerably, but I decided to leave that until the next
    cycle"

    * 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (41 commits)
    afs: Use fs_context to pass parameters over automount
    afs: Add fs_context support
    vfs: Add some logging to the core users of the fs_context log
    vfs: Implement logging through fs_context
    vfs: Provide documentation for new mount API
    vfs: Remove kern_mount_data()
    hugetlbfs: Convert to fs_context
    cpuset: Use fs_context
    kernfs, sysfs, cgroup, intel_rdt: Support fs_context
    cgroup: store a reference to cgroup_ns into cgroup_fs_context
    cgroup1_get_tree(): separate "get cgroup_root to use" into a separate helper
    cgroup_do_mount(): massage calling conventions
    cgroup: stash cgroup_root reference into cgroup_fs_context
    cgroup2: switch to option-by-option parsing
    cgroup1: switch to option-by-option parsing
    cgroup: take options parsing into ->parse_monolithic()
    cgroup: fold cgroup1_mount() into cgroup1_get_tree()
    cgroup: start switching to fs_context
    ipc: Convert mqueue fs to fs_context
    proc: Add fs_context support to procfs
    ...

    Linus Torvalds
     

28 Feb, 2019

1 commit

  • Make kernfs support superblock creation/mount/remount with fs_context.

    This requires that sysfs, cgroup and intel_rdt, which are built on kernfs,
    be made to support fs_context also.

    Notes:

    (1) A kernfs_fs_context struct is created to wrap fs_context and the
    kernfs mount parameters are moved in here (or are in fs_context).

    (2) kernfs_mount{,_ns}() are made into kernfs_get_tree(). The extra
    namespace tag parameter is passed in the context if desired

    (3) kernfs_free_fs_context() is provided as a destructor for the
    kernfs_fs_context struct, but for the moment it does nothing except
    get called in the right places.

    (4) sysfs doesn't wrap kernfs_fs_context since it has no parameters to
    pass, but possibly this should be done anyway in case someone wants to
    add a parameter in future.

    (5) A cgroup_fs_context struct is created to wrap kernfs_fs_context and
    the cgroup v1 and v2 mount parameters are all moved there.

    (6) cgroup1 parameter parsing error messages are now handled by invalf(),
    which allows userspace to collect them directly.

    (7) cgroup1 parameter cleanup is now done in the context destructor rather
    than in the mount/get_tree and remount functions.

    Weirdies:

    (*) cgroup_do_get_tree() calls cset_cgroup_from_root() with locks held,
    but then uses the resulting pointer after dropping the locks. I'm
    told this is okay and needs commenting.

    (*) The cgroup refcount web. This really needs documenting.

    (*) cgroup2 only has one root?

    Add a suggestion from Thomas Gleixner in which the RDT enablement code is
    placed into its own function.

    [folded a leak fix from Andrey Vagin]

    Signed-off-by: David Howells
    cc: Greg Kroah-Hartman
    cc: Tejun Heo
    cc: Li Zefan
    cc: Johannes Weiner
    cc: cgroups@vger.kernel.org
    cc: fenghua.yu@intel.com
    Signed-off-by: Al Viro

    David Howells
     

08 Feb, 2019

1 commit


18 Jan, 2019

1 commit


07 Jan, 2019

1 commit

  • It's rude to crash the system just because the developer did something
    wrong, as it prevents them from usually even seeing what went wrong.

    So convert the few BUG_ON() calls that have snuck into the sysfs code
    over the years to WARN_ON() to make it more "friendly". All of these
    are able to be recovered from, so it makes no sense to crash.

    Reported-by: Linus Torvalds
    Reviewed-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

04 Dec, 2018

1 commit

  • Let the passed in array be const (and thus placed in rodata) instead of
    a mutable array of const pointers.

    Cc: Greg Kroah-Hartman
    Cc: "Rafael J. Wysocki"
    Reviewed-by: Rafael J. Wysocki
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Jani Nikula
    Link: https://patchwork.freedesktop.org/patch/msgid/20181004143750.30880-1-jani.nikula@intel.com

    Jani Nikula
     

19 Aug, 2018

1 commit

  • Pull driver core updates from Greg KH:
    "Here are all of the driver core and related patches for 4.19-rc1.

    Nothing huge here, just a number of small cleanups and the ability to
    now stop the deferred probing after init happens.

    All of these have been in linux-next for a while with only a merge
    issue reported"

    * tag 'driver-core-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (21 commits)
    base: core: Remove WARN_ON from link dependencies check
    drivers/base: stop new probing during shutdown
    drivers: core: Remove glue dirs from sysfs earlier
    driver core: remove unnecessary function extern declare
    sysfs.h: fix non-kernel-doc comment
    PM / Domains: Stop deferring probe at the end of initcall
    iommu: Remove IOMMU_OF_DECLARE
    iommu: Stop deferring probe at end of initcalls
    pinctrl: Support stopping deferred probe after initcalls
    dt-bindings: pinctrl: add a 'pinctrl-use-default' property
    driver core: allow stopping deferred probe after init
    driver core: add a debugfs entry to show deferred devices
    sysfs: Fix internal_create_group() for named group updates
    base: fix order of OF initialization
    linux/device.h: fix kernel-doc notation warning
    Documentation: update firmware loader fallback reference
    kobject: Replace strncpy with memcpy
    drivers: base: cacheinfo: use OF property_read_u32 instead of get_property,read_number
    kernfs: Replace strncpy with memcpy
    device: Add #define dev_fmt similar to #define pr_fmt
    ...

    Linus Torvalds
     

16 Aug, 2018

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly updates to the usual drivers: mpt3sas, lpfc, qla2xxx,
    hisi_sas, smartpqi, megaraid_sas, arcmsr.

    In addition, with the continuing absence of Nic we have target updates
    for tcmu and target core (all with reviews and acks).

    The biggest observable change is going to be that we're (again) trying
    to switch to mulitqueue as the default (a user can still override the
    setting on the kernel command line).

    Other major core stuff is the removal of the remaining Microchannel
    drivers, an update of the internal timers and some reworks of
    completion and result handling"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (203 commits)
    scsi: core: use blk_mq_run_hw_queues in scsi_kick_queue
    scsi: ufs: remove unnecessary query(DM) UPIU trace
    scsi: qla2xxx: Fix issue reported by static checker for qla2x00_els_dcmd2_sp_done()
    scsi: aacraid: Spelling fix in comment
    scsi: mpt3sas: Fix calltrace observed while running IO & reset
    scsi: aic94xx: fix an error code in aic94xx_init()
    scsi: st: remove redundant pointer STbuffer
    scsi: qla2xxx: Update driver version to 10.00.00.08-k
    scsi: qla2xxx: Migrate NVME N2N handling into state machine
    scsi: qla2xxx: Save frame payload size from ICB
    scsi: qla2xxx: Fix stalled relogin
    scsi: qla2xxx: Fix race between switch cmd completion and timeout
    scsi: qla2xxx: Fix Management Server NPort handle reservation logic
    scsi: qla2xxx: Flush mailbox commands on chip reset
    scsi: qla2xxx: Fix unintended Logout
    scsi: qla2xxx: Fix session state stuck in Get Port DB
    scsi: qla2xxx: Fix redundant fc_rport registration
    scsi: qla2xxx: Silent erroneous message
    scsi: qla2xxx: Prevent sysfs access when chip is down
    scsi: qla2xxx: Add longer window for chip reset
    ...

    Linus Torvalds
     

03 Aug, 2018

1 commit


30 Jul, 2018

1 commit

  • Commit 5f81880d5204 ("sysfs, kobject: allow creating kobject belonging
    to arbitrary users") incorrectly changed the argument passed as the
    parent parameter when calling sysfs_add_file_mode_ns(). This caused some
    sysfs attribute files to not be added correctly to certain groups.

    Fixes: 5f81880d5204 ("sysfs, kobject: allow creating kobject belonging to arbitrary users")
    Signed-off-by: Tyler Hicks
    Reported-by: Heiner Kallweit
    Tested-by: Heiner Kallweit
    Signed-off-by: David S. Miller

    Tyler Hicks
     

21 Jul, 2018

2 commits

  • Normally kobjects and their sysfs representation belong to global root,
    however it is not necessarily the case for objects in separate namespaces.
    For example, objects in separate network namespace logically belong to the
    container's root and not global root.

    This change lays groundwork for allowing network namespace objects
    ownership to be transferred to container's root user by defining
    get_ownership() callback in ktype structure and using it in sysfs code to
    retrieve desired uid/gid when creating sysfs objects for given kobject.

    Co-Developed-by: Tyler Hicks
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Tyler Hicks
    Signed-off-by: David S. Miller

    Dmitry Torokhov
     
  • This change allows creating kernfs files and directories with arbitrary
    uid/gid instead of always using GLOBAL_ROOT_UID/GID by extending
    kernfs_create_dir_ns() and kernfs_create_file_ns() with uid/gid arguments.
    The "simple" kernfs_create_file() and kernfs_create_dir() are left alone
    and always create objects belonging to the global root.

    When creating symlinks ownership (uid/gid) is taken from the target kernfs
    object.

    Co-Developed-by: Tyler Hicks
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Tyler Hicks
    Signed-off-by: David S. Miller

    Dmitry Torokhov
     

07 Jul, 2018

1 commit

  • There are a couple of problems with named group updates in the code
    today:

    * sysfs_update_group() will always fail for a named group, because
    internal_create_group() will try to create a new sysfs directory
    unconditionally, which will ofcourse fail with -EEXIST.

    * We can leak the kernfs_node for grp->name if some one tries to:
    - rename a group (change grp->name), or
    - update a named group, to an unnamed group

    It appears that the whole purpose of sysfs_update_group() was to
    allow changing the permissions or visibility of attributes and not
    the names. So make it clear in the comments, and allow it to update
    an existing named group.

    Signed-off-by: Rajat Jain
    Signed-off-by: Greg Kroah-Hartman

    Rajat Jain
     

22 May, 2018

1 commit

  • new_sb is left uninitialized in case of early failures in kernfs_mount_ns(),
    and while IS_ERR(root) is true in all such cases, using IS_ERR(root) || !new_sb
    is not a solution - IS_ERR(root) is true in some cases when new_sb is true.

    Make sure new_sb is initialized (and matches the reality) in all cases and
    fix the condition for dropping kobj reference - we want it done precisely
    in those situations where the reference has not been transferred into a new
    super_block instance.

    Signed-off-by: Al Viro

    Al Viro
     

20 Mar, 2018

1 commit

  • The sysfs_create_link_nowarn() is going to be used in phylib framework in
    subsequent patch which can be built as module. Hence, export
    sysfs_create_link_nowarn() to avoid build errors.

    Cc: Florian Fainelli
    Cc: Andrew Lunn
    Fixes: a3995460491d ("net: phy: Relax error checking on sysfs_create_link()")
    Signed-off-by: Grygorii Strashko
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: David S. Miller

    Grygorii Strashko
     

02 Feb, 2018

1 commit

  • Pull printk updates from Petr Mladek:

    - Add a console_msg_format command line option:

    The value "default" keeps the old "[time stamp] text\n" format. The
    value "syslog" allows to see the syslog-like "[timestamp] text" format.

    This feature was requested by people doing regression tests, for
    example, 0day robot. They want to have both filtered and full logs
    at hands.

    - Reduce the risk of softlockup:

    Pass the console owner in a busy loop.

    This is a new approach to the old problem. It was first proposed by
    Steven Rostedt on Kernel Summit 2017. It marks a context in which
    the console_lock owner calls console drivers and could not sleep.
    On the other side, printk() callers could detect this state and use
    a busy wait instead of a simple console_trylock(). Finally, the
    console_lock owner checks if there is a busy waiter at the end of
    the special context and eventually passes the console_lock to the
    waiter.

    The hand-off works surprisingly well and helps in many situations.
    Well, there is still a possibility of the softlockup, for example,
    when the flood of messages stops and the last owner still has too
    much to flush.

    There is increasing number of people having problems with
    printk-related softlockups. We might eventually need to get better
    solution. Anyway, this looks like a good start and promising
    direction.

    - Do not allow to schedule in console_unlock() called from printk():

    This reverts an older controversial commit. The reschedule helped
    to avoid softlockups. But it also slowed down the console output.
    This patch is obsoleted by the new console waiter logic described
    above. In fact, the reschedule made the hand-off less effective.

    - Deprecate "%pf" and "%pF" format specifier:

    It was needed on ia64, ppc64 and parisc64 to dereference function
    descriptors and show the real function address. It is done
    transparently by "%ps" and "pS" format specifier now.

    Sergey Senozhatsky found that all the function descriptors were in
    a special elf section and could be easily detected.

    - Remove printk_symbol() API:

    It has been obsoleted by "%pS" format specifier, and this change
    helped to remove few continuous lines and a less intuitive old API.

    - Remove redundant memsets:

    Sergey removed unnecessary memset when processing printk.devkmsg
    command line option.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk: (27 commits)
    printk: drop redundant devkmsg_log_str memsets
    printk: Never set console_may_schedule in console_trylock()
    printk: Hide console waiter logic into helpers
    printk: Add console owner and waiter logic to load balance console writes
    kallsyms: remove print_symbol() function
    checkpatch: add pF/pf deprecation warning
    symbol lookup: introduce dereference_symbol_descriptor()
    parisc64: Add .opd based function descriptor dereference
    powerpc64: Add .opd based function descriptor dereference
    ia64: Add .opd based function descriptor dereference
    sections: split dereference_function_descriptor()
    openrisc: Fix conflicting types for _exext and _stext
    lib: do not use print_symbol()
    irq debug: do not use print_symbol()
    sysfs: do not use print_symbol()
    drivers: do not use print_symbol()
    x86: do not use print_symbol()
    unicore32: do not use print_symbol()
    sh: do not use print_symbol()
    mn10300: do not use print_symbol()
    ...

    Linus Torvalds
     

23 Jan, 2018

2 commits

  • It isn't needed at all in these files, dynamic debug is the best way to
    enable this type of thing, if you really want it. As it is, these
    defines were not doing anything at all.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • Move the license "mark" of the sysfs files to be in SPDX form, instead
    of the custom text that it currently is in. This is in a quest to get
    rid of the 700+ different ways we say "GPLv2" in the kernel tree.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

22 Jan, 2018

1 commit

  • It's not good to crash the machine if panic_on_warn() is set just
    because someone made a stupid mistake of trying to create a sysfs file
    with the same name of an existing one. This makes the automated testing
    tools a lot harder to find the real bugs in the kernel.

    So just print a warning out and dump the stack to get the attention of
    the developer that they did something foolish. Then keep on trucking,
    as this should not be a fatal error at all.

    Reported-by: Dmitry Vyukov
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

05 Jan, 2018

1 commit

  • print_symbol() is a very old API that has been obsoleted by %pS format
    specifier in a normal printk() call.

    Replace print_symbol() with a direct printk("%pS") call.

    Link: http://lkml.kernel.org/r/20171211125025.2270-11-sergey.senozhatsky@gmail.com
    To: Andrew Morton
    To: Russell King
    To: Catalin Marinas
    To: Mark Salter
    To: Tony Luck
    To: David Howells
    To: Yoshinori Sato
    To: Guan Xuetao
    To: Borislav Petkov
    To: Greg Kroah-Hartman
    To: Thomas Gleixner
    To: Peter Zijlstra
    To: Vineet Gupta
    To: Fengguang Wu
    Cc: Steven Rostedt
    Cc: Petr Mladek
    Cc: LKML
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-c6x-dev@linux-c6x.org
    Cc: linux-ia64@vger.kernel.org
    Cc: linux-am33-list@redhat.com
    Cc: linux-sh@vger.kernel.org
    Cc: linux-edac@vger.kernel.org
    Cc: x86@kernel.org
    Cc: linux-snps-arc@lists.infradead.org
    Signed-off-by: Sergey Senozhatsky
    [pmladek@suse.com: updated commit message]
    Signed-off-by: Petr Mladek

    Sergey Senozhatsky
     

18 Dec, 2017

1 commit

  • Fix ptr_ret.cocci warnings:
    fs/sysfs/group.c:409:8-14: WARNING: PTR_ERR_OR_ZERO can be used

    Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

    Generated by: scripts/coccinelle/api/ptr_ret.cocci

    Signed-off-by: Vasyl Gomonovych
    Signed-off-by: Greg Kroah-Hartman

    Vasyl Gomonovych
     

28 Nov, 2017

1 commit

  • This is a pure automated search-and-replace of the internal kernel
    superblock flags.

    The s_flags are now called SB_*, with the names and the values for the
    moment mirroring the MS_* flags that they're equivalent to.

    Note how the MS_xyz flags are the ones passed to the mount system call,
    while the SB_xyz flags are what we then use in sb->s_flags.

    The script to do this was:

    # places to look in; re security/*: it generally should *not* be
    # touched (that stuff parses mount(2) arguments directly), but
    # there are two places where we really deal with superblock flags.
    FILES="drivers/mtd drivers/staging/lustre fs ipc mm \
    include/linux/fs.h include/uapi/linux/bfs_fs.h \
    security/apparmor/apparmorfs.c security/apparmor/include/lib.h"
    # the list of MS_... constants
    SYMS="RDONLY NOSUID NODEV NOEXEC SYNCHRONOUS REMOUNT MANDLOCK \
    DIRSYNC NOATIME NODIRATIME BIND MOVE REC VERBOSE SILENT \
    POSIXACL UNBINDABLE PRIVATE SLAVE SHARED RELATIME KERNMOUNT \
    I_VERSION STRICTATIME LAZYTIME SUBMOUNT NOREMOTELOCK NOSEC BORN \
    ACTIVE NOUSER"

    SED_PROG=
    for i in $SYMS; do SED_PROG="$SED_PROG -e s/MS_$i/SB_$i/g"; done

    # we want files that contain at least one of MS_...,
    # with fs/namespace.c and fs/pnode.c excluded.
    L=$(for i in $SYMS; do git grep -w -l MS_$i $FILES; done| sort|uniq|grep -v '^fs/namespace.c'|grep -v '^fs/pnode.c')

    for f in $L; do sed -i $f $SED_PROG; done

    Requested-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

08 Apr, 2017

1 commit

  • ops->show() can return a negative error code.
    Commit 65da3484d9be ("sysfs: correctly handle short reads on PREALLOC attrs.")
    (in v4.4) caused this to be stored in an unsigned 'size_t' variable, so errors
    would look like large numbers.
    As a result, if an error is returned, sysfs_kf_read() will return the
    value of 'count', typically 4096.

    Commit 17d0774f8068 ("sysfs: correctly handle read offset on PREALLOC attrs")
    (in v4.8) extended this error to use the unsigned large 'len' as a size for
    memmove().
    Consequently, if ->show returns an error, then the first read() on the
    sysfs file will return 4096 and could return uninitialized memory to
    user-space.
    If the application performs a subsequent read, this will trigger a memmove()
    with extremely large count, and is likely to crash the machine is bizarre ways.

    This bug can currently only be triggered by reading from an md
    sysfs attribute declared with __ATTR_PREALLOC() during the
    brief period between when mddev_put() deletes an mddev from
    the ->all_mddevs list, and when mddev_delayed_delete() - which is
    scheduled on a workqueue - completes.
    Before this, an error won't be returned by the ->show()
    After this, the ->show() won't be called.

    I can reproduce it reliably only by putting delay like
    usleep_range(500000,700000);
    early in mddev_delayed_delete(). Then after creating an
    md device md0 run
    echo clear > /sys/block/md0/md/array_state; cat /sys/block/md0/md/array_state

    The bug can be triggered without the usleep.

    Fixes: 65da3484d9be ("sysfs: correctly handle short reads on PREALLOC attrs.")
    Fixes: 17d0774f8068 ("sysfs: correctly handle read offset on PREALLOC attrs")
    Cc: stable@vger.kernel.org
    Signed-off-by: NeilBrown
    Acked-by: Tejun Heo
    Reported-and-tested-by: Miroslav Benes
    Signed-off-by: Greg Kroah-Hartman

    NeilBrown
     

15 Oct, 2016

1 commit

  • Pull cgroup updates from Tejun Heo:

    - tracepoints for basic cgroup management operations added

    - kernfs and cgroup path formatting functions updated to behave in the
    style of strlcpy()

    - non-critical bug fixes

    * 'for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
    blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL
    cgroup: fix error handling regressions in proc_cgroup_show() and cgroup_release_agent()
    cpuset: fix error handling regression in proc_cpuset_show()
    cgroup: add tracepoints for basic operations
    cgroup: make cgroup_path() and friends behave in the style of strlcpy()
    kernfs: remove kernfs_path_len()
    kernfs: make kernfs_path*() behave in the style of strlcpy()
    kernfs: add dummy implementation of kernfs_path_from_node()

    Linus Torvalds
     

27 Sep, 2016

1 commit


31 Aug, 2016

1 commit

  • Attributes declared with __ATTR_PREALLOC use sysfs_kf_read() which returns
    zero bytes for non-zero offset. This breaks script checkarray in mdadm tool
    in debian where /bin/sh is 'dash' because its builtin 'read' reads only one
    byte at a time. Script gets 'i' instead of 'idle' when reads current action
    from /sys/block/$dev/md/sync_action and as a result does nothing.

    This patch adds trivial implementation of partial read: generate whole
    string and move required part into buffer head.

    Signed-off-by: Konstantin Khlebnikov
    Fixes: 4ef67a8c95f3 ("sysfs/kernfs: make read requests on pre-alloc files use the buffer.")
    Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787950
    Cc: Stable # v3.19+
    Acked-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Konstantin Khlebnikov
     

10 Aug, 2016

1 commit

  • kernfs_path*() functions always return the length of the full path but
    the path content is undefined if the length is larger than the
    provided buffer. This makes its behavior different from strlcpy() and
    requires error handling in all its users even when they don't care
    about truncation. In addition, the implementation can actully be
    simplified by making it behave properly in strlcpy() style.

    * Update kernfs_path_from_node_locked() to always fill up the buffer
    with path. If the buffer is not large enough, the output is
    truncated and terminated.

    * kernfs_path() no longer needs error handling. Make it a simple
    inline wrapper around kernfs_path_from_node().

    * sysfs_warn_dup()'s use of kernfs_path() doesn't need error handling.
    Updated accordingly.

    * cgroup_path()'s use of kernfs_path() updated to retain the old
    behavior.

    Signed-off-by: Tejun Heo
    Acked-by: Greg Kroah-Hartman
    Acked-by: Serge Hallyn

    Tejun Heo
     

24 Jun, 2016

2 commits

  • The cgroup filesystem is in the same boat as sysfs. No one ever
    permits executables of any kind on the cgroup filesystem, and there is
    no reasonable future case to support executables in the future.

    Therefore move the setting of SB_I_NOEXEC which makes the code proof
    against future mistakes of accidentally creating executables from
    sysfs to kernfs itself. Making the code simpler and covering the
    sysfs, cgroup, and cgroup2 filesystems.

    Acked-by: Seth Forshee
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • Replace the call of fs_fully_visible in do_new_mount from before the
    new superblock is allocated with a call of mount_too_revealing after
    the superblock is allocated. This winds up being a much better location
    for maintainability of the code.

    The first change this enables is the replacement of FS_USERNS_VISIBLE
    with SB_I_USERNS_VISIBLE. Moving the flag from struct filesystem_type
    to sb_iflags on the superblock.

    Unfortunately mount_too_revealing fundamentally needs to touch
    mnt_flags adding several MNT_LOCKED_XXX flags at the appropriate
    times. If the mnt_flags did not need to be touched the code
    could be easily moved into the filesystem specific mount code.

    Acked-by: Seth Forshee
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

14 Nov, 2015

1 commit

  • …/olof/chrome-platform

    Pull chrome platform updates from Olof Johansson:
    "Here's the branch of chrome platform changes for v4.4. Some have been
    queued up for the full 4.3 release cycle since I forgot to send them
    in for that round (rebased early on to deal with fixes conflicts).

    Most of these enable EC communication stuff -- Pixel 2015 support,
    enabling building for ARM64 platforms, and a few fixes for memory
    leaks.

    There's also a patch in here to allow reading/writing the verified
    boot context, which depends on a sysfs patch acked by Greg"

    * tag 'chrome-platform-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform:
    platform/chrome: Fix i2c-designware adapter name
    platform/chrome: Support reading/writing the vboot context
    sysfs: Support is_visible() on binary attributes
    platform/chrome: cros_ec: Fix possible leak in led_rgb_store()
    platform/chrome: cros_ec: Fix leak in sequence_store()
    platform/chrome: Enable Chrome platforms on 64-bit ARM
    platform/chrome: cros_ec_dev - Add a platform device ID table
    platform/chrome: cros_ec_lpc - Add support for Google Pixel 2
    platform/chrome: cros_ec_lpc - Use existing function to check EC result
    platform/chrome: Make depends on MFD_CROS_EC instead CROS_EC_PROTO
    Revert "platform/chrome: Don't make CHROME_PLATFORMS depends on X86 || ARM"

    Linus Torvalds
     

06 Nov, 2015

1 commit

  • Pull security subsystem update from James Morris:
    "This is mostly maintenance updates across the subsystem, with a
    notable update for TPM 2.0, and addition of Jarkko Sakkinen as a
    maintainer of that"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (40 commits)
    apparmor: clarify CRYPTO dependency
    selinux: Use a kmem_cache for allocation struct file_security_struct
    selinux: ioctl_has_perm should be static
    selinux: use sprintf return value
    selinux: use kstrdup() in security_get_bools()
    selinux: use kmemdup in security_sid_to_context_core()
    selinux: remove pointless cast in selinux_inode_setsecurity()
    selinux: introduce security_context_str_to_sid
    selinux: do not check open perm on ftruncate call
    selinux: change CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE default
    KEYS: Merge the type-specific data with the payload data
    KEYS: Provide a script to extract a module signature
    KEYS: Provide a script to extract the sys cert list from a vmlinux file
    keys: Be more consistent in selection of union members used
    certs: add .gitignore to stop git nagging about x509_certificate_list
    KEYS: use kvfree() in add_key
    Smack: limited capability for changing process label
    TPM: remove unnecessary little endian conversion
    vTPM: support little endian guests
    char: Drop owner assignment from i2c_driver
    ...

    Linus Torvalds
     

19 Oct, 2015

1 commit


08 Oct, 2015

1 commit

  • According to the sysfs header file:

    "The returned value will replace static permissions defined in
    struct attribute or struct bin_attribute."

    but this isn't the case, as is_visible is only called on struct attribute
    only. This patch introduces a new is_bin_visible() function to implement
    the same functionality for binary attributes, and updates documentation
    accordingly.

    Note that to keep functionality and code similar to that of normal
    attributes, the mode is now checked as well to ensure it contains only
    read/write permissions or SYSFS_PREALLOC.

    Reviewed-by: Guenter Roeck
    Signed-off-by: Emilio López
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Olof Johansson

    Emilio López
     

05 Oct, 2015

1 commit

  • attributes declared with __ATTR_PREALLOC use sysfs_kf_read()
    which ignores the 'count' arg.
    So a 1-byte read request can return more bytes than that.

    This is seen with the 'dash' shell when 'read' is used on
    some 'md' sysfs attributes.

    So only return the 'min' of count and the attribute length.

    Signed-off-by: NeilBrown
    Acked-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    NeilBrown