01 Mar, 2018

3 commits

  • We already have xmalloc(), xcalloc(), and xrealloc((). Add xstrdup()
    as well to save tedious error handling.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Currently, sparse issues warnings on code using an attribute
    it doesn't know about.

    One of the problem with this is that these warnings have no
    value for the developer, it's just noise for him. At best these
    warnings tell something about some deficiencies of sparse itself
    but not about a potential problem with code analyzed.

    A second problem with this is that sparse release are, alas,
    less frequent than new attributes are added to GCC.

    So, avoid the noise by asking sparse to not warn about
    attributes it doesn't know about.

    Reference: https://marc.info/?l=linux-sparse&m=151871600016790
    Reference: https://marc.info/?l=linux-sparse&m=151871725417322
    Signed-off-by: Luc Van Oostenryck
    Acked-by: Randy Dunlap
    Tested-by: Randy Dunlap
    Signed-off-by: Masahiro Yamada

    Luc Van Oostenryck
     
  • The comment above the silentoldconfig invocation is outdated.
    'make oldconfig' updates just .config and doesn't touch the
    include/config/ tree.

    This came up in https://lkml.org/lkml/2018/2/12/415.

    While fixing the comment, make it more informative by explaining the
    purpose of the unfortunately named silentoldconfig.

    I can't make sense of the comment re. auto.conf.cmd and a cleaned tree.
    include/config/auto.conf and include/config/auto.conf.cmd are both
    created simultaneously by silentoldconfig (in
    scripts/kconfig/confdata.c, by conf_write_autoconf()), and nothing seems
    to remove auto.conf.cmd that wouldn't remove auto.conf. Remove that part
    of the comment rather than blindly copying it. It might be a leftover
    from an older way of doing things.

    The include/config/auto.conf.cmd prerequisite might be there to ensure
    that silentoldconfig gets rerun if conf_write_autoconf() fails between
    writing out auto.conf.cmd and auto.conf (a comment in the function
    indicates that auto.conf is deliberately written out last to mark
    completion of the operation). It seems the Makefile dependency between
    include/config/auto.conf and .config would already take care of that
    though, since include/config/auto.conf would still be out of date re.
    .config if the operation fails.

    Cop out and leave the prerequisite in for now.

    Signed-off-by: Ulf Magnusson
    Signed-off-by: Masahiro Yamada

    Ulf Magnusson
     

26 Feb, 2018

7 commits


25 Feb, 2018

1 commit

  • Pull powerpc fixes from Michael Ellerman:

    - Add handling for a missing instruction in our 32-bit BPF JIT so that
    it can be used for seccomp filtering.

    - Add a missing NULL pointer check before a function call in new EEH
    code.

    - Fix an error path in the new ocxl driver to correctly return EFAULT.

    - The support for the new ibm,drc-info device tree property turns out
    to need several fixes, so for now we just stop advertising to
    firmware that we support it until the bugs can be ironed out.

    - One fix for the new drmem code which was incorrectly modifying the
    device tree in place.

    - Finally two fixes for the RFI flush support, so that firmware can
    advertise to us that it should be disabled entirely so as not to
    affect performance.

    Thanks to: Bharata B Rao, Frederic Barrat, Juan J. Alvarez, Mark Lord,
    Michael Bringmann.

    * tag 'powerpc-4.16-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
    powerpc/powernv: Support firmware disable of RFI flush
    powerpc/pseries: Support firmware disable of RFI flush
    powerpc/mm/drmem: Fix unexpected flag value in ibm,dynamic-memory-v2
    powerpc/bpf/jit: Fix 32-bit JIT for seccomp_data access
    powerpc/pseries: Revert support for ibm,drc-info devtree property
    powerpc/pseries: Fix duplicate firmware feature for DRC_INFO
    ocxl: Fix potential bad errno on irq allocation
    powerpc/eeh: Fix crashes in eeh_report_resume()

    Linus Torvalds
     

24 Feb, 2018

11 commits

  • Pull networking fixes from David Miller:

    1) Fix TTL offset calculation in mac80211 mesh code, from Peter Oh.

    2) Fix races with procfs in ipt_CLUSTERIP, from Cong Wang.

    3) Memory leak fix in lpm_trie BPF map code, from Yonghong Song.

    4) Need to use GFP_ATOMIC in BPF cpumap allocations, from Jason Wang.

    5) Fix potential deadlocks in netfilter getsockopt() code paths, from
    Paolo Abeni.

    6) Netfilter stackpointer size checks really are needed to validate
    user input, from Florian Westphal.

    7) Missing timer init in x_tables, from Paolo Abeni.

    8) Don't use WQ_MEM_RECLAIM in mac80211 hwsim, from Johannes Berg.

    9) When an ibmvnic device is brought down then back up again, it can be
    sent queue entries from a previous session, handle this properly
    instead of crashing. From Thomas Falcon.

    10) Fix TCP checksum on LRO buffers in mlx5e, from Gal Pressman.

    11) When we are dumping filters in cls_api, the output SKB is empty, and
    the filter we are dumping is too large for the space in the SKB, we
    should return -EMSGSIZE like other netlink dump operations do.
    Otherwise userland has no signal that is needs to increase the size
    of its read buffer. From Roman Kapl.

    12) Several XDP fixes for virtio_net, from Jesper Dangaard Brouer.

    13) Module refcount leak in netlink when a dump start fails, from Jason
    Donenfeld.

    14) Handle sub-optimal GSO sizes better in TCP BBR congestion control,
    from Eric Dumazet.

    15) Releasing bpf per-cpu arraymaps can take a long time, add a
    condtional scheduling point. From Eric Dumazet.

    16) Implement retpolines for tail calls in x64 and arm64 bpf JITs. From
    Daniel Borkmann.

    17) Fix page leak in gianfar driver, from Andy Spencer.

    18) Missed clearing of estimator scratch buffer, from Eric Dumazet.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (76 commits)
    net_sched: gen_estimator: fix broken estimators based on percpu stats
    gianfar: simplify FCS handling and fix memory leak
    ipv6 sit: work around bogus gcc-8 -Wrestrict warning
    macvlan: fix use-after-free in macvlan_common_newlink()
    bpf, arm64: fix out of bounds access in tail call
    bpf, x64: implement retpoline for tail call
    rxrpc: Fix send in rxrpc_send_data_packet()
    net: aquantia: Fix error handling in aq_pci_probe()
    bpf: fix rcu lockdep warning for lpm_trie map_free callback
    bpf: add schedule points in percpu arrays management
    regulatory: add NUL to request alpha2
    ibmvnic: Fix early release of login buffer
    net/smc9194: Remove bogus CONFIG_MAC reference
    net: ipv4: Set addr_type in hash_keys for forwarded case
    tcp_bbr: better deal with suboptimal GSO
    smsc75xx: fix smsc75xx_set_features()
    netlink: put module reference if dump start fails
    selftests/bpf/test_maps: exit child process without error in ENOMEM case
    selftests/bpf: update gitignore with test_libbpf_open
    selftests/bpf: tcpbpf_kern: use in6_* macros from glibc
    ..

    Linus Torvalds
     
  • …jmorris/linux-security

    Pull security subsystem fixes from James Morris:

    - keys fixes via David Howells:
    "A collection of fixes for Linux keyrings, mostly thanks to Eric
    Biggers:

    - Fix some PKCS#7 verification issues.

    - Fix handling of unsupported crypto in X.509.

    - Fix too-large allocation in big_key"

    - Seccomp updates via Kees Cook:
    "These are fixes for the get_metadata interface that landed during
    -rc1. While the new selftest is strictly not a bug fix, I think
    it's in the same spirit of avoiding bugs"

    - an IMA build fix from Randy Dunlap

    * 'fixes-v4.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
    integrity/security: fix digsig.c build error with header file
    KEYS: Use individual pages in big_key for crypto buffers
    X.509: fix NULL dereference when restricting key with unsupported_sig
    X.509: fix BUG_ON() when hash algorithm is unsupported
    PKCS#7: fix direct verification of SignerInfo signature
    PKCS#7: fix certificate blacklisting
    PKCS#7: fix certificate chain verification
    seccomp: add a selftest for get_metadata
    ptrace, seccomp: tweak get_metadata behavior slightly
    seccomp, ptrace: switch get_metadata types to arch independent

    Linus Torvalds
     
  • Pull arm64 fixes from Catalin Marinas:
    "arm64 and perf fixes:

    - build error when accessing MPIDR_HWID_BITMASK from .S

    - fix CTR_EL0 field definitions

    - remove/disable some kernel messages on user faults (unhandled
    signals, unimplemented syscalls)

    - fix kernel page fault in unwind_frame() with function graph tracing

    - fix perf sleeping while atomic errors when booting with ACPI"

    * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
    arm64: fix unwind_frame() for filtered out fn for function graph tracing
    arm64: Enforce BBM for huge IO/VMAP mappings
    arm64: perf: correct PMUVer probing
    arm_pmu: acpi: request IRQs up-front
    arm_pmu: note IRQs and PMUs per-cpu
    arm_pmu: explicitly enable/disable SPIs at hotplug
    arm_pmu: acpi: check for mismatched PPIs
    arm_pmu: add armpmu_alloc_atomic()
    arm_pmu: fold platform helpers into platform code
    arm_pmu: kill arm_pmu_platdata
    ARM: ux500: remove PMU IRQ bouncer
    arm64: __show_regs: Only resolve kernel symbols when running at EL1
    arm64: Remove unimplemented syscall log message
    arm64: Disable unhandled signal log messages by default
    arm64: cpufeature: Fix CTR_EL0 field definitions
    arm64: uaccess: Formalise types for access_ok()
    arm64: Fix compilation error while accessing MPIDR_HWID_BITMASK from .S files

    Linus Torvalds
     
  • Pull MIPS fix from James Hogan:
    "A single MIPS fix for mismatching struct compat_flock, resulting in
    bus errors starting Firefox on Debian 8 since 4.13"

    * tag 'mips_fixes_4.16_3' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips:
    MIPS: Drop spurious __unused in struct compat_flock

    Linus Torvalds
     
  • Pull printk fixlet from Petr Mladek:
    "People expect to see the real pointer value for %px.

    Let's substitute '(null)' only for the other %p? format modifiers that
    need to deference the pointer"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk:
    vsprintf: avoid misleading "(null)" for %px

    Linus Torvalds
     
  • Pull i2c fixes from Wolfram Sang:
    "Two bugfixes, one v4.16 regression fix, and two documentation fixes"

    * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
    i2c: designware: Consider SCL GPIO optional
    i2c: busses: i2c-sirf: Fix spelling: "formular" -> "formula".
    i2c: bcm2835: Set up the rising/falling edge delays
    i2c: i801: Add missing documentation entries for Braswell and Kaby Lake
    i2c: designware: must wait for enable

    Linus Torvalds
     
  • Pull SCSI fixes from James Bottomley:
    "These are mostly fixes for problems with merge window code.

    In addition we have one doc update (alua) and two dead code removals
    (aiclib and octogon) a spurious assignment removal (csiostor) and a
    performance improvement for storvsc involving better interrupt
    spreading and increasing the command per lun handling"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: qla4xxx: skip error recovery in case of register disconnect.
    scsi: aacraid: fix shutdown crash when init fails
    scsi: qedi: Cleanup local str variable
    scsi: qedi: Fix truncation of CHAP name and secret
    scsi: qla2xxx: Fix incorrect handle for abort IOCB
    scsi: qla2xxx: Fix double free bug after firmware timeout
    scsi: storvsc: Increase cmd_per_lun for higher speed devices
    scsi: qla2xxx: Fix a locking imbalance in qlt_24xx_handle_els()
    scsi: scsi_dh: Document alua_rtpg_queue() arguments
    scsi: Remove Makefile entry for oktagon files
    scsi: aic7xxx: remove aiclib.c
    scsi: qla2xxx: Avoid triggering undefined behavior in qla2x00_mbx_completion()
    scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo()
    scsi: sym53c8xx_2: iterator underflow in sym_getsync()
    scsi: bnx2fc: Fix check in SCSI completion handler for timed out request
    scsi: csiostor: remove redundant assignment to pointer 'ln'
    scsi: ufs: Enable quirk to ignore sending WRITE_SAME command
    scsi: ibmvfc: fix misdefined reserved field in ibmvfc_fcp_rsp_info
    scsi: qla2xxx: Fix memory corruption during hba reset test
    scsi: mpt3sas: fix an out of bound write

    Linus Torvalds
     
  • Pull drm fixes from Dave Airlie:
    "A bunch of fixes for rc3:

    Exynos:
    - fixes for using monotonic timestamps
    - register definitions
    - removal of unused file

    ipu-v3L
    - minor changes
    - make some register arrays const+static
    - fix some leaks

    meson:
    - fix for vsync

    atomic:
    - fix for memory leak

    EDID parser:
    - add quirks for some more non-desktop devices
    - 6-bit panel fix.

    drm_mm:
    - fix a bug in the core drm mm hole handling

    cirrus:
    - fix lut loading regression

    Lastly there is a deadlock fix around runtime suspend for secondary
    GPUs.

    There was a deadlock between one thread trying to wait for a workqueue
    job to finish in the runtime suspend path, and the workqueue job it
    was waiting for in turn waiting for a runtime_get_sync to return.

    The fixes avoids it by not doing the runtime sync in the workqueue as
    then we always wait for all those tasks to complete before we runtime
    suspend"

    * tag 'drm-fixes-for-v4.16-rc3' of git://people.freedesktop.org/~airlied/linux: (25 commits)
    drm/tve200: fix kernel-doc documentation comment include
    drm/edid: quirk Sony PlayStation VR headset as non-desktop
    drm/edid: quirk Windows Mixed Reality headsets as non-desktop
    drm/edid: quirk Oculus Rift headsets as non-desktop
    drm/meson: fix vsync buffer update
    drm: Handle unexpected holes in color-eviction
    drm: exynos: Use proper macro definition for HDMI_I2S_PIN_SEL_1
    drm/exynos: remove exynos_drm_rotator.h
    drm/exynos: g2d: Delete an error message for a failed memory allocation in two functions
    drm/exynos: fix comparison to bitshift when dealing with a mask
    drm/exynos: g2d: use monotonic timestamps
    drm/edid: Add 6 bpc quirk for CPT panel in Asus UX303LA
    gpu: ipu-csi: add 10/12-bit grayscale support to mbus_code_to_bus_cfg
    gpu: ipu-cpmem: add 16-bit grayscale support to ipu_cpmem_set_image
    gpu: ipu-v3: prg: fix device node leak in ipu_prg_lookup_by_phandle
    gpu: ipu-v3: pre: fix device node leak in ipu_pre_lookup_by_phandle
    drm/amdgpu: Fix deadlock on runtime suspend
    drm/radeon: Fix deadlock on runtime suspend
    drm/nouveau: Fix deadlock on runtime suspend
    drm: Allow determining if current task is output poll worker
    ...

    Linus Torvalds
     
  • pfifo_fast got percpu stats lately, uncovering a bug I introduced last
    year in linux-4.10.

    I missed the fact that we have to clear our temporary storage
    before calling __gnet_stats_copy_basic() in the case of percpu stats.

    Without this fix, rate estimators (tc qd replace dev xxx root est 1sec
    4sec pfifo_fast) are utterly broken.

    Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators")
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • Alexei Starovoitov says:

    ====================
    pull-request: bpf 2018-02-22

    The following pull-request contains BPF updates for your *net* tree.

    The main changes are:

    1) two urgent fixes for bpf_tail_call logic for x64 and arm64 JITs, from Daniel.

    2) cond_resched points in percpu array alloc/free paths, from Eric.

    3) lockdep and other minor fixes, from Yonghong, Arnd, Anders, Li.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Previously, buffer descriptors containing only the frame check sequence
    (FCS) were skipped and not added to the skb. However, the page reference
    count was still incremented, leading to a memory leak.

    Fixing this inside gfar_add_rx_frag() is difficult due to reserved
    memory handling and page reuse. Instead, move the FCS handling to
    gfar_process_frame() and trim off the FCS before passing the skb up the
    networking stack.

    Signed-off-by: Andy Spencer
    Signed-off-by: Jim Gruen
    Signed-off-by: David S. Miller

    Andy Spencer
     

23 Feb, 2018

18 commits

  • gcc-8 has a new warning that detects overlapping input and output arguments
    in memcpy(). It triggers for sit_init_net() calling ipip6_tunnel_clone_6rd(),
    which is actually correct:

    net/ipv6/sit.c: In function 'sit_init_net':
    net/ipv6/sit.c:192:3: error: 'memcpy' source argument is the same as destination [-Werror=restrict]

    The problem here is that the logic detecting the memcpy() arguments finds them
    to be the same, but the conditional that tests for the input and output of
    ipip6_tunnel_clone_6rd() to be identical is not a compile-time constant.

    We know that netdev_priv(t->dev) is the same as t for a tunnel device,
    and comparing "dev" directly here lets the compiler figure out as well
    that 'dev == sitn->fb_tunnel_dev' when called from sit_init_net(), so
    it no longer warns.

    This code is old, so Cc stable to make sure that we don't get the warning
    for older kernels built with new gcc.

    Cc: Martin Sebor
    Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83456
    Signed-off-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     
  • The following use-after-free was reported by KASan when running
    LTP macvtap01 test on 4.16-rc2:

    [10642.528443] BUG: KASAN: use-after-free in
    macvlan_common_newlink+0x12ef/0x14a0 [macvlan]
    [10642.626607] Read of size 8 at addr ffff880ba49f2100 by task ip/18450
    ...
    [10642.963873] Call Trace:
    [10642.994352] dump_stack+0x5c/0x7c
    [10643.035325] print_address_description+0x75/0x290
    [10643.092938] kasan_report+0x28d/0x390
    [10643.137971] ? macvlan_common_newlink+0x12ef/0x14a0 [macvlan]
    [10643.207963] macvlan_common_newlink+0x12ef/0x14a0 [macvlan]
    [10643.275978] macvtap_newlink+0x171/0x260 [macvtap]
    [10643.334532] rtnl_newlink+0xd4f/0x1300
    ...
    [10646.256176] Allocated by task 18450:
    [10646.299964] kasan_kmalloc+0xa6/0xd0
    [10646.343746] kmem_cache_alloc_trace+0xf1/0x210
    [10646.397826] macvlan_common_newlink+0x6de/0x14a0 [macvlan]
    [10646.464386] macvtap_newlink+0x171/0x260 [macvtap]
    [10646.522728] rtnl_newlink+0xd4f/0x1300
    ...
    [10647.022028] Freed by task 18450:
    [10647.061549] __kasan_slab_free+0x138/0x180
    [10647.111468] kfree+0x9e/0x1c0
    [10647.147869] macvlan_port_destroy+0x3db/0x650 [macvlan]
    [10647.211411] rollback_registered_many+0x5b9/0xb10
    [10647.268715] rollback_registered+0xd9/0x190
    [10647.319675] register_netdevice+0x8eb/0xc70
    [10647.370635] macvlan_common_newlink+0xe58/0x14a0 [macvlan]
    [10647.437195] macvtap_newlink+0x171/0x260 [macvtap]

    Commit d02fd6e7d293 ("macvlan: Fix one possible double free") handles
    the case when register_netdevice() invokes ndo_uninit() on error and
    as a result free the port. But 'macvlan_port_get_rtnl(dev))' check
    (returns dev->rx_handler_data), which was added by this commit in order
    to prevent double free, is not quite correct:

    * for macvlan it always returns NULL because 'lowerdev' is the one that
    was used to register rx handler (port) in macvlan_port_create() as
    well as to unregister it in macvlan_port_destroy().
    * for macvtap it always returns a valid pointer because macvtap registers
    its own rx handler before macvlan_common_newlink().

    Fixes: d02fd6e7d293 ("macvlan: Fix one possible double free")
    Signed-off-by: Alexey Kodanev
    Signed-off-by: David S. Miller

    Alexey Kodanev
     
  • do_task_stat() calls get_wchan(), which further does unwind_frame().
    unwind_frame() restores frame->pc to original value in case function
    graph tracer has modified a return address (LR) in a stack frame to hook
    a function return. However, if function graph tracer has hit a filtered
    function, then we can't unwind it as ftrace_push_return_trace() has
    biased the index(frame->graph) with a 'huge negative'
    offset(-FTRACE_NOTRACE_DEPTH).

    Moreover, arm64 stack walker defines index(frame->graph) as unsigned
    int, which can not compare a -ve number.

    Similar problem we can have with calling of walk_stackframe() from
    save_stack_trace_tsk() or dump_backtrace().

    This patch fixes unwind_frame() to test the index for -ve value and
    restore index accordingly before we can restore frame->pc.

    Reproducer:

    cd /sys/kernel/debug/tracing/
    echo schedule > set_graph_notrace
    echo 1 > options/display-graph
    echo wakeup > current_tracer
    ps -ef | grep -i agent

    Above commands result in:
    Unable to handle kernel paging request at virtual address ffff801bd3d1e000
    pgd = ffff8003cbe97c00
    [ffff801bd3d1e000] *pgd=0000000000000000, *pud=0000000000000000
    Internal error: Oops: 96000006 [#1] SMP
    [...]
    CPU: 5 PID: 11696 Comm: ps Not tainted 4.11.0+ #33
    [...]
    task: ffff8003c21ba000 task.stack: ffff8003cc6c0000
    PC is at unwind_frame+0x12c/0x180
    LR is at get_wchan+0xd4/0x134
    pc : [] lr : [] pstate: 60000145
    sp : ffff8003cc6c3ab0
    x29: ffff8003cc6c3ab0 x28: 0000000000000001
    x27: 0000000000000026 x26: 0000000000000026
    x25: 00000000000012d8 x24: 0000000000000000
    x23: ffff8003c1c04000 x22: ffff000008c83000
    x21: ffff8003c1c00000 x20: 000000000000000f
    x19: ffff8003c1bc0000 x18: 0000fffffc593690
    x17: 0000000000000000 x16: 0000000000000001
    x15: 0000b855670e2b60 x14: 0003e97f22cf1d0f
    x13: 0000000000000001 x12: 0000000000000000
    x11: 00000000e8f4883e x10: 0000000154f47ec8
    x9 : 0000000070f367c0 x8 : 0000000000000000
    x7 : 00008003f7290000 x6 : 0000000000000018
    x5 : 0000000000000000 x4 : ffff8003c1c03cb0
    x3 : ffff8003c1c03ca0 x2 : 00000017ffe80000
    x1 : ffff8003cc6c3af8 x0 : ffff8003d3e9e000

    Process ps (pid: 11696, stack limit = 0xffff8003cc6c0000)
    Stack: (0xffff8003cc6c3ab0 to 0xffff8003cc6c4000)
    [...]
    [] unwind_frame+0x12c/0x180
    [] do_task_stat+0x864/0x870
    [] proc_tgid_stat+0x3c/0x48
    [] proc_single_show+0x5c/0xb8
    [] seq_read+0x160/0x414
    [] __vfs_read+0x58/0x164
    [] vfs_read+0x88/0x144
    [] SyS_read+0x60/0xc0
    [] __sys_trace_return+0x0/0x4

    Fixes: 20380bb390a4 (arm64: ftrace: fix a stack tracer's output under function graph tracer)
    Signed-off-by: Pratyush Anand
    Signed-off-by: Jerome Marchand
    [catalin.marinas@arm.com: replace WARN_ON with WARN_ON_ONCE]
    Signed-off-by: Catalin Marinas

    Pratyush Anand
     
  • Without this fix, /proc/cpuinfo will display an incorrect amount
    of CPU cores, after bringing them offline and online again, as
    exemplified below:

    $ cat /proc/cpuinfo | grep cores
    cpu cores : 4
    cpu cores : 8
    cpu cores : 8
    cpu cores : 20
    cpu cores : 4
    cpu cores : 3
    cpu cores : 2
    cpu cores : 2

    This patch fixes this by always zeroing the booted_cores variable
    upon turning off a logical CPU.

    Tested-by: Dou Liyang
    Signed-off-by: Samuel Neves
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: jgross@suse.com
    Cc: luto@kernel.org
    Cc: prarit@redhat.com
    Cc: vkuznets@redhat.com
    Link: http://lkml.kernel.org/r/20180221205036.5244-1-sneves@dei.uc.pt
    Signed-off-by: Ingo Molnar

    Samuel Neves
     
  • topology_sibling_cpumask() is the correct thread-related topology
    function in the kernel:

    s/topology_sibling_mask/topology_sibling_cpumask

    Signed-off-by: Dou Liyang
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: corbet@lwn.net
    Cc: linux-doc@vger.kernel.org
    Link: http://lkml.kernel.org/r/20180222084812.14497-1-douly.fnst@cn.fujitsu.com
    Signed-off-by: Ingo Molnar

    Dou Liyang
     
  • Successful RMW operations are supposed to be fully ordered, but
    Alpha's xchg() and cmpxchg() do not meet this requirement.

    Will Deacon noticed the bug:

    > So MP using xchg:
    >
    > WRITE_ONCE(x, 1)
    > xchg(y, 1)
    >
    > smp_load_acquire(y) == 1
    > READ_ONCE(x) == 0
    >
    > would be allowed.

    ... which thus violates the above requirement.

    Fix it by adding a leading smp_mb() to the xchg() and cmpxchg() implementations.

    Reported-by: Will Deacon
    Signed-off-by: Andrea Parri
    Acked-by: Paul E. McKenney
    Cc: Alan Stern
    Cc: Andrew Morton
    Cc: Ivan Kokshaysky
    Cc: Linus Torvalds
    Cc: Matt Turner
    Cc: Peter Zijlstra
    Cc: Richard Henderson
    Cc: Thomas Gleixner
    Cc: linux-alpha@vger.kernel.org
    Link: http://lkml.kernel.org/r/1519291488-5752-1-git-send-email-parri.andrea@gmail.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     
  • Replace each occurrence of __ASM__MB with a (trailing) smp_mb() in
    xchg(), cmpxchg(), and remove the now unused __ASM__MB definitions;
    this improves readability, with no additional synchronization cost.

    Suggested-by: Will Deacon
    Signed-off-by: Andrea Parri
    Acked-by: Paul E. McKenney
    Cc: Alan Stern
    Cc: Andrew Morton
    Cc: Ivan Kokshaysky
    Cc: Linus Torvalds
    Cc: Matt Turner
    Cc: Peter Zijlstra
    Cc: Richard Henderson
    Cc: Thomas Gleixner
    Cc: linux-alpha@vger.kernel.org
    Link: http://lkml.kernel.org/r/1519291469-5702-1-git-send-email-parri.andrea@gmail.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     
  • …in resctrl file system

    If no monitoring feature is detected because all monitoring features are
    disabled during boot time or there is no monitoring feature in hardware,
    creating rdtgroup sub-directory by "mkdir" command reports error:

    mkdir: cannot create directory ‘/sys/fs/resctrl/p1’: No such file or directory

    But the sub-directory actually is generated and content is correct:

    cpus cpus_list schemata tasks

    The error is because rdtgroup_mkdir_ctrl_mon() returns non zero value after
    the sub-directory is created and the returned value is reported as an error
    to user.

    Clear the returned value to report to user that the sub-directory is
    actually created successfully.

    Signed-off-by: Wang Hui <john.wanghui@huawei.com>
    Signed-off-by: Zhang Yanfei <yanfei.zhang@huawei.com>
    Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ravi V Shankar <ravi.v.shankar@intel.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: Vikas <vikas.shivappa@intel.com>
    Cc: Xiaochen Shen <xiaochen.shen@intel.com>
    Link: http://lkml.kernel.org/r/1519356363-133085-1-git-send-email-fenghua.yu@intel.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Wang Hui
     
  • When a irq vector is replaced, then the previous vector is normally
    released when the first interrupt happens on the new vector. If the target
    CPU of the previous vector is already offline when the new vector is
    installed, then the previous vector is silently discarded, which leads to
    accounting issues causing suspend failures and other problems.

    Adjust the logic so that the previous vector is freed in the underlying
    matrix allocator to ensure that the accounting stays correct.

    Fixes: 69cde0004a4b ("x86/vector: Use matrix allocator for vector assignment")
    Reported-by: Yuriy Vostrikov
    Signed-off-by: Thomas Gleixner
    Tested-by: Yuriy Vostrikov
    Cc: Peter Zijlstra
    Cc: Randy Dunlap
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20180222112316.930791749@linutronix.de
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     
  • Some versions of firmware will have a setting that can be configured
    to disable the RFI flush, add support for it.

    Fixes: 6e032b350cd1 ("powerpc/powernv: Check device-tree for RFI flush settings")
    Signed-off-by: Michael Ellerman

    Michael Ellerman
     
  • Some versions of firmware will have a setting that can be configured
    to disable the RFI flush, add support for it.

    Fixes: 8989d56878a7 ("powerpc/pseries: Query hypervisor for RFI flush settings")
    Signed-off-by: Michael Ellerman

    Michael Ellerman
     
  • Memory addtion and removal by count and indexed-count methods
    temporarily mark the LMBs that are being added/removed by a special
    flag value DRMEM_LMB_RESERVED. Accessing flags value directly at a few
    places without proper accessor method is causing two unexpected
    side-effects:

    - DRMEM_LMB_RESERVED bit is becoming part of the flags word of
    drconf_cell_v2 entries in ibm,dynamic-memory-v2 DT property.
    - This results in extra drconf_cell entries in ibm,dynamic-memory-v2.
    For example if 1G memory is added, it leads to one entry for 3 LMBs
    and 1 separate entry for the last LMB. All the 4 LMBs should be
    defined by one entry here.

    Fix this by always accessing the flags by its accessor method
    drmem_lmb_flags().

    Fixes: 2b31e3aec1db ("powerpc/drmem: Add support for ibm, dynamic-memory-v2 property")
    Signed-off-by: Bharata B Rao
    Reviewed-by: Nathan Fontenot
    Signed-off-by: Michael Ellerman

    Bharata B Rao
     
  • security/integrity/digsig.c has build errors on some $ARCH due to a
    missing header file, so add it.

    security/integrity/digsig.c:146:2: error: implicit declaration of function 'vfree' [-Werror=implicit-function-declaration]

    Reported-by: Michael Ellerman
    Signed-off-by: Randy Dunlap
    Cc: Mimi Zohar
    Cc: linux-integrity@vger.kernel.org
    Link: http://kisskb.ellerman.id.au/kisskb/head/13396/
    Signed-off-by: James Morris

    Randy Dunlap
     
  • …/git/dhowells/linux-fs into fixes-v4.16-rc3

    Keyrings fixes.

    James Morris
     
  • drm/imx: ipu-v3 fixups and grayscale support

    - Make const interrupt register arrays static, reduces object size.
    - Fix device_node leaks in PRE/PRG phandle lookup functions.
    - Add 8-bit and 16-bit grayscale buffer support to ipu_cpmem_set_image,
    - add 10-bit and 12-bit grayscale media bus support to ipu-csi,
    to be used by the imx-media driver.

    * tag 'imx-drm-next-2018-02-22' of git://git.pengutronix.de/git/pza/linux:
    gpu: ipu-csi: add 10/12-bit grayscale support to mbus_code_to_bus_cfg
    gpu: ipu-cpmem: add 16-bit grayscale support to ipu_cpmem_set_image
    gpu: ipu-v3: prg: fix device node leak in ipu_prg_lookup_by_phandle
    gpu: ipu-v3: pre: fix device node leak in ipu_pre_lookup_by_phandle
    gpu: ipu-cpmem: add 8-bit grayscale support to ipu_cpmem_set_image
    gpu: ipu-v3: make const arrays int_reg static, shrinks object size

    Dave Airlie
     
  • The MIPS %.its.S compiler command did not define __ASSEMBLY__, which meant
    when compiler_types.h was added to kconfig.h, unexpected things appeared
    (e.g. struct declarations) which should not have been present. As done in
    the general %.S compiler command, __ASSEMBLY__ is now included here too.

    The failure was:

    Error: arch/mips/boot/vmlinux.gz.its:201.1-2 syntax error
    FATAL ERROR: Unable to parse input tree
    /usr/bin/mkimage: Can't read arch/mips/boot/vmlinux.gz.itb.tmp: Invalid argument
    /usr/bin/mkimage Can't add hashes to FIT blob

    Reported-by: kbuild test robot
    Fixes: 28128c61e08e ("kconfig.h: Include compiler types to avoid missed struct attributes")
    Signed-off-by: Kees Cook
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • …iederm/user-namespace

    Pull siginfo fix from Eric Biederman:
    "This fixes a build error that only shows up on blackfin"

    * 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
    fs/signalfd: fix build error for BUS_MCEERR_AR

    Linus Torvalds
     
  • Pull crypto fix from Herbert Xu:
    "Fix an oops in the s5p-sss driver when used with ecb(aes)"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: s5p-sss - Fix kernel Oops in AES-ECB mode

    Linus Torvalds