31 Jan, 2020

2 commits

  • …kernel/git/herbert/crypto-2.6") into android-mainline

    Baby steps in the 5.6-rc1 merge cycle to make things easier to review
    and debug.

    Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
    Change-Id: I6d63f7c9484210bae7474a809defd1aaa58e15f8

    Greg Kroah-Hartman
     
  • …cm/fs/fscrypt/fscrypt") into android-mainline

    Merge the upstream merge of fscrypt-for-linus, to resolve conflicts
    between the fscrypt changes that went upstream in 5.6 and the inline
    crypto and hardware-wrapped key support that is currently being carried
    in the Android common kernels.

    Conflicts:
    fs/crypto/Kconfig
    fs/crypto/bio.c
    fs/crypto/fname.c
    fs/crypto/fscrypt_private.h
    fs/crypto/keyring.c
    fs/crypto/keysetup.c
    include/uapi/linux/fscrypt.h

    Merge resolution notes:

    - In fscrypt_zeroout_range(), split the inline crypto case into a
    separate function fscrypt_zeroout_range_inlinecrypt(), as mixing the
    two cases together became much harder due to the upstream changes.

    - Allow the size of fscrypt-provisioning keys to be up to
    FSCRYPT_MAX_HW_WRAPPED_KEY_SIZE rather than FSCRYPT_MAX_KEY_SIZE.

    Change-Id: Ib1e6b9eda8fb5dcfc6bdc8fa89d93f72b088c5f6
    Signed-off-by: Eric Biggers <ebiggers@google.com>

    Eric Biggers
     

30 Jan, 2020

1 commit


29 Jan, 2020

9 commits

  • Pull crypto updates from Herbert Xu:
    "API:
    - Removed CRYPTO_TFM_RES flags
    - Extended spawn grabbing to all algorithm types
    - Moved hash descsize verification into API code

    Algorithms:
    - Fixed recursive pcrypt dead-lock
    - Added new 32 and 64-bit generic versions of poly1305
    - Added cryptogams implementation of x86/poly1305

    Drivers:
    - Added support for i.MX8M Mini in caam
    - Added support for i.MX8M Nano in caam
    - Added support for i.MX8M Plus in caam
    - Added support for A33 variant of SS in sun4i-ss
    - Added TEE support for Raven Ridge in ccp
    - Added in-kernel API to submit TEE commands in ccp
    - Added AMD-TEE driver
    - Added support for BCM2711 in iproc-rng200
    - Added support for AES256-GCM based ciphers for chtls
    - Added aead support on SEC2 in hisilicon"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (244 commits)
    crypto: arm/chacha - fix build failured when kernel mode NEON is disabled
    crypto: caam - add support for i.MX8M Plus
    crypto: x86/poly1305 - emit does base conversion itself
    crypto: hisilicon - fix spelling mistake "disgest" -> "digest"
    crypto: chacha20poly1305 - add back missing test vectors and test chunking
    crypto: x86/poly1305 - fix .gitignore typo
    tee: fix memory allocation failure checks on drv_data and amdtee
    crypto: ccree - erase unneeded inline funcs
    crypto: ccree - make cc_pm_put_suspend() void
    crypto: ccree - split overloaded usage of irq field
    crypto: ccree - fix PM race condition
    crypto: ccree - fix FDE descriptor sequence
    crypto: ccree - cc_do_send_request() is void func
    crypto: ccree - fix pm wrongful error reporting
    crypto: ccree - turn errors to debug msgs
    crypto: ccree - fix AEAD decrypt auth fail
    crypto: ccree - fix typo in comment
    crypto: ccree - fix typos in error msgs
    crypto: atmel-{aes,sha,tdes} - Retire crypto_platform_data
    crypto: x86/sha - Eliminate casts on asm implementations
    ...

    Linus Torvalds
     
  • Pull cifs updates from Steve French:
    "Various SMB3/CIFS fixes including four for stable.

    - Improvement to fallocate (enables 3 additional xfstests)

    - Fix for file creation when mounting with modefromsid

    - Add ability to backup/restore dos attributes and creation time

    - DFS failover and reconnect fixes

    - performance optimization for readir

    Note that due to the upcoming SMB3 Test Event (at SNIA SDC next week)
    there will likely be more changesets near the end of the merge window
    (since we will be testing heavily next week, I held off on some
    patches and I expect some additional multichannel patches as well as
    patches to enable some additional xfstests)"

    * tag '5.6-smb3-fixes-and-dfs-and-readdir-improvements' of git://git.samba.org/sfrench/cifs-2.6: (24 commits)
    CIFS: Fix task struct use-after-free on reconnect
    cifs: use PTR_ERR_OR_ZERO() to simplify code
    cifs: add support for fallocate mode 0 for non-sparse files
    cifs: fix NULL dereference in match_prepath
    smb3: fix default permissions on new files when mounting with modefromsid
    CIFS: Add support for setting owner info, dos attributes, and create time
    cifs: remove set but not used variable 'server'
    cifs: Fix memory allocation in __smb2_handle_cancelled_cmd()
    cifs: Fix mount options set in automount
    cifs: fix unitialized variable poential problem with network I/O cache lock patch
    cifs: Fix return value in __update_cache_entry
    cifs: Avoid doing network I/O while holding cache lock
    cifs: Fix potential deadlock when updating vol in cifs_reconnect()
    cifs: Merge is_path_valid() into get_normalized_path()
    cifs: Introduce helpers for finding TCP connection
    cifs: Get rid of kstrdup_const()'d paths
    cifs: Clean up DFS referral cache
    cifs: Don't use iov_iter::type directly
    cifs: set correct max-buffer-size for smb2_ioctl_init()
    cifs: use compounding for open and first query-dir for readdir()
    ...

    Linus Torvalds
     
  • Pull fsverity updates from Eric Biggers:

    - Optimize fs-verity sequential read performance by implementing
    readahead of Merkle tree pages. This allows the Merkle tree to be
    read in larger chunks.

    - Optimize FS_IOC_ENABLE_VERITY performance in the uncached case by
    implementing readahead of data pages.

    - Allocate the hash requests from a mempool in order to eliminate the
    possibility of allocation failures during I/O.

    * tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
    fs-verity: use u64_to_user_ptr()
    fs-verity: use mempool for hash requests
    fs-verity: implement readahead of Merkle tree pages
    fs-verity: implement readahead for FS_IOC_ENABLE_VERITY

    Linus Torvalds
     
  • Pull fscrypt updates from Eric Biggers:

    - Extend the FS_IOC_ADD_ENCRYPTION_KEY ioctl to allow the raw key to be
    provided via a keyring key.

    - Prepare for the new dirhash method (SipHash of plaintext name) that
    will be used by directories that are both encrypted and casefolded.

    - Switch to a new format for "no-key names" that prepares for the new
    dirhash method, and also fixes a longstanding bug where multiple
    filenames could map to the same no-key name.

    - Allow the crypto algorithms used by fscrypt to be built as loadable
    modules when the fscrypt-capable filesystems are.

    - Optimize fscrypt_zeroout_range().

    - Various cleanups.

    * tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt: (26 commits)
    fscrypt: improve format of no-key names
    ubifs: allow both hash and disk name to be provided in no-key names
    ubifs: don't trigger assertion on invalid no-key filename
    fscrypt: clarify what is meant by a per-file key
    fscrypt: derive dirhash key for casefolded directories
    fscrypt: don't allow v1 policies with casefolding
    fscrypt: add "fscrypt_" prefix to fname_encrypt()
    fscrypt: don't print name of busy file when removing key
    ubifs: use IS_ENCRYPTED() instead of ubifs_crypt_is_encrypted()
    fscrypt: document gfp_flags for bounce page allocation
    fscrypt: optimize fscrypt_zeroout_range()
    fscrypt: remove redundant bi_status check
    fscrypt: Allow modular crypto algorithms
    fscrypt: include in UAPI header
    fscrypt: don't check for ENOKEY from fscrypt_get_encryption_info()
    fscrypt: remove fscrypt_is_direct_key_policy()
    fscrypt: move fscrypt_valid_enc_modes() to policy.c
    fscrypt: check for appropriate use of DIRECT_KEY flag earlier
    fscrypt: split up fscrypt_supported_policy() by policy version
    fscrypt: introduce fscrypt_needs_contents_encryption()
    ...

    Linus Torvalds
     
  • Pull fs deduplication fix from David Sterba:
    "This is a fix for deduplication bug: the last block of two files is
    allowed to deduplicated. This got broken in 5.1 by lifting some
    generic checks to VFS layer. The affected filesystems are btrfs and
    xfs.

    The patches are marked for stable as the bug decreases deduplication
    effectivity"

    * tag 'fs-dedupe-last-block-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
    Btrfs: make deduplication with range including the last block work
    fs: allow deduplication of eof block into the end of the destination file

    Linus Torvalds
     
  • Pull btrfs updates from David Sterba:
    "Features, highlights:

    - async discard
    - "mount -o discard=async" to enable it
    - freed extents are not discarded immediatelly, but grouped
    together and trimmed later, with IO rate limiting
    - the "sync" mode submits short extents that could have been
    ignored completely by the device, for SATA prior to 3.1 the
    requests are unqueued and have a big impact on performance
    - the actual discard IO requests have been moved out of
    transaction commit to a worker thread, improving commit latency
    - IO rate and request size can be tuned by sysfs files, for now
    enabled only with CONFIG_BTRFS_DEBUG as we might need to
    add/delete the files and don't have a stable-ish ABI for
    general use, defaults are conservative

    - export device state info in sysfs, eg. missing, writeable

    - no discard of extents known to be untouched on disk (eg. after
    reservation)

    - device stats reset is logged with process name and PID that called
    the ioctl

    Fixes:

    - fix missing hole after hole punching and fsync when using NO_HOLES

    - writeback: range cyclic mode could miss some dirty pages and lead
    to OOM

    - two more corner cases for metadata_uuid change after power loss
    during the change

    - fix infinite loop during fsync after mix of rename operations

    Core changes:

    - qgroup assign returns ENOTCONN when quotas not enabled, used to
    return EINVAL that was confusing

    - device closing does not need to allocate memory anymore

    - snapshot aware code got removed, disabled for years due to
    performance problems, reimplmentation will allow to select wheter
    defrag breaks or does not break COW on shared extents

    - tree-checker:
    - check leaf chunk item size, cross check against number of
    stripes
    - verify location keys for DIR_ITEM, DIR_INDEX and XATTR items

    - new self test for physical -> logical mapping code, used for super
    block range exclusion

    - assertion helpers/macros updated to avoid objtool "unreachable
    code" reports on older compilers or config option combinations"

    * tag 'for-5.6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (84 commits)
    btrfs: free block groups after free'ing fs trees
    btrfs: Fix split-brain handling when changing FSID to metadata uuid
    btrfs: Handle another split brain scenario with metadata uuid feature
    btrfs: Factor out metadata_uuid code from find_fsid.
    btrfs: Call find_fsid from find_fsid_inprogress
    Btrfs: fix infinite loop during fsync after rename operations
    btrfs: set trans->drity in btrfs_commit_transaction
    btrfs: drop log root for dropped roots
    btrfs: sysfs, add devid/dev_state kobject and device attributes
    btrfs: Refactor btrfs_rmap_block to improve readability
    btrfs: Add self-tests for btrfs_rmap_block
    btrfs: selftests: Add support for dummy devices
    btrfs: Move and unexport btrfs_rmap_block
    btrfs: separate definition of assertion failure handlers
    btrfs: device stats, log when stats are zeroed
    btrfs: fix improper setting of scanned for range cyclic write cache pages
    btrfs: safely advance counter when looking up bio csums
    btrfs: remove unused member btrfs_device::work
    btrfs: remove unnecessary wrapper get_alloc_profile
    btrfs: add correction to handle -1 edge case in async discard
    ...

    Linus Torvalds
     
  • Pull x86 resource control updates from Ingo Molnar:
    "The main change in this tree is the extension of the resctrl procfs
    ABI with a new file that helps tooling to navigate from tasks back to
    resctrl groups: /proc/{pid}/cpu_resctrl_groups.

    Also fix static key usage for certain feature combinations and
    simplify the task exit resctrl case"

    * 'x86-cache-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/resctrl: Add task resctrl information display
    x86/resctrl: Check monitoring static key in the MBM overflow handler
    x86/resctrl: Do not reconfigure exiting tasks

    Linus Torvalds
     
  • Pull scheduler updates from Ingo Molnar:
    "These were the main changes in this cycle:

    - More -rt motivated separation of CONFIG_PREEMPT and
    CONFIG_PREEMPTION.

    - Add more low level scheduling topology sanity checks and warnings
    to filter out nonsensical topologies that break scheduling.

    - Extend uclamp constraints to influence wakeup CPU placement

    - Make the RT scheduler more aware of asymmetric topologies and CPU
    capacities, via uclamp metrics, if CONFIG_UCLAMP_TASK=y

    - Make idle CPU selection more consistent

    - Various fixes, smaller cleanups, updates and enhancements - please
    see the git log for details"

    * 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (58 commits)
    sched/fair: Define sched_idle_cpu() only for SMP configurations
    sched/topology: Assert non-NUMA topology masks don't (partially) overlap
    idle: fix spelling mistake "iterrupts" -> "interrupts"
    sched/fair: Remove redundant call to cpufreq_update_util()
    sched/psi: create /proc/pressure and /proc/pressure/{io|memory|cpu} only when psi enabled
    sched/fair: Fix sgc->{min,max}_capacity calculation for SD_OVERLAP
    sched/fair: calculate delta runnable load only when it's needed
    sched/cputime: move rq parameter in irqtime_account_process_tick
    stop_machine: Make stop_cpus() static
    sched/debug: Reset watchdog on all CPUs while processing sysrq-t
    sched/core: Fix size of rq::uclamp initialization
    sched/uclamp: Fix a bug in propagating uclamp value in new cgroups
    sched/fair: Load balance aggressively for SCHED_IDLE CPUs
    sched/fair : Improve update_sd_pick_busiest for spare capacity case
    watchdog: Remove soft_lockup_hrtimer_cnt and related code
    sched/rt: Make RT capacity-aware
    sched/fair: Make EAS wakeup placement consider uclamp restrictions
    sched/fair: Make task_fits_capacity() consider uclamp restrictions
    sched/uclamp: Rename uclamp_util_with() into uclamp_rq_util_with()
    sched/uclamp: Make uclamp util helpers use and return UL values
    ...

    Linus Torvalds
     
  • Pull perf updates from Ingo Molnar:
    "Kernel side changes:

    - Ftrace is one of the last W^X violators (after this only KLP is
    left). These patches move it over to the generic text_poke()
    interface and thereby get rid of this oddity. This requires a
    surprising amount of surgery, by Peter Zijlstra.

    - x86/AMD PMUs: add support for 'Large Increment per Cycle Events' to
    count certain types of events that have a special, quirky hw ABI
    (by Kim Phillips)

    - kprobes fixes by Masami Hiramatsu

    Lots of tooling updates as well, the following subcommands were
    updated: annotate/report/top, c2c, clang, record, report/top TUI,
    sched timehist, tests; plus updates were done to the gtk ui, libperf,
    headers and the parser"

    * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (57 commits)
    perf/x86/amd: Add support for Large Increment per Cycle Events
    perf/x86/amd: Constrain Large Increment per Cycle events
    perf/x86/intel/rapl: Add Comet Lake support
    tracing: Initialize ret in syscall_enter_define_fields()
    perf header: Use last modification time for timestamp
    perf c2c: Fix return type for histogram sorting comparision functions
    perf beauty sockaddr: Fix augmented syscall format warning
    perf/ui/gtk: Fix gtk2 build
    perf ui gtk: Add missing zalloc object
    perf tools: Use %define api.pure full instead of %pure-parser
    libperf: Setup initial evlist::all_cpus value
    perf report: Fix no libunwind compiled warning break s390 issue
    perf tools: Support --prefix/--prefix-strip
    perf report: Clarify in help that --children is default
    tools build: Fix test-clang.cpp with Clang 8+
    perf clang: Fix build with Clang 9
    kprobes: Fix optimize_kprobe()/unoptimize_kprobe() cancellation logic
    tools lib: Fix builds when glibc contains strlcpy()
    perf report/top: Make 'e' visible in the help and make it toggle showing callchains
    perf report/top: Do not offer annotation for symbols without samples
    ...

    Linus Torvalds
     

28 Jan, 2020

2 commits

  • Pull core SMP updates from Thomas Gleixner:
    "A small set of SMP core code changes:

    - Rework the smp function call core code to avoid the allocation of
    an additional cpumask

    - Remove the not longer required GFP argument from on_each_cpu_cond()
    and on_each_cpu_cond_mask() and fixup the callers"

    * tag 'smp-core-2020-01-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    smp: Remove allocation mask from on_each_cpu_cond.*()
    smp: Add a smp_cond_func_t argument to smp_call_function_many()
    smp: Use smp_cond_func_t as type for the conditional function

    Linus Torvalds
     
  • Pull timer updates from Thomas Gleixner:
    "The timekeeping and timers departement provides:

    - Time namespace support:

    If a container migrates from one host to another then it expects
    that clocks based on MONOTONIC and BOOTTIME are not subject to
    disruption. Due to different boot time and non-suspended runtime
    these clocks can differ significantly on two hosts, in the worst
    case time goes backwards which is a violation of the POSIX
    requirements.

    The time namespace addresses this problem. It allows to set offsets
    for clock MONOTONIC and BOOTTIME once after creation and before
    tasks are associated with the namespace. These offsets are taken
    into account by timers and timekeeping including the VDSO.

    Offsets for wall clock based clocks (REALTIME/TAI) are not provided
    by this mechanism. While in theory possible, the overhead and code
    complexity would be immense and not justified by the esoteric
    potential use cases which were discussed at Plumbers '18.

    The overhead for tasks in the root namespace (ie where host time
    offsets = 0) is in the noise and great effort was made to ensure
    that especially in the VDSO. If time namespace is disabled in the
    kernel configuration the code is compiled out.

    Kudos to Andrei Vagin and Dmitry Sofanov who implemented this
    feature and kept on for more than a year addressing review
    comments, finding better solutions. A pleasant experience.

    - Overhaul of the alarmtimer device dependency handling to ensure
    that the init/suspend/resume ordering is correct.

    - A new clocksource/event driver for Microchip PIT64

    - Suspend/resume support for the Hyper-V clocksource

    - The usual pile of fixes, updates and improvements mostly in the
    driver code"

    * tag 'timers-core-2020-01-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (71 commits)
    alarmtimer: Make alarmtimer_get_rtcdev() a stub when CONFIG_RTC_CLASS=n
    alarmtimer: Use wakeup source from alarmtimer platform device
    alarmtimer: Make alarmtimer platform device child of RTC device
    alarmtimer: Update alarmtimer_get_rtcdev() docs to reflect reality
    hrtimer: Add missing sparse annotation for __run_timer()
    lib/vdso: Only read hrtimer_res when needed in __cvdso_clock_getres()
    MIPS: vdso: Define BUILD_VDSO32 when building a 32bit kernel
    clocksource/drivers/hyper-v: Set TSC clocksource as default w/ InvariantTSC
    clocksource/drivers/hyper-v: Untangle stimers and timesync from clocksources
    clocksource/drivers/timer-microchip-pit64b: Fix sparse warning
    clocksource/drivers/exynos_mct: Rename Exynos to lowercase
    clocksource/drivers/timer-ti-dm: Fix uninitialized pointer access
    clocksource/drivers/timer-ti-dm: Switch to platform_get_irq
    clocksource/drivers/timer-ti-dm: Convert to devm_platform_ioremap_resource
    clocksource/drivers/em_sti: Fix variable declaration in em_sti_probe
    clocksource/drivers/em_sti: Convert to devm_platform_ioremap_resource
    clocksource/drivers/bcm2835_timer: Fix memory leak of timer
    clocksource/drivers/cadence-ttc: Use ttc driver as platform driver
    clocksource/drivers/timer-microchip-pit64b: Add Microchip PIT64B support
    clocksource/drivers/hyper-v: Reserve PAGE_SIZE space for tsc page
    ...

    Linus Torvalds
     

27 Jan, 2020

26 commits

  • Linux 5.5

    Signed-off-by: Greg Kroah-Hartman
    Change-Id: Ib513529bf4f0a72c87251a67f2e601fe503e3a88

    Greg Kroah-Hartman
     
  • The task which created the MID may be gone by the time cifsd attempts to
    call the callbacks on MIDs from cifs_reconnect().

    This leads to a use-after-free of the task struct in cifs_wake_up_task:

    ==================================================================
    BUG: KASAN: use-after-free in __lock_acquire+0x31a0/0x3270
    Read of size 8 at addr ffff8880103e3a68 by task cifsd/630

    CPU: 0 PID: 630 Comm: cifsd Not tainted 5.5.0-rc6+ #119
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
    Call Trace:
    dump_stack+0x8e/0xcb
    print_address_description.constprop.5+0x1d3/0x3c0
    ? __lock_acquire+0x31a0/0x3270
    __kasan_report+0x152/0x1aa
    ? __lock_acquire+0x31a0/0x3270
    ? __lock_acquire+0x31a0/0x3270
    kasan_report+0xe/0x20
    __lock_acquire+0x31a0/0x3270
    ? __wake_up_common+0x1dc/0x630
    ? _raw_spin_unlock_irqrestore+0x4c/0x60
    ? mark_held_locks+0xf0/0xf0
    ? _raw_spin_unlock_irqrestore+0x39/0x60
    ? __wake_up_common_lock+0xd5/0x130
    ? __wake_up_common+0x630/0x630
    lock_acquire+0x13f/0x330
    ? try_to_wake_up+0xa3/0x19e0
    _raw_spin_lock_irqsave+0x38/0x50
    ? try_to_wake_up+0xa3/0x19e0
    try_to_wake_up+0xa3/0x19e0
    ? cifs_compound_callback+0x178/0x210
    ? set_cpus_allowed_ptr+0x10/0x10
    cifs_reconnect+0xa1c/0x15d0
    ? generic_ip_connect+0x1860/0x1860
    ? rwlock_bug.part.0+0x90/0x90
    cifs_readv_from_socket+0x479/0x690
    cifs_read_from_socket+0x9d/0xe0
    ? cifs_readv_from_socket+0x690/0x690
    ? mempool_resize+0x690/0x690
    ? rwlock_bug.part.0+0x90/0x90
    ? memset+0x1f/0x40
    ? allocate_buffers+0xff/0x340
    cifs_demultiplex_thread+0x388/0x2a50
    ? cifs_handle_standard+0x610/0x610
    ? rcu_read_lock_held_common+0x120/0x120
    ? mark_lock+0x11b/0xc00
    ? __lock_acquire+0x14ed/0x3270
    ? __kthread_parkme+0x78/0x100
    ? lockdep_hardirqs_on+0x3e8/0x560
    ? lock_downgrade+0x6a0/0x6a0
    ? lockdep_hardirqs_on+0x3e8/0x560
    ? _raw_spin_unlock_irqrestore+0x39/0x60
    ? cifs_handle_standard+0x610/0x610
    kthread+0x2bb/0x3a0
    ? kthread_create_worker_on_cpu+0xc0/0xc0
    ret_from_fork+0x3a/0x50

    Allocated by task 649:
    save_stack+0x19/0x70
    __kasan_kmalloc.constprop.5+0xa6/0xf0
    kmem_cache_alloc+0x107/0x320
    copy_process+0x17bc/0x5370
    _do_fork+0x103/0xbf0
    __x64_sys_clone+0x168/0x1e0
    do_syscall_64+0x9b/0xec0
    entry_SYSCALL_64_after_hwframe+0x49/0xbe

    Freed by task 0:
    save_stack+0x19/0x70
    __kasan_slab_free+0x11d/0x160
    kmem_cache_free+0xb5/0x3d0
    rcu_core+0x52f/0x1230
    __do_softirq+0x24d/0x962

    The buggy address belongs to the object at ffff8880103e32c0
    which belongs to the cache task_struct of size 6016
    The buggy address is located 1960 bytes inside of
    6016-byte region [ffff8880103e32c0, ffff8880103e4a40)
    The buggy address belongs to the page:
    page:ffffea000040f800 refcount:1 mapcount:0 mapping:ffff8880108da5c0
    index:0xffff8880103e4c00 compound_mapcount: 0
    raw: 4000000000010200 ffffea00001f2208 ffffea00001e3408 ffff8880108da5c0
    raw: ffff8880103e4c00 0000000000050003 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffff8880103e3900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff8880103e3980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff8880103e3a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ^
    ffff8880103e3a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff8880103e3b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ==================================================================

    This can be reliably reproduced by adding the below delay to
    cifs_reconnect(), running find(1) on the mount, restarting the samba
    server while find is running, and killing find during the delay:

    spin_unlock(&GlobalMid_Lock);
    mutex_unlock(&server->srv_mutex);

    + msleep(10000);
    +
    cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__);
    list_for_each_safe(tmp, tmp2, &retry_list) {
    mid_entry = list_entry(tmp, struct mid_q_entry, qhead);

    Fix this by holding a reference to the task struct until the MID is
    freed.

    Signed-off-by: Vincent Whitchurch
    Signed-off-by: Steve French
    CC: Stable
    Reviewed-by: Paulo Alcantara (SUSE)
    Reviewed-by: Pavel Shilovsky

    Vincent Whitchurch
     
  • PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR, just use
    PTR_ERR_OR_ZERO directly.

    Signed-off-by: Chen Zhou
    Signed-off-by: Steve French
    Reviewed-by: Paulo Alcantara (SUSE)

    Chen Zhou
     
  • RHBZ 1336264

    When we extend a file we must also force the size to be updated.

    This fixes an issue with holetest in xfs-tests which performs the following
    sequence :
    1, create a new file
    2, use fallocate mode==0 to populate the file
    3, mmap the file
    4, touch each page by reading the mmapped region.

    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French

    Ronnie Sahlberg
     
  • RHBZ: 1760879

    Fix an oops in match_prepath() by making sure that the prepath string is not
    NULL before we pass it into strcmp().

    This is similar to other checks we make for example in cifs_root_iget()

    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French

    Ronnie Sahlberg
     
  • When mounting with "modefromsid" mount parm most servers will require
    that some default permissions are given to users in the ACL on newly
    created files, files created with the new 'sd context' - when passing in
    an sd context on create, permissions are not inherited from the parent
    directory, so in addition to the ACE with the special SID which contains
    the mode, we also must pass in an ACE allowing users to access the file
    (GENERIC_ALL for authenticated users seemed like a reasonable default,
    although later we could allow a mount option or config switch to make
    it GENERIC_ALL for EVERYONE special sid).

    CC: Stable
    Signed-off-by: Steve French
    Reviewed-By: Ronnie Sahlberg
    Reviewed-by: Pavel Shilovsky

    Steve French
     
  • This is needed for backup/restore scenarios among others.

    Add extended attribute "system.cifs_ntsd" (and alias "system.smb3_ntsd")
    to allow for setting owner and DACL in the security descriptor. This is in
    addition to the existing "system.cifs_acl" and "system.smb3_acl" attributes
    that allow for setting DACL only. Add support for setting creation time and
    dos attributes using set_file_info() calls to complement the existing
    support for getting these attributes via query_path_info() calls.

    Signed-off-by: Boris Protopopov
    Signed-off-by: Steve French

    Boris Protopopov
     
  • fs/cifs/smb2pdu.c: In function 'SMB2_query_directory':
    fs/cifs/smb2pdu.c:4444:26: warning:
    variable 'server' set but not used [-Wunused-but-set-variable]
    struct TCP_Server_Info *server;

    It is not used, so remove it.

    Reported-by: Hulk Robot
    Signed-off-by: YueHaibing
    Signed-off-by: Steve French

    YueHaibing
     
  • __smb2_handle_cancelled_cmd() is called under a spin lock held in
    cifs_mid_q_entry_release(), so make its memory allocation GFP_ATOMIC.

    This issue was observed when running xfstests generic/028:

    [ 1722.589204] CIFS VFS: \\192.168.30.26 Cancelling wait for mid 72064 cmd: 5
    [ 1722.590687] CIFS VFS: \\192.168.30.26 Cancelling wait for mid 72065 cmd: 17
    [ 1722.593529] CIFS VFS: \\192.168.30.26 Cancelling wait for mid 72066 cmd: 6
    [ 1723.039014] BUG: sleeping function called from invalid context at mm/slab.h:565
    [ 1723.040710] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 30877, name: cifsd
    [ 1723.045098] CPU: 3 PID: 30877 Comm: cifsd Not tainted 5.5.0-rc4+ #313
    [ 1723.046256] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba527-rebuilt.opensuse.org 04/01/2014
    [ 1723.048221] Call Trace:
    [ 1723.048689] dump_stack+0x97/0xe0
    [ 1723.049268] ___might_sleep.cold+0xd1/0xe1
    [ 1723.050069] kmem_cache_alloc_trace+0x204/0x2b0
    [ 1723.051051] __smb2_handle_cancelled_cmd+0x40/0x140 [cifs]
    [ 1723.052137] smb2_handle_cancelled_mid+0xf6/0x120 [cifs]
    [ 1723.053247] cifs_mid_q_entry_release+0x44d/0x630 [cifs]
    [ 1723.054351] ? cifs_reconnect+0x26a/0x1620 [cifs]
    [ 1723.055325] cifs_demultiplex_thread+0xad4/0x14a0 [cifs]
    [ 1723.056458] ? cifs_handle_standard+0x2c0/0x2c0 [cifs]
    [ 1723.057365] ? kvm_sched_clock_read+0x14/0x30
    [ 1723.058197] ? sched_clock+0x5/0x10
    [ 1723.058838] ? sched_clock_cpu+0x18/0x110
    [ 1723.059629] ? lockdep_hardirqs_on+0x17d/0x250
    [ 1723.060456] kthread+0x1ab/0x200
    [ 1723.061149] ? cifs_handle_standard+0x2c0/0x2c0 [cifs]
    [ 1723.062078] ? kthread_create_on_node+0xd0/0xd0
    [ 1723.062897] ret_from_fork+0x3a/0x50

    Signed-off-by: Paulo Alcantara (SUSE)
    Fixes: 9150c3adbf24 ("CIFS: Close open handle after interrupted close")
    Cc: Stable
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Paulo Alcantara (SUSE)
     
  • Starting from 4a367dc04435, we must set the mount options based on the
    DFS full path rather than the resolved target, that is, cifs_mount()
    will be responsible for resolving the DFS link (cached) as well as
    performing failover to any other targets in the referral.

    Signed-off-by: Paulo Alcantara (SUSE)
    Reported-by: Martijn de Gouw
    Fixes: 4a367dc04435 ("cifs: Add support for failover in cifs_mount()")
    Link: https://lore.kernel.org/linux-cifs/39643d7d-2abb-14d3-ced6-c394fab9a777@prodrive-technologies.com
    Tested-by: Martijn de Gouw
    Signed-off-by: Steve French

    Paulo Alcantara (SUSE)
     
  • static analysis with Coverity detected an issue with the following
    commit:

    Author: Paulo Alcantara (SUSE)
    Date: Wed Dec 4 17:38:03 2019 -0300

    cifs: Avoid doing network I/O while holding cache lock

    Addresses-Coverity: ("Uninitialized pointer read")
    Reported-by: Colin Ian King
    Signed-off-by: Paulo Alcantara (SUSE)
    Signed-off-by: Steve French

    Steve French
     
  • copy_ref_data() may return error, it should be
    returned to upstream caller.

    Fixes: 03535b72873b ("cifs: Avoid doing network I/O while holding cache lock")
    Signed-off-by: YueHaibing
    Signed-off-by: Steve French

    YueHaibing
     
  • When creating or updating a cache entry, we need to get an DFS
    referral (get_dfs_referral), so avoid holding any locks during such
    network operation.

    To prevent that, do the following:
    * change cache hashtable sync method from RCU sync to a read/write
    lock.
    * use GFP_ATOMIC in memory allocations.

    Signed-off-by: Paulo Alcantara (SUSE)
    Signed-off-by: Steve French

    Paulo Alcantara (SUSE)
     
  • We can't acquire volume lock while refreshing the DFS cache because
    cifs_reconnect() may call dfs_cache_update_vol() while we are walking
    through the volume list.

    To prevent that, make vol_info refcounted, create a temp list with all
    volumes eligible for refreshing, and then use it without any locks
    held.

    Besides, replace vol_lock with a spinlock and protect cache_ttl from
    concurrent accesses or changes.

    Signed-off-by: Paulo Alcantara (SUSE)
    Signed-off-by: Steve French

    Paulo Alcantara (SUSE)
     
  • Just do the trivial path validation in get_normalized_path().

    Signed-off-by: Paulo Alcantara (SUSE)
    Reviewed-by: Aurelien Aptel
    Signed-off-by: Steve French

    Paulo Alcantara (SUSE)
     
  • Add helpers for finding TCP connections that are good candidates for
    being used by DFS refresh worker.

    Signed-off-by: Paulo Alcantara (SUSE)
    Reviewed-by: Aurelien Aptel
    Signed-off-by: Steve French

    Paulo Alcantara (SUSE)
     
  • The DFS cache API is mostly used with heap allocated strings.

    Signed-off-by: Paulo Alcantara (SUSE)
    Reviewed-by: Aurelien Aptel
    Signed-off-by: Steve French

    Paulo Alcantara (SUSE)
     
  • Do some renaming and code cleanup.

    No functional changes.

    Signed-off-by: Paulo Alcantara (SUSE)
    Reviewed-by: Aurelien Aptel
    Signed-off-by: Steve French

    Paulo Alcantara (SUSE)
     
  • Don't use iov_iter::type directly, but rather use the new accessor
    functions that have been added. This allows the .type field to be split
    and rearranged without the need to update the filesystems.

    Signed-off-by: David Howells
    Signed-off-by: Steve French

    David Howells
     
  • Fix two places where we need to adjust down the max response size for
    ioctl when it is used together with compounding.

    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky
    CC: Stable

    Ronnie Sahlberg
     
  • Combine the initial SMB2_Open and the first SMB2_Query_Directory in a compound.
    This shaves one round-trip of each directory listing, changing it from 4 to 3
    for small directories.

    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     
  • Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     
  • Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     
  • Fixes coccicheck warning:

    fs/cifs/cifssmb.c:4622:3-22: WARNING: Assignment of 0/1 to bool variable
    fs/cifs/cifssmb.c:4756:3-22: WARNING: Assignment of 0/1 to bool variable

    Reported-by: Hulk Robot
    Signed-off-by: zhengbin
    Signed-off-by: Steve French

    zhengbin
     
  • Fixes coccicheck warning:

    fs/cifs/smb2ops.c:807:2-36: WARNING: Assignment of 0/1 to bool variable

    Reported-by: Hulk Robot
    Signed-off-by: zhengbin
    Signed-off-by: Steve French

    zhengbin
     
  • Pull io_uring fixes from Jens Axboe:
    "Fix for two regressions in this cycle, both reported by the postgresql
    use case.

    One removes the added restriction on who can submit IO, making it
    possible for rings shared across forks to do so. The other fixes an
    issue for the same kind of use case, where one exiting process would
    cancel all IO"

    * tag 'io_uring-5.5-2020-01-26' of git://git.kernel.dk/linux-block:
    io_uring: don't cancel all work on process exit
    Revert "io_uring: only allow submit from owning task"

    Linus Torvalds