15 May, 2019

1 commit

  • To facilitate additional options to get_user_pages_fast() change the
    singular write parameter to be gup_flags.

    This patch does not change any functionality. New functionality will
    follow in subsequent patches.

    Some of the get_user_pages_fast() call sites were unchanged because they
    already passed FOLL_WRITE or 0 for the write parameter.

    NOTE: It was suggested to change the ordering of the get_user_pages_fast()
    arguments to ensure that callers were converted. This breaks the current
    GUP call site convention of having the returned pages be the final
    parameter. So the suggestion was rejected.

    Link: http://lkml.kernel.org/r/20190328084422.29911-4-ira.weiny@intel.com
    Link: http://lkml.kernel.org/r/20190317183438.2057-4-ira.weiny@intel.com
    Signed-off-by: Ira Weiny
    Reviewed-by: Mike Marshall
    Cc: Aneesh Kumar K.V
    Cc: Benjamin Herrenschmidt
    Cc: Borislav Petkov
    Cc: Dan Williams
    Cc: "David S. Miller"
    Cc: Heiko Carstens
    Cc: Ingo Molnar
    Cc: James Hogan
    Cc: Jason Gunthorpe
    Cc: John Hubbard
    Cc: "Kirill A. Shutemov"
    Cc: Martin Schwidefsky
    Cc: Michal Hocko
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Ralf Baechle
    Cc: Rich Felker
    Cc: Thomas Gleixner
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ira Weiny
     

11 May, 2019

1 commit


10 May, 2019

2 commits

  • The commit 3e5903eb9cff70730 ("vsprintf: Prevent crash when dereferencing
    invalid pointers") broke boot on several architectures. The common
    pattern is that probe_kernel_read() is not working during early
    boot because userspace access framework is not ready.

    It is a generic problem. We have to avoid any complex external
    functions in vsprintf() code, especially in the common path.
    They might break printk() easily and are hard to debug.

    Replace probe_kernel_read() with some simple checks for obvious
    problems.

    Details:

    1. Report on Power:

    Kernel crashes very early during boot with with CONFIG_PPC_KUAP and
    CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG

    The problem is the combination of some new code called via printk(),
    check_pointer() which calls probe_kernel_read(). That then calls
    allow_user_access() (PPC_KUAP) and that uses mmu_has_feature() too early
    (before we've patched features). With the JUMP_LABEL debug enabled that
    causes us to call printk() & dump_stack() and we end up recursing and
    overflowing the stack.

    Because it happens so early you don't get any output, just an apparently
    dead system.

    The stack trace (which you don't see) is something like:

    ...
    dump_stack+0xdc
    probe_kernel_read+0x1a4
    check_pointer+0x58
    string+0x3c
    vsnprintf+0x1bc
    vscnprintf+0x20
    printk_safe_log_store+0x7c
    printk+0x40
    dump_stack_print_info+0xbc
    dump_stack+0x8
    probe_kernel_read+0x1a4
    probe_kernel_read+0x19c
    check_pointer+0x58
    string+0x3c
    vsnprintf+0x1bc
    vscnprintf+0x20
    vprintk_store+0x6c
    vprintk_emit+0xec
    vprintk_func+0xd4
    printk+0x40
    cpufeatures_process_feature+0xc8
    scan_cpufeatures_subnodes+0x380
    of_scan_flat_dt_subnodes+0xb4
    dt_cpu_ftrs_scan_callback+0x158
    of_scan_flat_dt+0xf0
    dt_cpu_ftrs_scan+0x3c
    early_init_devtree+0x360
    early_setup+0x9c

    2. Report on s390:

    vsnprintf invocations, are broken on s390. For example, the early boot
    output now looks like this where the first (efault) should be
    the linux_banner:

    [ 0.099985] (efault)
    [ 0.099985] setup: Linux is running as a z/VM guest operating system in 64-bit mode
    [ 0.100066] setup: The maximum memory size is 8192MB
    [ 0.100070] cma: Reserved 4 MiB at (efault)
    [ 0.100100] numa: NUMA mode: (efault)

    The reason for this, is that the code assumes that
    probe_kernel_address() works very early. This however is not true on
    at least s390. Uaccess on KERNEL_DS works only after page tables have
    been setup on s390, which happens with setup_arch()->paging_init().

    Any probe_kernel_address() invocation before that will return -EFAULT.

    Fixes: 3e5903eb9cff70730 ("vsprintf: Prevent crash when dereferencing invalid pointers")
    Link: http://lkml.kernel.org/r/20190510084213.22149-1-pmladek@suse.com
    Cc: Andy Shevchenko
    Cc: Rasmus Villemoes
    Cc: "Tobin C . Harding"
    Cc: Michal Hocko
    Cc: Sergey Senozhatsky
    Cc: Steven Rostedt
    Cc: linux-kernel@vger.kernel.org
    Cc: Michael Ellerman
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Russell Currey
    Cc: Christophe Leroy
    Cc: Stephen Rothwell
    Cc: Heiko Carstens
    Cc: linux-arch@vger.kernel.org
    Cc: linux-s390@vger.kernel.org
    Cc: Martin Schwidefsky
    Cc: Petr Mladek
    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Petr Mladek
     
  • Pull rdma updates from Jason Gunthorpe:
    "This has been a smaller cycle than normal. One new driver was
    accepted, which is unusual, and at least one more driver remains in
    review on the list.

    Summary:

    - Driver fixes for hns, hfi1, nes, rxe, i40iw, mlx5, cxgb4,
    vmw_pvrdma

    - Many patches from MatthewW converting radix tree and IDR users to
    use xarray

    - Introduction of tracepoints to the MAD layer

    - Build large SGLs at the start for DMA mapping and get the driver to
    split them

    - Generally clean SGL handling code throughout the subsystem

    - Support for restricting RDMA devices to net namespaces for
    containers

    - Progress to remove object allocation boilerplate code from drivers

    - Change in how the mlx5 driver shows representor ports linked to VFs

    - mlx5 uapi feature to access the on chip SW ICM memory

    - Add a new driver for 'EFA'. This is HW that supports user space
    packet processing through QPs in Amazon's cloud"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (186 commits)
    RDMA/ipoib: Allow user space differentiate between valid dev_port
    IB/core, ipoib: Do not overreact to SM LID change event
    RDMA/device: Don't fire uevent before device is fully initialized
    lib/scatterlist: Remove leftover from sg_page_iter comment
    RDMA/efa: Add driver to Kconfig/Makefile
    RDMA/efa: Add the efa module
    RDMA/efa: Add EFA verbs implementation
    RDMA/efa: Add common command handlers
    RDMA/efa: Implement functions that submit and complete admin commands
    RDMA/efa: Add the ABI definitions
    RDMA/efa: Add the com service API definitions
    RDMA/efa: Add the efa_com.h file
    RDMA/efa: Add the efa.h header file
    RDMA/efa: Add EFA device definitions
    RDMA: Add EFA related definitions
    RDMA/umem: Remove hugetlb flag
    RDMA/bnxt_re: Use core helpers to get aligned DMA address
    RDMA/i40iw: Use core helpers to get aligned DMA address within a supported page size
    RDMA/verbs: Add a DMA iterator to return aligned contiguous memory blocks
    RDMA/umem: Add API to find best driver supported page size in an MR
    ...

    Linus Torvalds
     

08 May, 2019

6 commits

  • Pull networking updates from David Miller:
    "Highlights:

    1) Support AES128-CCM ciphers in kTLS, from Vakul Garg.

    2) Add fib_sync_mem to control the amount of dirty memory we allow to
    queue up between synchronize RCU calls, from David Ahern.

    3) Make flow classifier more lockless, from Vlad Buslov.

    4) Add PHY downshift support to aquantia driver, from Heiner
    Kallweit.

    5) Add SKB cache for TCP rx and tx, from Eric Dumazet. This reduces
    contention on SLAB spinlocks in heavy RPC workloads.

    6) Partial GSO offload support in XFRM, from Boris Pismenny.

    7) Add fast link down support to ethtool, from Heiner Kallweit.

    8) Use siphash for IP ID generator, from Eric Dumazet.

    9) Pull nexthops even further out from ipv4/ipv6 routes and FIB
    entries, from David Ahern.

    10) Move skb->xmit_more into a per-cpu variable, from Florian
    Westphal.

    11) Improve eBPF verifier speed and increase maximum program size,
    from Alexei Starovoitov.

    12) Eliminate per-bucket spinlocks in rhashtable, and instead use bit
    spinlocks. From Neil Brown.

    13) Allow tunneling with GUE encap in ipvs, from Jacky Hu.

    14) Improve link partner cap detection in generic PHY code, from
    Heiner Kallweit.

    15) Add layer 2 encap support to bpf_skb_adjust_room(), from Alan
    Maguire.

    16) Remove SKB list implementation assumptions in SCTP, your's truly.

    17) Various cleanups, optimizations, and simplifications in r8169
    driver. From Heiner Kallweit.

    18) Add memory accounting on TX and RX path of SCTP, from Xin Long.

    19) Switch PHY drivers over to use dynamic featue detection, from
    Heiner Kallweit.

    20) Support flow steering without masking in dpaa2-eth, from Ioana
    Ciocoi.

    21) Implement ndo_get_devlink_port in netdevsim driver, from Jiri
    Pirko.

    22) Increase the strict parsing of current and future netlink
    attributes, also export such policies to userspace. From Johannes
    Berg.

    23) Allow DSA tag drivers to be modular, from Andrew Lunn.

    24) Remove legacy DSA probing support, also from Andrew Lunn.

    25) Allow ll_temac driver to be used on non-x86 platforms, from Esben
    Haabendal.

    26) Add a generic tracepoint for TX queue timeouts to ease debugging,
    from Cong Wang.

    27) More indirect call optimizations, from Paolo Abeni"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1763 commits)
    cxgb4: Fix error path in cxgb4_init_module
    net: phy: improve pause mode reporting in phy_print_status
    dt-bindings: net: Fix a typo in the phy-mode list for ethernet bindings
    net: macb: Change interrupt and napi enable order in open
    net: ll_temac: Improve error message on error IRQ
    net/sched: remove block pointer from common offload structure
    net: ethernet: support of_get_mac_address new ERR_PTR error
    net: usb: smsc: fix warning reported by kbuild test robot
    staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check
    net: dsa: support of_get_mac_address new ERR_PTR error
    net: dsa: sja1105: Fix status initialization in sja1105_get_ethtool_stats
    vrf: sit mtu should not be updated when vrf netdev is the link
    net: dsa: Fix error cleanup path in dsa_init_module
    l2tp: Fix possible NULL pointer dereference
    taprio: add null check on sched_nest to avoid potential null pointer dereference
    net: mvpp2: cls: fix less than zero check on a u32 variable
    net_sched: sch_fq: handle non connected flows
    net_sched: sch_fq: do not assume EDT packets are ordered
    net: hns3: use devm_kcalloc when allocating desc_cb
    net: hns3: some cleanup for struct hns3_enet_ring
    ...

    Linus Torvalds
     
  • Pull block updates from Jens Axboe:
    "Nothing major in this series, just fixes and improvements all over the
    map. This contains:

    - Series of fixes for sed-opal (David, Jonas)

    - Fixes and performance tweaks for BFQ (via Paolo)

    - Set of fixes for bcache (via Coly)

    - Set of fixes for md (via Song)

    - Enabling multi-page for passthrough requests (Ming)

    - Queue release fix series (Ming)

    - Device notification improvements (Martin)

    - Propagate underlying device rotational status in loop (Holger)

    - Removal of mtip32xx trim support, which has been disabled for years
    (Christoph)

    - Improvement and cleanup of nvme command handling (Christoph)

    - Add block SPDX tags (Christoph)

    - Cleanup/hardening of bio/bvec iteration (Christoph)

    - A few NVMe pull requests (Christoph)

    - Removal of CONFIG_LBDAF (Christoph)

    - Various little fixes here and there"

    * tag 'for-5.2/block-20190507' of git://git.kernel.dk/linux-block: (164 commits)
    block: fix mismerge in bvec_advance
    block: don't drain in-progress dispatch in blk_cleanup_queue()
    blk-mq: move cancel of hctx->run_work into blk_mq_hw_sysfs_release
    blk-mq: always free hctx after request queue is freed
    blk-mq: split blk_mq_alloc_and_init_hctx into two parts
    blk-mq: free hw queue's resource in hctx's release handler
    blk-mq: move cancel of requeue_work into blk_mq_release
    blk-mq: grab .q_usage_counter when queuing request from plug code path
    block: fix function name in comment
    nvmet: protect discovery change log event list iteration
    nvme: mark nvme_core_init and nvme_core_exit static
    nvme: move command size checks to the core
    nvme-fabrics: check more command sizes
    nvme-pci: check more command sizes
    nvme-pci: remove an unneeded variable initialization
    nvme-pci: unquiesce admin queue on shutdown
    nvme-pci: shutdown on timeout during deletion
    nvme-pci: fix psdt field for single segment sgls
    nvme-multipath: don't print ANA group state by default
    nvme-multipath: split bios with the ns_head bio_set before submitting
    ...

    Linus Torvalds
     
  • …/git/gregkh/char-misc

    Pull char/misc update part 2 from Greg KH:
    "Here is the "real" big set of char/misc driver patches for 5.2-rc1

    Loads of different driver subsystem stuff in here, all over the places:
    - thunderbolt driver updates
    - habanalabs driver updates
    - nvmem driver updates
    - extcon driver updates
    - intel_th driver updates
    - mei driver updates
    - coresight driver updates
    - soundwire driver cleanups and updates
    - fastrpc driver updates
    - other minor driver updates
    - chardev minor fixups

    Feels like this tree is getting to be a dumping ground of "small
    driver subsystems" these days. Which is fine with me, if it makes
    things easier for those subsystem maintainers.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'char-misc-5.2-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (255 commits)
    intel_th: msu: Add current window tracking
    intel_th: msu: Add a sysfs attribute to trigger window switch
    intel_th: msu: Correct the block wrap detection
    intel_th: Add switch triggering support
    intel_th: gth: Factor out trace start/stop
    intel_th: msu: Factor out pipeline draining
    intel_th: msu: Switch over to scatterlist
    intel_th: msu: Replace open-coded list_{first,last,next}_entry variants
    intel_th: Only report useful IRQs to subdevices
    intel_th: msu: Start handling IRQs
    intel_th: pci: Use MSI interrupt signalling
    intel_th: Communicate IRQ via resource
    intel_th: Add "rtit" source device
    intel_th: Skip subdevices if their MMIO is missing
    intel_th: Rework resource passing between glue layers and core
    intel_th: SPDX-ify the documentation
    intel_th: msu: Fix single mode with IOMMU
    coresight: funnel: Support static funnel
    dt-bindings: arm: coresight: Unify funnel DT binding
    coresight: replicator: Add new device id for static replicator
    ...

    Linus Torvalds
     
  • Pull driver core/kobject updates from Greg KH:
    "Here is the "big" set of driver core patches for 5.2-rc1

    There are a number of ACPI patches in here as well, as Rafael said
    they should go through this tree due to the driver core changes they
    required. They have all been acked by the ACPI developers.

    There are also a number of small subsystem-specific changes in here,
    due to some changes to the kobject core code. Those too have all been
    acked by the various subsystem maintainers.

    As for content, it's pretty boring outside of the ACPI changes:
    - spdx cleanups
    - kobject documentation updates
    - default attribute groups for kobjects
    - other minor kobject/driver core fixes

    All have been in linux-next for a while with no reported issues"

    * tag 'driver-core-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (47 commits)
    kobject: clean up the kobject add documentation a bit more
    kobject: Fix kernel-doc comment first line
    kobject: Remove docstring reference to kset
    firmware_loader: Fix a typo ("syfs" -> "sysfs")
    kobject: fix dereference before null check on kobj
    Revert "driver core: platform: Fix the usage of platform device name(pdev->name)"
    init/config: Do not select BUILD_BIN2C for IKCONFIG
    Provide in-kernel headers to make extending kernel easier
    kobject: Improve doc clarity kobject_init_and_add()
    kobject: Improve docs for kobject_add/del
    driver core: platform: Fix the usage of platform device name(pdev->name)
    livepatch: Replace klp_ktype_patch's default_attrs with groups
    cpufreq: schedutil: Replace default_attrs field with groups
    padata: Replace padata_attr_type default_attrs field with groups
    irqdesc: Replace irq_kobj_type's default_attrs field with groups
    net-sysfs: Replace ktype default_attrs field with groups
    block: Replace all ktype default_attrs with groups
    samples/kobject: Replace foo_ktype's default_attrs field with groups
    kobject: Add support for default attribute groups to kobj_type
    driver core: Postpone DMA tear-down until after devres release for probe failure
    ...

    Linus Torvalds
     
  • …kernel/git/gustavoars/linux

    Pull Wimplicit-fallthrough updates from Gustavo A. R. Silva:
    "Mark switch cases where we are expecting to fall through.

    This is part of the ongoing efforts to enable -Wimplicit-fallthrough.

    Most of them have been baking in linux-next for a whole development
    cycle. And with Stephen Rothwell's help, we've had linux-next
    nag-emails going out for newly introduced code that triggers
    -Wimplicit-fallthrough to avoid gaining more of these cases while we
    work to remove the ones that are already present.

    We are getting close to completing this work. Currently, there are
    only 32 of 2311 of these cases left to be addressed in linux-next. I'm
    auditing every case; I take a look into the code and analyze it in
    order to determine if I'm dealing with an actual bug or a false
    positive, as explained here:

    https://lore.kernel.org/lkml/c2fad584-1705-a5f2-d63c-824e9b96cf50@embeddedor.com/

    While working on this, I've found and fixed the several missing
    break/return bugs, some of them introduced more than 5 years ago.

    Once this work is finished, we'll be able to universally enable
    "-Wimplicit-fallthrough" to avoid any of these kinds of bugs from
    entering the kernel again"

    * tag 'Wimplicit-fallthrough-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux: (27 commits)
    memstick: mark expected switch fall-throughs
    drm/nouveau/nvkm: mark expected switch fall-throughs
    NFC: st21nfca: Fix fall-through warnings
    NFC: pn533: mark expected switch fall-throughs
    block: Mark expected switch fall-throughs
    ASN.1: mark expected switch fall-through
    lib/cmdline.c: mark expected switch fall-throughs
    lib: zstd: Mark expected switch fall-throughs
    scsi: sym53c8xx_2: sym_nvram: Mark expected switch fall-through
    scsi: sym53c8xx_2: sym_hipd: mark expected switch fall-throughs
    scsi: ppa: mark expected switch fall-through
    scsi: osst: mark expected switch fall-throughs
    scsi: lpfc: lpfc_scsi: Mark expected switch fall-throughs
    scsi: lpfc: lpfc_nvme: Mark expected switch fall-through
    scsi: lpfc: lpfc_nportdisc: Mark expected switch fall-through
    scsi: lpfc: lpfc_hbadisc: Mark expected switch fall-throughs
    scsi: lpfc: lpfc_els: Mark expected switch fall-throughs
    scsi: lpfc: lpfc_ct: Mark expected switch fall-throughs
    scsi: imm: mark expected switch fall-throughs
    scsi: csiostor: csio_wr: mark expected switch fall-through
    ...

    Linus Torvalds
     
  • Pull printk updates from Petr Mladek:

    - Allow state reset of printk_once() calls.

    - Prevent crashes when dereferencing invalid pointers in vsprintf().
    Only the first byte is checked for simplicity.

    - Make vsprintf warnings consistent and inlined.

    - Treewide conversion of obsolete %pf, %pF to %ps, %pF printf
    modifiers.

    - Some clean up of vsprintf and test_printf code.

    * tag 'printk-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk:
    lib/vsprintf: Make function pointer_string static
    vsprintf: Limit the length of inlined error messages
    vsprintf: Avoid confusion between invalid address and value
    vsprintf: Prevent crash when dereferencing invalid pointers
    vsprintf: Consolidate handling of unknown pointer specifiers
    vsprintf: Factor out %pO handler as kobject_string()
    vsprintf: Factor out %pV handler as va_format()
    vsprintf: Factor out %p[iI] handler as ip_addr_string()
    vsprintf: Do not check address of well-known strings
    vsprintf: Consistent %pK handling for kptr_restrict == 0
    vsprintf: Shuffle restricted_pointer()
    printk: Tie printk_once / printk_deferred_once into .data.once for reset
    treewide: Switch printk users from %pf and %pF to %ps and %pS, respectively
    lib/test_printf: Switch to bitmap_zalloc()

    Linus Torvalds
     

07 May, 2019

6 commits

  • …/git/shuah/linux-kselftest

    Pull Kselftest updates from Shuah Khan:

    - fixes to seccomp test, and kselftest framework

    - cleanups to remove duplicate header defines

    - fixes to efivarfs "make clean" target

    - cgroup cleanup path

    - Moving the IMA kexec_load selftest to selftests/kexec work from Mimi
    Johar and Petr Vorel

    - A framework to kselftest for writing kernel test modules addition
    from Tobin C. Harding

    * tag 'linux-kselftest-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (29 commits)
    selftests: build and run gpio when output directory is the src dir
    selftests/ipc: Fix msgque compiler warnings
    selftests/efivarfs: clean up test files from test_create*()
    selftests: fix headers_install circular dependency
    selftests/kexec: update get_secureboot_mode
    selftests/kexec: make kexec_load test independent of IMA being enabled
    selftests/kexec: check kexec_load and kexec_file_load are enabled
    selftests/kexec: Add missing '=y' to config options
    selftests/kexec: kexec_file_load syscall test
    selftests/kexec: define "require_root_privileges"
    selftests/kexec: define common logging functions
    selftests/kexec: define a set of common functions
    selftests/kexec: cleanup the kexec selftest
    selftests/kexec: move the IMA kexec_load selftest to selftests/kexec
    selftests/harness: Add 30 second timeout per test
    selftests/seccomp: Handle namespace failures gracefully
    selftests: cgroup: fix cleanup path in test_memcg_subtree_control()
    selftests: efivarfs: remove the test_create_read file if it was exist
    rseq/selftests: Adapt number of threads to the number of detected cpus
    lib: Add test module for strscpy_pad
    ...

    Linus Torvalds
     
  • Pull crypto update from Herbert Xu:
    "API:
    - Add support for AEAD in simd
    - Add fuzz testing to testmgr
    - Add panic_on_fail module parameter to testmgr
    - Use per-CPU struct instead multiple variables in scompress
    - Change verify API for akcipher

    Algorithms:
    - Convert x86 AEAD algorithms over to simd
    - Forbid 2-key 3DES in FIPS mode
    - Add EC-RDSA (GOST 34.10) algorithm

    Drivers:
    - Set output IV with ctr-aes in crypto4xx
    - Set output IV in rockchip
    - Fix potential length overflow with hashing in sun4i-ss
    - Fix computation error with ctr in vmx
    - Add SM4 protected keys support in ccree
    - Remove long-broken mxc-scc driver
    - Add rfc4106(gcm(aes)) cipher support in cavium/nitrox"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (179 commits)
    crypto: ccree - use a proper le32 type for le32 val
    crypto: ccree - remove set but not used variable 'du_size'
    crypto: ccree - Make cc_sec_disable static
    crypto: ccree - fix spelling mistake "protedcted" -> "protected"
    crypto: caam/qi2 - generate hash keys in-place
    crypto: caam/qi2 - fix DMA mapping of stack memory
    crypto: caam/qi2 - fix zero-length buffer DMA mapping
    crypto: stm32/cryp - update to return iv_out
    crypto: stm32/cryp - remove request mutex protection
    crypto: stm32/cryp - add weak key check for DES
    crypto: atmel - remove set but not used variable 'alg_name'
    crypto: picoxcell - Use dev_get_drvdata()
    crypto: crypto4xx - get rid of redundant using_sd variable
    crypto: crypto4xx - use sync skcipher for fallback
    crypto: crypto4xx - fix cfb and ofb "overran dst buffer" issues
    crypto: crypto4xx - fix ctr-aes missing output IV
    crypto: ecrdsa - select ASN1 and OID_REGISTRY for EC-RDSA
    crypto: ux500 - use ccflags-y instead of CFLAGS_.o
    crypto: ccree - handle tee fips error during power management resume
    crypto: ccree - add function to handle cryptocell tee fips error
    ...

    Linus Torvalds
     
  • Pull stack trace updates from Ingo Molnar:
    "So Thomas looked at the stacktrace code recently and noticed a few
    weirdnesses, and we all know how such stories of crummy kernel code
    meeting German engineering perfection end: a 45-patch series to clean
    it all up! :-)

    Here's the changes in Thomas's words:

    'Struct stack_trace is a sinkhole for input and output parameters
    which is largely pointless for most usage sites. In fact if embedded
    into other data structures it creates indirections and extra storage
    overhead for no benefit.

    Looking at all usage sites makes it clear that they just require an
    interface which is based on a storage array. That array is either on
    stack, global or embedded into some other data structure.

    Some of the stack depot usage sites are outright wrong, but
    fortunately the wrongness just causes more stack being used for
    nothing and does not have functional impact.

    Another oddity is the inconsistent termination of the stack trace
    with ULONG_MAX. It's pointless as the number of entries is what
    determines the length of the stored trace. In fact quite some call
    sites remove the ULONG_MAX marker afterwards with or without nasty
    comments about it. Not all architectures do that and those which do,
    do it inconsistenly either conditional on nr_entries == 0 or
    unconditionally.

    The following series cleans that up by:

    1) Removing the ULONG_MAX termination in the architecture code

    2) Removing the ULONG_MAX fixups at the call sites

    3) Providing plain storage array based interfaces for stacktrace
    and stackdepot.

    4) Cleaning up the mess at the callsites including some related
    cleanups.

    5) Removing the struct stack_trace based interfaces

    This is not changing the struct stack_trace interfaces at the
    architecture level, but it removes the exposure to the generic
    code'"

    * 'core-stacktrace-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (45 commits)
    x86/stacktrace: Use common infrastructure
    stacktrace: Provide common infrastructure
    lib/stackdepot: Remove obsolete functions
    stacktrace: Remove obsolete functions
    livepatch: Simplify stack trace retrieval
    tracing: Remove the last struct stack_trace usage
    tracing: Simplify stack trace retrieval
    tracing: Make ftrace_trace_userstack() static and conditional
    tracing: Use percpu stack trace buffer more intelligently
    tracing: Simplify stacktrace retrieval in histograms
    lockdep: Simplify stack trace handling
    lockdep: Remove save argument from check_prev_add()
    lockdep: Remove unused trace argument from print_circular_bug()
    drm: Simplify stacktrace handling
    dm persistent data: Simplify stack trace handling
    dm bufio: Simplify stack trace retrieval
    btrfs: ref-verify: Simplify stack trace retrieval
    dma/debug: Simplify stracktrace retrieval
    fault-inject: Simplify stacktrace retrieval
    mm/page_owner: Simplify stack trace handling
    ...

    Linus Torvalds
     
  • Pull objtool updates from Ingo Molnar:
    "This is a series from Peter Zijlstra that adds x86 build-time uaccess
    validation of SMAP to objtool, which will detect and warn about the
    following uaccess API usage bugs and weirdnesses:

    - call to %s() with UACCESS enabled
    - return with UACCESS enabled
    - return with UACCESS disabled from a UACCESS-safe function
    - recursive UACCESS enable
    - redundant UACCESS disable
    - UACCESS-safe disables UACCESS

    As it turns out not leaking uaccess permissions outside the intended
    uaccess functionality is hard when the interfaces are complex and when
    such bugs are mostly dormant.

    As a bonus we now also check the DF flag. We had at least one
    high-profile bug in that area in the early days of Linux, and the
    checking is fairly simple. The checks performed and warnings emitted
    are:

    - call to %s() with DF set
    - return with DF set
    - return with modified stack frame
    - recursive STD
    - redundant CLD

    It's all x86-only for now, but later on this can also be used for PAN
    on ARM and objtool is fairly cross-platform in principle.

    While all warnings emitted by this new checking facility that got
    reported to us were fixed, there might be GCC version dependent
    warnings that were not reported yet - which we'll address, should they
    trigger.

    The warnings are non-fatal build warnings"

    * 'core-objtool-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits)
    mm/uaccess: Use 'unsigned long' to placate UBSAN warnings on older GCC versions
    x86/uaccess: Dont leak the AC flag into __put_user() argument evaluation
    sched/x86_64: Don't save flags on context switch
    objtool: Add Direction Flag validation
    objtool: Add UACCESS validation
    objtool: Fix sibling call detection
    objtool: Rewrite alt->skip_orig
    objtool: Add --backtrace support
    objtool: Rewrite add_ignores()
    objtool: Handle function aliases
    objtool: Set insn->func for alternatives
    x86/uaccess, kcov: Disable stack protector
    x86/uaccess, ftrace: Fix ftrace_likely_update() vs. SMAP
    x86/uaccess, ubsan: Fix UBSAN vs. SMAP
    x86/uaccess, kasan: Fix KASAN vs SMAP
    x86/smap: Ditch __stringify()
    x86/uaccess: Introduce user_access_{save,restore}()
    x86/uaccess, signal: Fix AC=1 bloat
    x86/uaccess: Always inline user_access_begin()
    x86/uaccess, xen: Suppress SMAP warnings
    ...

    Linus Torvalds
     
  • The kernel the kernel is built with -Wvla for some time, so is not
    supposed to have any variable length arrays. Remove vla bounds checking
    from ubsan since it's useless now.

    Signed-off-by: Andrey Ryabinin
    Signed-off-by: Linus Torvalds

    Andrey Ryabinin
     
  • Building lib/ubsan.c with gcc-9 results in a ton of nasty warnings like
    this one:

    lib/ubsan.c warning: conflicting types for built-in function
    ‘__ubsan_handle_negate_overflow’; expected ‘void(void *, void *)’ [-Wbuiltin-declaration-mismatch]

    The kernel's declarations of __ubsan_handle_*() often uses 'unsigned
    long' types in parameters while GCC these parameters as 'void *' types,
    hence the mismatch.

    Fix this by using 'void *' to match GCC's declarations.

    Reported-by: Linus Torvalds
    Signed-off-by: Andrey Ryabinin
    Fixes: c6d308534aef ("UBSAN: run-time undefined behavior sanity checker")
    Cc:
    Signed-off-by: Linus Torvalds

    Andrey Ryabinin
     

06 May, 2019

3 commits


04 May, 2019

2 commits

  • Add new validation flag NL_VALIDATE_NESTED which adds three consistency
    checks of NLA_F_NESTED_FLAG:

    - the flag is set on attributes with NLA_NESTED{,_ARRAY} policy
    - the flag is not set on attributes with other policies except NLA_UNSPEC
    - the flag is set on attribute passed to nla_parse_nested()

    Signed-off-by: Michal Kubecek

    v2: change error messages to mention NLA_F_NESTED explicitly
    Reviewed-by: Johannes Berg
    Reviewed-by: David Ahern
    Signed-off-by: David S. Miller

    Michal Kubecek
     
  • The check that attribute type is within 0...maxtype range in
    __nla_validate_parse() sets only error message but not bad_attr in extack.
    Set also bad_attr to tell userspace which attribute failed validation.

    Signed-off-by: Michal Kubecek
    Reviewed-by: Johannes Berg
    Reviewed-by: David Ahern
    Signed-off-by: David S. Miller

    Michal Kubecek
     

03 May, 2019

3 commits


02 May, 2019

3 commits

  • kernel-doc comments have a prescribed format. This includes parenthesis
    on the function name. To be _particularly_ correct we should also
    capitalise the brief description and terminate it with a period.

    In preparation for adding/updating kernel-doc function comments clean up
    the ones currently present.

    Signed-off-by: Tobin C. Harding
    Signed-off-by: Greg Kroah-Hartman

    Tobin C. Harding
     
  • Currently the docstring for kobject_get_path() mentions 'kset'. The
    kset is not used in the function callchain starting from this function.

    Remove docstring reference to kset from the function kobject_get_path().

    Signed-off-by: Tobin C. Harding
    Signed-off-by: Greg Kroah-Hartman

    Tobin C. Harding
     
  • Similarly to dev/netdev/etc printk helpers, add standard printk helpers
    for the RDMA subsystem.

    Example output:
    efa 0000:00:06.0 efa_0: Hello World!
    efa_0: Hello World! (no parent device set)
    (NULL ib_device): Hello World! (ibdev is NULL)

    Cc: Jason Baron
    Suggested-by: Jason Gunthorpe
    Suggested-by: Leon Romanovsky
    Signed-off-by: Gal Pressman
    Reviewed-by: Leon Romanovsky
    Reviewed-by: Shiraz Saleem
    Reviewed-by: Dennis Dalessandro
    Signed-off-by: Doug Ledford

    Gal Pressman
     

01 May, 2019

1 commit

  • The kobj pointer is being null-checked so potentially it could be null,
    however, the ktype declaration before the null check is dereferencing kobj
    hence we have a potential null pointer deference. Fix this by moving the
    assignment of ktype after kobj has been null checked.

    Addresses-Coverity: ("Dereference before null check")
    Fixes: aa30f47cf666 ("kobject: Add support for default attribute groups to kobj_type")
    Signed-off-by: Colin Ian King
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     

30 Apr, 2019

1 commit

  • Enablement of AMD's Secure Memory Encryption feature is determined very
    early after start_kernel() is entered. Part of this procedure involves
    scanning the command line for the parameter 'mem_encrypt'.

    To determine intended state, the function sme_enable() uses library
    functions cmdline_find_option() and strncmp(). Their use occurs early
    enough such that it cannot be assumed that any instrumentation subsystem
    is initialized.

    For example, making calls to a KASAN-instrumented function before KASAN
    is set up will result in the use of uninitialized memory and a boot
    failure.

    When AMD's SME support is enabled, conditionally disable instrumentation
    of these dependent functions in lib/string.c and arch/x86/lib/cmdline.c.

    [ bp: Get rid of intermediary nostackp var and cleanup whitespace. ]

    Fixes: aca20d546214 ("x86/mm: Add support to make use of Secure Memory Encryption")
    Reported-by: Li RongQing
    Signed-off-by: Gary R Hook
    Signed-off-by: Borislav Petkov
    Cc: Alexander Shishkin
    Cc: Andrew Morton
    Cc: Andy Shevchenko
    Cc: Boris Brezillon
    Cc: Coly Li
    Cc: "dave.hansen@linux.intel.com"
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Kees Cook
    Cc: Kent Overstreet
    Cc: "luto@kernel.org"
    Cc: Masahiro Yamada
    Cc: Matthew Wilcox
    Cc: "mingo@redhat.com"
    Cc: "peterz@infradead.org"
    Cc: Sebastian Andrzej Siewior
    Cc: Thomas Gleixner
    Cc: x86-ml
    Link: https://lkml.kernel.org/r/155657657552.7116.18363762932464011367.stgit@sosrh3.amd.com

    Gary Hook
     

29 Apr, 2019

7 commits

  • Fix sparse warning:

    lib/vsprintf.c:673:6: warning:
    symbol 'pointer_string' was not declared. Should it be static?

    Link: http://lkml.kernel.org/r/20190426164630.22104-1-yuehaibing@huawei.com
    To:
    To:
    To:
    To:
    Signed-off-by: YueHaibing
    Signed-off-by: Petr Mladek

    YueHaibing
     
  • All architectures which support stacktrace carry duplicated code and
    do the stack storage and filtering at the architecture side.

    Provide a consolidated interface with a callback function for consuming the
    stack entries provided by the architecture specific stack walker. This
    removes lots of duplicated code and allows to implement better filtering
    than 'skip number of entries' in the future without touching any
    architecture specific code.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Josh Poimboeuf
    Cc: Andy Lutomirski
    Cc: linux-arch@vger.kernel.org
    Cc: Steven Rostedt
    Cc: Alexander Potapenko
    Cc: Alexey Dobriyan
    Cc: Andrew Morton
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: linux-mm@kvack.org
    Cc: David Rientjes
    Cc: Catalin Marinas
    Cc: Dmitry Vyukov
    Cc: Andrey Ryabinin
    Cc: kasan-dev@googlegroups.com
    Cc: Mike Rapoport
    Cc: Akinobu Mita
    Cc: Christoph Hellwig
    Cc: iommu@lists.linux-foundation.org
    Cc: Robin Murphy
    Cc: Marek Szyprowski
    Cc: Johannes Thumshirn
    Cc: David Sterba
    Cc: Chris Mason
    Cc: Josef Bacik
    Cc: linux-btrfs@vger.kernel.org
    Cc: dm-devel@redhat.com
    Cc: Mike Snitzer
    Cc: Alasdair Kergon
    Cc: Daniel Vetter
    Cc: intel-gfx@lists.freedesktop.org
    Cc: Joonas Lahtinen
    Cc: Maarten Lankhorst
    Cc: dri-devel@lists.freedesktop.org
    Cc: David Airlie
    Cc: Jani Nikula
    Cc: Rodrigo Vivi
    Cc: Tom Zanussi
    Cc: Miroslav Benes
    Link: https://lkml.kernel.org/r/20190425094803.713568606@linutronix.de

    Thomas Gleixner
     
  • No more users of the struct stack_trace based interfaces.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Josh Poimboeuf
    Acked-by: Alexander Potapenko
    Cc: Andy Lutomirski
    Cc: Steven Rostedt
    Cc: Alexey Dobriyan
    Cc: Andrew Morton
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: linux-mm@kvack.org
    Cc: David Rientjes
    Cc: Catalin Marinas
    Cc: Dmitry Vyukov
    Cc: Andrey Ryabinin
    Cc: kasan-dev@googlegroups.com
    Cc: Mike Rapoport
    Cc: Akinobu Mita
    Cc: Christoph Hellwig
    Cc: iommu@lists.linux-foundation.org
    Cc: Robin Murphy
    Cc: Marek Szyprowski
    Cc: Johannes Thumshirn
    Cc: David Sterba
    Cc: Chris Mason
    Cc: Josef Bacik
    Cc: linux-btrfs@vger.kernel.org
    Cc: dm-devel@redhat.com
    Cc: Mike Snitzer
    Cc: Alasdair Kergon
    Cc: Daniel Vetter
    Cc: intel-gfx@lists.freedesktop.org
    Cc: Joonas Lahtinen
    Cc: Maarten Lankhorst
    Cc: dri-devel@lists.freedesktop.org
    Cc: David Airlie
    Cc: Jani Nikula
    Cc: Rodrigo Vivi
    Cc: Tom Zanussi
    Cc: Miroslav Benes
    Cc: linux-arch@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190425094803.617937448@linutronix.de

    Thomas Gleixner
     
  • Replace the indirection through struct stack_trace with an invocation of
    the storage array based interface.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Josh Poimboeuf
    Cc: Andy Lutomirski
    Cc: Akinobu Mita
    Cc: Steven Rostedt
    Cc: Alexander Potapenko
    Cc: Alexey Dobriyan
    Cc: Andrew Morton
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: linux-mm@kvack.org
    Cc: David Rientjes
    Cc: Catalin Marinas
    Cc: Dmitry Vyukov
    Cc: Andrey Ryabinin
    Cc: kasan-dev@googlegroups.com
    Cc: Mike Rapoport
    Cc: Christoph Hellwig
    Cc: iommu@lists.linux-foundation.org
    Cc: Robin Murphy
    Cc: Marek Szyprowski
    Cc: Johannes Thumshirn
    Cc: David Sterba
    Cc: Chris Mason
    Cc: Josef Bacik
    Cc: linux-btrfs@vger.kernel.org
    Cc: dm-devel@redhat.com
    Cc: Mike Snitzer
    Cc: Alasdair Kergon
    Cc: Daniel Vetter
    Cc: intel-gfx@lists.freedesktop.org
    Cc: Joonas Lahtinen
    Cc: Maarten Lankhorst
    Cc: dri-devel@lists.freedesktop.org
    Cc: David Airlie
    Cc: Jani Nikula
    Cc: Rodrigo Vivi
    Cc: Tom Zanussi
    Cc: Miroslav Benes
    Cc: linux-arch@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190425094802.158306076@linutronix.de

    Thomas Gleixner
     
  • The struct stack_trace indirection in the stack depot functions is a truly
    pointless excercise which requires horrible code at the callsites.

    Provide interfaces based on plain storage arrays.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Josh Poimboeuf
    Acked-by: Alexander Potapenko
    Cc: Andy Lutomirski
    Cc: Steven Rostedt
    Cc: Alexey Dobriyan
    Cc: Andrew Morton
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: linux-mm@kvack.org
    Cc: David Rientjes
    Cc: Catalin Marinas
    Cc: Dmitry Vyukov
    Cc: Andrey Ryabinin
    Cc: kasan-dev@googlegroups.com
    Cc: Mike Rapoport
    Cc: Akinobu Mita
    Cc: Christoph Hellwig
    Cc: iommu@lists.linux-foundation.org
    Cc: Robin Murphy
    Cc: Marek Szyprowski
    Cc: Johannes Thumshirn
    Cc: David Sterba
    Cc: Chris Mason
    Cc: Josef Bacik
    Cc: linux-btrfs@vger.kernel.org
    Cc: dm-devel@redhat.com
    Cc: Mike Snitzer
    Cc: Alasdair Kergon
    Cc: Daniel Vetter
    Cc: intel-gfx@lists.freedesktop.org
    Cc: Joonas Lahtinen
    Cc: Maarten Lankhorst
    Cc: dri-devel@lists.freedesktop.org
    Cc: David Airlie
    Cc: Jani Nikula
    Cc: Rodrigo Vivi
    Cc: Tom Zanussi
    Cc: Miroslav Benes
    Cc: linux-arch@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190425094801.414574828@linutronix.de

    Thomas Gleixner
     
  • Function kobject_init_and_add() is currently misused in a number of
    places in the kernel. On error return kobject_put() must be called but
    is at times not.

    Make the function documentation more explicit about calling
    kobject_put() in the error path.

    Signed-off-by: Tobin C. Harding
    Signed-off-by: Greg Kroah-Hartman

    Tobin C. Harding
     
  • There is currently some confusion on how to wind back
    kobject_init_and_add() during the error paths in code that uses this
    function.

    Add documentation to kobject_add() and kobject_del() to help clarify the
    usage.

    Signed-off-by: Tobin C. Harding
    Signed-off-by: Greg Kroah-Hartman

    Tobin C. Harding
     

28 Apr, 2019

3 commits

  • Unfortunately, we cannot add strict parsing for all attributes, as
    that would break existing userspace. We currently warn about it, but
    that's about all we can do.

    For new attributes, however, the story is better: nobody is using
    them, so we can reject bad sizes.

    Also, for new attributes, we need not accept them when the policy
    doesn't declare their usage.

    David Ahern and I went back and forth on how to best encode this, and
    the best way we found was to have a "boundary type", from which point
    on new attributes have all possible validation applied, and NLA_UNSPEC
    is rejected.

    As we didn't want to add another argument to all functions that get a
    netlink policy, the workaround is to encode that boundary in the first
    entry of the policy array (which is for type 0 and thus probably not
    really valid anyway). I put it into the validation union for the rare
    possibility that somebody is actually using attribute 0, which would
    continue to work fine unless they tried to use the extended validation,
    which isn't likely. We also didn't find any in-tree users with type 0.

    The reason for setting the "start strict here" attribute is that we
    never really need to start strict from 0, which is invalid anyway (or
    in legacy families where that isn't true, it cannot be set to strict),
    so we can thus reserve the value 0 for "don't do this check" and don't
    have to add the tag to all policies right now.

    Thus, policies can now opt in to this validation, which we should do
    for all existing policies, at least when adding new attributes.

    Note that entirely *new* policies won't need to set it, as the use
    of that should be using nla_parse()/nlmsg_parse() etc. which anyway
    do fully strict validation now, regardless of this.

    So in effect, this patch only covers the "existing command with new
    attribute" case.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • We currently have two levels of strict validation:

    1) liberal (default)
    - undefined (type >= max) & NLA_UNSPEC attributes accepted
    - attribute length >= expected accepted
    - garbage at end of message accepted
    2) strict (opt-in)
    - NLA_UNSPEC attributes accepted
    - attribute length >= expected accepted

    Split out parsing strictness into four different options:
    * TRAILING - check that there's no trailing data after parsing
    attributes (in message or nested)
    * MAXTYPE - reject attrs > max known type
    * UNSPEC - reject attributes with NLA_UNSPEC policy entries
    * STRICT_ATTRS - strictly validate attribute size

    The default for future things should be *everything*.
    The current *_strict() is a combination of TRAILING and MAXTYPE,
    and is renamed to _deprecated_strict().
    The current regular parsing has none of this, and is renamed to
    *_parse_deprecated().

    Additionally it allows us to selectively set one of the new flags
    even on old policies. Notably, the UNSPEC flag could be useful in
    this case, since it can be arranged (by filling in the policy) to
    not be an incompatible userspace ABI change, but would then going
    forward prevent forgetting attribute entries. Similar can apply
    to the POLICY flag.

    We end up with the following renames:
    * nla_parse -> nla_parse_deprecated
    * nla_parse_strict -> nla_parse_deprecated_strict
    * nlmsg_parse -> nlmsg_parse_deprecated
    * nlmsg_parse_strict -> nlmsg_parse_deprecated_strict
    * nla_parse_nested -> nla_parse_nested_deprecated
    * nla_validate_nested -> nla_validate_nested_deprecated

    Using spatch, of course:
    @@
    expression TB, MAX, HEAD, LEN, POL, EXT;
    @@
    -nla_parse(TB, MAX, HEAD, LEN, POL, EXT)
    +nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT)

    @@
    expression NLH, HDRLEN, TB, MAX, POL, EXT;
    @@
    -nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT)
    +nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT)

    @@
    expression NLH, HDRLEN, TB, MAX, POL, EXT;
    @@
    -nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT)
    +nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT)

    @@
    expression TB, MAX, NLA, POL, EXT;
    @@
    -nla_parse_nested(TB, MAX, NLA, POL, EXT)
    +nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT)

    @@
    expression START, MAX, POL, EXT;
    @@
    -nla_validate_nested(START, MAX, POL, EXT)
    +nla_validate_nested_deprecated(START, MAX, POL, EXT)

    @@
    expression NLH, HDRLEN, MAX, POL, EXT;
    @@
    -nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT)
    +nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT)

    For this patch, don't actually add the strict, non-renamed versions
    yet so that it breaks compile if I get it wrong.

    Also, while at it, make nla_validate and nla_parse go down to a
    common __nla_validate_parse() function to avoid code duplication.

    Ultimately, this allows us to have very strict validation for every
    new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the
    next patch, while existing things will continue to work as is.

    In effect then, this adds fully strict validation for any new command.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Rather than using NLA_UNSPEC for this type of thing, use NLA_MIN_LEN
    so we can make NLA_UNSPEC be NLA_REJECT under certain conditions for
    future attributes.

    While at it, also use NLA_EXACT_LEN for the struct example.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

27 Apr, 2019

1 commit

  • On my "Intel(R) Xeon(R) W-2135 CPU @ 3.70GHz" system(12 CPUs) i get the
    warning from the compiler about frame size:

    warning: the frame size of 1096 bytes is larger than 1024 bytes [-Wframe-larger-than=]

    the size of cpumask_t depends on number of CPUs, therefore just make use
    of cpumask_of() in set_cpus_allowed_ptr() as a second argument.

    Link: http://lkml.kernel.org/r/20190418193925.9361-1-urezki@gmail.com
    Signed-off-by: Uladzislau Rezki (Sony)
    Reviewed-by: Andrew Morton
    Reviewed-by: Roman Gushchin
    Cc: Uladzislau Rezki
    Cc: Michal Hocko
    Cc: Matthew Wilcox
    Cc: Thomas Garnier
    Cc: Oleksiy Avramchenko
    Cc: Steven Rostedt
    Cc: Joel Fernandes
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uladzislau Rezki (Sony)