133 Commits

Author SHA1 Message Date
Michael Bestas
4b1f3533e2 Merge tag 'ASB-2023-09-05_4.14-stable' of https://android.googlesource.com/kernel/common into android-msm-pixel-4.14
https://source.android.com/docs/security/bulletin/2023-09-01

* tag 'ASB-2023-09-05_4.14-stable' of https://android.googlesource.com/kernel/common:
  Linux 4.14.325
  Revert "ARM: ep93xx: fix missing-prototype warnings"
  Revert "MIPS: Alchemy: fix dbdma2"
  Linux 4.14.324
  dma-buf/sw_sync: Avoid recursive lock during fence signal
  scsi: core: raid_class: Remove raid_component_add()
  scsi: snic: Fix double free in snic_tgt_create()
  rtnetlink: Reject negative ifindexes in RTM_NEWLINK
  x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4
  media: vcodec: Fix potential array out-of-bounds in encoder queue_setup
  lib/clz_ctz.c: Fix __clzdi2() and __ctzdi2() for 32-bit kernels
  batman-adv: Fix batadv_v_ogm_aggr_send memory leak
  batman-adv: Fix TT global entry leak when client roamed back
  batman-adv: Do not get eth header before batadv_check_management_packet
  batman-adv: Trigger events for auto adjusted MTU
  ibmveth: Use dcbf rather than dcbfl
  ipvs: fix racy memcpy in proc_do_sync_threshold
  ipvs: Improve robustness to the ipvs sysctl
  igb: Avoid starting unnecessary workqueues
  sock: annotate data-races around prot->memory_pressure
  tracing: Fix memleak due to race between current_tracer and trace
  net: phy: broadcom: stub c45 read/write for 54810
  net: xfrm: Amend XFRMA_SEC_CTX nla_policy structure
  net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled
  af_unix: Fix null-ptr-deref in unix_stream_sendpage().
  ASoC: rt5665: add missed regulator_bulk_disable
  netfilter: set default timeout to 3 secs for sctp shutdown send and recv state
  test_firmware: prevent race conditions by a correct implementation of locking
  binder: fix memory leak in binder_init()
  serial: 8250: Fix oops for port->pm on uart_change_pm()
  mmc: wbsd: fix double mmc_free_host() in wbsd_init()
  cifs: Release folio lock on fscache read hit.
  ALSA: usb-audio: Add support for Mythware XA001AU capture and playback interfaces.
  net: do not allow gso_size to be set to GSO_BY_FRAGS
  sock: Fix misuse of sk_under_memory_pressure()
  i40e: fix misleading debug logs
  team: Fix incorrect deletion of ETH_P_8021AD protocol vid from slaves
  netfilter: nft_dynset: disallow object maps
  xfrm: add NULL check in xfrm_update_ae_params
  ip_vti: fix potential slab-use-after-free in decode_session6
  ip6_vti: fix slab-use-after-free in decode_session6
  net: af_key: fix sadb_x_filter validation
  net: xfrm: Fix xfrm_address_filter OOB read
  fbdev: mmp: fix value check in mmphw_probe()
  drm/amdgpu: Fix potential fence use-after-free v2
  Bluetooth: L2CAP: Fix use-after-free
  pcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db()
  gfs2: Fix possible data races in gfs2_show_options()
  media: platform: mediatek: vpu: fix NULL ptr dereference
  media: v4l2-mem2mem: add lock to protect parameter num_rdy
  FS: JFS: Check for read-only mounted filesystem in txBegin
  FS: JFS: Fix null-ptr-deref Read in txBegin
  MIPS: dec: prom: Address -Warray-bounds warning
  fs: jfs: Fix UBSAN: array-index-out-of-bounds in dbAllocDmapLev
  udf: Fix uninitialized array access for some pathnames
  quota: fix warning in dqgrab()
  quota: Properly disable quotas when add_dquot_ref() fails
  ALSA: emu10k1: roll up loops in DSP setup code for Audigy
  drm/radeon: Fix integer overflow in radeon_cs_parser_init
  lib/mpi: Eliminate unused umul_ppmm definitions for MIPS
  UPSTREAM: media: usb: siano: Fix warning due to null work_func_t function pointer
  UPSTREAM: Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_ready_cb
  UPSTREAM: net/sched: cls_route: No longer copy tcf_result on update to avoid use-after-free
  UPSTREAM: net/sched: cls_fw: Fix improper refcount update leads to use-after-free
  UPSTREAM: net/sched: cls_u32: No longer copy tcf_result on update to avoid use-after-free
  Linux 4.14.323
  alpha: remove __init annotation from exported page_is_ram()
  scsi: core: Fix possible memory leak if device_add() fails
  scsi: snic: Fix possible memory leak if device_add() fails
  scsi: 53c700: Check that command slot is not NULL
  scsi: storvsc: Fix handling of virtual Fibre Channel timeouts
  scsi: core: Fix legacy /proc parsing buffer overflow
  netfilter: nf_tables: report use refcount overflow
  btrfs: don't stop integrity writeback too early
  IB/hfi1: Fix possible panic during hotplug remove
  drivers: net: prevent tun_build_skb() to exceed the packet size limit
  dccp: fix data-race around dp->dccps_mss_cache
  bonding: Fix incorrect deletion of ETH_P_8021AD protocol vid from slaves
  net/packet: annotate data-races around tp->status
  drm/nouveau/disp: Revert a NULL check inside nouveau_connector_get_modes
  x86: Move gds_ucode_mitigated() declaration to header
  x86/mm: Fix VDSO and VVAR placement on 5-level paging machines
  usb: dwc3: Properly handle processing of pending events
  usb-storage: alauda: Fix uninit-value in alauda_check_media()
  iio: cros_ec: Fix the allocation size for cros_ec_command
  test_firmware: return ENOMEM instead of ENOSPC on failed memory allocation
  nilfs2: fix use-after-free of nilfs_root in dirtying inodes via iput
  radix tree test suite: fix incorrect allocation size for pthreads
  dmaengine: pl330: Return DMA_PAUSED when transaction is paused
  ipv6: adjust ndisc_is_useropt() to also return true for PIO
  mmc: moxart: read scr register without changing byte order
  sparc: fix up arch_cpu_finalize_init() build breakage.
  Linux 4.14.322
  drm/edid: fix objtool warning in drm_cvt_modes()
  mtd: rawnand: omap_elm: Fix incorrect type in assignment
  test_firmware: fix a memory leak with reqs buffer
  ext2: Drop fragment support
  net: usbnet: Fix WARNING in usbnet_start_xmit/usb_submit_urb
  Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_ready_cb
  fs/sysv: Null check to prevent null-ptr-deref bug
  USB: zaurus: Add ID for A-300/B-500/C-700
  libceph: fix potential hang in ceph_osdc_notify()
  loop: Select I/O scheduler 'none' from inside add_disk()
  tcp_metrics: fix data-race in tcpm_suck_dst() vs fastopen
  tcp_metrics: annotate data-races around tm->tcpm_net
  tcp_metrics: annotate data-races around tm->tcpm_vals[]
  tcp_metrics: annotate data-races around tm->tcpm_lock
  tcp_metrics: annotate data-races around tm->tcpm_stamp
  tcp_metrics: fix addr_same() helper
  ip6mr: Fix skb_under_panic in ip6mr_cache_report()
  net/sched: cls_route: No longer copy tcf_result on update to avoid use-after-free
  net/sched: cls_u32: No longer copy tcf_result on update to avoid use-after-free
  net: add missing data-race annotation for sk_ll_usec
  net: add missing data-race annotations around sk->sk_peek_off
  perf test uprobe_from_different_cu: Skip if there is no gcc
  net/mlx5e: fix return value check in mlx5e_ipsec_remove_trailer()
  word-at-a-time: use the same return type for has_zero regardless of endianness
  perf: Fix function pointer case
  net/sched: cls_u32: Fix reference counter leak leading to overflow
  net/sched: sch_qfq: account for stab overhead in qfq_enqueue
  net/sched: cls_fw: Fix improper refcount update leads to use-after-free
  drm/client: Fix memory leak in drm_client_target_cloned
  dm cache policy smq: ensure IO doesn't prevent cleaner policy progress
  ASoC: wm8904: Fill the cache for WM8904_ADC_TEST_0 register
  s390/dasd: fix hanging device after quiesce/resume
  irq-bcm6345-l1: Do not assume a fixed block to cpu mapping
  tpm_tis: Explicitly check for error code
  hwmon: (nct7802) Fix for temp6 (PECI1) processed even if PECI1 disabled
  staging: ks7010: potential buffer overflow in ks_wlan_set_encode_ext()
  Documentation: security-bugs.rst: update preferences when dealing with the linux-distros group
  usb: xhci-mtk: set the dma max_seg_size
  usb: ohci-at91: Fix the unhandle interrupt when resume
  can: gs_usb: gs_can_close(): add missing set of CAN state to CAN_STATE_STOPPED
  USB: serial: simple: sort driver entries
  USB: serial: simple: add Kaufmann RKS+CAN VCP
  USB: serial: option: add Quectel EC200A module support
  USB: serial: option: support Quectel EM060K_128
  tracing: Fix warning in trace_buffered_event_disable()
  ring-buffer: Fix wrong stat of cpu_buffer->read
  ata: pata_ns87415: mark ns87560_tf_read static
  dm raid: fix missing reconfig_mutex unlock in raid_ctr() error paths
  block: Fix a source code comment in include/uapi/linux/blkzoned.h
  ASoC: fsl_spdif: Silence output on stop
  benet: fix return value check in be_lancer_xmit_workarounds()
  platform/x86: msi-laptop: Fix rfkill out-of-sync on MSI Wind U100
  team: reset team's flags when down link is P2P device
  bonding: reset bond's flags when down link is P2P device
  tcp: Reduce chance of collisions in inet6_hashfn().
  ipv6 addrconf: fix bug where deleting a mngtmpaddr can create a new temporary address
  ethernet: atheros: fix return value check in atl1e_tso_csum()
  i40e: Fix an NULL vs IS_ERR() bug for debugfs_create_dir()
  gpio: tps68470: Make tps68470_gpio_output() always set the initial value
  tcp: annotate data-races around fastopenq.max_qlen
  tcp: annotate data-races around tp->notsent_lowat
  tcp: annotate data-races around rskq_defer_accept
  netfilter: nf_tables: fix spurious set element insertion failure
  llc: Don't drop packet from non-root netns.
  fbdev: au1200fb: Fix missing IRQ check in au1200fb_drv_probe
  net: ethernet: ti: cpsw_ale: Fix cpsw_ale_get_field()/cpsw_ale_set_field()
  pinctrl: amd: Use amd_pinconf_set() for all config options
  fbdev: imxfb: warn about invalid left/right margin
  spi: bcm63xx: fix max prepend length
  igb: Fix igb_down hung on surprise removal
  wifi: wext-core: Fix -Wstringop-overflow warning in ioctl_standard_iw_point()
  bpf: Address KCSAN report on bpf_lru_list
  sched/fair: Don't balance task to its current running CPU
  posix-timers: Ensure timer ID search-loop limit is valid
  md/raid10: prevent soft lockup while flush writes
  md: fix data corruption for raid456 when reshape restart while grow up
  nbd: Add the maximum limit of allocated index in nbd_dev_add
  debugobjects: Recheck debug_objects_enabled before reporting
  ext4: correct inline offset when handling xattrs in inode body
  can: bcm: Fix UAF in bcm_proc_show()
  fuse: revalidate: don't invalidate if interrupted
  perf probe: Add test for regression introduced by switch to die_get_decl_file()
  serial: atmel: don't enable IRQs prematurely
  scsi: qla2xxx: Pointer may be dereferenced
  scsi: qla2xxx: Check valid rport returned by fc_bsg_to_rport()
  scsi: qla2xxx: Fix potential NULL pointer dereference
  scsi: qla2xxx: Wait for io return on terminate rport
  xtensa: ISS: fix call to split_if_spec
  ring-buffer: Fix deadloop issue on reading trace_pipe
  tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() when iterating clk
  tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() in case of error
  Revert "8250: add support for ASIX devices with a FIFO bug"
  meson saradc: fix clock divider mask length
  hwrng: imx-rngc - fix the timeout for init and self check
  fs: dlm: return positive pid value for F_GETLK
  md/raid0: add discard support for the 'original' layout
  misc: pci_endpoint_test: Re-init completion for every test
  PCI: Add function 1 DMA alias quirk for Marvell 88SE9235
  jfs: jfs_dmap: Validate db_l2nbperpage while mounting
  ext4: only update i_reserved_data_blocks on successful block allocation
  ext4: fix wrong unit use in ext4_mb_clear_bb
  perf intel-pt: Fix CYC timestamps after standalone CBR
  SUNRPC: Fix UAF in svc_tcp_listen_data_ready()
  tpm: tpm_vtpm_proxy: fix a race condition in /dev/vtpmx creation
  net/sched: make psched_mtu() RTNL-less safe
  wifi: airo: avoid uninitialized warning in airo_get_rate()
  ipv6/addrconf: fix a potential refcount underflow for idev
  NTB: ntb_transport: fix possible memory leak while device_register() fails
  ntb: intel: Fix error handling in intel_ntb_pci_driver_init()
  NTB: amd: Fix error handling in amd_ntb_pci_driver_init()
  ntb: idt: Fix error handling in idt_pci_driver_init()
  udp6: fix udp6_ehashfn() typo
  net: mvneta: fix txq_map in case of txq_number==1
  workqueue: clean up WORK_* constant types, clarify masking
  netfilter: nf_tables: prevent OOB access in nft_byteorder_eval
  netfilter: conntrack: Avoid nf_ct_helper_hash uses after free
  netfilter: nf_tables: unbind non-anonymous set if rule construction fails
  netfilter: nf_tables: add NFT_TRANS_PREPARE_ERROR to deal with bound set/chain
  netfilter: nf_tables: incorrect error path handling with NFT_MSG_NEWRULE
  spi: spi-fsl-spi: allow changing bits_per_word while CS is still active
  spi: spi-fsl-spi: relax message sanity checking a little
  spi: spi-fsl-spi: remove always-true conditional in fsl_spi_do_one_msg
  ARM: orion5x: fix d2net gpio initialization
  btrfs: fix race when deleting quota root from the dirty cow roots list
  jffs2: reduce stack usage in jffs2_build_xattr_subsystem()
  integrity: Fix possible multiple allocation in integrity_inode_get()
  mmc: core: disable TRIM on Micron MTFC4GACAJCN-1M
  mmc: core: disable TRIM on Kingston EMMC04G-M627
  NFSD: add encoding of op_recall flag for write delegation
  sh: dma: Fix DMA channel offset calculation
  net/sched: act_pedit: Add size check for TCA_PEDIT_PARMS_EX
  tcp: annotate data races in __tcp_oow_rate_limited()
  net: bridge: keep ports without IFF_UNICAST_FLT in BR_PROMISC mode
  powerpc: allow PPC_EARLY_DEBUG_CPM only when SERIAL_CPM=y
  mailbox: ti-msgmgr: Fill non-message tx data fields with 0x0
  spi: bcm-qspi: return error if neither hif_mspi nor mspi is available
  Add MODULE_FIRMWARE() for FIRMWARE_TG357766.
  sctp: fix potential deadlock on &net->sctp.addr_wq_lock
  rtc: st-lpc: Release some resources in st_rtc_probe() in case of error
  mfd: stmpe: Only disable the regulators if they are enabled
  mfd: intel-lpss: Add missing check for platform_get_resource
  mfd: rt5033: Drop rt5033-battery sub-device
  usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe()
  extcon: Fix kernel doc of property capability fields to avoid warnings
  extcon: Fix kernel doc of property fields to avoid warnings
  media: usb: siano: Fix warning due to null work_func_t function pointer
  media: videodev2.h: Fix struct v4l2_input tuner index comment
  media: usb: Check az6007_read() return value
  sh: j2: Use ioremap() to translate device tree address into kernel memory
  w1: fix loop in w1_fini()
  block: change all __u32 annotations to __be32 in affs_hardblocks.h
  USB: serial: option: add LARA-R6 01B PIDs
  modpost: fix off by one in is_executable_section()
  modpost: fix section mismatch message for R_ARM_{PC24,CALL,JUMP24}
  modpost: fix section mismatch message for R_ARM_ABS32
  crypto: nx - fix build warnings when DEBUG_FS is not enabled
  pinctrl: at91-pio4: check return value of devm_kasprintf()
  perf dwarf-aux: Fix off-by-one in die_get_varname()
  pinctrl: cherryview: Return correct value if pin in push-pull mode
  PCI: Add pci_clear_master() stub for non-CONFIG_PCI
  scsi: 3w-xxxx: Add error handling for initialization failure in tw_probe()
  ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer
  drm/radeon: fix possible division-by-zero errors
  fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe()
  soc/fsl/qe: fix usb.c build errors
  ASoC: es8316: Increment max value for ALC Capture Target Volume control
  ARM: ep93xx: fix missing-prototype warnings
  drm/panel: simple: fix active size for Ampire AM-480272H3TMQW-T01H
  Input: adxl34x - do not hardcode interrupt trigger type
  ARM: dts: BCM5301X: Drop "clock-names" from the SPI node
  Input: drv260x - sleep between polling GO bit
  radeon: avoid double free in ci_dpm_init()
  netlink: Add __sock_i_ino() for __netlink_diag_dump().
  netfilter: nf_conntrack_sip: fix the ct_sip_parse_numerical_param() return value.
  lib/ts_bm: reset initial match offset for every block of text
  gtp: Fix use-after-free in __gtp_encap_destroy().
  netlink: do not hard code device address lenth in fdb dumps
  netlink: fix potential deadlock in netlink_set_err()
  wifi: ath9k: convert msecs to jiffies where needed
  wifi: ath9k: Fix possible stall on ath9k_txq_list_has_key()
  memstick r592: make memstick_debug_get_tpc_name() static
  kexec: fix a memory leak in crash_shrink_memory()
  watchdog/perf: more properly prevent false positives with turbo modes
  watchdog/perf: define dummy watchdog_update_hrtimer_threshold() on correct config
  wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
  wifi: ray_cs: Fix an error handling path in ray_probe()
  wifi: wl3501_cs: Fix an error handling path in wl3501_probe()
  wifi: atmel: Fix an error handling path in atmel_probe()
  wifi: orinoco: Fix an error handling path in orinoco_cs_probe()
  wifi: orinoco: Fix an error handling path in spectrum_cs_probe()
  wifi: ath9k: avoid referencing uninit memory in ath9k_wmi_ctrl_rx
  wifi: ath9k: fix AR9003 mac hardware hang check register offset calculation
  evm: Complete description of evm_inode_setattr()
  PM: domains: fix integer overflow issues in genpd_parse_state()
  md/raid10: fix io loss while replacement replace rdev
  md/raid10: fix wrong setting of max_corr_read_errors
  md/raid10: fix overflow of md/safe_mode_delay
  treewide: Remove uninitialized_var() usage
  drm/amdgpu: Validate VM ioctl flags.
  scripts/tags.sh: Resolve gtags empty index generation
  drm/edid: Fix uninitialized variable in drm_cvt_modes()
  fbdev: imsttfb: Fix use after free bug in imsttfb_probe
  x86/smp: Use dedicated cache-line for mwait_play_dead()
  x86/microcode/AMD: Load late on both threads too
  gfs2: Don't deref jdesc in evict
  Linux 4.14.321
  x86: fix backwards merge of GDS/SRSO bit
  xen/netback: Fix buffer overrun triggered by unusual packet
  Documentation/x86: Fix backwards on/off logic about YMM support
  x86/xen: Fix secondary processors' FPU initialization
  KVM: Add GDS_NO support to KVM
  x86/speculation: Add Kconfig option for GDS
  x86/speculation: Add force option to GDS mitigation
  x86/speculation: Add Gather Data Sampling mitigation
  x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
  x86/fpu: Mark init functions __init
  x86/fpu: Remove cpuinfo argument from init functions
  init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()
  init: Invoke arch_cpu_finalize_init() earlier
  init: Remove check_bugs() leftovers
  um/cpu: Switch to arch_cpu_finalize_init()
  sparc/cpu: Switch to arch_cpu_finalize_init()
  sh/cpu: Switch to arch_cpu_finalize_init()
  mips/cpu: Switch to arch_cpu_finalize_init()
  m68k/cpu: Switch to arch_cpu_finalize_init()
  ia64/cpu: Switch to arch_cpu_finalize_init()
  ARM: cpu: Switch to arch_cpu_finalize_init()
  x86/cpu: Switch to arch_cpu_finalize_init()
  init: Provide arch_cpu_finalize_init()

 Conflicts:
	drivers/block/loop.c
	drivers/usb/dwc3/gadget.c

Change-Id: I992e9302cd013f55616a3158f5227b263e1c322d
2023-09-19 18:31:18 +03:00
Thomas Gleixner
01d36b819b init: Provide arch_cpu_finalize_init()
commit 7725acaa4f0c04fbefb0e0d342635b967bb7d414 upstream

check_bugs() has become a dumping ground for all sorts of activities to
finalize the CPU initialization before running the rest of the init code.

Most are empty, a few do actual bug checks, some do alternative patching
and some cobble a CPU advertisement string together....

Aside of that the current implementation requires duplicated function
declaration and mostly empty header files for them.

Provide a new function arch_cpu_finalize_init(). Provide a generic
declaration if CONFIG_ARCH_HAS_CPU_FINALIZE_INIT is selected and a stub
inline otherwise.

This requires a temporary #ifdef in start_kernel() which will be removed
along with check_bugs() once the architectures are converted over.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20230613224544.957805717@linutronix.de
Signed-off-by: Daniel Sneddon <daniel.sneddon@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-08 19:48:23 +02:00
Wilson Sung
394a00276f Merge android-4.14-stable (4.14.299) into android-msm-pixel-4.14-tm-lts
Merge 4.14.299 into android-4.14-stable
    Merge 4.14.298 into android-4.14-stable
Linux 4.14.299
    wifi: brcmfmac: Fix potential buffer overflow in brcmf_fweh_event_worker()
  * linux/bits.h: make BIT(), GENMASK(), and friends available in assembly
      include/linux/bits.h
  * linux/const.h: move UL() macro to include/linux/const.h
      arch/arm64/include/asm/memory.h
      include/linux/const.h
      include/uapi/linux/const.h
  * linux/const.h: prefix include guard of uapi/linux/const.h with _UAPI
      include/uapi/linux/const.h
    KVM: x86: emulator: update the emulation mode after CR0 write
    KVM: x86: emulator: introduce emulator_recalc_and_set_mode
    KVM: x86: emulator: em_sysexit should update ctxt->mode
    KVM: x86: Mask off reserved bits in CPUID.80000008H
  * ext4: fix warning in 'ext4_da_release_space'
      fs/ext4/migrate.c
    parisc: Export iosapic_serial_irq() symbol for serial port driver
  * parisc: Make 8250_gsc driver dependend on CONFIG_PARISC
      drivers/tty/serial/8250/Kconfig
  * efi: random: reduce seed size to 32 bytes
      include/linux/efi.h
  * ALSA: usb-audio: Add quirks for MacroSilicon MS2100/MS2106 devices
      sound/usb/quirks-table.h
      sound/usb/quirks.c
  * capabilities: fix potential memleak on error path from vfs_getxattr_alloc()
      security/commoncap.c
  * tcp/udp: Make early_demux back namespacified.
      include/net/protocol.h
      include/net/tcp.h
      include/net/udp.h
      net/ipv4/af_inet.c
      net/ipv4/ip_input.c
      net/ipv4/sysctl_net_ipv4.c
      net/ipv6/ip6_input.c
      net/ipv6/tcp_ipv6.c
      net/ipv6/udp.c
    btrfs: fix type of parameter generation in btrfs_get_dentry
    block, bfq: protect 'bfqd->queued' by 'bfqd->lock'
  * Bluetooth: L2CAP: Fix attempting to access uninitialized memory
      net/bluetooth/l2cap_core.c
    i2c: xiic: Add platform module alias
    media: dvb-frontends/drxk: initialize err to 0
    media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE
  * net, neigh: Fix null-ptr-deref in neigh_table_clear()
      net/core/neighbour.c
  * net: mdio: fix undefined behavior in bit shift for __mdiobus_register
      drivers/net/phy/mdio_bus.c
  * Bluetooth: L2CAP: fix use-after-free in l2cap_conn_del()
      net/bluetooth/l2cap_core.c
  * Bluetooth: L2CAP: Fix use-after-free caused by l2cap_reassemble_sdu
      net/bluetooth/l2cap_core.c
    btrfs: fix ulist leaks in error paths of qgroup self tests
    btrfs: fix inode list leak during backref walking at resolve_indirect_refs()
    isdn: mISDN: netjet: fix wrong check of device registration
    mISDN: fix possible memory leak in mISDN_register_device()
    rose: Fix NULL pointer dereference in rose_send_frame()
    ipvs: use explicitly signed chars
    net: sched: Fix use after free in red_enqueue()
    ata: pata_legacy: fix pdc20230_set_piomode()
    net: fec: fix improper use of NETDEV_TX_BUSY
    nfc: nfcmrvl: Fix potential memory leak in nfcmrvl_i2c_nci_send()
    nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send()
    net: dsa: Fix possible memory leaks in dsa_loop_init()
    nfs4: Fix kmemleak when allocate slot failed
    NFSv4.1: We must always send RECLAIM_COMPLETE after a reboot
    NFSv4.1: Handle RECLAIM_COMPLETE trunking errors
  * UPSTREAM: linux/const.h: move UL() macro to include/linux/const.h
      arch/arm64/include/asm/memory.h
      include/linux/const.h
      include/uapi/linux/const.h
  * UPSTREAM: linux/const.h: prefix include guard of uapi/linux/const.h with _UAPI
      include/uapi/linux/const.h
  * UPSTREAM: linux/bits.h: make BIT(), GENMASK(), and friends available in assembly
      include/linux/bits.h
Linux 4.14.298
    can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global FIFO receive
    net: ehea: fix possible memory leak in ehea_register_port()
    openvswitch: switch from WARN to pr_warn
    ALSA: aoa: Fix I2S device accounting
    ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev()
  * PM: domains: Fix handling of unavailable/disabled idle states
      drivers/base/power/domain.c
    net: ksz884x: fix missing pci_disable_device() on error in pcidev_init()
    i40e: Fix flow-type by setting GL_HASH_INSET registers
    i40e: Fix ethtool rx-flow-hash setting for X722
  * media: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check 'interlaced'
      include/uapi/linux/videodev2.h
  * media: v4l2-dv-timings: add sanity checks for blanking values
      drivers/media/v4l2-core/v4l2-dv-timings.c
    media: vivid: dev->bitmap_cap wasn't freed in all cases
    media: vivid: s_fbuf: add more sanity checks
    PM: hibernate: Allow hybrid sleep to work with s2idle
    can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error path
  * tcp: fix indefinite deferral of RTO with SACK reneging
      net/ipv4/tcp_input.c
    net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY
    kcm: annotate data-races around kcm->rx_wait
    kcm: annotate data-races around kcm->rx_psock
    amd-xgbe: add the bit rate quirk for Molex cables
    amd-xgbe: fix the SFP compliance codes check for DAC cables
    x86/unwind/orc: Fix unreliable stack dump with gcov
    ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()
    arc: iounmap() arg is volatile
    drm/msm: Fix return type of mdp4_lvds_connector_mode_valid
    net: ieee802154: fix error return code in dgram_bind()
    mm,hugetlb: take hugetlb_lock before decrementing h->resv_huge_pages
    xen/gntdev: Prevent leaking grants
    Xen/gntdev: don't ignore kernel unmapping error
    s390/futex: add missing EX_TABLE entry to __futex_atomic_op()
  * kernfs: fix use-after-free in __kernfs_remove
      fs/kernfs/dir.c
    mmc: core: Fix kernel panic when remove non-standard SDIO card
    drm/msm/hdmi: fix memory corruption with too many bridges
    mac802154: Fix LQI recording
    fbdev: smscufx: Fix several use-after-free bugs
    iio: light: tsl2583: Fix module unloading
    tools: iio: iio_utils: fix digit calculation
  * xhci: Remove device endpoints from bandwidth list when freeing the device
      drivers/usb/host/xhci-mem.c
  * usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller
      drivers/usb/host/xhci-pci.c
    usb: bdc: change state when port disconnected
  * usb: dwc3: gadget: Don't set IMI for no_interrupt
      drivers/usb/dwc3/gadget.c
  * USB: add RESET_RESUME quirk for NVIDIA Jetson devices in RCM
      drivers/usb/core/quirks.c
    ALSA: au88x0: use explicitly signed char
    ALSA: Use del_timer_sync() before freeing timer
    ACPI: video: Force backlight native for more TongFang devices
  * media: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls
      drivers/media/v4l2-core/v4l2-mem2mem.c
    iommu/vt-d: Clean up si_domain in the init_dmars() error path
    net: hns: fix possible memory leak in hnae_ae_register()
    net/atm: fix proc_mpc_write incorrect return value
  * HID: magicmouse: Do not set BTN_MOUSE on double report
      drivers/hid/hid-magicmouse.c
    ACPI: extlog: Handle multiple records
    btrfs: fix processing of delayed data refs during backref walking
  * r8152: add PID for the Lenovo OneLink+ Dock
      drivers/net/usb/cdc_ether.c
      drivers/net/usb/r8152.c
  * arm64: errata: Remove AES hwcap for COMPAT tasks
      arch/arm64/Kconfig
      arch/arm64/include/asm/cpucaps.h
      arch/arm64/kernel/cpu_errata.c
      arch/arm64/kernel/cpufeature.c
    KVM: arm64: vgic: Fix exit condition in scan_its_table()
    ata: ahci: Match EM_MAX_SLOTS with SATA_PMP_MAX_PORTS
    ata: ahci-imx: Fix MODULE_ALIAS
    x86/microcode/AMD: Apply the patch early on every logical thread
    ocfs2: fix BUG when iput after ocfs2_mknod fails
    ocfs2: clear dinode links count in case of error
    Merge 4.14.297 into android-4.14-stable
Linux 4.14.297
    x86/speculation: Add RSB VM Exit protections
    x86/bugs: Warn when "ibrs" mitigation is selected on Enhanced IBRS parts
    x86/speculation: Use DECLARE_PER_CPU for x86_spec_ctrl_current
    x86/speculation: Disable RRSBA behavior
    x86/bugs: Add Cannon lake to RETBleed affected CPU list
    x86/cpu/amd: Enumerate BTC_NO
    x86/common: Stamp out the stepping madness
    x86/speculation: Fill RSB on vmexit for IBRS
    KVM: VMX: Fix IBRS handling after vmexit
    KVM: VMX: Prevent guest RSB poisoning attacks with eIBRS
    x86/speculation: Remove x86_spec_ctrl_mask
    x86/speculation: Use cached host SPEC_CTRL value for guest entry/exit
    x86/speculation: Fix SPEC_CTRL write on SMT state change
    x86/speculation: Fix firmware entry SPEC_CTRL handling
    x86/speculation: Fix RSB filling with CONFIG_RETPOLINE=n
    x86/speculation: Add LFENCE to RSB fill sequence
    x86/speculation: Change FILL_RETURN_BUFFER to work with objtool
    entel_idle: Disable IBRS during long idle
    x86/bugs: Report Intel retbleed vulnerability
    x86/bugs: Split spectre_v2_select_mitigation() and spectre_v2_user_select_mitigation()
    x86/speculation: Add spectre_v2=ibrs option to support Kernel IBRS
    x86/bugs: Optimize SPEC_CTRL MSR writes
    x86/entry: Add kernel IBRS implementation
    x86/bugs: Keep a per-CPU IA32_SPEC_CTRL value
    x86/bugs: Add AMD retbleed= boot parameter
  * x86/bugs: Report AMD retbleed vulnerability
      drivers/base/cpu.c
      include/linux/cpu.h
    x86/cpufeatures: Move RETPOLINE flags to word 11
    x86/entry: Remove skip_r11rcx
  * x86/cpu: Add a steppings field to struct x86_cpu_id
      include/linux/mod_devicetable.h
    x86/cpu: Add consistent CPU match macros
  * x86/devicetable: Move x86 specific macro out of generic code
      include/linux/mod_devicetable.h
    x86/cpufeature: Fix various quality problems in the <asm/cpu_device_hd.h> header
    x86/cpufeature: Add facility to check for min microcode revisions
  * Revert "x86/cpu: Add a steppings field to struct x86_cpu_id"
      include/linux/mod_devicetable.h
    Merge 4.14.296 into android-4.14-stable
Linux 4.14.296
    thermal: intel_powerclamp: Use first online CPU as control_cpu
  * inet: fully convert sk->sk_rx_dst to RCU rules
      include/net/sock.h
      net/ipv4/af_inet.c
      net/ipv4/tcp.c
      net/ipv4/tcp_input.c
      net/ipv4/tcp_ipv4.c
      net/ipv4/udp.c
      net/ipv6/tcp_ipv6.c
      net/ipv6/udp.c
    efi: libstub: drop pointless get_memory_map() call
    md: Replace snprintf with scnprintf
  * ext4: continue to expand file system when the target size doesn't reach
      fs/ext4/resize.c
    net/ieee802154: don't warn zero-sized raw_sendmsg()
    net: ieee802154: return -EINVAL for unknown addr type
    perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc
    usb: idmouse: fix an uninit-value in idmouse_open
  * Revert "usb: storage: Add quirk for Samsung Fit flash"
      drivers/usb/storage/unusual_devs.h
    usb: musb: Fix musb_gadget.c rxstate overflow bug
  * usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info()
      drivers/usb/host/xhci-mem.c
    md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d
    HID: roccat: Fix use-after-free in roccat_read()
    nbd: Fix hung when signal interrupts nbd_start_device_ioctl()
    scsi: 3w-9xxx: Avoid disabling device if failing to enable it
    media: cx88: Fix a null-ptr-deref bug in buffer_prepare()
    ARM: dts: imx6sl: add missing properties for sram
    ARM: dts: imx6qp: add missing properties for sram
    ARM: dts: imx6dl: add missing properties for sram
    ARM: dts: imx6q: add missing properties for sram
    ARM: dts: imx7d-sdb: config the max pressure for tsc2046
    drm/amdgpu: fix initial connector audio value
    platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading
    drm/vc4: vec: Fix timings for VEC modes
  * drm: Prevent drm_copy_field() to attempt copying a NULL pointer
      drivers/gpu/drm/drm_ioctl.c
  * drm: Use size_t type for len variable in drm_copy_field()
      drivers/gpu/drm/drm_ioctl.c
  * r8152: Rate limit overflow messages
      drivers/net/usb/r8152.c
  * Bluetooth: L2CAP: Fix user-after-free
      net/bluetooth/l2cap_core.c
  * net: If sock is dead don't access sock's sk_wq in sk_stream_wait_memory
      net/core/stream.c
    wifi: rt2x00: correctly set BBP register 86 for MT7620
    wifi: rt2x00: set SoC wmac clock register
    wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620
    wifi: rt2x00: don't run Rt5592 IQ calibration on MT7620
    can: bcm: check the result of can_send() in bcm_can_tx()
  * Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times
      net/bluetooth/hci_sysfs.c
  * Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create()
      net/bluetooth/l2cap_core.c
    wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit()
  * xfrm: Update ipcomp_scratches with NULL when freed
      net/xfrm/xfrm_ipcomp.c
    wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg()
  * tcp: annotate data-race around tcp_md5sig_pool_populated
      net/ipv4/tcp.c
    openvswitch: Fix overreporting of drops in dropwatch
    openvswitch: Fix double reporting of drops in dropwatch
    wifi: brcmfmac: fix invalid address access when enabling SCAN log level
    NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data
    thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash
    powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue
    MIPS: BCM47XX: Cast memcmp() of function to (void *)
    ACPI: video: Add Toshiba Satellite/Portege Z830 quirk
  * f2fs: fix race condition on setting FI_NO_EXTENT flag
      fs/f2fs/extent_cache.c
    crypto: cavium - prevent integer overflow loading firmware
  * iommu/iova: Fix module config properly
      include/linux/iova.h
    iommu/omap: Fix buffer overflow in debugfs
    powerpc: Fix SPE Power ISA properties for e500v1 platforms
    powerpc/powernv: add missing of_node_put() in opal_export_attrs()
    powerpc/pci_dn: Add missing of_node_put()
    powerpc/sysdev/fsl_msi: Add missing of_node_put()
    powerpc/math_emu/efp: Include module.h
    mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg
    clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe
    clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration
  * spmi: pmic-arb: correct duplicate APID to PPID mapping logic
      drivers/spmi/spmi-pmic-arb.c
    dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup()
    mfd: sm501: Add check for platform_driver_register()
    mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init()
    mfd: lp8788: Fix an error handling path in lp8788_probe()
    mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq()
    mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe()
    fsi: core: Check error number after calling ida_simple_get
    serial: 8250: Fix restoring termios speed after suspend
    firmware: google: Test spinlock on panic path to avoid lockups
    phy: qualcomm: call clk_disable_unprepare in the error handling
    drivers: serial: jsm: fix some leaks in probe
    usb: gadget: function: fix dangling pnp_string in f_printer.c
  * xhci: Don't show warning for reinit on known broken suspend
      drivers/usb/host/xhci.c
    md/raid5: Ensure stripe_fill happens on non-read IO with journal
    ata: fix ata_id_has_dipm()
    ata: fix ata_id_has_ncq_autosense()
    ata: fix ata_id_has_devslp()
    ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting()
  * dyndbg: let query-modname override actual module name
      lib/dynamic_debug.c
  * dyndbg: fix module.dyndbg handling
      include/linux/dynamic_debug.h
    RDMA/rxe: Fix the error caused by qp->sk
    RDMA/rxe: Fix "kernel NULL pointer dereference" error
    media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init
    tty: xilinx_uartps: Fix the ignore_status
    media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop
    HSI: omap_ssi_port: Fix dma_map_sg error check
    HSI: omap_ssi: Fix refcount leak in ssi_probe
    clk: tegra20: Fix refcount leak in tegra20_clock_init
    clk: tegra: Fix refcount leak in tegra114_clock_init
    clk: tegra: Fix refcount leak in tegra210_clock_init
    clk: oxnas: Hold reference returned by of_get_parent()
    iio: ABI: Fix wrong format of differential capacitance channel ABI.
  * iio: inkern: only release the device node when done with it
      drivers/iio/inkern.c
    iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX
    ARM: dts: exynos: fix polarity of VBUS GPIO of Origen
    ARM: Drop CMDLINE_* dependency on ATAGS
    ARM: dts: kirkwood: lsxl: remove first ethernet port
    ARM: dts: kirkwood: lsxl: fix serial line
    ARM: dts: turris-omnia: Fix mpp26 pin name and comment
  * soc: qcom: smem_state: Add refcounting for the 'state->of_node'
      drivers/soc/qcom/smem_state.c
    soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe()
    memory: of: Fix refcount leak bug in of_get_ddr_timings()
    mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe()
    ALSA: dmaengine: increment buffer pointer atomically
    ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API
    mmc: au1xmmc: Fix an error handling path in au1xmmc_probe()
    drm/bridge: megachips: Fix a null pointer dereference bug
    platform/x86: msi-laptop: Fix resource cleanup
    platform/x86: msi-laptop: Fix old-ec check for backlight registering
  * drm/mipi-dsi: Detach devices when removing the host
      drivers/gpu/drm/drm_mipi_dsi.c
    bnx2x: fix potential memory leak in bnx2x_tpa_stop()
    net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks()
  * tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited
      include/linux/tcp.h
      include/net/tcp.h
      net/ipv4/tcp.c
      net/ipv4/tcp_output.c
    mISDN: fix use-after-free bugs in l1oip timer handlers
    vhost/vsock: Use kvmalloc/kvfree for larger packets.
    spi: s3c64xx: Fix large transfers with DMA
    netfilter: nft_fib: Fix for rpath check with VRF devices
    spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe
    net: fs_enet: Fix wrong check in do_pd_setup
    wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration
    wifi: rtl8xxxu: Fix skb misuse in TX queue selection
    spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime()
    spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume()
    wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse()
    wifi: mac80211: allow bw change during channel switch in mesh
    wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state()
    sh: machvec: Use char[] for section boundaries
    selinux: use "grep -E" instead of "egrep"
    gcov: support GCC 12.1 and newer compilers
    KVM: nVMX: Unconditionally purge queued/injected events on nested "exit"
    KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility
  * ring-buffer: Fix race between reset page and reading page
      kernel/trace/ring_buffer.c
  * ring-buffer: Check pending waiters when doing wake ups as well
      kernel/trace/ring_buffer.c
  * ring-buffer: Allow splice to read previous partially read pages
      kernel/trace/ring_buffer.c
    ftrace: Properly unset FTRACE_HASH_FL_MOD
    livepatch: fix race between fork and KLP transition
  * ext4: place buffer head allocation before handle start
      fs/ext4/inode.c
  * ext4: make ext4_lazyinit_thread freezable
      fs/ext4/super.c
  * ext4: fix null-ptr-deref in ext4_write_info
      fs/ext4/super.c
  * ext4: avoid crash when inline data creation follows DIO write
      fs/ext4/file.c
    nilfs2: fix lockdep warnings during disk space reclamation
    nilfs2: fix lockdep warnings in page operations for btree nodes
    nilfs2: fix use-after-free bug of struct nilfs_root
    fbdev: smscufx: Fix use-after-free in ufx_ops_open()
  * PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge
      drivers/pci/setup-res.c
    UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
    parisc: fbdev/stifb: Align graphics memory size to 4MB
  * Revert "fs: check FMODE_LSEEK to control internal pipe splicing"
      fs/splice.c
    regulator: qcom_rpm: Fix circular deferral regression
  * quota: Check next/prev free block number after reading from quota file
      fs/quota/quota_tree.c
  * HID: multitouch: Add memory barriers
      drivers/hid/hid-multitouch.c
    fs: dlm: handle -EBUSY first in lock arg validation
    fs: dlm: fix race between test_bit() and queue_work()
    iio: dac: ad5593r: Fix i2c read protocol requirements
  * ALSA: usb-audio: Fix NULL dererence at error path
      sound/usb/endpoint.c
  * ALSA: usb-audio: Fix potential memory leaks
      sound/usb/endpoint.c
  * ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free()
      sound/core/rawmidi.c
    ALSA: oss: Fix potential deadlock at unregistration
  * random: use expired timer rather than wq for mixing fast pool
      drivers/char/random.c
  * Input: xpad - fix wireless 360 controller breaking after suspend
      drivers/input/joystick/xpad.c
  * Input: xpad - add supported devices as contributed on github
      drivers/input/joystick/xpad.c
    wifi: mac80211_hwsim: avoid mac80211 warning on bad rate
  * random: avoid reading two cache lines on irq randomness
      drivers/char/random.c
  * random: restore O_NONBLOCK support
      drivers/char/mem.c
      drivers/char/random.c
    USB: serial: qcserial: add new usb-id for Dell branded EM7455
  * scsi: stex: Properly zero out the passthrough command structure
      include/scsi/scsi_cmnd.h
    ALSA: hda: Fix position reporting on Poulsbo
  * random: clamp credited irq bits to maximum mixed
      drivers/char/random.c
    ceph: don't truncate file in atomic_open
    nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure
    nilfs2: fix leak of nilfs_root in case of writer thread creation failure
    nilfs2: fix NULL pointer dereference at nilfs_bmap_lookup_at_level()
  * netfilter: nf_queue: fix socket leak
      net/netfilter/nf_queue.c
  * rpmsg: qcom: glink: replace strncpy() with strscpy_pad()
      drivers/rpmsg/qcom_glink_native.c
    mmc: core: Terminate infinite loop in SD-UHS voltage switch
    mmc: core: Replace with already defined values for readability
    USB: serial: ftdi_sio: fix 300 bps rate for SIO
    usb: mon: make mmapped memory read only
    um: Cleanup compiler warning in arch/x86/um/tls_32.c
    um: Cleanup syscall_handler_t cast in syscalls_32.h
    net/ieee802154: fix uninit value bug in dgram_sendmsg
    ARM: dts: fix Moxa SDIO 'compatible', remove 'sdhci' misnomer
    dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure
    dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property
  * fs: fix UAF/GPF bug in nilfs_mdt_destroy
      fs/inode.c
    ARM: fix function graph tracer and unwinder dependencies
  * i2c: dev: prevent ZERO_SIZE_PTR deref in i2cdev_ioctl_rdwr()
      drivers/i2c/i2c-dev.c
  * Makefile.extrawarn: Move -Wcast-function-type-strict to W=1
      scripts/Makefile.extrawarn
    clk: iproc: Do not rely on node name for correct PLL setup
    clk: iproc: Minor tidy up of iproc pll data structures
    selftests: Fix the if conditions of in test_extra_filter()
    nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices
    nvme: add new line after variable declatation
  * usbnet: Fix memory leak in usbnet_disconnect()
      drivers/net/usb/usbnet.c
    Input: melfas_mip4 - fix return value check in mip4_probe()
    Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time"
    soc: sunxi: sram: Fix debugfs info for A64 SRAM C
    soc: sunxi: sram: Actually claim SRAM regions
  * mm/migrate_device.c: flush TLB while holding PTL
      mm/migrate.c
  * mm: prevent page_frag_alloc() from corrupting the memory
      mm/page_alloc.c
  * mm/page_alloc: fix race condition between build_all_zonelists and page allocation
      mm/page_alloc.c
    mmc: moxart: fix 4-bit bus width and remove 8-bit bus width
    ntfs: fix BUG_ON in ntfs_lookup_inode_by_name()
    net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455
    uas: ignore UAS for Thinkplus chips
    usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS
    uas: add no-uas quirk for Hiksemi usb_disk
  * ANDROID: kbuild: Wrap zero trivial-auto-var-init enablement flag with cc-option
      Makefile
  * UPSTREAM: f2fs: guarantee to write dirty data when enabling checkpoint back
      fs/f2fs/file.c
      fs/f2fs/super.c

Bug: 260299968
Change-Id: I3d8686e6dfa612ff0de4a72686637be0ce678aa6
Signed-off-by: Wilson Sung <wilsonsung@google.com>
Signed-off-by: JohnnLee <johnnlee@google.com>
2022-12-14 02:47:57 +00:00
Alexandre Chartre
f8fcd872ae x86/bugs: Report AMD retbleed vulnerability
commit 6b80b59b3555706508008f1f127b5412c89c7fd8 upstream.

Report that AMD x86 CPUs are vulnerable to the RETBleed (Arbitrary
Speculative Code Execution with Return Instructions) attack.

  [peterz: add hygon]
  [kim: invert parity; fam15h]

Co-developed-by: Kim Phillips <kim.phillips@amd.com>
Signed-off-by: Kim Phillips <kim.phillips@amd.com>
Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
[ bp: Adjust context ]
Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-01 19:14:44 +01:00
Lucas Wei
fa61e2931e Merge android-4.14-stable (4.14.285) into android-msm-pixel-4.14-tm-lts
Merge 4.14.285 into android-4.14-stable
  * UPSTREAM: lib/vsprintf: Hash printed address for netdev bits fallback
      lib/vsprintf.c
  * UPSTREAM: lib/vsprintf: Prepare for more general use of ptr_to_id()
      lib/vsprintf.c
  * UPSTREAM: lib/vsprintf: Make ptr argument conts in ptr_to_id()
      lib/vsprintf.c
  * UPSTREAM: vsprintf: Replace memory barrier with static_key for random_ptr_key update
      lib/vsprintf.c
    UPSTREAM: lib/test_printf.c: accept "ptrval" as valid result for plain 'p' tests
  * UPSTREAM: lib/vsprintf: Do not handle %pO[^F] as %px
      lib/vsprintf.c
  * BACKPORT: l2tp: fix race in pppol2tp_release with session object destroy
      net/l2tp/l2tp_ppp.c
  * BACKPORT: l2tp: don't use inet_shutdown on ppp session destroy
      net/l2tp/l2tp_ppp.c
Linux 4.14.285
  * tcp: drop the hash_32() part from the index calculation
      net/ipv4/inet_hashtables.c
  * tcp: increase source port perturb table to 2^16
      net/ipv4/inet_hashtables.c
  * tcp: dynamically allocate the perturb table used by source ports
      net/ipv4/inet_hashtables.c
  * tcp: add small random increments to the source port
      net/ipv4/inet_hashtables.c
  * tcp: use different parts of the port_offset for index and offset
      net/ipv4/inet_hashtables.c
  * tcp: add some entropy in __inet_hash_connect()
      net/ipv4/inet_hashtables.c
    xprtrdma: fix incorrect header size calculations
  * usb: gadget: u_ether: fix regression in setting fixed MAC address
      drivers/usb/gadget/function/u_ether.c
    s390/mm: use non-quiescing sske for KVM switch to keyed guest
  * l2tp: fix race in pppol2tp_release with session object destroy
      net/l2tp/l2tp_ppp.c
  * l2tp: don't use inet_shutdown on ppp session destroy
      net/l2tp/l2tp_ppp.c
    virtio-pci: Remove wrong address verification in vp_del_vqs()
  * ext4: add reserved GDT blocks check
      fs/ext4/resize.c
  * ext4: make variable "count" signed
      fs/ext4/namei.c
  * ext4: fix bug_on ext4_mb_use_inode_pa
      fs/ext4/mballoc.c
    serial: 8250: Store to lsr_save_flags after lsr read
    usb: gadget: lpc32xx_udc: Fix refcount leak in lpc32xx_udc_probe
    usb: dwc2: Fix memory leak in dwc2_hcd_init
    USB: serial: io_ti: add Agilent E5805A support
    USB: serial: option: add support for Cinterion MV31 with new baseline
    comedi: vmk80xx: fix expression for tx buffer size
    irqchip/gic/realview: Fix refcount leak in realview_gic_of_init
    certs/blacklist_hashes.c: fix const confusion in certs blacklist
    arm64: ftrace: fix branch range checks
    net: bgmac: Fix an erroneous kfree() in bgmac_remove()
    misc: atmel-ssc: Fix IRQ check in ssc_probe
    tty: goldfish: Fix free_irq() on remove
    i40e: Fix call trace in setup_tx_descriptors
    pNFS: Don't keep retrying if the server replied NFS4ERR_LAYOUTUNAVAILABLE
  * random: credit cpu and bootloader seeds by default
      drivers/char/Kconfig
    net: ethernet: mtk_eth_soc: fix misuse of mem alloc interface netdev[napi]_alloc_frag
  * ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg
      net/l2tp/l2tp_ip6.c
    nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred
    virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
    scsi: pmcraid: Fix missing resource cleanup in error case
    scsi: ipr: Fix missing/incorrect resource cleanup in error case
    scsi: lpfc: Fix port stuck in bypassed state after LIP in PT2PT topology
    scsi: vmw_pvscsi: Expand vcpuHint to 16 bits
    ASoC: wm8962: Fix suspend while playing music
    ata: libata-core: fix NULL pointer deref in ata_host_alloc_pinfo()
    ASoC: cs42l56: Correct typo in minimum level for SX volume controls
    ASoC: cs42l52: Correct TLV for Bypass Volume
    ASoC: cs53l30: Correct number of volume levels on SX controls
    ASoC: cs42l52: Fix TLV scales for mixer controls
  * random: account for arch randomness in bits
      drivers/char/random.c
  * random: mark bootloader randomness code as __init
      drivers/char/random.c
      include/linux/random.h
  * random: avoid checking crng_ready() twice in random_init()
      drivers/char/random.c
  * crypto: drbg - make reseeding from get_random_bytes() synchronous
      crypto/drbg.c
      drivers/char/random.c
      include/crypto/drbg.h
  * crypto: drbg - always try to free Jitter RNG instance
      crypto/drbg.c
  * crypto: drbg - move dynamic ->reseed_threshold adjustments to __drbg_seed()
      crypto/drbg.c
  * crypto: drbg - track whether DRBG was seeded with !rng_is_initialized()
      crypto/drbg.c
      include/crypto/drbg.h
  * crypto: drbg - prepare for more fine-grained tracking of seeding state
      crypto/drbg.c
      include/crypto/drbg.h
  * crypto: drbg - always seeded with SP800-90B compliant noise source
      crypto/drbg.c
      include/crypto/drbg.h
  * crypto: drbg - add FIPS 140-2 CTRNG for noise source
      crypto/drbg.c
      include/crypto/drbg.h
  * Revert "random: use static branch for crng_ready()"
      drivers/char/random.c
  * random: check for signals after page of pool writes
      drivers/char/random.c
  * random: wire up fops->splice_{read,write}_iter()
      drivers/char/random.c
  * random: convert to using fops->write_iter()
      drivers/char/random.c
  * random: move randomize_page() into mm where it belongs
      drivers/char/random.c
      include/linux/mm.h
      include/linux/random.h
      mm/util.c
  * random: move initialization functions out of hot pages
      drivers/char/random.c
  * random: use proper return types on get_random_{int,long}_wait()
      drivers/char/random.c
      include/linux/random.h
  * random: remove extern from functions in header
      include/linux/random.h
  * random: use static branch for crng_ready()
      drivers/char/random.c
  * random: credit architectural init the exact amount
      drivers/char/random.c
  * random: handle latent entropy and command line from random_init()
      drivers/char/random.c
      include/linux/random.h
      init/main.c
  * random: use proper jiffies comparison macro
      drivers/char/random.c
  * random: remove ratelimiting for in-kernel unseeded randomness
      drivers/char/random.c
      lib/Kconfig.debug
  * random: avoid initializing twice in credit race
      drivers/char/random.c
  * random: use symbolic constants for crng_init states
      drivers/char/random.c
  * siphash: use one source of truth for siphash permutations
      drivers/char/random.c
      include/linux/prandom.h
      include/linux/siphash.h
      lib/siphash.c
  * random: help compiler out with fast_mix() by using simpler arguments
      drivers/char/random.c
  * random: do not use input pool from hard IRQs
      drivers/char/random.c
  * random: order timer entropy functions below interrupt functions
      drivers/char/random.c
  * random: do not pretend to handle premature next security model
      drivers/char/random.c
  * random: do not use batches when !crng_ready()
      drivers/char/random.c
  * random: insist on random_get_entropy() existing in order to simplify
      drivers/char/random.c
    xtensa: use fallback for random_get_entropy() instead of zero
    sparc: use fallback for random_get_entropy() instead of zero
    um: use fallback for random_get_entropy() instead of zero
    x86/tsc: Use fallback for random_get_entropy() instead of zero
    nios2: use fallback for random_get_entropy() instead of zero
    arm: use fallback for random_get_entropy() instead of zero
    mips: use fallback for random_get_entropy() instead of just c0 random
    m68k: use fallback for random_get_entropy() instead of zero
  * timekeeping: Add raw clock fallback for random_get_entropy()
      include/linux/timex.h
      kernel/time/timekeeping.c
    powerpc: define get_cycles macro for arch-override
    alpha: define get_cycles macro for arch-override
    parisc: define get_cycles macro for arch-override
    s390: define get_cycles macro for arch-override
    ia64: define get_cycles macro for arch-override
  * init: call time_init() before rand_initialize()
      init/main.c
    random: fix sysctl documentation nits
  * random: document crng_fast_key_erasure() destination possibility
      drivers/char/random.c
  * random: make random_get_entropy() return an unsigned long
      drivers/char/random.c
      include/linux/timex.h
  * random: check for signals every PAGE_SIZE chunk of /dev/[u]random
      drivers/char/random.c
  * random: check for signal_pending() outside of need_resched() check
      drivers/char/random.c
  * random: do not allow user to keep crng key around on stack
      drivers/char/random.c
  * random: do not split fast init input in add_hwgenerator_randomness()
      drivers/char/random.c
  * random: mix build-time latent entropy into pool at init
      drivers/char/random.c
  * random: re-add removed comment about get_random_{u32,u64} reseeding
      drivers/char/random.c
  * random: treat bootloader trust toggle the same way as cpu trust toggle
      drivers/char/Kconfig
      drivers/char/random.c
  * random: skip fast_init if hwrng provides large chunk of entropy
      drivers/char/random.c
  * random: check for signal and try earlier when generating entropy
      drivers/char/random.c
  * random: reseed more often immediately after booting
      drivers/char/random.c
  * random: make consistent usage of crng_ready()
      drivers/char/random.c
  * random: use SipHash as interrupt entropy accumulator
      drivers/char/random.c
  * random: replace custom notifier chain with standard one
      crypto/drbg.c
      drivers/char/random.c
      include/crypto/drbg.h
      include/linux/random.h
      lib/random32.c
  * random: don't let 644 read-only sysctls be written to
      drivers/char/random.c
  * random: give sysctl_random_min_urandom_seed a more sensible value
      drivers/char/random.c
  * random: do crng pre-init loading in worker rather than irq
      drivers/char/random.c
  * random: unify cycles_t and jiffies usage and types
      drivers/char/random.c
  * random: cleanup UUID handling
      drivers/char/random.c
  * random: only wake up writers after zap if threshold was passed
      drivers/char/random.c
  * random: round-robin registers as ulong, not u32
      drivers/char/random.c
  * random: clear fast pool, crng, and batches in cpuhp bring up
      drivers/char/random.c
      include/linux/cpuhotplug.h
      include/linux/random.h
      kernel/cpu.c
  * random: pull add_hwgenerator_randomness() declaration into random.h
      drivers/char/hw_random/core.c
      include/linux/hw_random.h
      include/linux/random.h
  * random: check for crng_init == 0 in add_device_randomness()
      drivers/char/random.c
  * random: unify early init crng load accounting
      drivers/char/random.c
  * random: do not take pool spinlock at boot
      drivers/char/random.c
  * random: defer fast pool mixing to worker
      drivers/char/random.c
  * random: rewrite header introductory comment
      drivers/char/random.c
  * random: group sysctl functions
      drivers/char/random.c
  * random: group userspace read/write functions
      drivers/char/random.c
  * random: group entropy collection functions
      drivers/char/random.c
  * random: group entropy extraction functions
      drivers/char/random.c
  * random: group initialization wait functions
      drivers/char/random.c
  * random: remove whitespace and reorder includes
      drivers/char/random.c
  * random: remove useless header comment
      include/linux/random.h
  * random: introduce drain_entropy() helper to declutter crng_reseed()
      drivers/char/random.c
  * random: deobfuscate irq u32/u64 contributions
      drivers/char/random.c
  * random: add proper SPDX header
      drivers/char/random.c
  * random: remove unused tracepoints
      drivers/char/random.c
      lib/random32.c
  * random: remove ifdef'd out interrupt bench
      drivers/char/random.c
  * random: tie batched entropy generation to base_crng generation
      drivers/char/random.c
  * random: zero buffer after reading entropy from userspace
      drivers/char/random.c
  * random: remove outdated INT_MAX >> 6 check in urandom_read()
      drivers/char/random.c
  * random: use hash function for crng_slow_load()
      drivers/char/random.c
      include/linux/hw_random.h
      include/linux/random.h
  * random: absorb fast pool into input pool after fast load
      drivers/char/random.c
  * random: do not xor RDRAND when writing into /dev/random
      drivers/char/random.c
  * random: ensure early RDSEED goes through mixer on init
      drivers/char/random.c
  * random: inline leaves of rand_initialize()
      drivers/char/random.c
  * random: use RDSEED instead of RDRAND in entropy extraction
      drivers/char/random.c
  * random: fix locking in crng_fast_load()
      drivers/char/random.c
  * random: remove batched entropy locking
      drivers/char/random.c
  * random: remove use_input_pool parameter from crng_reseed()
      drivers/char/random.c
  * random: make credit_entropy_bits() always safe
      drivers/char/random.c
  * random: always wake up entropy writers after extraction
      drivers/char/random.c
  * random: use linear min-entropy accumulation crediting
      drivers/char/random.c
  * random: simplify entropy debiting
      drivers/char/random.c
  * random: use computational hash for entropy extraction
      drivers/char/random.c
  * random: only call crng_finalize_init() for primary_crng
      drivers/char/random.c
  * random: access primary_pool directly rather than through pointer
      drivers/char/random.c
  * random: continually use hwgenerator randomness
      drivers/char/random.c
  * random: simplify arithmetic function flow in account()
      drivers/char/random.c
  * random: access input_pool_data directly rather than through pointer
      drivers/char/random.c
  * random: cleanup fractional entropy shift constants
      drivers/char/random.c
  * random: prepend remaining pool constants with POOL_
      drivers/char/random.c
  * random: de-duplicate INPUT_POOL constants
      drivers/char/random.c
  * random: remove unused OUTPUT_POOL constants
      drivers/char/random.c
  * random: rather than entropy_store abstraction, use global
      drivers/char/random.c
  * random: try to actively add entropy rather than passively wait for it
      drivers/char/random.c
  * random: remove unused extract_entropy() reserved argument
      drivers/char/random.c
  * random: remove incomplete last_data logic
      drivers/char/random.c
  * random: cleanup integer types
      drivers/char/random.c
  * crypto: chacha20 - Fix chacha20_block() keystream alignment (again)
      drivers/char/random.c
  * random: cleanup poolinfo abstraction
      drivers/char/random.c
  * random: fix typo in comments
      drivers/char/random.c
  * random: don't reset crng_init_cnt on urandom_read()
      drivers/char/random.c
  * random: avoid superfluous call to RDRAND in CRNG extraction
      drivers/char/random.c
  * random: early initialization of ChaCha constants
      drivers/char/random.c
  * random: initialize ChaCha20 constants with correct endianness
      drivers/char/random.c
  * random: use IS_ENABLED(CONFIG_NUMA) instead of ifdefs
      drivers/char/random.c
  * random: harmonize "crng init done" messages
      drivers/char/random.c
  * random: mix bootloader randomness into pool
      drivers/char/random.c
  * random: do not re-init if crng_reseed completes before primary init
      drivers/char/random.c
  * random: do not sign extend bytes for rotation when mixing
      drivers/char/random.c
  * random: use BLAKE2s instead of SHA1 in extraction
      drivers/char/random.c
  * random: remove unused irq_flags argument from add_interrupt_randomness()
      drivers/char/random.c
      include/linux/random.h
      kernel/irq/handle.c
  * random: document add_hwgenerator_randomness() with other input functions
      drivers/char/random.c
  * crypto: blake2s - adjust include guard naming
      include/crypto/blake2s.h
      include/crypto/internal/blake2s.h
  * crypto: blake2s - include <linux/bug.h> instead of <asm/bug.h>
      include/crypto/blake2s.h
    MAINTAINERS: co-maintain random.c
  * random: remove dead code left over from blocking pool
      drivers/char/random.c
  * random: avoid arch_get_random_seed_long() when collecting IRQ randomness
      drivers/char/random.c
  * random: add arch_get_random_*long_early()
      drivers/char/random.c
      include/linux/random.h
    powerpc: Use bool in archrandom.h
  * linux/random.h: Mark CONFIG_ARCH_RANDOM functions __must_check
      include/linux/random.h
  * linux/random.h: Use false with bool
      include/linux/random.h
  * linux/random.h: Remove arch_has_random, arch_has_random_seed
      include/linux/random.h
    s390: Remove arch_has_random, arch_has_random_seed
    powerpc: Remove arch_has_random, arch_has_random_seed
    x86: Remove arch_has_random, arch_has_random_seed
  * random: avoid warnings for !CONFIG_NUMA builds
      drivers/char/random.c
  * random: split primary/secondary crng init paths
      drivers/char/random.c
  * random: remove some dead code of poolinfo
      drivers/char/random.c
  * random: fix typo in add_timer_randomness()
      drivers/char/random.c
  * random: Add and use pr_fmt()
      drivers/char/random.c
  * random: convert to ENTROPY_BITS for better code readability
      drivers/char/random.c
  * random: remove unnecessary unlikely()
      drivers/char/random.c
  * random: remove kernel.random.read_wakeup_threshold
      drivers/char/random.c
  * random: delete code to pull data into pools
      drivers/char/random.c
  * random: remove the blocking pool
      drivers/char/random.c
  * random: fix crash on multiple early calls to add_bootloader_randomness()
      drivers/char/random.c
  * char/random: silence a lockdep splat with printk()
      drivers/char/random.c
  * random: make /dev/random be almost like /dev/urandom
      drivers/char/random.c
  * random: ignore GRND_RANDOM in getentropy(2)
      drivers/char/random.c
      include/uapi/linux/random.h
  * random: add GRND_INSECURE to return best-effort non-cryptographic bytes
      drivers/char/random.c
      include/uapi/linux/random.h
  * random: Add a urandom_read_nowait() for random APIs that don't warn
      drivers/char/random.c
  * random: Don't wake crng_init_wait when crng_init == 1
      drivers/char/random.c
  * lib/crypto: sha1: re-roll loops to reduce code size
      lib/sha1.c
  * lib/crypto: blake2s: move hmac construction into wireguard
      include/crypto/blake2s.h
      lib/crypto/blake2s.c
  * crypto: blake2s - generic C library implementation and selftest
      include/crypto/blake2s.h
      include/crypto/internal/blake2s.h
      lib/Makefile
      lib/crypto/Makefile
      lib/crypto/blake2s-generic.c
      lib/crypto/blake2s.c
  * crypto: Deduplicate le32_to_cpu_array() and cpu_to_le32_array()
      crypto/md4.c
      crypto/md5.c
      include/linux/byteorder/generic.h
  * Revert "hwrng: core - Freeze khwrng thread during suspend"
      drivers/char/random.c
  * char/random: Add a newline at the end of the file
      drivers/char/random.c
  * random: Use wait_event_freezable() in add_hwgenerator_randomness()
      drivers/char/random.c
  * fdt: add support for rng-seed
      drivers/char/Kconfig
      drivers/char/random.c
      drivers/of/fdt.c
      include/linux/random.h
  * random: Support freezable kthreads in add_hwgenerator_randomness()
      drivers/char/random.c
  * random: fix soft lockup when trying to read from an uninitialized blocking pool
      drivers/char/random.c
  * latent_entropy: avoid build error when plugin cflags are not set
      include/linux/random.h
  * random: document get_random_int() family
      drivers/char/random.c
  * random: move rand_initialize() earlier
      drivers/char/random.c
      include/linux/random.h
      init/main.c
  * random: only read from /dev/random after its pool has received 128 bits
      drivers/char/random.c
  * drivers/char/random.c: make primary_crng static
      drivers/char/random.c
  * drivers/char/random.c: remove unused stuct poolinfo::poolbits
      drivers/char/random.c
  * drivers/char/random.c: constify poolinfo_table
      drivers/char/random.c
  * random: make CPU trust a boot parameter
      drivers/char/Kconfig
      drivers/char/random.c
  * random: Make crng state queryable
      drivers/char/random.c
      include/linux/random.h
  * random: remove preempt disabled region
      drivers/char/random.c
  * random: add a config option to trust the CPU's hwrng
      drivers/char/Kconfig
      drivers/char/random.c
  * random: Return nbytes filled from hw RNG
      drivers/char/random.c
      include/linux/random.h
  * random: Fix whitespace pre random-bytes work
      drivers/char/random.c
  * drivers/char/random.c: remove unused dont_count_entropy
      drivers/char/random.c
  * random: optimize add_interrupt_randomness
      drivers/char/random.c
  * random: always fill buffer in get_random_bytes_wait
      include/linux/random.h
  * crypto: chacha20 - Fix keystream alignment for chacha20_block()
      drivers/char/random.c
    9p: missing chunk of "fs/9p: Don't update file type when updating file attributes"
  * UPSTREAM: ext4: verify dir block before splitting it
      fs/ext4/namei.c
  * UPSTREAM: ext4: fix use-after-free in ext4_rename_dir_prepare
      fs/ext4/namei.c
  * BACKPORT: ext4: Only advertise encrypted_casefold when encryption and unicode are enabled
      fs/ext4/sysfs.c
  * BACKPORT: ext4: fix no-key deletion for encrypt+casefold
      fs/ext4/namei.c
  * BACKPORT: ext4: optimize match for casefolded encrypted dirs
      fs/ext4/ext4.h
      fs/ext4/namei.c
  * BACKPORT: ext4: handle casefolding with encryption
      fs/ext4/dir.c
      fs/ext4/ext4.h
      fs/ext4/hash.c
      fs/ext4/inline.c
      fs/ext4/namei.c
      fs/ext4/super.c
      fs/ext4/sysfs.c
  * Revert "ANDROID: ext4: Handle casefolding with encryption"
      fs/ext4/dir.c
      fs/ext4/ext4.h
      fs/ext4/hash.c
      fs/ext4/ialloc.c
      fs/ext4/inline.c
      fs/ext4/namei.c
      fs/ext4/super.c
  * Revert "ANDROID: ext4: Optimize match for casefolded encrypted dirs"
      fs/ext4/ext4.h
      fs/ext4/namei.c
    Merge 4.14.284 into android-4.14-stable
  * Revert "ext4: fix use-after-free in ext4_rename_dir_prepare"
      fs/ext4/namei.c
  * Revert "ext4: verify dir block before splitting it"
      fs/ext4/namei.c
Linux 4.14.284
    x86/speculation/mmio: Print SMT warning
    KVM: x86/speculation: Disable Fill buffer clear within guests
    x86/speculation/mmio: Reuse SRBDS mitigation for SBDS
    x86/speculation/srbds: Update SRBDS mitigation selection
  * x86/speculation/mmio: Add sysfs reporting for Processor MMIO Stale Data
      drivers/base/cpu.c
      include/linux/cpu.h
    x86/speculation/mmio: Enable CPU Fill buffer clearing on idle
    x86/bugs: Group MDS, TAA & Processor MMIO Stale Data mitigations
    x86/speculation/mmio: Add mitigation for Processor MMIO Stale Data
    x86/speculation: Add a common function for MD_CLEAR mitigation update
    x86/speculation/mmio: Enumerate Processor MMIO Stale Data bug
    Documentation: Add documentation for Processor MMIO Stale Data
    x86/cpu: Add another Alder Lake CPU to the Intel family
    x86/cpu: Add Lakefield, Alder Lake and Rocket Lake models to the to Intel CPU family
    x86/cpu: Add Comet Lake to the Intel CPU models header
    x86/CPU: Add more Icelake model numbers
    x86/CPU: Add Icelake model number
    x86/cpu: Add Cannonlake to Intel family
    x86/cpu: Add Jasper Lake to Intel family
  * cpu/speculation: Add prototype for cpu_show_srbds()
      include/linux/cpu.h
    x86/cpu: Add Elkhart Lake to Intel family
    Merge 4.14.283 into android-4.14-stable
Linux 4.14.283
  * tcp: fix tcp_mtup_probe_success vs wrong snd_cwnd
      net/ipv4/tcp_input.c
    PCI: qcom: Fix unbalanced PHY init on probe errors
    mtd: cfi_cmdset_0002: Use chip_ready() for write on S29GL064N
    mtd: cfi_cmdset_0002: Move and rename chip_check/chip_ready/chip_good_for_write
    md/raid0: Ignore RAID0 layout if the second zone has only one device
    powerpc/32: Fix overread/overwrite of thread_struct via ptrace
    Input: bcm5974 - set missing URB_NO_TRANSFER_DMA_MAP urb flag
    ixgbe: fix unexpected VLAN Rx in promisc mode on VF
    ixgbe: fix bcast packets Rx on VF after promisc removal
    nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling
    nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION
    ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files
    cifs: return errors during session setup during reconnects
    ALSA: hda/conexant - Fix loopback issue with CX20632
    vringh: Fix loop descriptors check in the indirect cases
  * nodemask: Fix return values to be unsigned
      include/linux/nodemask.h
      lib/nodemask.c
    nbd: fix io hung while disconnecting device
    nbd: fix race between nbd_alloc_config() and module removal
    nbd: call genl_unregister_family() first in nbd_cleanup()
  * modpost: fix undefined behavior of is_arm_mapping_symbol()
      scripts/mod/modpost.c
    drm/radeon: fix a possible null pointer dereference
  * Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process"
      net/key/af_key.c
    md: protect md_unregister_thread from reentrancy
  * kernfs: Separate kernfs_pr_cont_buf and rename_lock.
      fs/kernfs/dir.c
    serial: msm_serial: disable interrupts in __msm_console_write()
    staging: rtl8712: fix uninit-value in r871xu_drv_init()
    clocksource/drivers/sp804: Avoid error on multiple instances
  * extcon: Modify extcon device to be created after driver data is set
      drivers/extcon/extcon.c
    misc: rtsx: set NULL intfdata when probe fails
    usb: dwc2: gadget: don't reset gadget's driver->bus
  * USB: hcd-pci: Fully suspend across freeze/thaw cycle
      drivers/usb/core/hcd-pci.c
    drivers: usb: host: Fix deadlock in oxu_bus_suspend()
    drivers: tty: serial: Fix deadlock in sa1100_set_termios()
    USB: host: isp116x: check return value after calling platform_get_resource()
    drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop()
    tty: Fix a possible resource leak in icom_probe
    tty: synclink_gt: Fix null-pointer-dereference in slgt_clean()
    lkdtm/usercopy: Expand size of "out of frame" object
    iio: dummy: iio_simple_dummy: check the return value of kstrdup()
    drm: imx: fix compiler warning with gcc-12
    net: altera: Fix refcount leak in altera_tse_mdio_create
    net: ipv6: unexport __init-annotated seg6_hmac_init()
  * net: xfrm: unexport __init-annotated xfrm4_protocol_init()
      net/ipv4/xfrm4_protocol.c
  * net: mdio: unexport __init-annotated mdio_bus_init()
      drivers/net/phy/mdio_bus.c
    SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()
    net/mlx4_en: Fix wrong return value on ioctl EEPROM query failure
    ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe
    xprtrdma: treat all calls not a bcall when bc_serv is NULL
    video: fbdev: pxa3xx-gcu: release the resources correctly in pxa3xx_gcu_probe/remove()
    m68knommu: fix undefined reference to `_init_sp'
    m68knommu: set ZERO_PAGE() to the allocated zeroed page
    i2c: cadence: Increase timeout per message if necessary
  * tracing: Avoid adding tracer option before update_tracer_options
      kernel/trace/trace.c
  * tracing: Fix sleeping function called from invalid context on RT kernel
      kernel/trace/trace.c
    mips: cpc: Fix refcount leak in mips_cpc_default_phys_base
    perf c2c: Fix sorting in percent_rmt_hitm_cmp()
  * tcp: tcp_rtx_synack() can be called from process context
      net/ipv4/tcp_output.c
    ubi: ubi_create_volume: Fix use-after-free when volume creation failed
    jffs2: fix memory leak in jffs2_do_fill_super
  * modpost: fix removing numeric suffixes
      scripts/mod/modpost.c
    net: dsa: mv88e6xxx: Fix refcount leak in mv88e6xxx_mdios_register
    net: ethernet: mtk_eth_soc: out of bounds read in mtk_hwlro_get_fdir_entry()
    clocksource/drivers/oxnas-rps: Fix irq_of_parse_and_map() return value
    firmware: dmi-sysfs: Fix memory leak in dmi_sysfs_register_handle
    serial: st-asc: Sanitize CSIZE and correct PARENB for CS7
    serial: sh-sci: Don't allow CS5-6
    serial: txx9: Don't allow CS5-6
    serial: digicolor-usart: Don't allow CS5-6
    serial: meson: acquire port->lock in startup()
    rtc: mt6397: check return value after calling platform_get_resource()
    soc: rockchip: Fix refcount leak in rockchip_grf_init
    coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier
    rpmsg: qcom_smd: Fix irq_of_parse_and_map() return value
    pwm: lp3943: Fix duty calculation in case period was clamped
    USB: storage: karma: fix rio_karma_init return
    usb: usbip: add missing device lock on tweak configuration cmd
    usb: usbip: fix a refcount leak in stub_probe()
    tty: goldfish: Use tty_port_destroy() to destroy port
    staging: greybus: codecs: fix type confusion of list iterator variable
    pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards
    netfilter: nf_tables: disallow non-stateful expression in sets earlier
    MIPS: IP27: Remove incorrect `cpu_has_fpu' override
    RDMA/rxe: Generate a completion for unsupported/invalid opcode
    phy: qcom-qmp: fix reset-controller leak on probe errors
    dt-bindings: gpio: altera: correct interrupt-cells
    docs/conf.py: Cope with removal of language=None in Sphinx 5.0.0
    phy: qcom-qmp: fix struct clk leak on probe errors
    arm64: dts: qcom: ipq8074: fix the sleep clock frequency
    gma500: fix an incorrect NULL check on list iterator
    carl9170: tx: fix an incorrect use of list iterator
  * ASoC: rt5514: Fix event generation for "DSP Voice Wake Up" control
      sound/soc/codecs/rt5514.c
    rtl818x: Prevent using not initialized queues
    hugetlb: fix huge_pmd_unshare address update
  * nodemask.h: fix compilation error with GCC12
      include/linux/nodemask.h
    iommu/msm: Fix an incorrect NULL check on list iterator
    um: Fix out-of-bounds read in LDT setup
    um: chan_user: Fix winch_tramp() return value
    mac80211: upgrade passive scan to active scan on DFS channels after beacon rx
    irqchip: irq-xtensa-mx: fix initial IRQ affinity
    irqchip/armada-370-xp: Do not touch Performance Counter Overflow on A375, A38x, A39x
    RDMA/hfi1: Fix potential integer multiplication overflow errors
    md: fix an incorrect NULL check in md_reload_sb
    md: fix an incorrect NULL check in does_sb_need_changing
    drm/bridge: analogix_dp: Grab runtime PM reference for DP-AUX
    drm/nouveau/clk: Fix an incorrect NULL check on list iterator
    drm/amdgpu/cs: make commands with 0 chunks illegal behaviour.
  * scsi: ufs: qcom: Add a readl() to make sure ref_clk gets enabled
      drivers/scsi/ufs/ufs-qcom.c
    scsi: dc395x: Fix a missing check on list iterator
    ocfs2: dlmfs: fix error handling of user_dlm_destroy_lock
    dlm: fix missing lkb refcount handling
    dlm: fix plock invalid read
  * ext4: avoid cycles in directory h-tree
      fs/ext4/namei.c
  * ext4: verify dir block before splitting it
      fs/ext4/namei.c
  * ext4: fix bug_on in ext4_writepages
      fs/ext4/inline.c
  * ext4: fix use-after-free in ext4_rename_dir_prepare
      fs/ext4/namei.c
  * fs-writeback: writeback_sb_inodes:Recalculate 'wrote' according skipped pages
      fs/fs-writeback.c
    iwlwifi: mvm: fix assert 1F04 upon reconfig
    wifi: mac80211: fix use-after-free in chanctx code
    perf jevents: Fix event syntax error caused by ExtSel
    perf c2c: Use stdio interface if slang is not supported
    iommu/amd: Increase timeout waiting for GA log enablement
    video: fbdev: clcdfb: Fix refcount leak in clcdfb_of_vram_setup
    iommu/mediatek: Add list_del in mtk_iommu_remove
  * mailbox: forward the hrtimer if not queued and under a lock
      drivers/mailbox/mailbox.c
      include/linux/mailbox_controller.h
    powerpc/fsl_rio: Fix refcount leak in fsl_rio_setup
    powerpc/perf: Fix the threshold compare group constraint for power9
    Input: sparcspkr - fix refcount leak in bbc_beep_probe
  * tty: fix deadlock caused by calling printk() under tty_port->lock
      drivers/tty/tty_buffer.c
    powerpc/4xx/cpm: Fix return value of __setup() handler
    powerpc/idle: Fix return value of __setup() handler
    powerpc/8xx: export 'cpm_setbrg' for modules
    drivers/base/node.c: fix compaction sysfs file leak
    pinctrl: mvebu: Fix irq_of_parse_and_map() return value
    scsi: fcoe: Fix Wstringop-overflow warnings in fcoe_wwn_from_mac()
    mfd: ipaq-micro: Fix error check return value of platform_get_irq()
    ARM: dts: bcm2835-rpi-b: Fix GPIO line names
    ARM: dts: bcm2835-rpi-zero-w: Fix GPIO line name for Wifi/BT
    soc: qcom: smsm: Fix missing of_node_put() in smsm_parse_ipc
  * soc: qcom: smp2p: Fix missing of_node_put() in smp2p_parse_ipc
      drivers/soc/qcom/smp2p.c
    rxrpc: Don't try to resend the request if we're receiving the reply
    rxrpc: Fix listen() setting the bar too high for the prealloc rings
    ASoC: wm2000: fix missing clk_disable_unprepare() on error in wm2000_anc_transition()
  * sctp: read sk->sk_bound_dev_if once in sctp_rcv()
      net/sctp/input.c
    m68k: math-emu: Fix dependencies of math emulation support
  * Bluetooth: fix dangling sco_conn and use-after-free in sco_sock_timeout
      net/bluetooth/sco.c
    media: pvrusb2: fix array-index-out-of-bounds in pvr2_i2c_core_init
    media: exynos4-is: Change clk_disable to clk_disable_unprepare
    media: st-delta: Fix PM disable depth imbalance in delta_probe
    regulator: pfuze100: Fix refcount leak in pfuze_parse_regulators_dt
    ASoC: mxs-saif: Fix refcount leak in mxs_saif_probe
  * media: uvcvideo: Fix missing check to determine if element is found in list
      drivers/media/usb/uvc/uvc_v4l2.c
  * drm/msm: return an error pointer in msm_gem_prime_get_sg_table()
      drivers/gpu/drm/msm/msm_gem_prime.c
    x86/mm: Cleanup the control_va_addr_alignment() __setup handler
    irqchip/aspeed-i2c-ic: Fix irq_of_parse_and_map() return value
    x86: Fix return value of __setup handlers
    drm/rockchip: vop: fix possible null-ptr-deref in vop_bind()
    drm/msm/hdmi: check return value after calling platform_get_resource_byname()
    drm/msm/dsi: fix error checks and return values for DSI xmit functions
    x86/pm: Fix false positive kmemleak report in msr_build_context()
  * fsnotify: fix wrong lockdep annotations
      fs/notify/mark.c
  * inotify: show inotify mask flags in proc fdinfo
      fs/notify/fdinfo.c
      fs/notify/inotify/inotify.h
      fs/notify/inotify/inotify_user.c
    ath9k_htc: fix potential out of bounds access with invalid rxstatus->rs_keyix
    spi: img-spfi: Fix pm_runtime_get_sync() error checking
    HID: hid-led: fix maximum brightness for Dream Cheeky
  * efi: Add missing prototype for efi_capsule_setup_info
      include/linux/efi.h
    NFC: NULL out the dev->rfkill to prevent UAF
    spi: spi-ti-qspi: Fix return value handling of wait_for_completion_timeout
    drm/mediatek: Fix mtk_cec_mask()
    x86/delay: Fix the wrong asm constraint in delay_loop()
    ASoC: mediatek: Fix missing of_node_put in mt2701_wm8960_machine_probe
    ASoC: mediatek: Fix error handling in mt8173_max98090_dev_probe
    ath9k: fix ar9003_get_eepmisc
  * drm: fix EDID struct for old ARM OABI format
      include/drm/drm_edid.h
    RDMA/hfi1: Prevent panic when SDMA is disabled
  * macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled
      drivers/macintosh/Kconfig
      drivers/macintosh/Makefile
    powerpc/xics: fix refcount leak in icp_opal_init()
  * tracing: incorrect isolate_mote_t cast in mm_vmscan_lru_isolate
      include/trace/events/vmscan.h
  * PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store()
      drivers/pci/pci.c
    ARM: hisi: Add missing of_node_put after of_find_compatible_node
    ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM
    ARM: versatile: Add missing of_node_put in dcscb_init
  * fat: add ratelimit to fat*_ent_bread()
      fs/fat/fatent.c
    ARM: OMAP1: clock: Fix UART rate reporting algorithm
    fs: jfs: fix possible NULL pointer dereference in dbFree()
    ARM: dts: ox820: align interrupt controller node name with dtschema
  * eth: tg3: silence the GCC 12 array-bounds warning
      drivers/net/ethernet/broadcom/Makefile
    rxrpc: Return an error to sendmsg if call failed
    media: exynos4-is: Fix compile warning
  * net: phy: micrel: Allow probing without .driver_data
      drivers/net/phy/micrel.c
    ASoC: rt5645: Fix errorenous cleanup order
    nvme-pci: fix a NULL pointer dereference in nvme_alloc_admin_tags
    openrisc: start CPU timer early in boot
    rtlwifi: Use pr_warn instead of WARN_ONCE
    ipmi:ssif: Check for NULL msg when handling events and messages
    dma-debug: change allocation mode from GFP_NOWAIT to GFP_ATIOMIC
    s390/preempt: disable __preempt_count_add() optimization for PROFILE_ALL_BRANCHES
  * ASoC: dapm: Don't fold register value changes into notifications
      sound/soc/soc-dapm.c
  * ipv6: Don't send rs packets to the interface of ARPHRD_TUNNEL
      net/ipv6/addrconf.c
    drm/amd/pm: fix the compile warning
    scsi: megaraid: Fix error check return value of register_chrdev()
    media: cx25821: Fix the warning when removing the module
    media: pci: cx23885: Fix the error handling in cx23885_initdev()
    media: venus: hfi: avoid null dereference in deinit
    ath9k: fix QCA9561 PA bias level
    drm/amd/pm: fix double free in si_parse_power_table()
  * ALSA: jack: Access input_dev under mutex
      include/sound/jack.h
      sound/core/jack.c
    ACPICA: Avoid cache flush inside virtual machines
    ipw2x00: Fix potential NULL dereference in libipw_xmit()
    b43: Fix assigning negative value to unsigned variable
    b43legacy: Fix assigning negative value to unsigned variable
    mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue
    drm/virtio: fix NULL pointer dereference in virtio_gpu_conn_get_modes
    btrfs: repair super block num_devices automatically
    btrfs: add "0x" prefix for unsupported optional features
  * ptrace: Reimplement PTRACE_KILL by always sending SIGKILL
      kernel/ptrace.c
  * ptrace/xtensa: Replace PT_SINGLESTEP with TIF_SINGLESTEP
      include/linux/ptrace.h
  * USB: new quirk for Dell Gen 2 devices
      drivers/usb/core/quirks.c
    USB: serial: option: add Quectel BG95 modem
    binfmt_flat: do not stop relocating GOT entries prematurely on riscv
  * BACKPORT: psi: Fix uaf issue when psi trigger is destroyed while being polled
      include/linux/psi.h
      include/linux/psi_types.h
      kernel/cgroup/cgroup.c
      kernel/sched/psi.c
  * FROMGIT: Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process"
      net/key/af_key.c
    ANDROID: android-verity: Prevent double-freeing metadata
    Merge 4.14.282 into android-4.14-stable
Linux 4.14.282
  * bpf: Enlarge offset check value to INT_MAX in bpf_skb_{load,store}_bytes
      net/core/filter.c
    NFSD: Fix possible sleep during nfsd4_release_lockowner()
    docs: submitting-patches: Fix crossref to 'The canonical patch format'
    tpm: ibmvtpm: Correct the return value in tpm_ibmvtpm_probe()
  * dm verity: set DM_TARGET_IMMUTABLE feature flag
      drivers/md/dm-verity-target.c
  * dm stats: add cond_resched when looping over entries
      drivers/md/dm-stats.c
  * dm crypt: make printing of the key constant-time
      drivers/md/dm-crypt.c
    dm integrity: fix error code in dm_integrity_ctr()
  * zsmalloc: fix races between asynchronous zspage free and page migration
      mm/zsmalloc.c
  * netfilter: conntrack: re-fetch conntrack after insertion
      include/net/netfilter/nf_conntrack_core.h
  * exec: Force single empty string when argv is empty
      fs/exec.c
  * block-map: add __GFP_ZERO flag for alloc_page in function bio_copy_kern
      block/bio.c
    drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency()
  * assoc_array: Fix BUG_ON during garbage collect
      lib/assoc_array.c
    drivers: i2c: thunderx: Allow driver to work with ACPI defined TWSI controllers
    net: ftgmac100: Disable hardware checksum on AST2600
  * net: af_key: check encryption module availability consistency
      net/key/af_key.c
    ACPI: sysfs: Fix BERT error region memory mapping
    ACPI: sysfs: Make sparse happy about address space in use
  * secure_seq: use the 64 bits of the siphash for port offset calculation
      include/net/inet_hashtables.h
      include/net/secure_seq.h
      net/core/secure_seq.c
      net/ipv4/inet_hashtables.c
      net/ipv6/inet6_hashtables.c
  * tcp: change source port randomizarion at connect() time
      net/ipv4/inet_hashtables.c
    staging: rtl8723bs: prevent ->Ssid overflow in rtw_wx_set_scan()
    x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests

Bug: 237729727
Change-Id: I47053f037f09ce3b44fb4ca21dd80f8b6371d3aa
Signed-off-by: Lucas Wei <lucaswei@google.com>
2022-07-25 15:26:14 +08:00
Pawan Gupta
ae62092804 x86/speculation/mmio: Add sysfs reporting for Processor MMIO Stale Data
commit 8d50cdf8b8341770bc6367bce40c0c1bb0e1d5b3 upstream

Add the sysfs reporting file for Processor MMIO Stale Data
vulnerability. It exposes the vulnerability and mitigation state similar
to the existing files for the other hardware vulnerabilities.

Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-16 13:01:55 +02:00
Guenter Roeck
008649ae55 cpu/speculation: Add prototype for cpu_show_srbds()
commit 2accfa69050c2a0d6fc6106f609208b3e9622b26 upstream.

0-day is not happy that there is no prototype for cpu_show_srbds():

drivers/base/cpu.c:565:16: error: no previous prototype for 'cpu_show_srbds'

Fixes: 7e5b3c267d25 ("x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200617141410.93338-1-linux@roeck-us.net
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-16 13:01:54 +02:00
Yadu MG
133b973159 arm64: Allow boot on cpus other than logical cpu 0
Kernel assumes boot cpu to be always on logical cpu 0.
At times there are benefits to boot kernel on other cpus
as well. On a heterogeneous multiprocessor system, booting
on a high-performance core can improve the boot time.

This patch removes the assumption that boot-cpu is logical
cpu 0. Device tree is looked up very early in boot to
determine the boot-cpus logical id. It also fixes hard-coding
of logical cpu 0 done at various places.

Change-Id: I27f1b2762db23a0af84fa5289f4b68ed31d84560
Signed-off-by: Yadu MG <ymg@codeaurora.org>
2020-08-24 00:46:46 -07:00
Blagovest Kolenichev
9f5be70fa4 Merge android-4.14-q.154 (b7f5267) into msm-4.14
* refs/heads/tmp-b7f5267:
  usb: gadget: configfs: Fix missing spin_lock_init()
  Linux 4.14.154
  kvm: x86: mmu: Recovery of shattered NX large pages
  kvm: Add helper function for creating VM worker threads
  kvm: mmu: ITLB_MULTIHIT mitigation
  KVM: vmx, svm: always run with EFER.NXE=1 when shadow paging is active
  KVM: x86: add tracepoints around __direct_map and FNAME(fetch)
  KVM: x86: change kvm_mmu_page_get_gfn BUG_ON to WARN_ON
  KVM: x86: remove now unneeded hugepage gfn adjustment
  KVM: x86: make FNAME(fetch) and __direct_map more similar
  kvm: mmu: Do not release the page inside mmu_set_spte()
  kvm: Convert kvm_lock to a mutex
  kvm: x86, powerpc: do not allow clearing largepages debugfs entry
  Documentation: Add ITLB_MULTIHIT documentation
  cpu/speculation: Uninline and export CPU mitigations helpers
  x86/cpu: Add Tremont to the cpu vulnerability whitelist
  x86/bugs: Add ITLB_MULTIHIT bug infrastructure
  x86/speculation/taa: Fix printing of TAA_MSG_SMT on IBRS_ALL CPUs
  x86/tsx: Add config options to set tsx=on|off|auto
  x86/speculation/taa: Add documentation for TSX Async Abort
  x86/tsx: Add "auto" option to the tsx= cmdline parameter
  kvm/x86: Export MDS_NO=0 to guests when TSX is enabled
  x86/speculation/taa: Add sysfs reporting for TSX Async Abort
  x86/speculation/taa: Add mitigation for TSX Async Abort
  x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default
  x86/cpu: Add a helper function x86_read_arch_cap_msr()
  x86/msr: Add the IA32_TSX_CTRL MSR
  KVM: x86: use Intel speculation bugs and features as derived in generic x86 code
  drm/i915/cmdparser: Fix jump whitelist clearing
  drm/i915/gen8+: Add RC6 CTX corruption WA
  drm/i915: Lower RM timeout to avoid DSI hard hangs
  drm/i915/cmdparser: Ignore Length operands during command matching
  drm/i915/cmdparser: Add support for backward jumps
  drm/i915/cmdparser: Use explicit goto for error paths
  drm/i915: Add gen9 BCS cmdparsing
  drm/i915: Allow parsing of unsized batches
  drm/i915: Support ro ppgtt mapped cmdparser shadow buffers
  drm/i915: Add support for mandatory cmdparsing
  drm/i915: Remove Master tables from cmdparser
  drm/i915: Disable Secure Batches for gen6+
  drm/i915: Rename gen7 cmdparser tables
  drm/i915: Move engine->needs_cmd_parser to engine->flags
  drm/i915: Don't use GPU relocations prior to cmdparser stalls
  drm/i915: Silence smatch for cmdparser
  drm/i915/cmdparser: Do not check past the cmd length.
  drm/i915/cmdparser: Check reg_table_count before derefencing.
  drm/i915: Prevent writing into a read-only object via a GGTT mmap
  drm/i915/gtt: Disable read-only support under GVT
  drm/i915/gtt: Read-only pages for insert_entries on bdw+
  drm/i915/gtt: Add read only pages to gen8_pte_encode
  net: prevent load/store tearing on sk->sk_stamp
  usbip: Fix free of unallocated memory in vhci tx
  cgroup,writeback: don't switch wbs immediately on dead wbs if the memcg is dead
  mm/filemap.c: don't initiate writeback if mapping has no dirty pages
  can: flexcan: disable completely the ECC mechanism
  x86/apic/32: Avoid bogus LDR warnings
  x86/apic: Drop logical_smp_processor_id() inline
  x86/apic: Move pending interrupt check code into it's own function
  e1000: fix memory leaks
  igb: Fix constant media auto sense switching when no cable is connected
  net: ethernet: arc: add the missed clk_disable_unprepare
  NFSv4: Don't allow a cached open with a revoked delegation
  hv_netvsc: Fix error handling in netvsc_attach()
  net: hisilicon: Fix "Trying to free already-free IRQ"
  fjes: Handle workqueue allocation failure
  scsi: qla2xxx: stop timer in shutdown path
  RDMA/iw_cxgb4: Avoid freeing skb twice in arp failure case
  USB: ldusb: use unsigned size format specifiers
  USB: Skip endpoints with 0 maxpacket length
  perf/x86/amd/ibs: Handle erratum #420 only on the affected CPU family (10h)
  perf/x86/amd/ibs: Fix reading of the IBS OpData register and thus precise RIP validity
  usb: dwc3: remove the call trace of USBx_GFLADJ
  usb: gadget: configfs: fix concurrent issue between composite APIs
  usb: gadget: composite: Fix possible double free memory bug
  usb: gadget: udc: atmel: Fix interrupt storm in FIFO mode.
  usb: fsl: Check memory resource before releasing it
  macsec: fix refcnt leak in module exit routine
  bonding: fix unexpected IFF_BONDING bit unset
  ipvs: move old_secure_tcp into struct netns_ipvs
  ipvs: don't ignore errors in case refcounting ip_vs module fails
  scsi: qla2xxx: Initialized mailbox to prevent driver load failure
  scsi: lpfc: Honor module parameter lpfc_use_adisc
  net: openvswitch: free vport unless register_netdevice() succeeds
  RDMA/uverbs: Prevent potential underflow
  scsi: qla2xxx: fixup incorrect usage of host_byte
  net/mlx5: prevent memory leak in mlx5_fpga_conn_create_cq
  RDMA/qedr: Fix reported firmware version
  HID: intel-ish-hid: fix wrong error handling in ishtp_cl_alloc_tx_ring()
  dmaengine: xilinx_dma: Fix control reg update in vdma_channel_set_config
  PCI: tegra: Enable Relaxed Ordering only for Tegra20 & Tegra30
  usbip: Implement SG support to vhci-hcd and stub driver
  usbip: stub_rx: fix static checker warning on unnecessary checks
  usbip: Fix vhci_urb_enqueue() URB null transfer buffer error path
  lib/scatterlist: Introduce sgl_alloc() and sgl_free()
  sched/fair: Fix -Wunused-but-set-variable warnings
  sched/fair: Fix low cpu usage with high throttling by removing expiration of cpu-local slices
  ARM: dts: dra7: Disable USB metastability workaround for USB2
  cpufreq: ti-cpufreq: add missing of_node_put()
  i2c: omap: Trigger bus recovery in lockup case
  ASoC: davinci-mcasp: Fix an error handling path in 'davinci_mcasp_probe()'
  ASoC: davinci: Kill BUG_ON() usage
  ASoC: davinci-mcasp: Handle return value of devm_kasprintf
  ASoC: tlv320dac31xx: mark expected switch fall-through
  mailbox: reset txdone_method TXDONE_BY_POLL if client knows_txdone
  misc: pci_endpoint_test: Fix BUG_ON error during pci_disable_msi()
  PCI: dra7xx: Add shutdown handler to cleanly turn off clocks
  misc: pci_endpoint_test: Prevent some integer overflows
  mtd: spi-nor: cadence-quadspi: add a delay in write sequence
  mtd: spi-nor: enable 4B opcodes for mx66l51235l
  ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes
  mfd: palmas: Assign the right powerhold mask for tps65917
  usb: dwc3: Allow disabling of metastability workaround
  configfs: fix a deadlock in configfs_symlink()
  configfs: provide exclusion between IO and removals
  configfs: new object reprsenting tree fragments
  configfs_register_group() shouldn't be (and isn't) called in rmdirable parts
  configfs: stash the data we need into configfs_buffer at open time
  configfs: Fix bool initialization/comparison
  can: peak_usb: fix slab info leak
  can: mcba_usb: fix use-after-free on disconnect
  can: gs_usb: gs_can_open(): prevent memory leak
  can: rx-offload: can_rx_offload_queue_sorted(): fix error handling, avoid skb mem leak
  can: peak_usb: fix a potential out-of-sync while decoding packets
  can: c_can: c_can_poll(): only read status register after status IRQ
  can: usb_8dev: fix use-after-free on disconnect
  intel_th: pci: Add Jasper Lake PCH support
  intel_th: pci: Add Comet Lake PCH support
  netfilter: ipset: Fix an error code in ip_set_sockfn_get()
  netfilter: nf_tables: Align nft_expr private data to 64-bit
  iio: srf04: fix wrong limitation in distance measuring
  iio: imu: adis16480: make sure provided frequency is positive
  iio: adc: stm32-adc: fix stopping dma
  ceph: add missing check in d_revalidate snapdir handling
  ceph: fix use-after-free in __ceph_remove_cap()
  arm64: Do not mask out PTE_RDONLY in pte_same()
  HID: wacom: generic: Treat serial number and related fields as unsigned
  drm/radeon: fix si_enable_smc_cac() failed issue
  perf tools: Fix time sorting
  tools: gpio: Use !building_out_of_srctree to determine srctree
  dump_stack: avoid the livelock of the dump_lock
  mm, vmstat: hide /proc/pagetypeinfo from normal users
  mm: thp: handle page cache THP correctly in PageTransCompoundMap
  ALSA: hda/ca0132 - Fix possible workqueue stall
  ALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire Pro i/o series
  ALSA: timer: Fix incorrectly assigned timer instance
  qede: fix NULL pointer deref in __qede_remove()
  NFC: st21nfca: fix double free
  nfc: netlink: fix double device reference drop
  NFC: fdp: fix incorrect free object
  net: usb: qmi_wwan: add support for DW5821e with eSIM support
  net: qualcomm: rmnet: Fix potential UAF when unregistering
  net: fix data-race in neigh_event_send()
  net: ethernet: octeon_mgmt: Account for second possible VLAN header
  ipv4: Fix table id reference in fib_sync_down_addr
  CDC-NCM: handle incomplete transfer of MTU
  bonding: fix state transition issue in link monitoring

Conflicts:
	Documentation/devicetree/bindings/usb/dwc3.txt
	drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
	drivers/usb/dwc3/core.h
	kernel/cpu.c

Change-Id: I81b1613324c238a6e612cf1c6cf2c67ca17b4adc
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2020-02-12 04:35:33 -08:00
Tyler Hicks
fa8617fdda cpu/speculation: Uninline and export CPU mitigations helpers
commit 731dc9df975a5da21237a18c3384f811a7a41cc6 upstream.

A kernel module may need to check the value of the "mitigations=" kernel
command line parameter as part of its setup when the module needs
to perform software mitigations for a CPU flaw.

Uninline and export the helper functions surrounding the cpu_mitigations
enum to allow for their usage from a module.

Lastly, privatize the enum and cpu_mitigations variable since the value of
cpu_mitigations can be checked with the exported helper functions.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-12 19:19:04 +01:00
Vineela Tummalapalli
56a0f3867c x86/bugs: Add ITLB_MULTIHIT bug infrastructure
commit db4d30fbb71b47e4ecb11c4efa5d8aad4b03dfae upstream.

Some processors may incur a machine check error possibly resulting in an
unrecoverable CPU lockup when an instruction fetch encounters a TLB
multi-hit in the instruction TLB. This can occur when the page size is
changed along with either the physical address or cache type. The relevant
erratum can be found here:

   https://bugzilla.kernel.org/show_bug.cgi?id=205195

There are other processors affected for which the erratum does not fully
disclose the impact.

This issue affects both bare-metal x86 page tables and EPT.

It can be mitigated by either eliminating the use of large pages or by
using careful TLB invalidations when changing the page size in the page
tables.

Just like Spectre, Meltdown, L1TF and MDS, a new bit has been allocated in
MSR_IA32_ARCH_CAPABILITIES (PSCHANGE_MC_NO) and will be set on CPUs which
are mitigated against this issue.

Signed-off-by: Vineela Tummalapalli <vineela.tummalapalli@intel.com>
Co-developed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-12 19:19:03 +01:00
Pawan Gupta
79373f485f x86/speculation/taa: Add sysfs reporting for TSX Async Abort
commit 6608b45ac5ecb56f9e171252229c39580cc85f0f upstream.

Add the sysfs reporting file for TSX Async Abort. It exposes the
vulnerability and the mitigation state similar to the existing files for
the other hardware vulnerabilities.

Sysfs file path is:
/sys/devices/system/cpu/vulnerabilities/tsx_async_abort

Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Neelima Krishnan <neelima.krishnan@intel.com>
Reviewed-by: Mark Gross <mgross@linux.intel.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-12 19:19:00 +01:00
Blagovest Kolenichev
7c63330d05 Merge android-4.14.125 (dc5b587) into msm-4.14
* refs/heads/tmp-dc5b587:
  Linux 4.14.125
  ethtool: check the return value of get_regs_len
  ipv4: Define __ipv4_neigh_lookup_noref when CONFIG_INET is disabled
  fuse: Add FOPEN_STREAM to use stream_open()
  fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock
  qmi_wwan: Add quirk for Quectel dynamic config
  TTY: serial_core, add ->install
  drm/i915/fbc: disable framebuffer compression on GeminiLake
  drm/i915: Fix I915_EXEC_RING_MASK
  drm/radeon: prefer lower reference dividers
  drm/amdgpu/psp: move psp version specific function pointers to early_init
  drm/nouveau: add kconfig option to turn off nouveau legacy contexts. (v3)
  drm/gma500/cdv: Check vbt config bits when detecting lvds panels
  test_firmware: Use correct snprintf() limit
  genwqe: Prevent an integer overflow in the ioctl
  Revert "MIPS: perf: ath79: Fix perfcount IRQ assignment"
  MIPS: pistachio: Build uImage.gz by default
  MIPS: Bounds check virt_addr_valid
  i2c: xiic: Add max_read_len quirk
  x86/power: Fix 'nosmt' vs hibernation triple fault during resume
  pstore/ram: Run without kernel crash dump region
  pstore: Convert buf_lock to semaphore
  pstore: Remove needless lock during console writes
  fuse: fallocate: fix return with locked inode
  parisc: Use implicit space register selection for loading the coherence index of I/O pdirs
  rcu: locking and unlocking need to always be at least barriers
  Revert "fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied"
  Revert "fib_rules: fix error in backport of e9919a24d302 ("fib_rules: return 0...")"
  ipv6: fix the check before getting the cookie in rt6_get_cookie
  net: sfp: read eeprom in maximum 16 byte increments
  ipv6: use READ_ONCE() for inet->hdrincl as in ipv4
  ipv6: fix EFAULT on sendto with icmpv6 and hdrincl
  pktgen: do not sleep with the thread lock held.
  net: rds: fix memory leak in rds_ib_flush_mr_pool
  net/mlx4_en: ethtool, Remove unsupported SFP EEPROM high pages query
  neighbor: Call __ipv4_neigh_lookup_noref in neigh_xmit
  Fix memory leak in sctp_process_init
  ethtool: fix potential userspace buffer overflow

Change-Id: Ice7fba2663c02167db026bf7b9c8f466a158f6d5
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2019-07-23 11:00:22 -07:00
Blagovest Kolenichev
581527e21b Merge android-4.14.119 (e6cbf92) into msm-4.14
* refs/heads/tmp-e6cbf92:
  Linux 4.14.119
  x86/speculation/mds: Fix documentation typo
  Documentation: Correct the possible MDS sysfs values
  x86/mds: Add MDSUM variant to the MDS documentation
  x86/speculation/mds: Add 'mitigations=' support for MDS
  s390/speculation: Support 'mitigations=' cmdline option
  powerpc/speculation: Support 'mitigations=' cmdline option
  x86/speculation: Support 'mitigations=' cmdline option
  cpu/speculation: Add 'mitigations=' cmdline option
  x86/speculation/mds: Print SMT vulnerable on MSBDS with mitigations off
  x86/speculation/mds: Fix comment
  x86/speculation/mds: Add SMT warning message
  x86/speculation: Move arch_smt_update() call to after mitigation decisions
  x86/speculation/mds: Add mds=full,nosmt cmdline option
  Documentation: Add MDS vulnerability documentation
  Documentation: Move L1TF to separate directory
  x86/speculation/mds: Add mitigation mode VMWERV
  x86/speculation/mds: Add sysfs reporting for MDS
  x86/speculation/mds: Add mitigation control for MDS
  x86/speculation/mds: Conditionally clear CPU buffers on idle entry
  x86/kvm/vmx: Add MDS protection when L1D Flush is not active
  x86/speculation/mds: Clear CPU buffers on exit to user
  x86/speculation/mds: Add mds_clear_cpu_buffers()
  x86/kvm: Expose X86_FEATURE_MD_CLEAR to guests
  x86/speculation/mds: Add BUG_MSBDS_ONLY
  x86/speculation/mds: Add basic bug infrastructure for MDS
  x86/speculation: Consolidate CPU whitelists
  x86/msr-index: Cleanup bit defines
  locking/atomics, asm-generic: Move some macros from <linux/bitops.h> to a new <linux/bits.h> file
  kvm: x86: Report STIBP on GET_SUPPORTED_CPUID
  x86/cpu: Sanitize FAM6_ATOM naming
  Documentation/l1tf: Fix small spelling typo
  x86/speculation: Simplify the CPU bug detection logic

Conflicts:
	kernel/cpu.c

Change-Id: I75ffff0f46fb87e8e3d4c2312ccf7f636416a493
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2019-07-23 10:59:49 -07:00
Jiri Kosina
b9284404b1 x86/power: Fix 'nosmt' vs hibernation triple fault during resume
commit ec527c318036a65a083ef68d8ba95789d2212246 upstream.

As explained in

	0cc3cd21657b ("cpu/hotplug: Boot HT siblings at least once")

we always, no matter what, have to bring up x86 HT siblings during boot at
least once in order to avoid first MCE bringing the system to its knees.

That means that whenever 'nosmt' is supplied on the kernel command-line,
all the HT siblings are as a result sitting in mwait or cpudile after
going through the online-offline cycle at least once.

This causes a serious issue though when a kernel, which saw 'nosmt' on its
commandline, is going to perform resume from hibernation: if the resume
from the hibernated image is successful, cr3 is flipped in order to point
to the address space of the kernel that is being resumed, which in turn
means that all the HT siblings are all of a sudden mwaiting on address
which is no longer valid.

That results in triple fault shortly after cr3 is switched, and machine
reboots.

Fix this by always waking up all the SMT siblings before initiating the
'restore from hibernation' process; this guarantees that all the HT
siblings will be properly carried over to the resumed kernel waiting in
resume_play_dead(), and acted upon accordingly afterwards, based on the
target kernel configuration.

Symmetricaly, the resumed kernel has to push the SMT siblings to mwait
again in case it has SMT disabled; this means it has to online all
the siblings when resuming (so that they come out of hlt) and offline
them again to let them reach mwait.

Cc: 4.19+ <stable@vger.kernel.org> # v4.19+
Debugged-by: Thomas Gleixner <tglx@linutronix.de>
Fixes: 0cc3cd21657b ("cpu/hotplug: Boot HT siblings at least once")
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-11 12:21:48 +02:00
Josh Poimboeuf
ed1dfe838f cpu/speculation: Add 'mitigations=' cmdline option
commit 98af8452945c55652de68536afdde3b520fec429 upstream

Keeping track of the number of mitigations for all the CPU speculation
bugs has become overwhelming for many users.  It's getting more and more
complicated to decide which mitigations are needed for a given
architecture.  Complicating matters is the fact that each arch tends to
have its own custom way to mitigate the same vulnerability.

Most users fall into a few basic categories:

a) they want all mitigations off;

b) they want all reasonable mitigations on, with SMT enabled even if
   it's vulnerable; or

c) they want all reasonable mitigations on, with SMT disabled if
   vulnerable.

Define a set of curated, arch-independent options, each of which is an
aggregation of existing options:

- mitigations=off: Disable all mitigations.

- mitigations=auto: [default] Enable all the default mitigations, but
  leave SMT enabled, even if it's vulnerable.

- mitigations=auto,nosmt: Enable all the default mitigations, disabling
  SMT if needed by a mitigation.

Currently, these options are placeholders which don't actually do
anything.  They will be fleshed out in upcoming patches.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Jiri Kosina <jkosina@suse.cz> (on x86)
Reviewed-by: Jiri Kosina <jkosina@suse.cz>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Waiman Long <longman@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Jon Masters <jcm@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arch@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Steven Price <steven.price@arm.com>
Cc: Phil Auld <pauld@redhat.com>
Link: https://lkml.kernel.org/r/b07a8ef9b7c5055c3a4637c87d07c296d5016fe0.1555085500.git.jpoimboe@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-14 19:18:46 +02:00
Thomas Gleixner
644386d19f x86/speculation/mds: Add sysfs reporting for MDS
commit 8a4b06d391b0a42a373808979b5028f5c84d9c6a upstream

Add the sysfs reporting file for MDS. It exposes the vulnerability and
mitigation state similar to the existing files for the other speculative
hardware vulnerabilities.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Jon Masters <jcm@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-14 19:18:44 +02:00
Blagovest Kolenichev
f1b30ef999 Merge android-4.14-p.99 (b952da4) into msm-4.14
* refs/heads/tmp-b952da4:
  Revert "iommu/arm-smmu: Add support for qcom,smmu-v2 variant"
  Linux 4.14.99
  ath9k: dynack: check da->enabled first in sampling routines
  ath9k: dynack: make ewma estimation faster
  perf/x86/intel: Delay memory deallocation until x86_pmu_dead_cpu()
  IB/hfi1: Add limit test for RC/UC send via loopback
  nfsd4: catch some false session retries
  nfsd4: fix cached replies to solo SEQUENCE compounds
  serial: 8250_pci: Make PCI class test non fatal
  serial: fix race between flush_to_ldisc and tty_open
  perf tests evsel-tp-sched: Fix bitwise operator
  perf/core: Don't WARN() for impossible ring-buffer sizes
  x86/MCE: Initialize mce.bank in the case of a fatal error in mce_no_way_out()
  perf/x86/intel/uncore: Add Node ID mask
  cpu/hotplug: Fix "SMT disabled by BIOS" detection for KVM
  KVM: nVMX: unconditionally cancel preemption timer in free_nested (CVE-2019-7221)
  kvm: fix kvm_ioctl_create_device() reference counting (CVE-2019-6974)
  KVM: x86: work around leak of uninitialized stack contents (CVE-2019-7222)
  scsi: aic94xx: fix module loading
  scsi: cxlflash: Prevent deadlock when adapter probe fails
  staging: speakup: fix tty-operation NULL derefs
  usb: gadget: musb: fix short isoc packets with inventra dma
  usb: gadget: udc: net2272: Fix bitwise and boolean operations
  usb: dwc3: gadget: Handle 0 xfer length for OUT EP
  usb: phy: am335x: fix race condition in _probe
  irqchip/gic-v3-its: Plug allocation race for devices sharing a DevID
  futex: Handle early deadlock return correctly
  dmaengine: imx-dma: fix wrong callback invoke
  dmaengine: bcm2835: Fix abort of transactions
  dmaengine: bcm2835: Fix interrupt race on RT
  fuse: handle zero sized retrieve correctly
  fuse: decrement NR_WRITEBACK_TEMP on the right page
  fuse: call pipe_buf_release() under pipe lock
  ALSA: hda - Serialize codec registrations
  ALSA: compress: Fix stop handling on compressed capture streams
  net: dsa: slave: Don't propagate flag changes on down slave interfaces
  net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames
  net: systemport: Fix WoL with password after deep sleep
  rds: fix refcount bug in rds_sock_addref
  skge: potential memory corruption in skge_get_regs()
  rxrpc: bad unlock balance in rxrpc_recvmsg
  net: dp83640: expire old TX-skb
  enic: fix checksum validation for IPv6
  dccp: fool proof ccid_hc_[rt]x_parse_options()
  thermal: hwmon: inline helpers when CONFIG_THERMAL_HWMON is not set
  scripts/gdb: fix lx-version string output
  exec: load_script: don't blindly truncate shebang string
  fs/epoll: drop ovflist branch prediction
  kernel/hung_task.c: force console verbose before panic
  proc/sysctl: fix return error for proc_doulongvec_minmax()
  kernel/hung_task.c: break RCU locks based on jiffies
  HID: lenovo: Add checks to fix of_led_classdev_register
  thermal: generic-adc: Fix adc to temp interpolation
  kdb: Don't back trace on a cpu that didn't round up
  thermal: bcm2835: enable hwmon explicitly
  block/swim3: Fix -EBUSY error when re-opening device after unmount
  fsl/fman: Use GFP_ATOMIC in {memac,tgec}_add_hash_mac_address()
  gdrom: fix a memory leak bug
  isdn: hisax: hfc_pci: Fix a possible concurrency use-after-free bug in HFCPCI_l1hw()
  ocfs2: improve ocfs2 Makefile
  ocfs2: don't clear bh uptodate for block read
  scripts/decode_stacktrace: only strip base path when a prefix of the path
  cgroup: fix parsing empty mount option string
  f2fs: fix sbi->extent_list corruption issue
  niu: fix missing checks of niu_pci_eeprom_read
  um: Avoid marking pages with "changed protection"
  cifs: check ntwrk_buf_start for NULL before dereferencing it
  MIPS: ralink: Select CONFIG_CPU_MIPSR2_IRQ_VI on MT7620/8
  crypto: ux500 - Use proper enum in hash_set_dma_transfer
  crypto: ux500 - Use proper enum in cryp_set_dma_transfer
  seq_buf: Make seq_buf_puts() null-terminate the buffer
  hwmon: (lm80) fix a missing check of bus read in lm80 probe
  hwmon: (lm80) fix a missing check of the status of SMBus read
  NFS: nfs_compare_mount_options always compare auth flavors.
  kvm: Change offset in kvm_write_guest_offset_cached to unsigned
  powerpc/fadump: Do not allow hot-remove memory from fadump reserved area.
  KVM: x86: svm: report MSR_IA32_MCG_EXT_CTL as unsupported
  pinctrl: meson: meson8b: fix the GPIO function for the GPIOAO pins
  pinctrl: meson: meson8: fix the GPIO function for the GPIOAO pins
  powerpc/mm: Fix reporting of kernel execute faults on the 8xx
  fbdev: fbcon: Fix unregister crash when more than one framebuffer
  ACPI/APEI: Clear GHES block_status before panic()
  igb: Fix an issue that PME is not enabled during runtime suspend
  i40e: define proper net_device::neigh_priv_len
  fbdev: fbmem: behave better with small rotated displays and many CPUs
  md: fix raid10 hang issue caused by barrier
  video: clps711x-fb: release disp device node in probe()
  drbd: Avoid Clang warning about pointless switch statment
  drbd: skip spurious timeout (ping-timeo) when failing promote
  drbd: disconnect, if the wrong UUIDs are attached on a connected peer
  drbd: narrow rcu_read_lock in drbd_sync_handshake
  powerpc/perf: Fix thresholding counter data for unknown type
  cw1200: Fix concurrency use-after-free bugs in cw1200_hw_scan()
  scsi: smartpqi: increase fw status register read timeout
  scsi: smartpqi: correct volume status
  scsi: smartpqi: correct host serial num for ssa
  mlxsw: spectrum: Properly cleanup LAG uppers when removing port from LAG
  Bluetooth: Fix unnecessary error message for HCI request completion
  xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi
  mac80211: fix radiotap vendor presence bitmap handling
  powerpc/uaccess: fix warning/error with access_ok()
  percpu: convert spin_lock_irq to spin_lock_irqsave.
  usb: musb: dsps: fix otg state machine
  arm64: KVM: Skip MMIO insn after emulation
  perf probe: Fix unchecked usage of strncpy()
  perf header: Fix unchecked usage of strncpy()
  perf test: Fix perf_event_attr test failure
  tty: serial: samsung: Properly set flags in autoCTS mode
  mmc: sdhci-xenon: Fix timeout checks
  mmc: sdhci-of-esdhc: Fix timeout checks
  memstick: Prevent memstick host from getting runtime suspended during card detection
  mmc: bcm2835: reset host on timeout
  mmc: bcm2835: Recover from MMC_SEND_EXT_CSD
  KVM: PPC: Book3S: Only report KVM_CAP_SPAPR_TCE_VFIO on powernv machines
  ASoC: fsl: Fix SND_SOC_EUKREA_TLV320 build error on i.MX8M
  ARM: pxa: avoid section mismatch warning
  selftests/bpf: use __bpf_constant_htons in test_prog.c
  switchtec: Fix SWITCHTEC_IOCTL_EVENT_IDX_ALL flags overwrite
  udf: Fix BUG on corrupted inode
  phy: sun4i-usb: add support for missing USB PHY index
  i2c-axxia: check for error conditions first
  OPP: Use opp_table->regulators to verify no regulator case
  cpuidle: big.LITTLE: fix refcount leak
  clk: imx6sl: ensure MMDC CH0 handshake is bypassed
  sata_rcar: fix deferred probing
  iommu/arm-smmu-v3: Use explicit mb() when moving cons pointer
  iommu/arm-smmu: Add support for qcom,smmu-v2 variant
  usb: dwc3: gadget: Disable CSP for stream OUT ep
  watchdog: renesas_wdt: don't set divider while watchdog is running
  ARM: dts: Fix up the D-Link DIR-685 MTD partition info
  media: coda: fix H.264 deblocking filter controls
  mips: bpf: fix encoding bug for mm_srlv32_op
  ARM: dts: Fix OMAP4430 SDP Ethernet startup
  iommu/amd: Fix amd_iommu=force_isolation
  pinctrl: sx150x: handle failure case of devm_kstrdup
  usb: dwc3: trace: add missing break statement to make compiler happy
  IB/hfi1: Unreserve a reserved request when it is completed
  kobject: return error code if writing /sys/.../uevent fails
  driver core: Move async_synchronize_full call
  clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for all audio module clocks
  usb: mtu3: fix the issue about SetFeature(U1/U2_Enable)
  timekeeping: Use proper seqcount initializer
  usb: hub: delay hub autosuspend if USB3 port is still link training
  usb: dwc3: Correct the logic for checking TRB full in __dwc3_prepare_one_trb()
  smack: fix access permissions for keyring
  media: DaVinci-VPBE: fix error handling in vpbe_initialize()
  x86/fpu: Add might_fault() to user_insn()
  ARM: dts: mmp2: fix TWSI2
  arm64: ftrace: don't adjust the LR value
  s390/zcrypt: improve special ap message cmd handling
  firmware/efi: Add NULL pointer checks in efivars API functions
  Thermal: do not clear passive state during system sleep
  arm64: io: Ensure value passed to __iormb() is held in a 64-bit register
  drm: Clear state->acquire_ctx before leaving drm_atomic_helper_commit_duplicated_state()
  nfsd4: fix crash on writing v4_end_grace before nfsd startup
  soc: bcm: brcmstb: Don't leak device tree node reference
  sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN
  arm64: io: Ensure calls to delay routines are ordered against prior readX()
  i2c: sh_mobile: add support for r8a77990 (R-Car E3)
  f2fs: fix wrong return value of f2fs_acl_create
  f2fs: fix race between write_checkpoint and write_begin
  f2fs: move dir data flush to write checkpoint process
  staging: pi433: fix potential null dereference
  ACPI: SPCR: Consider baud rate 0 as preconfigured state
  media: adv*/tc358743/ths8200: fill in min width/height/pixelclock
  iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID
  iio: adc: meson-saradc: fix internal clock names
  iio: adc: meson-saradc: check for devm_kasprintf failure
  dmaengine: xilinx_dma: Remove __aligned attribute on zynqmp_dma_desc_ll
  ptp: Fix pass zero to ERR_PTR() in ptp_clock_register
  media: mtk-vcodec: Release device nodes in mtk_vcodec_init_enc_pm()
  soc/tegra: Don't leak device tree node reference
  perf tools: Add Hygon Dhyana support
  modpost: validate symbol names also in find_elf_symbol
  net/mlx5: EQ, Use the right place to store/read IRQ affinity hint
  ARM: OMAP2+: hwmod: Fix some section annotations
  drm/rockchip: fix for mailbox read size
  usbnet: smsc95xx: fix rx packet alignment
  staging: iio: ad7780: update voltage on read
  platform/chrome: don't report EC_MKBP_EVENT_SENSOR_FIFO as wakeup
  Tools: hv: kvp: Fix a warning of buffer overflow with gcc 8.0.1
  fpga: altera-cvp: Fix registration for CvP incapable devices
  staging:iio:ad2s90: Make probe handle spi_setup failure
  MIPS: Boston: Disable EG20T prefetch
  ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl
  serial: fsl_lpuart: clear parity enable bit when disable parity
  drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE
  crypto: aes_ti - disable interrupts while accessing S-box
  powerpc/pseries: add of_node_put() in dlpar_detach_node()
  x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux)
  dlm: Don't swamp the CPU with callbacks queued during recovery
  clk: boston: fix possible memory leak in clk_boston_setup()
  ARM: 8808/1: kexec:offline panic_smp_self_stop CPU
  scsi: lpfc: Fix LOGO/PLOGI handling when triggerd by ABTS Timeout event
  scsi: mpt3sas: Call sas_remove_host before removing the target devices
  scsi: lpfc: Correct LCB RJT handling
  ath9k: dynack: use authentication messages for 'late' ack
  gpu: ipu-v3: image-convert: Prevent race between run and unprepare
  ASoC: Intel: mrfld: fix uninitialized variable access
  pinctrl: bcm2835: Use raw spinlock for RT compatibility
  drm/vgem: Fix vgem_init to get drm device available.
  staging: iio: adc: ad7280a: handle error from __ad7280_read32()
  drm/bufs: Fix Spectre v1 vulnerability

Conflicts:
	drivers/thermal/thermal_core.c

File below is aligned according to change [1] from this LTS import:

    arch/arm64/include/asm/io.h

[1] arm64: io: Ensure calls to delay routines are ordered against prior readX()

Change-Id: Ieae90a5ca7b81b08fcfedb150da732f5986aefe5
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2019-03-01 11:14:23 -08:00
Josh Poimboeuf
5e1f1c1f5d cpu/hotplug: Fix "SMT disabled by BIOS" detection for KVM
commit b284909abad48b07d3071a9fc9b5692b3e64914b upstream.

With the following commit:

  73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")

... the hotplug code attempted to detect when SMT was disabled by BIOS,
in which case it reported SMT as permanently disabled.  However, that
code broke a virt hotplug scenario, where the guest is booted with only
primary CPU threads, and a sibling is brought online later.

The problem is that there doesn't seem to be a way to reliably
distinguish between the HW "SMT disabled by BIOS" case and the virt
"sibling not yet brought online" case.  So the above-mentioned commit
was a bit misguided, as it permanently disabled SMT for both cases,
preventing future virt sibling hotplugs.

Going back and reviewing the original problems which were attempted to
be solved by that commit, when SMT was disabled in BIOS:

  1) /sys/devices/system/cpu/smt/control showed "on" instead of
     "notsupported"; and

  2) vmx_vm_init() was incorrectly showing the L1TF_MSG_SMT warning.

I'd propose that we instead consider #1 above to not actually be a
problem.  Because, at least in the virt case, it's possible that SMT
wasn't disabled by BIOS and a sibling thread could be brought online
later.  So it makes sense to just always default the smt control to "on"
to allow for that possibility (assuming cpuid indicates that the CPU
supports SMT).

The real problem is #2, which has a simple fix: change vmx_vm_init() to
query the actual current SMT state -- i.e., whether any siblings are
currently online -- instead of looking at the SMT "control" sysfs value.

So fix it by:

  a) reverting the original "fix" and its followup fix:

     73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")
     bc2d8d262cba ("cpu/hotplug: Fix SMT supported evaluation")

     and

  b) changing vmx_vm_init() to query the actual current SMT state --
     instead of the sysfs control value -- to determine whether the L1TF
     warning is needed.  This also requires the 'sched_smt_present'
     variable to exported, instead of 'cpu_smt_control'.

Fixes: 73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")
Reported-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Joe Mario <jmario@redhat.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: kvm@vger.kernel.org
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/e3a85d585da28cc333ecbc1e78ee9216e6da9396.1548794349.git.jpoimboe@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-12 19:46:13 +01:00
Blagovest Kolenichev
1987b17312 Merge android-4.14-p.63 (8b11380) into msm-4.14
* refs/heads/tmp-8b11380:
  Linux 4.14.63
  x86/CPU/AMD: Have smp_num_siblings and cpu_llc_id always be present
  x86/speculation/l1tf: Unbreak !__HAVE_ARCH_PFN_MODIFY_ALLOWED architectures
  x86/init: fix build with CONFIG_SWAP=n
  cpu/hotplug: Non-SMP machines do not make use of booted_once
  x86/smp: fix non-SMP broken build due to redefinition of apic_id_is_primary_thread
  x86/microcode: Allow late microcode loading with SMT disabled
  tools headers: Synchronise x86 cpufeatures.h for L1TF additions
  x86/mm/kmmio: Make the tracer robust against L1TF
  x86/mm/pat: Make set_memory_np() L1TF safe
  x86/speculation/l1tf: Make pmd/pud_mknotpresent() invert
  x86/speculation/l1tf: Invert all not present mappings
  cpu/hotplug: Fix SMT supported evaluation
  KVM: VMX: Tell the nested hypervisor to skip L1D flush on vmentry
  x86/speculation: Use ARCH_CAPABILITIES to skip L1D flush on vmentry
  x86/speculation: Simplify sysfs report of VMX L1TF vulnerability
  KVM: VMX: support MSR_IA32_ARCH_CAPABILITIES as a feature MSR
  KVM: X86: Allow userspace to define the microcode version
  KVM: X86: Introduce kvm_get_msr_feature()
  KVM: SVM: Add MSR-based feature support for serializing LFENCE
  KVM: x86: Add a framework for supporting MSR-based features
  Documentation/l1tf: Remove Yonah processors from not vulnerable list
  x86/KVM/VMX: Don't set l1tf_flush_l1d from vmx_handle_external_intr()
  x86/irq: Let interrupt handlers set kvm_cpu_l1tf_flush_l1d
  x86: Don't include linux/irq.h from asm/hardirq.h
  x86/KVM/VMX: Introduce per-host-cpu analogue of l1tf_flush_l1d
  x86/irq: Demote irq_cpustat_t::__softirq_pending to u16
  x86/KVM/VMX: Move the l1tf_flush_l1d test to vmx_l1d_flush()
  x86/KVM/VMX: Replace 'vmx_l1d_flush_always' with 'vmx_l1d_flush_cond'
  x86/KVM/VMX: Don't set l1tf_flush_l1d to true from vmx_l1d_flush()
  cpu/hotplug: detect SMT disabled by BIOS
  Documentation/l1tf: Fix typos
  x86/KVM/VMX: Initialize the vmx_l1d_flush_pages' content
  Documentation: Add section about CPU vulnerabilities
  x86/bugs, kvm: Introduce boot-time control of L1TF mitigations
  cpu/hotplug: Set CPU_SMT_NOT_SUPPORTED early
  cpu/hotplug: Expose SMT control init function
  x86/kvm: Allow runtime control of L1D flush
  x86/kvm: Serialize L1D flush parameter setter
  x86/kvm: Add static key for flush always
  x86/kvm: Move l1tf setup function
  x86/l1tf: Handle EPT disabled state proper
  x86/kvm: Drop L1TF MSR list approach
  x86/litf: Introduce vmx status variable
  cpu/hotplug: Online siblings when SMT control is turned on
  x86/KVM/VMX: Use MSR save list for IA32_FLUSH_CMD if required
  x86/KVM/VMX: Extend add_atomic_switch_msr() to allow VMENTER only MSRs
  x86/KVM/VMX: Separate the VMX AUTOLOAD guest/host number accounting
  x86/KVM/VMX: Add find_msr() helper function
  x86/KVM/VMX: Split the VMX MSR LOAD structures to have an host/guest numbers
  x86/KVM/VMX: Add L1D flush logic
  x86/KVM/VMX: Add L1D MSR based flush
  x86/KVM/VMX: Add L1D flush algorithm
  x86/KVM/VMX: Add module argument for L1TF mitigation
  x86/KVM: Warn user if KVM is loaded SMT and L1TF CPU bug being present
  cpu/hotplug: Boot HT siblings at least once
  Revert "x86/apic: Ignore secondary threads if nosmt=force"
  x86/speculation/l1tf: Fix up pte->pfn conversion for PAE
  x86/speculation/l1tf: Protect PAE swap entries against L1TF
  x86/CPU/AMD: Move TOPOEXT reenablement before reading smp_num_siblings
  x86/cpufeatures: Add detection of L1D cache flush support.
  x86/speculation/l1tf: Extend 64bit swap file size limit
  x86/apic: Ignore secondary threads if nosmt=force
  x86/cpu/AMD: Evaluate smp_num_siblings early
  x86/CPU/AMD: Do not check CPUID max ext level before parsing SMP info
  x86/cpu/intel: Evaluate smp_num_siblings early
  x86/cpu/topology: Provide detect_extended_topology_early()
  x86/cpu/common: Provide detect_ht_early()
  x86/cpu/AMD: Remove the pointless detect_ht() call
  x86/cpu: Remove the pointless CPU printout
  cpu/hotplug: Provide knobs to control SMT
  cpu/hotplug: Split do_cpu_down()
  cpu/hotplug: Make bringup/teardown of smp threads symmetric
  x86/topology: Provide topology_smt_supported()
  x86/smp: Provide topology_is_primary_thread()
  sched/smt: Update sched_smt_present at runtime
  x86/bugs: Move the l1tf function and define pr_fmt properly
  x86/speculation/l1tf: Limit swap file size to MAX_PA/2
  x86/speculation/l1tf: Disallow non privileged high MMIO PROT_NONE mappings
  x86/speculation/l1tf: Add sysfs reporting for l1tf
  x86/speculation/l1tf: Make sure the first page is always reserved
  x86/speculation/l1tf: Protect PROT_NONE PTEs against speculation
  x86/speculation/l1tf: Protect swap entries against L1TF
  x86/speculation/l1tf: Change order of offset/type in swap entry
  x86/speculation/l1tf: Increase 32bit PAE __PHYSICAL_PAGE_SHIFT
  x86/irqflags: Provide a declaration for native_save_fl
  kprobes/x86: Fix %p uses in error messages
  x86/speculation: Protect against userspace-userspace spectreRSB
  x86/paravirt: Fix spectre-v2 mitigations for paravirt guests
  ARM: dts: imx6sx: fix irq for pcie bridge
  Bluetooth: hci_serdev: Init hci_uart proto_lock to avoid oops
  Bluetooth: hci_ldisc: Allow sleeping while proto locks are held.
  phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
  mtd: nand: qcom: Add a NULL check for devm_kasprintf()
  fix __legitimize_mnt()/mntput() race
  fix mntput/mntput race
  make sure that __dentry_kill() always invalidates d_seq, unhashed or not
  root dentries need RCU-delayed freeing
  init: rename and re-order boot_cpu_state_init()
  scsi: qla2xxx: Fix memory leak for allocating abort IOCB
  scsi: sr: Avoid that opening a CD-ROM hangs with runtime power management enabled
  xen/netfront: don't cache skb_shinfo()
  stop_machine: Disable preemption after queueing stopper threads
  Mark HI and TASKLET softirq synchronous
  kasan: add no_sanitize attribute for clang builds
  scsi: virtio_scsi: fix IO hang caused by automatic irq vector affinity
  scsi: core: introduce force_blk_mq
  scsi: hpsa: fix selection of reply queue
  parisc: Define mb() and add memory barriers to assembler unlock sequences
  parisc: Enable CONFIG_MLONGCALLS by default
  ANDROID: AVB error handler to invalidate vbmeta partition.

Conflicts:
	include/linux/cpu.h
	include/linux/swapfile.h
	kernel/softirq.c
	kernel/stop_machine.c

Change-Id: I940d6493a2124eb2a7f6ad3d9ff81fe48e413531
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2018-08-28 03:08:02 -07:00
Thomas Gleixner
9eb0a3cce0 cpu/hotplug: Fix SMT supported evaluation
commit bc2d8d262cba5736332cbc866acb11b1c5748aa9 upstream

Josh reported that the late SMT evaluation in cpu_smt_state_init() sets
cpu_smt_control to CPU_SMT_NOT_SUPPORTED in case that 'nosmt' was supplied
on the kernel command line as it cannot differentiate between SMT disabled
by BIOS and SMT soft disable via 'nosmt'. That wreckages the state and
makes the sysfs interface unusable.

Rework this so that during bringup of the non boot CPUs the availability of
SMT is determined in cpu_smt_allowed(). If a newly booted CPU is not a
'primary' thread then set the local cpu_smt_available marker and evaluate
this explicitely right after the initial SMP bringup has finished.

SMT evaulation on x86 is a trainwreck as the firmware has all the
information _before_ booting the kernel, but there is no interface to query
it.

Fixes: 73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")
Reported-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-15 18:13:00 +02:00
Thomas Gleixner
476d29ab70 cpu/hotplug: Set CPU_SMT_NOT_SUPPORTED early
commit fee0aede6f4739c87179eca76136f83210953b86 upstream

The CPU_SMT_NOT_SUPPORTED state is set (if the processor does not support
SMT) when the sysfs SMT control file is initialized.

That was fine so far as this was only required to make the output of the
control file correct and to prevent writes in that case.

With the upcoming l1tf command line parameter, this needs to be set up
before the L1TF mitigation selection and command line parsing happens.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Jiri Kosina <jkosina@suse.cz>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20180713142323.121795971@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-15 18:12:56 +02:00
Jiri Kosina
8e41ddda30 cpu/hotplug: Expose SMT control init function
commit 8e1b706b6e819bed215c0db16345568864660393 upstream

The L1TF mitigation will gain a commend line parameter which allows to set
a combination of hypervisor mitigation and SMT control.

Expose cpu_smt_disable() so the command line parser can tweak SMT settings.

[ tglx: Split out of larger patch and made it preserve an already existing
  	force off state ]

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Jiri Kosina <jkosina@suse.cz>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20180713142323.039715135@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-15 18:12:56 +02:00
Thomas Gleixner
c5ac43ee8c cpu/hotplug: Provide knobs to control SMT
commit 05736e4ac13c08a4a9b1ef2de26dd31a32cbee57 upstream

Provide a command line and a sysfs knob to control SMT.

The command line options are:

 'nosmt':	Enumerate secondary threads, but do not online them

 'nosmt=force': Ignore secondary threads completely during enumeration
 		via MP table and ACPI/MADT.

The sysfs control file has the following states (read/write):

 'on':		 SMT is enabled. Secondary threads can be freely onlined
 'off':		 SMT is disabled. Secondary threads, even if enumerated
 		 cannot be onlined
 'forceoff':	 SMT is permanentely disabled. Writes to the control
 		 file are rejected.
 'notsupported': SMT is not supported by the CPU

The command line option 'nosmt' sets the sysfs control to 'off'. This
can be changed to 'on' to reenable SMT during runtime.

The command line option 'nosmt=force' sets the sysfs control to
'forceoff'. This cannot be changed during runtime.

When SMT is 'on' and the control file is changed to 'off' then all online
secondary threads are offlined and attempts to online a secondary thread
later on are rejected.

When SMT is 'off' and the control file is changed to 'on' then secondary
threads can be onlined again. The 'off' -> 'on' transition does not
automatically online the secondary threads.

When the control file is set to 'forceoff', the behaviour is the same as
setting it to 'off', but the operation is irreversible and later writes to
the control file are rejected.

When the control status is 'notsupported' then writes to the control file
are rejected.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-15 18:12:52 +02:00
Andi Kleen
3d98de691c x86/speculation/l1tf: Add sysfs reporting for l1tf
commit 17dbca119312b4e8173d4e25ff64262119fcef38 upstream

L1TF core kernel workarounds are cheap and normally always enabled, However
they still should be reported in sysfs if the system is vulnerable or
mitigated. Add the necessary CPU feature/bug bits.

- Extend the existing checks for Meltdowns to determine if the system is
  vulnerable. All CPUs which are not vulnerable to Meltdown are also not
  vulnerable to L1TF

- Check for 32bit non PAE and emit a warning as there is no practical way
  for mitigation due to the limited physical address bits

- If the system has more than MAX_PA/2 physical memory the invert page
  workarounds don't protect the system against the L1TF attack anymore,
  because an inverted physical address will also point to valid
  memory. Print a warning in this case and report that the system is
  vulnerable.

Add a function which returns the PFN limit for the L1TF mitigation, which
will be used in follow up patches for sanity and range checks.

[ tglx: Renamed the CPU feature bit to L1TF_PTEINV ]

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-15 18:12:50 +02:00
Linus Torvalds
b7722f4ac3 init: rename and re-order boot_cpu_state_init()
commit b5b1404d0815894de0690de8a1ab58269e56eae6 upstream.

This is purely a preparatory patch for upcoming changes during the 4.19
merge window.

We have a function called "boot_cpu_state_init()" that isn't really
about the bootup cpu state: that is done much earlier by the similarly
named "boot_cpu_init()" (note lack of "state" in name).

This function initializes some hotplug CPU state, and needs to run after
the percpu data has been properly initialized.  It even has a comment to
that effect.

Except it _doesn't_ actually run after the percpu data has been properly
initialized.  On x86 it happens to do that, but on at least arm and
arm64, the percpu base pointers are initialized by the arch-specific
'smp_prepare_boot_cpu()' hook, which ran _after_ boot_cpu_state_init().

This had some unexpected results, and in particular we have a patch
pending for the merge window that did the obvious cleanup of using
'this_cpu_write()' in the cpu hotplug init code:

  -       per_cpu_ptr(&cpuhp_state, smp_processor_id())->state = CPUHP_ONLINE;
  +       this_cpu_write(cpuhp_state.state, CPUHP_ONLINE);

which is obviously the right thing to do.  Except because of the
ordering issue, it actually failed miserably and unexpectedly on arm64.

So this just fixes the ordering, and changes the name of the function to
be 'boot_cpu_hotplug_init()' to make it obvious that it's about cpu
hotplug state, because the core CPU state was supposed to have already
been done earlier.

Marked for stable, since the (not yet merged) patch that will show this
problem is marked for stable.

Reported-by: Vlastimil Babka <vbabka@suse.cz>
Reported-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-15 18:12:48 +02:00
Blagovest Kolenichev
0e1a219e24 Merge android-4.14.43 (4c9e0a9) into msm-4.14
* refs/heads/tmp-4c9e0a9
  Linux 4.14.43
  x86/bugs: Rename SSBD_NO to SSB_NO
  KVM: SVM: Implement VIRT_SPEC_CTRL support for SSBD
  x86/speculation, KVM: Implement support for VIRT_SPEC_CTRL/LS_CFG
  x86/bugs: Rework spec_ctrl base and mask logic
  x86/bugs: Remove x86_spec_ctrl_set()
  x86/bugs: Expose x86_spec_ctrl_base directly
  x86/bugs: Unify x86_spec_ctrl_{set_guest,restore_host}
  x86/speculation: Rework speculative_store_bypass_update()
  x86/speculation: Add virtualized speculative store bypass disable support
  x86/bugs, KVM: Extend speculation control for VIRT_SPEC_CTRL
  x86/speculation: Handle HT correctly on AMD
  x86/cpufeatures: Add FEATURE_ZEN
  x86/cpufeatures: Disentangle SSBD enumeration
  x86/cpufeatures: Disentangle MSR_SPEC_CTRL enumeration from IBRS
  x86/speculation: Use synthetic bits for IBRS/IBPB/STIBP
  KVM: SVM: Move spec control call after restore of GS
  x86/cpu: Make alternative_msr_write work for 32-bit code
  x86/bugs: Fix the parameters alignment and missing void
  x86/bugs: Make cpu_show_common() static
  x86/bugs: Fix __ssb_select_mitigation() return type
  Documentation/spec_ctrl: Do some minor cleanups
  proc: Use underscores for SSBD in 'status'
  x86/bugs: Rename _RDS to _SSBD
  x86/speculation: Make "seccomp" the default mode for Speculative Store Bypass
  seccomp: Move speculation migitation control to arch code
  seccomp: Add filter flag to opt-out of SSB mitigation
  seccomp: Use PR_SPEC_FORCE_DISABLE
  prctl: Add force disable speculation
  x86/bugs: Make boot modes __ro_after_init
  seccomp: Enable speculation flaw mitigations
  proc: Provide details on speculation flaw mitigations
  nospec: Allow getting/setting on non-current task
  x86/speculation: Add prctl for Speculative Store Bypass mitigation
  x86/process: Allow runtime control of Speculative Store Bypass
  prctl: Add speculation control prctls
  x86/speculation: Create spec-ctrl.h to avoid include hell
  x86/KVM/VMX: Expose SPEC_CTRL Bit(2) to the guest
  x86/bugs/AMD: Add support to disable RDS on Fam[15,16,17]h if requested
  x86/bugs: Whitelist allowed SPEC_CTRL MSR values
  x86/bugs/intel: Set proper CPU features and setup RDS
  x86/bugs: Provide boot parameters for the spec_store_bypass_disable mitigation
  x86/cpufeatures: Add X86_FEATURE_RDS
  x86/bugs: Expose /sys/../spec_store_bypass
  x86/bugs, KVM: Support the combination of guest and host IBRS
  x86/bugs: Read SPEC_CTRL MSR during boot and re-use reserved bits
  x86/bugs: Concentrate bug reporting into a separate function
  x86/bugs: Concentrate bug detection into a separate function
  x86/nospec: Simplify alternative_msr_write()
  btrfs: fix reading stale metadata blocks after degraded raid1 mounts
  btrfs: Fix delalloc inodes invalidation during transaction abort
  btrfs: Split btrfs_del_delalloc_inode into 2 functions
  btrfs: fix crash when trying to resume balance without the resume flag
  btrfs: property: Set incompat flag if lzo/zstd compression is set
  Btrfs: send, fix invalid access to commit roots due to concurrent snapshotting
  Btrfs: fix xattr loss after power failure
  ARM: 8772/1: kprobes: Prohibit kprobes on get_user functions
  ARM: 8770/1: kprobes: Prohibit probing on optimized_callback
  ARM: 8769/1: kprobes: Fix to use get_kprobe_ctlblk after irq-disabed
  tick/broadcast: Use for_each_cpu() specially on UP kernels
  x86/mm: Drop TS_COMPAT on 64-bit exec() syscall
  ARM: 8771/1: kprobes: Prohibit kprobes on do_undefinstr
  efi: Avoid potential crashes, fix the 'struct efi_pci_io_protocol_32' definition for mixed mode
  x86/pkeys: Do not special case protection key 0
  x86/pkeys: Override pkey when moving away from PROT_EXEC
  s390: remove indirect branch from do_softirq_own_stack
  s390/qdio: don't release memory in qdio_setup_irq()
  s390/cpum_sf: ensure sample frequency of perf event attributes is non-zero
  s390/qdio: fix access to uninitialized qdio_q fields
  drm/i915/gen9: Add WaClearHIZ_WM_CHICKEN3 for bxt and glk
  mm: don't allow deferred pages with NEED_PER_CPU_KM
  radix tree: fix multi-order iteration race
  lib/test_bitmap.c: fix bitmap optimisation tests to report errors correctly
  drm: Match sysfs name in link removal to link creation
  powerpc/powernv: Fix NVRAM sleep in invalid context when crashing
  i2c: designware: fix poll-after-enable regression
  netfilter: nf_socket: Fix out of bounds access in nf_sk_lookup_slow_v{4,6}
  netfilter: nf_tables: can't fail after linking rule into active rule list
  netfilter: nf_tables: free set name in error path
  tee: shm: fix use-after-free via temporarily dropped reference
  tracing/x86/xen: Remove zero data size trace events trace_xen_mmu_flush_tlb{_all}
  vfio: ccw: fix cleanup if cp_prefetch fails
  powerpc: Don't preempt_disable() in show_cpuinfo()
  KVM: arm/arm64: VGIC/ITS: protect kvm_read_guest() calls with SRCU lock
  KVM: arm/arm64: VGIC/ITS save/restore: protect kvm_read_guest() calls
  spi: bcm-qspi: Always read and set BSPI_MAST_N_BOOT_CTRL
  spi: bcm-qspi: Avoid setting MSPI_CDRAM_PCS for spi-nor master
  spi: pxa2xx: Allow 64-bit DMA
  ALSA: control: fix a redundant-copy issue
  ALSA: hda: Add Lenovo C50 All in one to the power_save blacklist
  ALSA: usb: mixer: volume quirk for CM102-A+/102S+
  usbip: usbip_host: fix bad unlock balance during stub_probe()
  usbip: usbip_host: fix NULL-ptr deref and use-after-free errors
  usbip: usbip_host: run rebind from exit when module is removed
  usbip: usbip_host: delete device from busid_table after rebind
  usbip: usbip_host: refine probe and disconnect debug msgs to be useful
  Linux 4.14.42
  proc: do not access cmdline nor environ from file-backed areas
  l2tp: revert "l2tp: fix missing print session offset info"
  xfrm: fix xfrm_do_migrate() with AEAD e.g(AES-GCM)
  btrfs: Take trans lock before access running trans in check_delayed_ref
  xfrm: Use __skb_queue_tail in xfrm_trans_queue
  scsi: aacraid: Correct hba_send to include iu_type
  udp: fix SO_BINDTODEVICE
  nsh: fix infinite loop
  net/mlx5e: Allow offloading ipv4 header re-write for icmp
  ipv6: fix uninit-value in ip6_multipath_l3_keys()
  hv_netvsc: set master device
  net/mlx5: Avoid cleaning flow steering table twice during error flow
  net/mlx5e: TX, Use correct counter in dma_map error flow
  net: sched: fix error path in tcf_proto_create() when modules are not configured
  bonding: send learning packets for vlans on slave
  bonding: do not allow rlb updates to invalid mac
  tg3: Fix vunmap() BUG_ON() triggered from tg3_free_consistent().
  tcp: ignore Fast Open on repair mode
  tcp_bbr: fix to zero idle_restart only upon S/ACKed data
  sctp: use the old asoc when making the cookie-ack chunk in dupcook_d
  sctp: remove sctp_chunk_put from fail_mark err path in sctp_ulpevent_make_rcvmsg
  sctp: handle two v4 addrs comparison in sctp_inet6_cmp_addr
  sctp: fix the issue that the cookie-ack with auth can't get processed
  sctp: delay the authentication for the duplicated cookie-echo chunk
  rds: do not leak kernel memory to user land
  r8169: fix powering up RTL8168h
  qmi_wwan: do not steal interfaces from class drivers
  openvswitch: Don't swap table in nlattr_set() after OVS_ATTR_NESTED is found
  net/tls: Fix connection stall on partial tls record
  net/tls: Don't recursively call push_record during tls_write_space callbacks
  net: support compat 64-bit time in {s,g}etsockopt
  net_sched: fq: take care of throttled flows before reuse
  net sched actions: fix refcnt leak in skbmod
  net/mlx5: E-Switch, Include VF RDMA stats in vport statistics
  net/mlx5e: Err if asked to offload TC match on frag being first
  net/mlx4_en: Verify coalescing parameters are in range
  net/mlx4_en: Fix an error handling path in 'mlx4_en_init_netdev()'
  net: ethernet: ti: cpsw: fix packet leaking in dual_mac mode
  net: ethernet: sun: niu set correct packet size in skb
  llc: better deal with too small mtu
  ipv4: fix memory leaks in udp_sendmsg, ping_v4_sendmsg
  ipv4: fix fnhe usage by non-cached routes
  dccp: fix tasklet usage
  bridge: check iface upper dev when setting master via ioctl
  8139too: Use disable_irq_nosync() in rtl8139_poll_controller()
  ANDROID: sdcardfs: Don't d_drop in d_revalidate
  FROMLIST: brcmfmac: fix initialization of struct cfg80211_inform_bss variable
  FROMLIST: brcmfmac: reports boottime_ns while informing bss

Change-Id: I43c27b71b153a2a87070de3ea393002769856960
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2018-05-22 13:21:39 -07:00
Konrad Rzeszutek Wilk
c6dc89dd04 x86/bugs: Expose /sys/../spec_store_bypass
commit c456442cd3a59eeb1d60293c26cbe2ff2c4e42cf upstream

Add the sysfs file for the new vulerability. It does not do much except
show the words 'Vulnerable' for recent x86 cores.

Intel cores prior to family 6 are known not to be vulnerable, and so are
some Atoms and some Xeon Phi.

It assumes that older Cyrix, Centaur, etc. cores are immune.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-22 18:54:02 +02:00
Blagovest Kolenichev
ce969c4e6a Merge android-4.14.14 (9b68347) into msm-4.14
* refs/heads/tmp-9b68347
  Linux 4.14.14
  x86/retpoline: Remove compile time warning
  x86,perf: Disable intel_bts when PTI
  security/Kconfig: Correct the Documentation reference for PTI
  x86/pti: Fix !PCID and sanitize defines
  selftests/x86: Add test_vsyscall
  x86/retpoline: Fill return stack buffer on vmexit
  x86/retpoline/irq32: Convert assembler indirect jumps
  x86/retpoline/checksum32: Convert assembler indirect jumps
  x86/retpoline/xen: Convert Xen hypercall indirect jumps
  x86/retpoline/hyperv: Convert assembler indirect jumps
  x86/retpoline/ftrace: Convert ftrace assembler indirect jumps
  x86/retpoline/entry: Convert entry assembler indirect jumps
  x86/retpoline/crypto: Convert crypto assembler indirect jumps
  x86/spectre: Add boot time option to select Spectre v2 mitigation
  x86/retpoline: Add initial retpoline support
  objtool: Allow alternatives to be ignored
  objtool: Detect jumps to retpoline thunks
  x86/pti: Make unpoison of pgd for trusted boot work for real
  x86/alternatives: Fix optimize_nops() checking
  sysfs/cpu: Fix typos in vulnerability documentation
  x86/cpu/AMD: Use LFENCE_RDTSC in preference to MFENCE_RDTSC
  x86/cpu/AMD: Make LFENCE a serializing instruction
  x86/mm/pti: Remove dead logic in pti_user_pagetable_walk*()
  x86/tboot: Unbreak tboot with PTI enabled
  x86/cpu: Implement CPU vulnerabilites sysfs functions
  sysfs/cpu: Add vulnerability folder
  x86/cpufeatures: Add X86_BUG_SPECTRE_V[12]
  x86/Documentation: Add PTI description
  x86/pti: Unbreak EFI old_memmap
  e1000e: Fix e1000_check_for_copper_link_ich8lan return value.
  apparmor: fix ptrace label match when matching stacked labels
  kdump: write correct address of mem_section into vmcoreinfo
  mux: core: fix double get_device()
  uas: ignore UAS for Norelsys NS1068(X) chips
  Bluetooth: Prevent stack info leak from the EFS element.
  staging: android: ashmem: fix a race condition in ASHMEM_SET_SIZE ioctl
  usbip: vudc_tx: fix v_send_ret_submit() vulnerability to null xfer buffer
  usbip: fix vudc_rx: harden CMD_SUBMIT path to handle malicious input
  usbip: remove kernel addresses from usb device and urb debug msgs
  USB: UDC core: fix double-free in usb_add_gadget_udc_release
  USB: fix usbmon BUG trigger
  usb: misc: usb3503: make sure reset is low for at least 100us
  USB: serial: cp210x: add new device ID ELV ALC 8xxx
  USB: serial: cp210x: add IDs for LifeScan OneTouch Verio IQ
  bpf: arsh is not supported in 32 bit alu thus reject it
  bpf, array: fix overflow in max_entries and undefined behavior in index_mask
  bpf: prevent out-of-bounds speculation
  drm/i915: Fix init_clock_gating for resume
  drm/i915: Move init_clock_gating() back to where it was
  drm/i915: Whitelist SLICE_COMMON_ECO_CHICKEN1 on Geminilake.
  drm/i915/gvt: Clear the shadow page table entry after post-sync
  drm/vmwgfx: Potential off by one in vmw_view_add()
  drm/vmwgfx: Don't cache framebuffer maps
  KVM: PPC: Book3S HV: Always flush TLB in kvmppc_alloc_reset_hpt()
  KVM: PPC: Book3S HV: Fix use after free in case of multiple resize requests
  KVM: PPC: Book3S HV: Drop prepare_done from struct kvm_resize_hpt
  KVM: PPC: Book3S PR: Fix WIMG handling under pHyp
  KVM: x86: Add memory barrier on vmcs field lookup
  x86/microcode/intel: Extend BDW late-loading with a revision check
  iwlwifi: pcie: fix DMA memory mapping / unmapping
  rbd: set max_segments to USHRT_MAX
  rbd: reacquire lock should update lock owner client id
  mmc: renesas_sdhi: Add MODULE_LICENSE
  crypto: algapi - fix NULL dereference in crypto_remove_spawns()
  membarrier: Disable preemption when calling smp_call_function_many()
  sfp: fix sfp-bus oops when removing socket/upstream
  mlxsw: spectrum: Relax sanity checks during enslavement
  ipv6: sr: fix TLVs not being copied using setsockopt
  net/sched: Fix update of lastuse in act modules implementing stats_update
  mlxsw: spectrum_router: Fix NULL pointer deref
  ethtool: do not print warning for applications using legacy API
  ipv6: fix possible mem leaks in ipv6_make_skb()
  sh_eth: fix SH7757 GEther initialization
  net: stmmac: enable EEE in MII, GMII or RGMII only
  sh_eth: fix TSU resource handling
  sctp: fix the handling of ICMP Frag Needed for too small MTUs
  sctp: do not retransmit upon FragNeeded if PMTU discovery is disabled
  net: fec: free/restore resource in related probe error pathes
  net: fec: defer probe if regulator is not ready
  net: fec: restore dev_id in the cases of probe error
  RDS: null pointer dereference in rds_atomic_free_op
  RDS: Heap OOB write in rds_message_alloc_sgs()
  phylink: ensure we report link down when LOS asserted
  net: core: fix module type in sock_diag_bind
  ip6_tunnel: disable dst caching if tunnel is dual-stack
  8021q: fix a memory leak for VLAN 0 device
  x86/acpi: Reduce code duplication in mp_override_legacy_irq()
  ALSA: aloop: Fix racy hw constraints adjustment
  ALSA: aloop: Fix inconsistent format due to incomplete rule
  ALSA: aloop: Release cable upon open error path
  ALSA: pcm: Allow aborting mutex lock at OSS read/write loops
  ALSA: pcm: Abort properly at pending signal in OSS read/write loops
  ALSA: pcm: Add missing error checks in OSS emulation plugin builder
  ALSA: pcm: Workaround for weird PulseAudio behavior on rewind error
  ALSA: pcm: Remove incorrect snd_BUG_ON() usages
  x86/acpi: Handle SCI interrupts above legacy space gracefully
  iw_cxgb4: when flushing, complete all wrs in a chain
  iw_cxgb4: reflect the original WR opcode in drain cqes
  iw_cxgb4: only clear the ARMED bit if a notification is needed
  iw_cxgb4: atomically flush the qp
  iw_cxgb4: only call the cq comp_handler when the cq is armed
  platform/x86: wmi: Call acpi_wmi_init() later
  kvm: vmx: Scrub hardware GPRs at VM-exit
  cgroup: fix css_task_iter crash on CSS_TASK_ITER_PROC
  MIPS: Disallow outsized PTRACE_SETREGSET NT_PRFPREG regset accesses
  MIPS: Also verify sizeof `elf_fpreg_t' with PTRACE_SETREGSET
  MIPS: Fix an FCSR access API regression with NT_PRFPREG and MSA
  MIPS: Consistently handle buffer counter with PTRACE_SETREGSET
  MIPS: Guard against any partial write attempt with PTRACE_SETREGSET
  MIPS: Factor out NT_PRFPREG regset access helpers
  MIPS: Validate PR_SET_FP_MODE prctl(2) requests against the ABI of the task
  IB/srpt: Fix ACL lookup during login
  IB/srpt: Disable RDMA access by the initiator
  can: gs_usb: fix return value of the "set_bittiming" callback
  can: vxcan: improve handling of missing peer name attribute
  KVM: Fix stack-out-of-bounds read in write_mmio
  dm bufio: fix shrinker scans when (nr_to_scan < retain_target)
  Revert "ANDROID: fs: ext4: Add support for FIDTRIM, a best-effort ioctl for deep discard trim"
  fscrypt: updates on 4.15-rc4
  ANDROID: uid_sys_stats: fix the comment
  ANDROID: Squashfs: lz4_wrapper: Remove unused variable
  ANDROID: Squashfs: optimize reading uncompressed data
  ANDROID: Squashfs: implement .readpages()
  ANDROID: Squashfs: replace buffer_head with BIO
  ANDROID: Squashfs: refactor page_actor
  ANDROID: Squashfs: remove the FILE_CACHE option
  Revert "ANDROID: Squashfs: refactor page_actor"
  Revert "ANDROID: Squashfs: replace buffer_head with BIO"
  Revert "ANDROID: Squashfs: implement .readpages()"
  Revert "ANDROID: Squashfs: optimize reading uncompressed data"

Change-Id: Ie71e308f60efe7338e483b2851fd4459a99ce6f6
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
Signed-off-by: Runmin Wang <runminw@codeaurora.org>
2018-01-19 14:39:15 -08:00
Thomas Gleixner
5a3e4b399e sysfs/cpu: Add vulnerability folder
commit 87590ce6e373d1a5401f6539f0c59ef92dd924a9 upstream.

As the meltdown/spectre problem affects several CPU architectures, it makes
sense to have common way to express whether a system is affected by a
particular vulnerability or not. If affected the way to express the
mitigation should be common as well.

Create /sys/devices/system/cpu/vulnerabilities folder and files for
meltdown, spectre_v1 and spectre_v2.

Allow architectures to override the show function.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Linus Torvalds <torvalds@linuxfoundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Link: https://lkml.kernel.org/r/20180107214913.096657732@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-17 09:45:27 +01:00
Runmin Wang
253c6dff4b Merge remote-tracking branch 'remotes/origin/tmp-39dae59' into msm-next
* remotes/msm-4.9/tmp-39dae59:
  Linux 4.14-rc8
  x86/module: Detect and skip invalid relocations
  objtool: Prevent GCC from merging annotate_unreachable(), take 2
  Revert "x86/mm: Stop calling leave_mm() in idle code"
  Documentation: Add Frank Rowand to list of enforcement statement endorsers
  doc: add Willy Tarreau to the list of enforcement statement endorsers
  tools/headers: Synchronize kernel ABI headers
  objtool: Resync objtool's instruction decoder source code copy with the kernel's latest version
  Input: sparse-keymap - send sync event for KE_SW/KE_VSW
  Input: ar1021_i2c - set INPUT_PROP_DIRECT
  arch/tile: Implement ->set_state_oneshot_stopped()
  Update MIPS email addresses
  x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo
  mm, swap: fix race between swap count continuation operations
  mm/huge_memory.c: deposit page table when copying a PMD migration entry
  initramfs: fix initramfs rebuilds w/ compression after disabling
  fs/hugetlbfs/inode.c: fix hwpoison reserve accounting
  ocfs2: fstrim: Fix start offset of first cluster group during fstrim
  mm, /proc/pid/pagemap: fix soft dirty marking for PMD migration entry
  userfaultfd: hugetlbfs: prevent UFFDIO_COPY to fill beyond the end of i_size
  Documentation: Add Tim Bird to list of enforcement statement endorsers
  net: systemport: Correct IPG length settings
  tcp: do not mangle skb->cb[] in tcp_make_synack()
  fib: fib_dump_info can no longer use __in_dev_get_rtnl
  stmmac: use of_property_read_u32 instead of read_u8
  net_sched: hold netns refcnt for each action
  net_sched: acquire RTNL in tc_action_net_exit()
  powerpc/perf: Fix core-imc hotplug callback failure during imc initialization
  Kbuild: don't pass "-C" to preprocessor when processing linker scripts
  Revert "x86: do not use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz""
  arm64: ensure __dump_instr() checks addr_limit
  KVM: x86: Update APICv on APIC reset
  KVM: VMX: Do not fully reset PI descriptor on vCPU reset
  kvm: Return -ENODEV from update_persistent_clock
  futex: futex_wake_op, do not fail on invalid op
  MIPS: Update email address for Marcin Nowakowski
  License cleanup: add SPDX license identifier to uapi header files with a license
  License cleanup: add SPDX license identifier to uapi header files with no license
  License cleanup: add SPDX GPL-2.0 license identifier to files with no license
  KEYS: fix out-of-bounds read during ASN.1 parsing
  KEYS: trusted: fix writing past end of buffer in trusted_read()
  KEYS: return full count in keyring_read() if buffer is too small
  net: vrf: correct FRA_L3MDEV encode type
  tcp_nv: fix division by zero in tcpnv_acked()
  drm/amdgpu: allow harvesting check for Polaris VCE
  drm/amdgpu: return -ENOENT from uvd 6.0 early init for harvesting
  ARM: add debug ".edata_real" symbol
  MIPS: smp-cmp: Fix vpe_id build error
  MAINTAINERS: Update Pistachio platform maintainers
  MIPS: smp-cmp: Use right include for task_struct
  signal: Fix name of SIGEMT in #if defined() check
  MIPS: Update Goldfish RTC driver maintainer email address
  MIPS: Update RINT emulation maintainer email address
  MIPS: CPS: Fix use of current_cpu_data in preemptible code
  x86/mcelog: Get rid of RCU remnants
  watchdog/hardlockup/perf: Use atomics to track in-use cpu counter
  watchdog/harclockup/perf: Revert a33d44843d ("watchdog/hardlockup/perf: Simplify deferred event destroy")
  ARM: 8716/1: pass endianness info to sparse
  drm/i915: Check incoming alignment for unfenced buffers (on i915gm)
  x86/mm: fix use-after-free of vma during userfaultfd fault
  ide:ide-cd: fix kernel panic resulting from missing scsi_req_init
  mmc: dw_mmc: Fix the DTO timeout calculation
  tcp: fix tcp_mtu_probe() vs highest_sack
  ipv6: addrconf: increment ifp refcount before ipv6_del_addr()
  tun/tap: sanitize TUNSETSNDBUF input
  mlxsw: i2c: Fix buffer increment counter for write transaction
  netfilter: nf_reject_ipv4: Fix use-after-free in send_reset
  futex: Fix more put_pi_state() vs. exit_pi_state_list() races
  powerpc/kprobes: Dereference function pointers only if the address does not belong to kernel text
  Revert "powerpc64/elfv1: Only dereference function descriptor for non-text symbols"
  mlxsw: reg: Add high and low temperature thresholds
  MAINTAINERS: Remove Yotam from mlxfw
  MAINTAINERS: Update Yotam's E-mail
  net: hns: set correct return value
  net: lapbether: fix double free
  bpf: remove SK_REDIRECT from UAPI
  net: phy: marvell: Only configure RGMII delays when using RGMII
  MIPS: SMP: Fix deadlock & online race
  MIPS: bpf: Fix a typo in build_one_insn()
  MIPS: microMIPS: Fix incorrect mask in insn_table_MM
  MIPS: Fix CM region target definitions
  MIPS: generic: Fix compilation error from include asm/mips-cpc.h
  MIPS: Fix exception entry when CONFIG_EVA enabled
  irqchip/irq-mvebu-gicp: Add missing spin_lock init
  drm/nouveau/kms/nv50: use the correct state for base channel notifier setup
  MIPS: generic: Fix NI 169445 its build
  Update MIPS email addresses
  tile: pass machine size to sparse
  selftests: lib.mk: print individual test results to console by default
  RDMA/nldev: Enforce device index check for port callback
  Revert "PM / QoS: Fix device resume latency PM QoS"
  Revert "PM / QoS: Fix default runtime_pm device resume latency"
  scsi: qla2xxx: Fix oops in qla2x00_probe_one error path
  xfrm: Fix GSO for IPsec with GRE tunnel.
  ALSA: seq: Fix nested rwsem annotation for lockdep splat
  ALSA: timer: Add missing mutex lock for compat ioctls
  tc-testing: fix arg to ip command: -s -> -n
  net_sched: remove tcf_block_put_deferred()
  l2tp: hold tunnel in pppol2tp_connect()
  drm/i915: Hold rcu_read_lock when iterating over the radixtree (vma idr)
  drm/i915: Hold rcu_read_lock when iterating over the radixtree (objects)
  drm/i915/edp: read edp display control registers unconditionally
  drm/i915: Do not rely on wm preservation for ILK watermarks
  drm/i915: Cancel the modeset retry work during modeset cleanup
  Mark 'ioremap_page_range()' as possibly sleeping
  nvme: Fix setting logical block format when revalidating
  mmc: dw_mmc: Add locking to the CTO timer
  mmc: dw_mmc: Fix the CTO timeout calculation
  mmc: dw_mmc: cancel the CTO timer after a voltage switch
  perf/cgroup: Fix perf cgroup hierarchy support
  PM / QoS: Fix default runtime_pm device resume latency
  Revert "ath10k: fix napi_poll budget overflow"
  ath10k: rebuild crypto header in rx data frames
  cifs: check MaxPathNameComponentLength != 0 before using it
  KVM: arm/arm64: vgic-its: Check GITS_BASER Valid bit before saving tables
  KVM: arm/arm64: vgic-its: Check CBASER/BASER validity before enabling the ITS
  KVM: arm/arm64: vgic-its: Fix vgic_its_restore_collection_table returned value
  KVM: arm/arm64: vgic-its: Fix return value for device table restore
  efi/libstub: arm: omit sorting of the UEFI memory map
  perf tools: Unwind properly location after REJECT
  virtio_blk: Fix an SG_IO regression
  wcn36xx: Remove unnecessary rcu_read_unlock in wcn36xx_bss_info_changed
  ARM: dts: mvebu: pl310-cache disable double-linefill
  xfrm: Clear sk_dst_cache when applying per-socket policy.
  perf symbols: Fix memory corruption because of zero length symbols
  powerpc/64s/radix: Fix preempt imbalance in TLB flush
  netfilter: nft_set_hash: disable fast_ops for 2-len keys
  powerpc: Fix check for copy/paste instructions in alignment handler
  powerpc/perf: Fix IMC allocation routine
  xfrm: Fix xfrm_dst_cache memleak
  ARM: 8715/1: add a private asm/unaligned.h
  clk: uniphier: fix clock data for PXs3
  Documentation: Add my name to kernel enforcement statement
  nvme-rdma: fix possible hang when issuing commands during ctrl removal
  arm/arm64: kvm: Disable branch profiling in HYP code
  arm/arm64: kvm: Move initialization completion message
  arm/arm64: KVM: set right LR register value for 32 bit guest when inject abort
  Documentation: kernel-enforcement-statement.rst: proper sort names
  ASoC: rt5616: fix 0x91 default value
  Documentation: Add Arm Ltd to kernel-enforcement-statement.rst
  arm64: dts: uniphier: add STDMAC clock to EHCI nodes
  ARM: dts: uniphier: add STDMAC clock to EHCI nodes
  mmc: renesas_sdhi: fix kernel panic in _internal_dmac.c
  mmc: tmio: fix swiotlb buffer is full
  Documentation: kernel-enforcement-statement.rst: Remove Red Hat markings
  Documentation: Add myself to the enforcement statement list
  Documentation: Sign kernel enforcement statement
  Add ack for Trond Myklebust to the enforcement statement
  Documentation: update kernel enforcement support list
  Documentation: add my name to supporters
  ASoC: rt5659: connect LOUT Amp with Charge Pump
  ASoC: rt5659: register power bit of LOUT Amp
  KVM: arm64: its: Fix missing dynamic allocation check in scan_its_table
  crypto: x86/chacha20 - satisfy stack validation 2.0
  ASoC: rt5663: Change the dev getting function in rt5663_irq
  ASoC: rt5514: Revert Hotword Model control
  ASoC: topology: Fix a potential memory leak in 'soc_tplg_dapm_widget_denum_create()'
  ASoC: topology: Fix a potential NULL pointer dereference in 'soc_tplg_dapm_widget_denum_create()'
  ASoC: rt5514-spi: check irq status to schedule data copy
  ASoC: adau17x1: Workaround for noise bug in ADC

  Conflicts:
	drivers/gpu/drm/msm/Makefile
	drivers/soc/qcom/Makefile
	drivers/staging/android/ion/Makefile
	include/linux/coresight-stm.h
	include/trace/events/kmem.h

Change-Id: I01f1779762b652b9213924caa3d54f29cf03d285
Signed-off-by: Runmin Wang <runminw@codeaurora.org>
2017-11-06 11:37:20 -08:00
Greg Kroah-Hartman
b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Amit Pundir
c2461bc0a4 ANDROID: idle_notifier: Add generic idle notifiers
AOSP Change-ID: Idf29cda15be151f494ff245933c12462643388d5
moved x86_64 idle notifiers as generic so that they can
be used in interactive governor.

Upstream change 8e7a7ee9dd ("x86/idle: Remove idle_notifier")
removed x86_64 idle notifiers altogether. This patch add
generic idle notifiers again.

Fixes: android-4.9 commit bfd2a547fc17 ("ANDROID: ARM: Call idle notifiers")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2017-07-17 10:35:21 +05:30
Thomas Gleixner
fc8dffd379 cpu/hotplug: Convert hotplug locking to percpu rwsem
There are no more (known) nested calls to get_online_cpus() and all
observed lock ordering problems have been addressed.

Replace the magic nested 'rwsem' hackery with a percpu-rwsem.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170524081549.447014063@linutronix.de
2017-05-26 10:10:46 +02:00
Thomas Gleixner
ade3f680a7 cpu/hotplug: Provide lockdep_assert_cpus_held()
Provide a stub function which can be used in places where existing
get_online_cpus() calls are moved to call sites.

This stub is going to be filled by the final conversion of the hotplug
locking mechanism to a percpu rwsem.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170524081547.161282442@linutronix.de
2017-05-26 10:10:35 +02:00
Thomas Gleixner
8f553c498e cpu/hotplug: Provide cpus_read|write_[un]lock()
The counting 'rwsem' hackery of get|put_online_cpus() is going to be
replaced by percpu rwsem.

Rename the functions to make it clear that it's locking and not some
refcount style interface. These new functions will be used for the
preparatory patches which make the code ready for the percpu rwsem
conversion.

Rename all instances in the cpu hotplug code while at it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170524081547.080397752@linutronix.de
2017-05-26 10:10:34 +02:00
Ingo Molnar
1777e46355 sched/headers: Prepare to move _init() prototypes from <linux/sched.h> to <linux/sched/init.h>
But first introduce a trivial header and update usage sites.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-03-02 08:42:40 +01:00
Thomas Gleixner
530e9b76ae cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions
hotcpu_notifier(), cpu_notifier(), __hotcpu_notifier(), __cpu_notifier(),
register_hotcpu_notifier(), register_cpu_notifier(),
__register_hotcpu_notifier(), __register_cpu_notifier(),
unregister_hotcpu_notifier(), unregister_cpu_notifier(),
__unregister_hotcpu_notifier(), __unregister_cpu_notifier()

are unused now. Remove them and all related code.

Remove also the now pointless cpu notifier error injection mechanism. The
states can be executed step by step and error rollback is the same as cpu
down, so any state transition can be tested w/o requiring the notifier
error injection.

Some CPU hotplug states are kept as they are (ab)used for hotplug state
tracking.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20161221192112.005642358@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-12-25 10:47:43 +01:00
Linus Torvalds
7b9dc3f75f Merge tag 'pm-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management updates from Rafael Wysocki:
 "Again, cpufreq gets more changes than the other parts this time (one
  new driver, one old driver less, a bunch of enhancements of the
  existing code, new CPU IDs, fixes, cleanups)

  There also are some changes in cpuidle (idle injection rework, a
  couple of new CPU IDs, online/offline rework in intel_idle, fixes and
  cleanups), in the generic power domains framework (mostly related to
  supporting power domains containing CPUs), and in the Operating
  Performance Points (OPP) library (mostly related to supporting devices
  with multiple voltage regulators)

  In addition to that, the system sleep state selection interface is
  modified to make it easier for distributions with unchanged user space
  to support suspend-to-idle as the default system suspend method, some
  issues are fixed in the PM core, the latency tolerance PM QoS
  framework is improved a bit, the Intel RAPL power capping driver is
  cleaned up and there are some fixes and cleanups in the devfreq
  subsystem

  Specifics:

   - New cpufreq driver for Broadcom STB SoCs and a Device Tree binding
     for it (Markus Mayer)

   - Support for ARM Integrator/AP and Integrator/CP in the generic DT
     cpufreq driver and elimination of the old Integrator cpufreq driver
     (Linus Walleij)

   - Support for the zx296718, r8a7743 and r8a7745, Socionext UniPhier,
     and PXA SoCs in the the generic DT cpufreq driver (Baoyou Xie,
     Geert Uytterhoeven, Masahiro Yamada, Robert Jarzmik)

   - cpufreq core fix to eliminate races that may lead to using inactive
     policy objects and related cleanups (Rafael Wysocki)

   - cpufreq schedutil governor update to make it use SCHED_FIFO kernel
     threads (instead of regular workqueues) for doing delayed work (to
     reduce the response latency in some cases) and related cleanups
     (Viresh Kumar)

   - New cpufreq sysfs attribute for resetting statistics (Markus Mayer)

   - cpufreq governors fixes and cleanups (Chen Yu, Stratos Karafotis,
     Viresh Kumar)

   - Support for using generic cpufreq governors in the intel_pstate
     driver (Rafael Wysocki)

   - Support for per-logical-CPU P-state limits and the EPP/EPB (Energy
     Performance Preference/Energy Performance Bias) knobs in the
     intel_pstate driver (Srinivas Pandruvada)

   - New CPU ID for Knights Mill in intel_pstate (Piotr Luc)

   - intel_pstate driver modification to use the P-state selection
     algorithm based on CPU load on platforms with the system profile in
     the ACPI tables set to "mobile" (Srinivas Pandruvada)

   - intel_pstate driver cleanups (Arnd Bergmann, Rafael Wysocki,
     Srinivas Pandruvada)

   - cpufreq powernv driver updates including fast switching support
     (for the schedutil governor), fixes and cleanus (Akshay Adiga,
     Andrew Donnellan, Denis Kirjanov)

   - acpi-cpufreq driver rework to switch it over to the new CPU
     offline/online state machine (Sebastian Andrzej Siewior)

   - Assorted cleanups in cpufreq drivers (Wei Yongjun, Prashanth
     Prakash)

   - Idle injection rework (to make it use the regular idle path instead
     of a home-grown custom one) and related powerclamp thermal driver
     updates (Peter Zijlstra, Jacob Pan, Petr Mladek, Sebastian Andrzej
     Siewior)

   - New CPU IDs for Atom Z34xx and Knights Mill in intel_idle (Andy
     Shevchenko, Piotr Luc)

   - intel_idle driver cleanups and switch over to using the new CPU
     offline/online state machine (Anna-Maria Gleixner, Sebastian
     Andrzej Siewior)

   - cpuidle DT driver update to support suspend-to-idle properly
     (Sudeep Holla)

   - cpuidle core cleanups and misc updates (Daniel Lezcano, Pan Bian,
     Rafael Wysocki)

   - Preliminary support for power domains including CPUs in the generic
     power domains (genpd) framework and related DT bindings (Lina Iyer)

   - Assorted fixes and cleanups in the generic power domains (genpd)
     framework (Colin Ian King, Dan Carpenter, Geert Uytterhoeven)

   - Preliminary support for devices with multiple voltage regulators
     and related fixes and cleanups in the Operating Performance Points
     (OPP) library (Viresh Kumar, Masahiro Yamada, Stephen Boyd)

   - System sleep state selection interface rework to make it easier to
     support suspend-to-idle as the default system suspend method
     (Rafael Wysocki)

   - PM core fixes and cleanups, mostly related to the interactions
     between the system suspend and runtime PM frameworks (Ulf Hansson,
     Sahitya Tummala, Tony Lindgren)

   - Latency tolerance PM QoS framework imorovements (Andrew Lutomirski)

   - New Knights Mill CPU ID for the Intel RAPL power capping driver
     (Piotr Luc)

   - Intel RAPL power capping driver fixes, cleanups and switch over to
     using the new CPU offline/online state machine (Jacob Pan, Thomas
     Gleixner, Sebastian Andrzej Siewior)

   - Fixes and cleanups in the exynos-ppmu, exynos-nocp, rk3399_dmc,
     rockchip-dfi devfreq drivers and the devfreq core (Axel Lin,
     Chanwoo Choi, Javier Martinez Canillas, MyungJoo Ham, Viresh Kumar)

   - Fix for false-positive KASAN warnings during resume from ACPI S3
     (suspend-to-RAM) on x86 (Josh Poimboeuf)

   - Memory map verification during resume from hibernation on x86 to
     ensure a consistent address space layout (Chen Yu)

   - Wakeup sources debugging enhancement (Xing Wei)

   - rockchip-io AVS driver cleanup (Shawn Lin)"

* tag 'pm-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (127 commits)
  devfreq: rk3399_dmc: Don't use OPP structures outside of RCU locks
  devfreq: rk3399_dmc: Remove dangling rcu_read_unlock()
  devfreq: exynos: Don't use OPP structures outside of RCU locks
  Documentation: intel_pstate: Document HWP energy/performance hints
  cpufreq: intel_pstate: Support for energy performance hints with HWP
  cpufreq: intel_pstate: Add locking around HWP requests
  PM / sleep: Print active wakeup sources when blocking on wakeup_count reads
  PM / core: Fix bug in the error handling of async suspend
  PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend
  PM / Domains: Fix compatible for domain idle state
  PM / OPP: Don't WARN on multiple calls to dev_pm_opp_set_regulators()
  PM / OPP: Allow platform specific custom set_opp() callbacks
  PM / OPP: Separate out _generic_set_opp()
  PM / OPP: Add infrastructure to manage multiple regulators
  PM / OPP: Pass struct dev_pm_opp_supply to _set_opp_voltage()
  PM / OPP: Manage supply's voltage/current in a separate structure
  PM / OPP: Don't use OPP structure outside of rcu protected section
  PM / OPP: Reword binding supporting multiple regulators per device
  PM / OPP: Fix incorrect cpu-supply property in binding
  cpuidle: Add a kerneldoc comment to cpuidle_use_deepest_state()
  ..
2016-12-13 10:41:53 -08:00
Michal Hocko
777c6e0dae hotplug: Make register and unregister notifier API symmetric
Yu Zhao has noticed that __unregister_cpu_notifier only unregisters its
notifiers when HOTPLUG_CPU=y while the registration might succeed even
when HOTPLUG_CPU=n if MODULE is enabled. This means that e.g. zswap
might keep a stale notifier on the list on the manual clean up during
the pool tear down and thus corrupt the list. Resulting in the following

[  144.964346] BUG: unable to handle kernel paging request at ffff880658a2be78
[  144.971337] IP: [<ffffffffa290b00b>] raw_notifier_chain_register+0x1b/0x40
<snipped>
[  145.122628] Call Trace:
[  145.125086]  [<ffffffffa28e5cf8>] __register_cpu_notifier+0x18/0x20
[  145.131350]  [<ffffffffa2a5dd73>] zswap_pool_create+0x273/0x400
[  145.137268]  [<ffffffffa2a5e0fc>] __zswap_param_set+0x1fc/0x300
[  145.143188]  [<ffffffffa2944c1d>] ? trace_hardirqs_on+0xd/0x10
[  145.149018]  [<ffffffffa2908798>] ? kernel_param_lock+0x28/0x30
[  145.154940]  [<ffffffffa2a3e8cf>] ? __might_fault+0x4f/0xa0
[  145.160511]  [<ffffffffa2a5e237>] zswap_compressor_param_set+0x17/0x20
[  145.167035]  [<ffffffffa2908d3c>] param_attr_store+0x5c/0xb0
[  145.172694]  [<ffffffffa290848d>] module_attr_store+0x1d/0x30
[  145.178443]  [<ffffffffa2b2b41f>] sysfs_kf_write+0x4f/0x70
[  145.183925]  [<ffffffffa2b2a5b9>] kernfs_fop_write+0x149/0x180
[  145.189761]  [<ffffffffa2a99248>] __vfs_write+0x18/0x40
[  145.194982]  [<ffffffffa2a9a412>] vfs_write+0xb2/0x1a0
[  145.200122]  [<ffffffffa2a9a732>] SyS_write+0x52/0xa0
[  145.205177]  [<ffffffffa2ff4d97>] entry_SYSCALL_64_fastpath+0x12/0x17

This can be even triggered manually by changing
/sys/module/zswap/parameters/compressor multiple times.

Fix this issue by making unregister APIs symmetric to the register so
there are no surprises.

Fixes: 47e627bc8c ("[PATCH] hotplug: Allow modules to use the cpu hotplug notifiers even if !CONFIG_HOTPLUG_CPU")
Reported-and-tested-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Cc: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Streetman <ddstreet@ieee.org>
Link: http://lkml.kernel.org/r/20161207135438.4310-1-mhocko@kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-12-08 10:08:41 +01:00
Peter Zijlstra
c1de45ca83 sched/idle: Add support for tasks that inject idle
Idle injection drivers such as Intel powerclamp and ACPI PAD drivers use
realtime tasks to take control of CPU then inject idle. There are two
issues with this approach:

 1. Low efficiency: injected idle task is treated as busy so sched ticks
    do not stop during injected idle period, the result of these
    unwanted wakeups can be ~20% loss in power savings.

 2. Idle accounting: injected idle time is presented to user as busy.

This patch addresses the issues by introducing a new PF_IDLE flag which
allows any given task to be treated as idle task while the flag is set.
Therefore, idle injection tasks can run through the normal flow of NOHZ
idle enter/exit to get the correct accounting as well as tick stop when
possible.

The implication is that idle task is then no longer limited to PID == 0.

Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-11-29 14:02:21 +01:00
Chris Metcalf
6727ad9e20 nmi_backtrace: generate one-line reports for idle cpus
When doing an nmi backtrace of many cores, most of which are idle, the
output is a little overwhelming and very uninformative.  Suppress
messages for cpus that are idling when they are interrupted and just
emit one line, "NMI backtrace for N skipped: idling at pc 0xNNN".

We do this by grouping all the cpuidle code together into a new
.cpuidle.text section, and then checking the address of the interrupted
PC to see if it lies within that section.

This commit suitably tags x86 and tile idle routines, and only adds in
the minimal framework for other architectures.

Link: http://lkml.kernel.org/r/1472487169-14923-5-git-send-email-cmetcalf@mellanox.com
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org> [arm]
Tested-by: Petr Mladek <pmladek@suse.com>
Cc: Aaron Tomlin <atomlin@redhat.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-07 18:46:30 -07:00
Linus Torvalds
597f03f9d1 Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull CPU hotplug updates from Thomas Gleixner:
 "Yet another batch of cpu hotplug core updates and conversions:

   - Provide core infrastructure for multi instance drivers so the
     drivers do not have to keep custom lists.

   - Convert custom lists to the new infrastructure. The block-mq custom
     list conversion comes through the block tree and makes the diffstat
     tip over to more lines removed than added.

   - Handle unbalanced hotplug enable/disable calls more gracefully.

   - Remove the obsolete CPU_STARTING/DYING notifier support.

   - Convert another batch of notifier users.

   The relayfs changes which conflicted with the conversion have been
   shipped to me by Andrew.

   The remaining lot is targeted for 4.10 so that we finally can remove
   the rest of the notifiers"

* 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits)
  cpufreq: Fix up conversion to hotplug state machine
  blk/mq: Reserve hotplug states for block multiqueue
  x86/apic/uv: Convert to hotplug state machine
  s390/mm/pfault: Convert to hotplug state machine
  mips/loongson/smp: Convert to hotplug state machine
  mips/octeon/smp: Convert to hotplug state machine
  fault-injection/cpu: Convert to hotplug state machine
  padata: Convert to hotplug state machine
  cpufreq: Convert to hotplug state machine
  ACPI/processor: Convert to hotplug state machine
  virtio scsi: Convert to hotplug state machine
  oprofile/timer: Convert to hotplug state machine
  block/softirq: Convert to hotplug state machine
  lib/irq_poll: Convert to hotplug state machine
  x86/microcode: Convert to hotplug state machine
  sh/SH-X3 SMP: Convert to hotplug state machine
  ia64/mca: Convert to hotplug state machine
  ARM/OMAP/wakeupgen: Convert to hotplug state machine
  ARM/shmobile: Convert to hotplug state machine
  arm64/FP/SIMD: Convert to hotplug state machine
  ...
2016-10-03 19:43:08 -07:00
Thomas Gleixner
ee1e714b94 cpu/hotplug: Remove CPU_STARTING and CPU_DYING notifier
All users are converted to state machine, remove CPU_STARTING and the
corresponding CPU_DYING.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160818125731.27256-2-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-09-06 18:30:19 +02:00
James Morse
d391e55229 cpu/hotplug: Allow suspend/resume CPU to be specified
disable_nonboot_cpus() assumes that the lowest numbered online CPU is
the boot CPU, and that this is the correct CPU to run any power
management code on.

On x86 this is always correct, as CPU0 cannot (easily) by taken offline.

On arm64 CPU0 can be taken offline. For hibernate/resume this means we
may hibernate on a CPU other than CPU0. If the system is rebooted with
kexec 'CPU0' will be assigned to a different physical CPU. This
complicates hibernate/resume as now we can't trust the CPU numbers.
Arch code can find the correct physical CPU, and ensure it is online
before resume from hibernate begins, but also needs to influence
disable_nonboot_cpus()s choice of CPU.

Rename disable_nonboot_cpus() as freeze_secondary_cpus() and add an
argument indicating which CPU should be left standing. Follow the logic
in migrate_to_reboot_cpu() to use the lowest numbered online CPU if the
requested CPU is not online.
Add disable_nonboot_cpus() as an inline function that has the existing
behaviour.

Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2016-08-26 11:20:11 +01:00
Thomas Gleixner
7ee681b252 workqueue: Convert to state machine callbacks
Get rid of the prio ordering of the separate notifiers and use a proper state
callback pair.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153335.197083890@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 09:34:43 +02:00
Thomas Gleixner
89ab9cb169 perf/core: Remove perf CPU notifier code
All users converted to state machine callbacks.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153335.115333381@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 09:34:42 +02:00
Thomas Gleixner
f2785ddb53 sched/hotplug: Move migration CPU_DYING to sched_cpu_dying()
Remove the hotplug notifier and make it an explicit state.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160310120025.502222097@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-05-06 14:58:25 +02:00
Thomas Gleixner
40190a78f8 sched/hotplug: Convert cpu_[in]active notifiers to state machine
Now that we reduced everything into single notifiers, it's simple to move them
into the hotplug state machine space.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: rt@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-05-06 14:58:24 +02:00
Thomas Gleixner
135fb3e197 sched: Consolidate the notifier maze
We can maintain the ordering of the scheduler cpu hotplug functionality nicely
in one notifer. Get rid of the maze.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: rt@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-05-06 14:58:23 +02:00