1. 16 Dec, 2020 40 commits
    • Linus Torvalds's avatar
      Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 60f7c503
      Linus Torvalds authored
      Pull SCSI updates from James Bottomley:
       "This consists of the usual driver updates (ufs, qla2xxx, smartpqi,
        target, zfcp, fnic, mpt3sas, ibmvfc) plus a load of cleanups, a major
        power management rework and a load of assorted minor updates.
      
        There are a few core updates (formatting fixes being the big one) but
        nothing major this cycle"
      
      * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (279 commits)
        scsi: mpt3sas: Update driver version to 36.100.00.00
        scsi: mpt3sas: Handle trigger page after firmware update
        scsi: mpt3sas: Add persistent MPI trigger page
        scsi: mpt3sas: Add persistent SCSI sense trigger page
        scsi: mpt3sas: Add persistent Event trigger page
        scsi: mpt3sas: Add persistent Master trigger page
        scsi: mpt3sas: Add persistent trigger pages support
        scsi: mpt3sas: Sync time periodically between driver and firmware
        scsi: qla2xxx: Update version to 10.02.00.104-k
        scsi: qla2xxx: Fix device loss on 4G and older HBAs
        scsi: qla2xxx: If fcport is undergoing deletion complete I/O with retry
        scsi: qla2xxx: Fix the call trace for flush workqueue
        scsi: qla2xxx: Fix flash update in 28XX adapters on big endian machines
        scsi: qla2xxx: Handle aborts correctly for port undergoing deletion
        scsi: qla2xxx: Fix N2N and NVMe connect retry failure
        scsi: qla2xxx: Fix FW initialization error on big endian machines
        scsi: qla2xxx: Fix crash during driver load on big endian machines
        scsi: qla2xxx: Fix compilation issue in PPC systems
        scsi: qla2xxx: Don't check for fw_started while posting NVMe command
        scsi: qla2xxx: Tear down session if FW say it is down
        ...
      60f7c503
    • Linus Torvalds's avatar
      Merge tag 'for-5.11/drivers-2020-12-14' of git://git.kernel.dk/linux-block · 69f637c3
      Linus Torvalds authored
      Pull block driver updates from Jens Axboe:
       "Nothing major in here:
      
         - NVMe pull request from Christoph:
              - nvmet passthrough improvements (Chaitanya Kulkarni)
              - fcloop error injection support (James Smart)
              - read-only support for zoned namespaces without Zone Append
                (Javier González)
              - improve some error message (Minwoo Im)
              - reject I/O to offline fabrics namespaces (Victor Gladkov)
              - PCI queue allocation cleanups (Niklas Schnelle)
              - remove an unused allocation in nvmet (Amit Engel)
              - a Kconfig spelling fix (Colin Ian King)
              - nvme_req_qid simplication (Baolin Wang)
      
         - MD pull request from Song:
              - Fix race condition in md_ioctl() (Dae R. Jeong)
              - Initialize read_slot properly for raid10 (Kevin Vigor)
              - Code cleanup (Pankaj Gupta)
              - md-cluster resync/reshape fix (Zhao Heming)
      
         - Move null_blk into its own directory (Damien Le Moal)
      
         - null_blk zone and discard improvements (Damien Le Moal)
      
         - bcache race fix (Dongsheng Yang)
      
         - Set of rnbd fixes/improvements (Gioh Kim, Guoqing Jiang, Jack Wang,
           Lutz Pogrell, Md Haris Iqbal)
      
         - lightnvm NULL pointer deref fix (tangzhenhao)
      
         - sr in_interrupt() removal (Sebastian Andrzej Siewior)
      
         - FC endpoint security support for s390/dasd (Jan Höppner, Sebastian
           Ott, Vineeth Vijayan). From the s390 arch guys, arch bits included
           as it made it easier for them to funnel the feature through the
           block driver tree.
      
         - Follow up fixes (Colin Ian King)"
      
      * tag 'for-5.11/drivers-2020-12-14' of git://git.kernel.dk/linux-block: (64 commits)
        block: drop dead assignments in loop_init()
        sr: Remove in_interrupt() usage in sr_init_command().
        sr: Switch the sector size back to 2048 if sr_read_sector() changed it.
        cdrom: Reset sector_size back it is not 2048.
        drivers/lightnvm: fix a null-ptr-deref bug in pblk-core.c
        null_blk: Move driver into its own directory
        null_blk: Allow controlling max_hw_sectors limit
        null_blk: discard zones on reset
        null_blk: cleanup discard handling
        null_blk: Improve implicit zone close
        null_blk: improve zone locking
        block: Align max_hw_sectors to logical blocksize
        null_blk: Fail zone append to conventional zones
        null_blk: Fix zone size initialization
        bcache: fix race between setting bdev state to none and new write request direct to backing
        block/rnbd: fix a null pointer dereference on dev->blk_symlink_name
        block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name
        block/rnbd: call kobject_put in the failure path
        Documentation/ABI/rnbd-srv: add document for force_close
        block/rnbd-srv: close a mapped device from server side.
        ...
      69f637c3
    • Linus Torvalds's avatar
      Merge tag 'for-5.11/block-2020-12-14' of git://git.kernel.dk/linux-block · ac7ac461
      Linus Torvalds authored
      Pull block updates from Jens Axboe:
       "Another series of killing more code than what is being added, again
        thanks to Christoph's relentless cleanups and tech debt tackling.
      
        This contains:
      
         - blk-iocost improvements (Baolin Wang)
      
         - part0 iostat fix (Jeffle Xu)
      
         - Disable iopoll for split bios (Jeffle Xu)
      
         - block tracepoint cleanups (Christoph Hellwig)
      
         - Merging of struct block_device and hd_struct (Christoph Hellwig)
      
         - Rework/cleanup of how block device sizes are updated (Christoph
           Hellwig)
      
         - Simplification of gendisk lookup and removal of block device
           aliasing (Christoph Hellwig)
      
         - Block device ioctl cleanups (Christoph Hellwig)
      
         - Removal of bdget()/blkdev_get() as exported API (Christoph Hellwig)
      
         - Disk change rework, avoid ->revalidate_disk() (Christoph Hellwig)
      
         - sbitmap improvements (Pavel Begunkov)
      
         - Hybrid polling fix (Pavel Begunkov)
      
         - bvec iteration improvements (Pavel Begunkov)
      
         - Zone revalidation fixes (Damien Le Moal)
      
         - blk-throttle limit fix (Yu Kuai)
      
         - Various little fixes"
      
      * tag 'for-5.11/block-2020-12-14' of git://git.kernel.dk/linux-block: (126 commits)
        blk-mq: fix msec comment from micro to milli seconds
        blk-mq: update arg in comment of blk_mq_map_queue
        blk-mq: add helper allocating tagset->tags
        Revert "block: Fix a lockdep complaint triggered by request queue flushing"
        nvme-loop: use blk_mq_hctx_set_fq_lock_class to set loop's lock class
        blk-mq: add new API of blk_mq_hctx_set_fq_lock_class
        block: disable iopoll for split bio
        block: Improve blk_revalidate_disk_zones() checks
        sbitmap: simplify wrap check
        sbitmap: replace CAS with atomic and
        sbitmap: remove swap_lock
        sbitmap: optimise sbitmap_deferred_clear()
        blk-mq: skip hybrid polling if iopoll doesn't spin
        blk-iocost: Factor out the base vrate change into a separate function
        blk-iocost: Factor out the active iocgs' state check into a separate function
        blk-iocost: Move the usage ratio calculation to the correct place
        blk-iocost: Remove unnecessary advance declaration
        blk-iocost: Fix some typos in comments
        blktrace: fix up a kerneldoc comment
        block: remove the request_queue to argument request based tracepoints
        ...
      ac7ac461
    • Linus Torvalds's avatar
      Merge tag 'for-5.11/io_uring-2020-12-14' of git://git.kernel.dk/linux-block · 48aba79b
      Linus Torvalds authored
      Pull io_uring updates from Jens Axboe:
       "Fairly light set of changes this time around, and mostly some bits
        that were pushed out to 5.11 instead of 5.10, fixes/cleanups, and a
        few features. In particular:
      
         - Cleanups around iovec import (David Laight, Pavel)
      
         - Add timeout support for io_uring_enter(2), which enables us to
           clean up liburing and avoid a timeout sqe submission in the
           completion path.
      
           The big win here is that it allows setups that split SQ and CQ
           handling into separate threads to avoid locking, as the CQ side
           will no longer submit when timeouts are needed when waiting for
           events (Hao Xu)
      
         - Add support for socket shutdown, and renameat/unlinkat.
      
         - SQPOLL cleanups and improvements (Xiaoguang Wang)
      
         - Allow SQPOLL setups for CAP_SYS_NICE, and enable regular
           (non-fixed) files to be used.
      
         - Cancelation improvements (Pavel)
      
         - Fixed file reference improvements (Pavel)
      
         - IOPOLL related race fixes (Pavel)
      
         - Lots of other little fixes and cleanups (mostly Pavel)"
      
      * tag 'for-5.11/io_uring-2020-12-14' of git://git.kernel.dk/linux-block: (43 commits)
        io_uring: fix io_cqring_events()'s noflush
        io_uring: fix racy IOPOLL flush overflow
        io_uring: fix racy IOPOLL completions
        io_uring: always let io_iopoll_complete() complete polled io
        io_uring: add timeout update
        io_uring: restructure io_timeout_cancel()
        io_uring: fix files cancellation
        io_uring: use bottom half safe lock for fixed file data
        io_uring: fix miscounting ios_left
        io_uring: change submit file state invariant
        io_uring: check kthread stopped flag when sq thread is unparked
        io_uring: share fixed_file_refs b/w multiple rsrcs
        io_uring: replace inflight_wait with tctx->wait
        io_uring: don't take fs for recvmsg/sendmsg
        io_uring: only wake up sq thread while current task is in io worker context
        io_uring: don't acquire uring_lock twice
        io_uring: initialize 'timeout' properly in io_sq_thread()
        io_uring: refactor io_sq_thread() handling
        io_uring: always batch cancel in *cancel_files()
        io_uring: pass files into kill timeouts/poll
        ...
      48aba79b
    • Linus Torvalds's avatar
      Merge tag 'tif-task_work.arch-2020-12-14' of git://git.kernel.dk/linux-block · 005b2a9d
      Linus Torvalds authored
      Pull TIF_NOTIFY_SIGNAL updates from Jens Axboe:
       "This sits on top of of the core entry/exit and x86 entry branch from
        the tip tree, which contains the generic and x86 parts of this work.
      
        Here we convert the rest of the archs to support TIF_NOTIFY_SIGNAL.
      
        With that done, we can get rid of JOBCTL_TASK_WORK from task_work and
        signal.c, and also remove a deadlock work-around in io_uring around
        knowing that signal based task_work waking is invoked with the sighand
        wait queue head lock.
      
        The motivation for this work is to decouple signal notify based
        task_work, of which io_uring is a heavy user of, from sighand. The
        sighand lock becomes a huge contention point, particularly for
        threaded workloads where it's shared between threads. Even outside of
        threaded applications it's slower than it needs to be.
      
        Roman Gershman <romger@amazon.com> reported that his networked
        workload dropped from 1.6M QPS at 80% CPU to 1.0M QPS at 100% CPU
        after io_uring was changed to use TIF_NOTIFY_SIGNAL. The time was all
        spent hammering on the sighand lock, showing 57% of the CPU time there
        [1].
      
        There are further cleanups possible on top of this. One example is
        TIF_PATCH_PENDING, where a patch already exists to use
        TIF_NOTIFY_SIGNAL instead. Hopefully this will also lead to more
        consolidation, but the work stands on its own as well"
      
      [1] https://github.com/axboe/liburing/issues/215
      
      * tag 'tif-task_work.arch-2020-12-14' of git://git.kernel.dk/linux-block: (28 commits)
        io_uring: remove 'twa_signal_ok' deadlock work-around
        kernel: remove checking for TIF_NOTIFY_SIGNAL
        signal: kill JOBCTL_TASK_WORK
        io_uring: JOBCTL_TASK_WORK is no longer used by task_work
        task_work: remove legacy TWA_SIGNAL path
        sparc: add support for TIF_NOTIFY_SIGNAL
        riscv: add support for TIF_NOTIFY_SIGNAL
        nds32: add support for TIF_NOTIFY_SIGNAL
        ia64: add support for TIF_NOTIFY_SIGNAL
        h8300: add support for TIF_NOTIFY_SIGNAL
        c6x: add support for TIF_NOTIFY_SIGNAL
        alpha: add support for TIF_NOTIFY_SIGNAL
        xtensa: add support for TIF_NOTIFY_SIGNAL
        arm: add support for TIF_NOTIFY_SIGNAL
        microblaze: add support for TIF_NOTIFY_SIGNAL
        hexagon: add support for TIF_NOTIFY_SIGNAL
        csky: add support for TIF_NOTIFY_SIGNAL
        openrisc: add support for TIF_NOTIFY_SIGNAL
        sh: add support for TIF_NOTIFY_SIGNAL
        um: add support for TIF_NOTIFY_SIGNAL
        ...
      005b2a9d
    • Linus Torvalds's avatar
      Merge branch 'parisc-5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 5ee863be
      Linus Torvalds authored
      Pull parisc updates from Helge Deller:
       "A change to increase the default maximum stack size on parisc to 100MB
        and the ability to further increase the stack hard limit size at
        runtime with ulimit for newly started processes.
      
        The other patches fix compile warnings, utilize the Kbuild logic and
        cleanups the parisc arch code"
      
      * 'parisc-5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: pci-dma: fix warning unused-function
        parisc/uapi: Use Kbuild logic to provide <asm/types.h>
        parisc: Make user stack size configurable
        parisc: Use _TIF_USER_WORK_MASK in entry.S
        parisc: Drop loops_per_jiffy from per_cpu struct
      5ee863be
    • Linus Torvalds's avatar
      Merge tag 'mips_5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux · 8312f41f
      Linus Torvalds authored
      Pull MIPS updates from Thomas Bogendoerfer:
      
       - enable GCOV
      
       - rework setup of protection map
      
       - add support for more MSCC platforms
      
       - add sysfs boardinfo for Loongson64
      
       - enable KASLR for Loogson64
      
       - add reset controller for BCM63xx
      
       - cleanups and fixes
      
      * tag 'mips_5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (70 commits)
        mips: fix Section mismatch in reference
        MAINTAINERS: Add linux-mips mailing list to JZ47xx entries
        MAINTAINERS: Remove JZ4780 DMA driver entry
        MAINTAINERS: chenhc@lemote.com -> chenhuacai@kernel.org
        MIPS: Octeon: irq: Alloc desc before configuring IRQ
        MIPS: mm: Add back define for PAGE_SHARED
        MIPS: Select ARCH_KEEP_MEMBLOCK if DEBUG_KERNEL to enable sysfs memblock debug
        mips: lib: uncached: fix non-standard usage of variable 'sp'
        MIPS: DTS: img: Fix schema warnings for pwm-leds
        MIPS: KASLR: Avoid endless loop in sync_icache if synci_step is zero
        MIPS: Move memblock_dump_all() to the end of setup_arch()
        MIPS: SMP-CPS: Add support for irq migration when CPU offline
        MIPS: OCTEON: Don't add kernel sections into memblock allocator
        MIPS: Don't round up kernel sections size for memblock_add()
        MIPS: Enable GCOV
        MIPS: configs: drop unused BACKLIGHT_GENERIC option
        MIPS: Loongson64: Fix up reserving kernel memory range
        MIPS: mm: Remove unused is_aligned_hugepage_range
        MIPS: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable()
        mips: cdmm: fix use-after-free in mips_cdmm_bus_discover
        ...
      8312f41f
    • Linus Torvalds's avatar
      Merge tag 'microblaze-v5.11' of git://git.monstr.eu/linux-2.6-microblaze · 66fc6a62
      Linus Torvalds authored
      Pull microblaze updates from Michal Simek:
       "The biggest change is to remove support for noMMU configuration.
      
        FPGAs are bigger so people use Microblaze with MMU for a lot of years
        and there is likely no user of this code anymore. No one is updating
        libraries for this configuration either.
      
         - Remove noMMU support
      
         - Add support for TIF_NOTIFY_SIGNAL
      
         - Small header fix"
      
      * tag 'microblaze-v5.11' of git://git.monstr.eu/linux-2.6-microblaze:
        microblaze: Remove noMMU code
        microblaze: add support for TIF_NOTIFY_SIGNAL
        microblaze: Replace <linux/clk-provider.h> by <linux/of_clk.h>
      66fc6a62
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.11-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 7acfd427
      Linus Torvalds authored
      Pull xen updates from Juergen Gross:
       "Fixes for security issues just having been disclosed:
      
         - a five patch series for fixing of XSA-349 (DoS via resource
           depletion in Xen dom0)
      
         - a patch fixing XSA-350 (access of stale pointer in a Xen dom0)"
      
      * tag 'for-linus-5.11-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen-blkback: set ring->xenblkd to NULL after kthread_stop()
        xenbus/xenbus_backend: Disallow pending watch messages
        xen/xenbus: Count pending messages for each watch
        xen/xenbus/xen_bus_type: Support will_handle watch callback
        xen/xenbus: Add 'will_handle' callback support in xenbus_watch_path()
        xen/xenbus: Allow watches discard events before queueing
      7acfd427
    • Linus Torvalds's avatar
      Merge tag 'hyperv-next-signed-20201214' of... · 571b12dd
      Linus Torvalds authored
      Merge tag 'hyperv-next-signed-20201214' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
      
      Pull Hyper-V updates from Wei Liu:
      
       - harden VMBus (Andres Beltran)
      
       - clean up VMBus driver (Matheus Castello)
      
       - fix hv_balloon reporting (Vitaly Kuznetsov)
      
       - fix a potential OOB issue (Andrea Parri)
      
       - remove an obsolete TODO item (Stefan Eschenbacher)
      
      * tag 'hyperv-next-signed-20201214' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
        hv_balloon: do adjust_managed_page_count() when ballooning/un-ballooning
        hv_balloon: simplify math in alloc_balloon_pages()
        drivers/hv: remove obsolete TODO and fix misleading typo in comment
        drivers: hv: vmbus: Fix checkpatch SPLIT_STRING
        hv_netvsc: Validate number of allocated sub-channels
        drivers: hv: vmbus: Fix call msleep using < 20ms
        drivers: hv: vmbus: Fix checkpatch LINE_SPACING
        drivers: hv: vmbus: Replace symbolic permissions by octal permissions
        drivers: hv: Fix hyperv_record_panic_msg path on comment
        hv_netvsc: Use vmbus_requestor to generate transaction IDs for VMBus hardening
        scsi: storvsc: Use vmbus_requestor to generate transaction IDs for VMBus hardening
        Drivers: hv: vmbus: Add vmbus_requestor data structure for VMBus hardening
      571b12dd
    • Linus Torvalds's avatar
      Merge tag 'seccomp-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · e994cc24
      Linus Torvalds authored
      Pull seccomp updates from Kees Cook:
       "The major change here is finally gaining seccomp constant-action
        bitmaps, which internally reduces the seccomp overhead for many
        real-world syscall filters to O(1), as discussed at Plumbers this
        year.
      
         - Improve seccomp performance via constant-action bitmaps (YiFei Zhu
           & Kees Cook)
      
         - Fix bogus __user annotations (Jann Horn)
      
         - Add missed CONFIG for improved selftest coverage (Mickaël Salaün)"
      
      * tag 'seccomp-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        selftests/seccomp: Update kernel config
        seccomp: Remove bogus __user annotations
        seccomp/cache: Report cache data through /proc/pid/seccomp_cache
        xtensa: Enable seccomp architecture tracking
        sh: Enable seccomp architecture tracking
        s390: Enable seccomp architecture tracking
        riscv: Enable seccomp architecture tracking
        powerpc: Enable seccomp architecture tracking
        parisc: Enable seccomp architecture tracking
        csky: Enable seccomp architecture tracking
        arm: Enable seccomp architecture tracking
        arm64: Enable seccomp architecture tracking
        selftests/seccomp: Compare bitmap vs filter overhead
        x86: Enable seccomp architecture tracking
        seccomp/cache: Add "emulator" to check if filter is constant allow
        seccomp/cache: Lookup syscall allowlist bitmap for fast path
      e994cc24
    • Linus Torvalds's avatar
      Merge tag 'pstore-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · ba1d41a5
      Linus Torvalds authored
      Pull pstore updates from Kees Cook:
      
       - Clean up unused but exposed API (Christoph Hellwig)
      
       - Provide KCONFIG for default size of kmsg buffer (Vasile-Laurentiu
         Stanimir)
      
      * tag 'pstore-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        pstore: Move kmsg_bytes default into Kconfig
        pstore/blk: remove {un,}register_pstore_blk
        pstore/blk: update the command line example
        pstore/zone: cap the maximum device size
      ba1d41a5
    • Linus Torvalds's avatar
      Merge tag 'gcc-plugins-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 6df0f285
      Linus Torvalds authored
      Pull gcc-plugins updates from Kees Cook:
      
       - Clean up gcc plugin builds now that GCC must be 4.9+ (Masahiro
         Yamada)
      
       - Update MAINTAINERS (Kees Cook)
      
      * tag 'gcc-plugins-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        MAINTAINERS: Drop inactive gcc-plugins maintainer
        gcc-plugins: simplify GCC plugin-dev capability test
        gcc-plugins: remove code for GCC versions older than 4.9
      6df0f285
    • Linus Torvalds's avatar
      Merge tag 'Smack-for-5.11' of git://github.com/cschaufler/smack-next · 8bda68d6
      Linus Torvalds authored
      Pull smack updates from Casey Schaufler:
       "There are no functional changes. Just one minor code clean-up and a
        set of corrections in function header comments"
      
      * tag 'Smack-for-5.11' of git://github.com/cschaufler/smack-next:
        security/smack: remove unused varible 'rc'
        Smack: fix kernel-doc interface on functions
      8bda68d6
    • Linus Torvalds's avatar
      Merge tag 'integrity-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity · e20a9b92
      Linus Torvalds authored
      Pull integrity subsystem updates from Mimi Zohar:
       "Just three patches here. Other integrity changes are being upstreamed
        via EFI (defines a common EFI secure and trusted boot IMA policy) and
        BPF LSM (exporting the IMA file cache hash info based on inode).
      
        The three patches included here:
      
         - bug fix: fail calculating the file hash, when a file not opened for
           read and the attempt to re-open it for read fails.
      
         - defer processing the "ima_appraise" boot command line option to
           avoid enabling different modes (e.g. fix, log) to when the secure
           boot flag is available on arm.
      
         - defines "ima-buf" as the default IMA buffer measurement template in
           preparation for the builtin integrity "critical data" policy"
      
      * tag 'integrity-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity:
        ima: Don't modify file descriptor mode on the fly
        ima: select ima-buf template for buffer measurement
        ima: defer arch_ima_get_secureboot() call to IMA init time
      e20a9b92
    • Linus Torvalds's avatar
      Merge tag 'selinux-pr-20201214' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · ca5b877b
      Linus Torvalds authored
      Pull selinux updates from Paul Moore:
       "While we have a small number of SELinux patches for v5.11, there are a
        few changes worth highlighting:
      
         - Change the LSM network hooks to pass flowi_common structs instead
           of the parent flowi struct as the LSMs do not currently need the
           full flowi struct and they do not have enough information to use it
           safely (missing information on the address family).
      
           This patch was discussed both with Herbert Xu (representing team
           netdev) and James Morris (representing team
           LSMs-other-than-SELinux).
      
         - Fix how we handle errors in inode_doinit_with_dentry() so that we
           attempt to properly label the inode on following lookups instead of
           continuing to treat it as unlabeled.
      
         - Tweak the kernel logic around allowx, auditallowx, and dontauditx
           SELinux policy statements such that the auditx/dontauditx are
           effective even without the allowx statement.
      
        Everything passes our test suite"
      
      * tag 'selinux-pr-20201214' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
        lsm,selinux: pass flowi_common instead of flowi to the LSM hooks
        selinux: Fix fall-through warnings for Clang
        selinux: drop super_block backpointer from superblock_security_struct
        selinux: fix inode_doinit_with_dentry() LABEL_INVALID error handling
        selinux: allow dontauditx and auditallowx rules to take effect without allowx
        selinux: fix error initialization in inode_doinit_with_dentry()
      ca5b877b
    • Linus Torvalds's avatar
      Merge tag 'audit-pr-20201214' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit · 3d5de2dd
      Linus Torvalds authored
      Pull audit updates from Paul Moore:
       "A small set of audit patches for v5.11 with four patches in total and
        only one of any real significance.
      
        Richard's patch to trigger accompanying records causes the kernel to
        emit additional related records when an audit event occurs; helping
        provide some much needed context to events in the audit log. It is
        also worth mentioning that this is a revised patch based on an earlier
        attempt that had to be reverted in the v5.8 time frame.
      
        Everything passes our test suite, and with no problems reported please
        merge this for v5.11"
      
      * tag 'audit-pr-20201214' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit:
        audit: replace atomic_add_return()
        audit: fix macros warnings
        audit: trigger accompanying records when no rules present
        audit: fix a kernel-doc markup
      3d5de2dd
    • Linus Torvalds's avatar
      Merge tag 'printk-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux · d3eb5211
      Linus Torvalds authored
      Pull printk updates from Petr Mladek:
      
       - Finally allow parallel writes and reads into/from the lockless
         ringbuffer. But it is not a complete solution. Readers are still
         serialized against each other. And nested writes are still prevented
         by printk_safe per-CPU buffers.
      
       - Use ttynull as the ultimate fallback for /dev/console.
      
       - Officially allow disabling console output by using console="" or
         console=null
      
       - A few code cleanups
      
      * tag 'printk-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
        printk: remove logbuf_lock writer-protection of ringbuffer
        printk: inline log_output(),log_store() in vprintk_store()
        printk: remove obsolete dead assignment
        printk/console: Allow to disable console output by using console="" or console=null
        init/console: Use ttynull as a fallback when there is no console
        printk: ringbuffer: Reference text_data_ring directly in callees.
      d3eb5211
    • Linus Torvalds's avatar
      Merge tag 'fallthrough-fixes-clang-5.11-rc1' of... · 5e60366d
      Linus Torvalds authored
      Merge tag 'fallthrough-fixes-clang-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux
      
      Pull fallthrough fixes from Gustavo A. R. Silva:
       "Fix many fall-through warnings when building with Clang 12.0.0
        using -Wimplicit-fallthrough.
      
         - powerpc: boot: include compiler_attributes.h (Nick Desaulniers)
      
         - Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
           (Nick Desaulniers)
      
         - powerpc: fix -Wimplicit-fallthrough (Nick Desaulniers)
      
         - lib: Fix fall-through warnings for Clang (Gustavo A. R. Silva)"
      
      * tag 'fallthrough-fixes-clang-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux:
        lib: Fix fall-through warnings for Clang
        powerpc: fix -Wimplicit-fallthrough
        Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
        powerpc: boot: include compiler_attributes.h
      5e60366d
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-kunit-5.11-rc1' of... · 706451d4
      Linus Torvalds authored
      Merge tag 'linux-kselftest-kunit-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kunit updates from Shuah Khan:
      
       - documentation update and fix to kunit_tool to parse diagnostic
         messages correctly from David Gow
      
       - Support for Parameterized Testing and fs/ext4 test updates to use
         KUnit parameterized testing feature from Arpitha Raghunandan
      
       - Helper to derive file names depending on --build_dir argument from
         Andy Shevchenko
      
      * tag 'linux-kselftest-kunit-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        fs: ext4: Modify inode-test.c to use KUnit parameterized testing feature
        kunit: Support for Parameterized Testing
        kunit: kunit_tool: Correctly parse diagnostic messages
        Documentation: kunit: provide guidance for testing many inputs
        kunit: Introduce get_file_path() helper
      706451d4
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-next-5.11-rc1' of... · 7194850e
      Linus Torvalds authored
      Merge tag 'linux-kselftest-next-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest updates from Shuah Khan:
      
       - Much needed gpio test Makefile cleanup to various problems with test
         dependencies and build errors from Michael Ellerman
      
       - Enabling vDSO test on non x86 platforms from Vincenzo Frascino
      
       - Fix intel_pstate to replace deprecated ftime() usages with
         clock_gettime() from Tommi Rantala
      
       - cgroup test build fix on older releases from Sachin Sant
      
       - A couple of spelling mistake fixes
      
      * tag 'linux-kselftest-next-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/cgroup: Fix build on older distros
        selftests/run_kselftest.sh: fix dry-run typo
        tool: selftests: fix spelling typo of 'writting'
        selftests/memfd: Fix implicit declaration warnings
        selftests: intel_pstate: ftime() is deprecated
        selftests/gpio: Add to CLEAN rule rather than overriding
        selftests/gpio: Fix build when source tree is read only
        selftests/gpio: Move include of lib.mk up
        selftests/gpio: Use TEST_GEN_PROGS_EXTENDED
        kselftest: Extend vdso correctness test to clock_gettime64
        kselftest: Move test_vdso to the vDSO test suite
        kselftest: Extend vDSO selftest to clock_getres
        kselftest: Extend vDSO selftest
        kselftest: Enable vDSO test on non x86 platforms
      7194850e
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-fixes-5.11-rc1' of... · b80affe3
      Linus Torvalds authored
      Merge tag 'linux-kselftest-fixes-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest fixes from Shuah Khan:
       "Build fixes for clone3 and rseq tests"
      
      * tag 'linux-kselftest-fixes-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/clone3: Fix build error
        rseq/selftests: Fix MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ build error under other arch.
      b80affe3
    • Linus Torvalds's avatar
      Merge tag 'asm-generic-timers-5.11' of... · 7a932e57
      Linus Torvalds authored
      Merge tag 'asm-generic-timers-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
      
      Pull asm-generic cross-architecture timer cleanup from Arnd Bergmann:
       "This cleans up two ancient timer features that were never completed in
        the past, CONFIG_GENERIC_CLOCKEVENTS and CONFIG_ARCH_USES_GETTIMEOFFSET.
      
        There was only one user left for the ARCH_USES_GETTIMEOFFSET variant
        of clocksource implementations, the ARM EBSA110 platform. Rather than
        changing to use modern timekeeping, we remove the platform entirely as
        Russell no longer uses his machine and nobody else seems to have one
        any more.
      
        The conditional code for using arch_gettimeoffset() is removed as a
        result.
      
        For CONFIG_GENERIC_CLOCKEVENTS, there are still a couple of platforms
        not using clockevent drivers: parisc, ia64, most of m68k, and one Arm
        platform. These all do timer ticks slighly differently, and this gets
        cleaned up to the point they at least all call the same helper
        function.
      
        Instead of most platforms using 'select GENERIC_CLOCKEVENTS' in
        Kconfig, the polarity is now reversed, with the few remaining ones
        selecting LEGACY_TIMER_TICK instead"
      
      * tag 'asm-generic-timers-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
        timekeeping: default GENERIC_CLOCKEVENTS to enabled
        timekeeping: remove xtime_update
        m68k: remove timer_interrupt() function
        m68k: change remaining timers to legacy_timer_tick
        m68k: m68328: use legacy_timer_tick()
        m68k: sun3/sun3c: use legacy_timer_tick
        m68k: split heartbeat out of timer function
        m68k: coldfire: use legacy_timer_tick()
        parisc: use legacy_timer_tick
        ARM: rpc: use legacy_timer_tick
        ia64: convert to legacy_timer_tick
        timekeeping: add CONFIG_LEGACY_TIMER_TICK
        timekeeping: remove arch_gettimeoffset
        net: remove am79c961a driver
        ARM: remove ebsa110 platform
      7a932e57
    • Linus Torvalds's avatar
      Merge tag 'asm-generic-mmu-context-5.11' of... · 15780712
      Linus Torvalds authored
      Merge tag 'asm-generic-mmu-context-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
      
      Pull asm-generic mmu-context cleanup from Arnd Bergmann:
       "This is a cleanup series from Nicholas Piggin, preparing for later
        changes. The asm/mmu_context.h header are generalized and common code
        moved to asm-gneneric/mmu_context.h.
      
        This saves a bit of code and makes it easier to change in the future"
      
      * tag 'asm-generic-mmu-context-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (25 commits)
        h8300: Fix generic mmu_context build
        m68k: mmu_context: Fix Sun-3 build
        xtensa: use asm-generic/mmu_context.h for no-op implementations
        x86: use asm-generic/mmu_context.h for no-op implementations
        um: use asm-generic/mmu_context.h for no-op implementations
        sparc: use asm-generic/mmu_context.h for no-op implementations
        sh: use asm-generic/mmu_context.h for no-op implementations
        s390: use asm-generic/mmu_context.h for no-op implementations
        riscv: use asm-generic/mmu_context.h for no-op implementations
        powerpc: use asm-generic/mmu_context.h for no-op implementations
        parisc: use asm-generic/mmu_context.h for no-op implementations
        openrisc: use asm-generic/mmu_context.h for no-op implementations
        nios2: use asm-generic/mmu_context.h for no-op implementations
        nds32: use asm-generic/mmu_context.h for no-op implementations
        mips: use asm-generic/mmu_context.h for no-op implementations
        microblaze: use asm-generic/mmu_context.h for no-op implementations
        m68k: use asm-generic/mmu_context.h for no-op implementations
        ia64: use asm-generic/mmu_context.h for no-op implementations
        hexagon: use asm-generic/mmu_context.h for no-op implementations
        csky: use asm-generic/mmu_context.h for no-op implementations
        ...
      15780712
    • Linus Torvalds's avatar
      Merge tag 'asm-generic-cleanup-5.11' of... · e2dc4957
      Linus Torvalds authored
      Merge tag 'asm-generic-cleanup-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
      
      Pull asm-generic cleanups from Arnd Bergmann:
       "These are a couple of compiler warning fixes to make 'make W=2' less
        noisy, as well as some fixes to code comments in asm-generic"
      
      * tag 'asm-generic-cleanup-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
        syscalls: Fix file comments for syscalls implemented in kernel/sys.c
        ctype.h: remove duplicate isdigit() helper
        qspinlock: use signed temporaries for cmpxchg
        asm-generic: fix ffs -Wshadow warning
        asm-generic: percpu: avoid Wshadow warning
        asm-generic/sembuf: Update architecture related information in comment
      e2dc4957
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · f986e350
      Linus Torvalds authored
      Merge yet more updates from Andrew Morton:
      
       - lots of little subsystems
      
       - a few post-linux-next MM material. Most of the rest awaits more
         merging of other trees.
      
      Subsystems affected by this series: alpha, procfs, misc, core-kernel,
      bitmap, lib, lz4, checkpatch, nilfs, kdump, rapidio, gcov, bfs, relay,
      resource, ubsan, reboot, fault-injection, lzo, apparmor, and mm (swap,
      memory-hotplug, pagemap, cleanups, and gup).
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (86 commits)
        mm: fix some spelling mistakes in comments
        mm: simplify follow_pte{,pmd}
        mm: unexport follow_pte_pmd
        apparmor: remove duplicate macro list_entry_is_head()
        lib/lzo/lzo1x_compress.c: make lzogeneric1x_1_compress() static
        fault-injection: handle EI_ETYPE_TRUE
        reboot: hide from sysfs not applicable settings
        reboot: allow to override reboot type if quirks are found
        reboot: remove cf9_safe from allowed types and rename cf9_force
        reboot: allow to specify reboot mode via sysfs
        reboot: refactor and comment the cpu selection code
        lib/ubsan.c: mark type_check_kinds with static keyword
        kcov: don't instrument with UBSAN
        ubsan: expand tests and reporting
        ubsan: remove UBSAN_MISC in favor of individual options
        ubsan: enable for all*config builds
        ubsan: disable UBSAN_TRAP for all*config
        ubsan: disable object-size sanitizer under GCC
        ubsan: move cc-option tests into Kconfig
        ubsan: remove redundant -Wno-maybe-uninitialized
        ...
      f986e350
    • Haitao Shi's avatar
      mm: fix some spelling mistakes in comments · 8958b249
      Haitao Shi authored
      Fix some spelling mistakes in comments:
      	udpate ==> update
      	succesful ==> successful
      	exmaple ==> example
      	unneccessary ==> unnecessary
      	stoping ==> stopping
      	uknown ==> unknown
      
      Link: https://lkml.kernel.org/r/20201127011747.86005-1-shihaitao1@huawei.comSigned-off-by: default avatarHaitao Shi <shihaitao1@huawei.com>
      Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Reviewed-by: default avatarSouptick Joarder <jrdr.linux@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8958b249
    • Christoph Hellwig's avatar
      mm: simplify follow_pte{,pmd} · ff5c19ed
      Christoph Hellwig authored
      Merge __follow_pte_pmd, follow_pte_pmd and follow_pte into a single
      follow_pte function and just pass two additional NULL arguments for the
      two previous follow_pte callers.
      
      [sfr@canb.auug.org.au: merge fix for "s390/pci: remove races against pte updates"]
        Link: https://lkml.kernel.org/r/20201111221254.7f6a3658@canb.auug.org.au
      
      Link: https://lkml.kernel.org/r/20201029101432.47011-3-hch@lst.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ff5c19ed
    • Christoph Hellwig's avatar
      mm: unexport follow_pte_pmd · 73363757
      Christoph Hellwig authored
      Patch series "simplify follow_pte a bit".
      
      This small series drops the not needed follow_pte_pmd exports, and
      simplifies the follow_pte family of functions a bit.
      
      This patch (of 2):
      
      follow_pte_pmd() is only used by the DAX code, which can't be modular.
      
      Link: https://lkml.kernel.org/r/20201029101432.47011-2-hch@lst.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      73363757
    • Andy Shevchenko's avatar
      apparmor: remove duplicate macro list_entry_is_head() · 9801ca27
      Andy Shevchenko authored
      Strangely I hadn't had noticed the existence of the list_entry_is_head()
      in apparmor code when added the same one in the list.h.  Luckily it's
      fully identical and didn't break builds.  In any case we don't need a
      duplicate anymore, thus remove it from apparmor code.
      
      Link: https://lkml.kernel.org/r/20201208100639.88182-1-andriy.shevchenko@linux.intel.com
      Fixes: e1308161 ("include/linux/list.h: add a macro to test if entry is pointing to the head")
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarJohn Johansen <john.johansen@canonical.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: "Serge E . Hallyn " <serge@hallyn.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9801ca27
    • Jason Yan's avatar
      lib/lzo/lzo1x_compress.c: make lzogeneric1x_1_compress() static · 33fb626b
      Jason Yan authored
      Fix the following sparse warning:
      
        lib/lzo/lzo1x_compress.c:304:5: warning: symbol 'lzogeneric1x_1_compress' was not declared. Should it be static?
      
      Link: https://lkml.kernel.org/r/20201020031415.136874-1-yanaijie@huawei.comSigned-off-by: default avatarJason Yan <yanaijie@huawei.com>
      Cc: Dave Rodgman <dave.rodgman@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      33fb626b
    • Barnabás Pőcze's avatar
      fault-injection: handle EI_ETYPE_TRUE · 537cd894
      Barnabás Pőcze authored
      Commit af3b8544 ("mm/page_alloc.c: allow error injection")
      introduced EI_ETYPE_TRUE, but did not extend
      
       * lib/error-inject.c:error_type_string(), and
       * kernel/fail_function.c:adjust_error_retval()
      
      to accommodate for this change.
      
      Handle EI_ETYPE_TRUE in both functions appropriately by
       * returning "TRUE" in error_type_string(),
       * adjusting the return value to true (1) in adjust_error_retval().
      
      Furthermore, simplify the logic of handling EI_ETYPE_NULL in
      adjust_error_retval().
      
      Link: https://lkml.kernel.org/r/njB1czX0ZgWPR9h61euHIBb5bEyePw9D4D2m3i5lc9Cl96P8Q1308dTcmsEZW7Vtz3Ifz4do-rOtSfuFTyGoEDYokkK2aUqBePVptzZEWfU=@protonmail.comSigned-off-by: default avatarBarnabás Pőcze <pobrn@protonmail.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      537cd894
    • Matteo Croce's avatar
      reboot: hide from sysfs not applicable settings · 40247e55
      Matteo Croce authored
      Not all the reboot settings from both the kernel command line or sysfs
      interface are available to all platforms.
      
      Filter out reboot_type and reboot_force which are x86 only, and also
      remove reboot_cpu on kernels without SMP support.
      
      This saves some space, and avoid confusing the user with settings which
      will have no effect.
      
      Link: https://lkml.kernel.org/r/20201130173717.198952-3-mcroce@linux.microsoft.comSigned-off-by: default avatarMatteo Croce <mcroce@microsoft.com>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      40247e55
    • Matteo Croce's avatar
      reboot: allow to override reboot type if quirks are found · 1a9d079f
      Matteo Croce authored
      Patch series "reboot: sysfs improvements".
      
      Some improvements to the sysfs reboot interface: hide not working settings
      and support machines with known reboot quirks.
      
      This patch (of 2):
      
      On some machines a quirk can force a specific reboot type.  Quirks are
      found during a DMI scan, the list of machines which need special reboot
      handling is defined in reboot_dmi_table.
      
      The kernel command line reboot= option overrides this via a global
      variable `reboot_default`, so that the reboot type requested in the
      command line is really performed.
      
      This was not true when setting the reboot type via the new sysfs
      interface.  Fix this by setting reboot_default upon the first change, like
      reboot_setup() does for the command line.
      
      Link: https://lkml.kernel.org/r/20201130173717.198952-1-mcroce@linux.microsoft.com
      Link: https://lkml.kernel.org/r/20201130173717.198952-2-mcroce@linux.microsoft.comSigned-off-by: default avatarMatteo Croce <mcroce@microsoft.com>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1a9d079f
    • Matteo Croce's avatar
      reboot: remove cf9_safe from allowed types and rename cf9_force · 0c5c0179
      Matteo Croce authored
      BOOT_CF9_SAFE_STR is an internal value used only by the x86 code and it's
      not possible to set it from userspace.
      
      Remove it, and rename 'cf9_force' to 'pci', so to make it coherent with
      the kernel command line reboot= option.
      
      Tested with this script:
      
      	cd /sys/kernel/reboot/
      
      	for i in cold warm hard soft gpio; do
      		echo $i >mode
      		read j <mode
      		[ $i = $j ] || echo "mode $i != $j"
      	done
      
      	for i in bios acpi kbd triple efi pci; do
      		echo $i >type
      		read j <type
      		[ $i = $j ] || echo "type $i != $j"
      	done
      
      	for i in $(seq 0 $(nproc --ignore=1)); do
      		echo $i >cpu
      		read j <cpu
      		[ $i = $j ] || echo "cpu $i != $j"
      	done
      
      	for i in 0 1; do
      		echo $i >force
      		read j <force
      		[ $i = $j ] || echo "force $i != $j"
      	done
      
      Link: https://lkml.kernel.org/r/20201113015900.543923-1-mcroce@linux.microsoft.com
      Fixes: eab8da48579d ("reboot: allow to specify reboot mode via sysfs")
      Signed-off-by: default avatarMatteo Croce <mcroce@microsoft.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Nathan Chancellor <natechancellor@gmail.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Tyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0c5c0179
    • Matteo Croce's avatar
      reboot: allow to specify reboot mode via sysfs · 2c622ed0
      Matteo Croce authored
      The kernel cmdline reboot= option offers some sort of control on how the
      reboot is issued.
      
      We don't always know in advance what type of reboot to perform.
      
      Sometimes a warm reboot is preferred to persist certain memory regions
      across the reboot.  Others a cold one is needed to apply a future system
      update that makes a memory memory model change, like changing the base
      page size or resizing a persistent memory region.
      
      Or simply we want to enable reboot_force because we noticed that
      something bad happened.
      
      Add handles in sysfs to allow setting these reboot options, so they can
      be changed when the system is booted, other than at boot time.
      
      The handlers are under <sysfs>/kernel/reboot, can be read to get the
      current configuration and written to alter it.
      
      	# cd /sys/kernel/reboot/
      
      	# grep . *
      	cpu:0
      	force:0
      	mode:cold
      	type:acpi
      
      	# echo 2 >cpu
      	# echo yes >force
      	# echo soft >mode
      	# echo bios >type
      
      	# grep . *
      	cpu:2
      	force:1
      	mode:soft
      	type:bios
      
      Before setting anything, check for CAP_SYS_BOOT capability, so it's
      possible to allow an unpriviledged process to change these settings simply
      by relaxing the handles permissions, without opening them to the world.
      
      [natechancellor@gmail.com: fix variable assignments in type_store]
        Link: https://lkml.kernel.org/r/20201112035023.974748-1-natechancellor@gmail.com
        Link: https://github.com/ClangBuiltLinux/linux/issues/1197
      
      Link: https://lkml.kernel.org/r/20201110202746.9690-1-mcroce@linux.microsoft.comSigned-off-by: default avatarMatteo Croce <mcroce@microsoft.com>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Tyler Hicks <tyhicks@linux.microsoft.com>
      Cc: Nathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2c622ed0
    • Matteo Croce's avatar
      reboot: refactor and comment the cpu selection code · f9a90501
      Matteo Croce authored
      Small improvements to the code, without changing the way it works:
      
       - use a local variable, to avoid a small time lapse where reboot_cpu
         can have an invalid value
      
       - comment the code which is not easy to understand at a glance
      
       - merge two identical code blocks into one
      
       - replace pointer arithmetics with equivalent array syntax
      
      Link: https://lkml.kernel.org/r/20201103214025.116799-4-mcroce@linux.microsoft.comSigned-off-by: default avatarMatteo Croce <mcroce@microsoft.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Fabian Frederick <fabf@skynet.be>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Robin Holt <robinmholt@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f9a90501
    • Zou Wei's avatar
      lib/ubsan.c: mark type_check_kinds with static keyword · d3c22797
      Zou Wei authored
      Fix the following sparse warning:
      
        lib/ubsan.c:20:12: warning: symbol 'type_check_kinds' was not declared. Should it be static?
      
      [akpm@linux-foundation.org: make it `static const char * const' while we're in there]
      
      Link: https://lkml.kernel.org/r/1607602638-79584-1-git-send-email-zou_wei@huawei.comSigned-off-by: default avatarZou Wei <zou_wei@huawei.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d3c22797
    • Dmitry Vyukov's avatar
      kcov: don't instrument with UBSAN · c1cb05e7
      Dmitry Vyukov authored
      Both KCOV and UBSAN use compiler instrumentation.  If UBSAN detects a bug
      in KCOV, it may cause infinite recursion via printk and other common
      functions.  We already don't instrument KCOV with KASAN/KCSAN for this
      reason, don't instrument it with UBSAN as well.
      
      As a side effect this also resolves the following gcc warning:
      
      conflicting types for built-in function '__sanitizer_cov_trace_switch';
      expected 'void(long unsigned int, void *)'
      [-Wbuiltin-declaration-mismatch]
      
      It's only reported when kcov.c is compiled with any of the sanitizers
      enabled.  Size of the arguments is correct, it's just that gcc uses 'long'
      on 64-bit arches and 'long long' on 32-bit arches, while kernel type is
      always 'long long'.
      
      Link: https://lkml.kernel.org/r/20201209100152.2492072-1-dvyukov@google.comSigned-off-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Suggested-by: default avatarMarco Elver <elver@google.com>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c1cb05e7
    • Kees Cook's avatar
      ubsan: expand tests and reporting · 4a26f49b
      Kees Cook authored
      Expand the UBSAN tests to include some additional UB cases.  Notably the
      out-of-bounds enum loading appears not to work.  Also include per-test
      reporting, including the relevant CONFIG_UBSAN...  Kconfigs.
      
      Link: https://lkml.kernel.org/r/20201203004437.389959-8-keescook@chromium.orgSigned-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: George Popescu <georgepope@android.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Marco Elver <elver@google.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Michal Marek <michal.lkml@markovi.net>
      Cc: Nathan Chancellor <natechancellor@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4a26f49b