1. 25 Jun, 2019 21 commits
    • Mike Marciniszyn's avatar
      IB/hfi1: Silence txreq allocation warnings · 303386b3
      Mike Marciniszyn authored
      commit 3230f4a8 upstream.
      
      The following warning can happen when a memory shortage
      occurs during txreq allocation:
      
      [10220.939246] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
      [10220.939246] Hardware name: Intel Corporation S2600WT2R/S2600WT2R, BIOS SE5C610.86B.01.01.0018.C4.072020161249 07/20/2016
      [10220.939247]   cache: mnt_cache, object size: 384, buffer size: 384, default order: 2, min order: 0
      [10220.939260] Workqueue: hfi0_0 _hfi1_do_send [hfi1]
      [10220.939261]   node 0: slabs: 1026568, objs: 43115856, free: 0
      [10220.939262] Call Trace:
      [10220.939262]   node 1: slabs: 820872, objs: 34476624, free: 0
      [10220.939263]  dump_stack+0x5a/0x73
      [10220.939265]  warn_alloc+0x103/0x190
      [10220.939267]  ? wake_all_kswapds+0x54/0x8b
      [10220.939268]  __alloc_pages_slowpath+0x86c/0xa2e
      [10220.939270]  ? __alloc_pages_nodemask+0x2fe/0x320
      [10220.939271]  __alloc_pages_nodemask+0x2fe/0x320
      [10220.939273]  new_slab+0x475/0x550
      [10220.939275]  ___slab_alloc+0x36c/0x520
      [10220.939287]  ? hfi1_make_rc_req+0x90/0x18b0 [hfi1]
      [10220.939299]  ? __get_txreq+0x54/0x160 [hfi1]
      [10220.939310]  ? hfi1_make_rc_req+0x90/0x18b0 [hfi1]
      [10220.939312]  __slab_alloc+0x40/0x61
      [10220.939323]  ? hfi1_make_rc_req+0x90/0x18b0 [hfi1]
      [10220.939325]  kmem_cache_alloc+0x181/0x1b0
      [10220.939336]  hfi1_make_rc_req+0x90/0x18b0 [hfi1]
      [10220.939348]  ? hfi1_verbs_send_dma+0x386/0xa10 [hfi1]
      [10220.939359]  ? find_prev_entry+0xb0/0xb0 [hfi1]
      [10220.939371]  hfi1_do_send+0x1d9/0x3f0 [hfi1]
      [10220.939372]  process_one_work+0x171/0x380
      [10220.939374]  worker_thread+0x49/0x3f0
      [10220.939375]  kthread+0xf8/0x130
      [10220.939377]  ? max_active_store+0x80/0x80
      [10220.939378]  ? kthread_bind+0x10/0x10
      [10220.939379]  ret_from_fork+0x35/0x40
      [10220.939381] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
      
      The shortage is handled properly so the message isn't needed. Silence by
      adding the no warn option to the slab allocation.
      
      Fixes: 45842abb ("staging/rdma/hfi1: move txreq header code")
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      303386b3
    • Kaike Wan's avatar
      IB/hfi1: Validate fault injection opcode user input · 7cc9c993
      Kaike Wan authored
      commit 5f90677e upstream.
      
      The opcode range for fault injection from user should be validated before
      it is applied to the fault->opcodes[] bitmap to avoid out-of-bound
      error.
      
      Cc: <stable@vger.kernel.org>
      Fixes: a74d5307 ("IB/hfi1: Rework fault injection machinery")
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarKaike Wan <kaike.wan@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7cc9c993
    • Mathias Nyman's avatar
      usb: xhci: Don't try to recover an endpoint if port is in error state. · 17027034
      Mathias Nyman authored
      commit b8c3b718 upstream.
      
      A USB3 device needs to be reset and re-enumarated if the port it
      connects to goes to a error state, with link state inactive.
      
      There is no use in trying to recover failed transactions by resetting
      endpoints at this stage. Tests show that in rare cases, after multiple
      endpoint resets of a roothub port the whole host controller might stop
      completely.
      
      Several retries to recover from transaction error can happen as
      it can take a long time before the hub thread discovers the USB3
      port error and inactive link.
      
      We can't reliably detect the port error from slot or endpoint context
      due to a limitation in xhci, see xhci specs section 4.8.3:
      "There are several cases where the EP State field in the Output
      Endpoint Context may not reflect the current state of an endpoint"
      and
      "Software should maintain an accurate value for EP State, by tracking it
      with an internal variable that is driven by Events and Doorbell accesses"
      
      Same appears to be true for slot state.
      
      set a flag to the corresponding slot if a USB3 roothub port link goes
      inactive to prevent both queueing new URBs and resetting endpoints.
      Reported-by: default avatarRapolu Chiranjeevi <chiranjeevi.rapolu@intel.com>
      Tested-by: default avatarRapolu Chiranjeevi <chiranjeevi.rapolu@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      17027034
    • Mathias Nyman's avatar
      xhci: detect USB 3.2 capable host controllers correctly · d606a82c
      Mathias Nyman authored
      commit ddd57980 upstream.
      
      USB 3.2 capability in a host can be detected from the
      xHCI Supported Protocol Capability major and minor revision fields.
      
      If major is 0x3 and minor 0x20 then the host is USB 3.2 capable.
      
      For USB 3.2 capable hosts set the root hub lane count to 2.
      
      The Major Revision and Minor Revision fields contain a BCD version number.
      The value of the Major Revision field is JJh and the value of the Minor
      Revision field is MNh for version JJ.M.N, where JJ = major revision number,
      M - minor version number, N = sub-minor version number,
      e.g. version 3.1 is represented with a value of 0310h.
      
      Also fix the extra whitespace printed out when announcing regular
      SuperSpeed hosts.
      
      Cc: <stable@vger.kernel.org> # v4.18+
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d606a82c
    • Peter Chen's avatar
      usb: chipidea: udc: workaround for endpoint conflict issue · e6563039
      Peter Chen authored
      commit c19dffc0 upstream.
      
      An endpoint conflict occurs when the USB is working in device mode
      during an isochronous communication. When the endpointA IN direction
      is an isochronous IN endpoint, and the host sends an IN token to
      endpointA on another device, then the OUT transaction may be missed
      regardless the OUT endpoint number. Generally, this occurs when the
      device is connected to the host through a hub and other devices are
      connected to the same hub.
      
      The affected OUT endpoint can be either control, bulk, isochronous, or
      an interrupt endpoint. After the OUT endpoint is primed, if an IN token
      to the same endpoint number on another device is received, then the OUT
      endpoint may be unprimed (cannot be detected by software), which causes
      this endpoint to no longer respond to the host OUT token, and thus, no
      corresponding interrupt occurs.
      
      There is no good workaround for this issue, the only thing the software
      could do is numbering isochronous IN from the highest endpoint since we
      have observed most of device number endpoint from the lowest.
      
      Cc: <stable@vger.kernel.org> #v3.14+
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Cc: Jun Li <jun.li@nxp.com>
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e6563039
    • Stanley Chu's avatar
      scsi: ufs: Avoid runtime suspend possibly being blocked forever · 0746b2f5
      Stanley Chu authored
      commit 24e2e7a1 upstream.
      
      UFS runtime suspend can be triggered after pm_runtime_enable() is invoked
      in ufshcd_pltfrm_init(). However if the first runtime suspend is triggered
      before binding ufs_hba structure to ufs device structure via
      platform_set_drvdata(), then UFS runtime suspend will be no longer
      triggered in the future because its dev->power.runtime_error was set in the
      first triggering and does not have any chance to be cleared.
      
      To be more clear, dev->power.runtime_error is set if hba is NULL in
      ufshcd_runtime_suspend() which returns -EINVAL to rpm_callback() where
      dev->power.runtime_error is set as -EINVAL. In this case, any future
      rpm_suspend() for UFS device fails because rpm_check_suspend_allowed()
      fails due to non-zero
      dev->power.runtime_error.
      
      To resolve this issue, make sure the first UFS runtime suspend get valid
      "hba" in ufshcd_runtime_suspend(): Enable UFS runtime PM only after hba is
      successfully bound to UFS device structure.
      
      Fixes: 62694735 ([SCSI] ufs: Add runtime PM support for UFS host controller driver)
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarStanley Chu <stanley.chu@mediatek.com>
      Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0746b2f5
    • Ulf Hansson's avatar
      mmc: core: Prevent processing SDIO IRQs when the card is suspended · 98467b8f
      Ulf Hansson authored
      commit 83293386 upstream.
      
      Processing of SDIO IRQs must obviously be prevented while the card is
      system suspended, otherwise we may end up trying to communicate with an
      uninitialized SDIO card.
      
      Reports throughout the years shows that this is not only a theoretical
      problem, but a real issue. So, let's finally fix this problem, by keeping
      track of the state for the card and bail out before processing the SDIO
      IRQ, in case the card is suspended.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarDouglas Anderson <dianders@chromium.org>
      Tested-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      98467b8f
    • Douglas Anderson's avatar
      mmc: core: Add sdio_retune_hold_now() and sdio_retune_release() · 0349dbeb
      Douglas Anderson authored
      commit b4c9f938 upstream.
      
      We want SDIO drivers to be able to temporarily stop retuning when the
      driver knows that the SDIO card is not in a state where retuning will
      work (maybe because the card is asleep).  We'll move the relevant
      functions to a place where drivers can call them.
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0349dbeb
    • Douglas Anderson's avatar
      mmc: core: API to temporarily disable retuning for SDIO CRC errors · 7ed49e1b
      Douglas Anderson authored
      commit 0a55f4ab upstream.
      
      Normally when the MMC core sees an "-EILSEQ" error returned by a host
      controller then it will trigger a retuning of the card.  This is
      generally a good idea.
      
      However, if a command is expected to sometimes cause transfer errors
      then these transfer errors shouldn't cause a re-tuning.  This
      re-tuning will be a needless waste of time.  One example case where a
      transfer is expected to cause errors is when transitioning between
      idle (sometimes referred to as "sleep" in Broadcom code) and active
      state on certain Broadcom WiFi SDIO cards.  Specifically if the card
      was already transitioning between states when the command was sent it
      could cause an error on the SDIO bus.
      
      Let's add an API that the SDIO function drivers can call that will
      temporarily disable the auto-tuning functionality.  Then we can add a
      call to this in the Broadcom WiFi driver and any other driver that
      might have similar needs.
      
      NOTE: this makes the assumption that the card is already tuned well
      enough that it's OK to disable the auto-retuning during one of these
      error-prone situations.  Presumably the driver code performing the
      error-prone transfer knows how to recover / retry from errors.  ...and
      after we can get back to a state where transfers are no longer
      error-prone then we can enable the auto-retuning again.  If we truly
      find ourselves in a case where the card needs to be retuned sometimes
      to handle one of these error-prone transfers then we can always try a
      few transfers first without auto-retuning and then re-try with
      auto-retuning if the first few fail.
      
      Without this change on rk3288-veyron-minnie I periodically see this in
      the logs of a machine just sitting there idle:
        dwmmc_rockchip ff0d0000.dwmmc: Successfully tuned phase to XYZ
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ed49e1b
    • Raul E Rangel's avatar
      mmc: sdhci: sdhci-pci-o2micro: Correctly set bus width when tuning · 4b6d290c
      Raul E Rangel authored
      commit 0f7b79a4 upstream.
      
      The O2Micro controller only supports tuning at 4-bits. So the host driver
      needs to change the bus width while tuning and then set it back when done.
      
      There was a bug in the original implementation in that mmc->ios.bus_width
      also wasn't updated. Thus setting the incorrect blocksize in
      sdhci_send_tuning which results in a tuning failure.
      Signed-off-by: default avatarRaul E Rangel <rrangel@chromium.org>
      Fixes: 0086fc21 ("mmc: sdhci: Add support for O2 hardware tuning")
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4b6d290c
    • Harald Freudenberger's avatar
      s390/ap: rework assembler functions to use unions for in/out register variables · 4c15ded5
      Harald Freudenberger authored
      [ Upstream commit 159491f3 ]
      
      The inline assembler functions ap_aqic() and ap_qact() used two
      variables declared on the very same register. One variable was for
      input only, the other for output. Looks like newer versions of the gcc
      don't like this. Anyway it is a better coding to use one variable
      (which may have a union data type) on one register for input and
      output. So this patch introduces unions and uses only one variable now
      for input and output for GR1 for the PQAP(QACT) and PQAP(QIC)
      invocation.
      Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4c15ded5
    • Ilya Leoshkevich's avatar
      s390/jump_label: Use "jdd" constraint on gcc9 · fb48fb15
      Ilya Leoshkevich authored
      [ Upstream commit 14644852 ]
      
      [heiko.carstens@de.ibm.com]:
      -----
      Laura Abbott reported that the kernel doesn't build anymore with gcc 9,
      due to the "X" constraint. Ilya provided the gcc 9 patch "S/390:
      Introduce jdd constraint" which introduces the new "jdd" constraint
      which fixes this.
      -----
      
      The support for section anchors on S/390 introduced in gcc9 has changed
      the behavior of "X" constraint, which can now produce register
      references. Since existing constraints, in particular, "i", do not fit
      the intended use case on S/390, the new machine-specific "jdd"
      constraint was introduced. This patch makes jump labels use "jdd"
      constraint when building with gcc9.
      Reported-by: default avatarLaura Abbott <labbott@redhat.com>
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fb48fb15
    • Arnd Bergmann's avatar
      ovl: fix bogus -Wmaybe-unitialized warning · 0319ef1d
      Arnd Bergmann authored
      [ Upstream commit 1dac6f5b ]
      
      gcc gets a bit confused by the logic in ovl_setup_trap() and
      can't figure out whether the local 'trap' variable in the caller
      was initialized or not:
      
      fs/overlayfs/super.c: In function 'ovl_fill_super':
      fs/overlayfs/super.c:1333:4: error: 'trap' may be used uninitialized in this function [-Werror=maybe-uninitialized]
          iput(trap);
          ^~~~~~~~~~
      fs/overlayfs/super.c:1312:17: note: 'trap' was declared here
      
      Reword slightly to make it easier for the compiler to understand.
      
      Fixes: 146d62e5 ("ovl: detect overlapping layers")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0319ef1d
    • Miklos Szeredi's avatar
      ovl: don't fail with disconnected lower NFS · 639e8c2f
      Miklos Szeredi authored
      [ Upstream commit 9179c21d ]
      
      NFS mounts can be disconnected from fs root.  Don't fail the overlapping
      layer check because of this.
      
      The check is not authoritative anyway, since topology can change during or
      after the check.
      Reported-by: default avatarAntti Antinoja <antti@fennosys.fi>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Fixes: 146d62e5 ("ovl: detect overlapping layers")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      639e8c2f
    • Amir Goldstein's avatar
      ovl: detect overlapping layers · f1c5aa5e
      Amir Goldstein authored
      [ Upstream commit 146d62e5 ]
      
      Overlapping overlay layers are not supported and can cause unexpected
      behavior, but overlayfs does not currently check or warn about these
      configurations.
      
      User is not supposed to specify the same directory for upper and
      lower dirs or for different lower layers and user is not supposed to
      specify directories that are descendants of each other for overlay
      layers, but that is exactly what this zysbot repro did:
      
          https://syzkaller.appspot.com/x/repro.syz?x=12c7a94f400000
      
      Moving layer root directories into other layers while overlayfs
      is mounted could also result in unexpected behavior.
      
      This commit places "traps" in the overlay inode hash table.
      Those traps are dummy overlay inodes that are hashed by the layers
      root inodes.
      
      On mount, the hash table trap entries are used to verify that overlay
      layers are not overlapping.  While at it, we also verify that overlay
      layers are not overlapping with directories "in-use" by other overlay
      instances as upperdir/workdir.
      
      On lookup, the trap entries are used to verify that overlay layers
      root inodes have not been moved into other layers after mount.
      
      Some examples:
      
      $ ./run --ov --samefs -s
      ...
      ( mkdir -p base/upper/0/u base/upper/0/w base/lower lower upper mnt
        mount -o bind base/lower lower
        mount -o bind base/upper upper
        mount -t overlay none mnt ...
              -o lowerdir=lower,upperdir=upper/0/u,workdir=upper/0/w)
      
      $ umount mnt
      $ mount -t overlay none mnt ...
              -o lowerdir=base,upperdir=upper/0/u,workdir=upper/0/w
      
        [   94.434900] overlayfs: overlapping upperdir path
        mount: mount overlay on mnt failed: Too many levels of symbolic links
      
      $ mount -t overlay none mnt ...
              -o lowerdir=upper/0/u,upperdir=upper/0/u,workdir=upper/0/w
      
        [  151.350132] overlayfs: conflicting lowerdir path
        mount: none is already mounted or mnt busy
      
      $ mount -t overlay none mnt ...
              -o lowerdir=lower:lower/a,upperdir=upper/0/u,workdir=upper/0/w
      
        [  201.205045] overlayfs: overlapping lowerdir path
        mount: mount overlay on mnt failed: Too many levels of symbolic links
      
      $ mount -t overlay none mnt ...
              -o lowerdir=lower,upperdir=upper/0/u,workdir=upper/0/w
      $ mv base/upper/0/ base/lower/
      $ find mnt/0
        mnt/0
        mnt/0/w
        find: 'mnt/0/w/work': Too many levels of symbolic links
        find: 'mnt/0/u': Too many levels of symbolic links
      
      Reported-by: syzbot+9c69c282adc4edd2b540@syzkaller.appspotmail.com
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f1c5aa5e
    • Amir Goldstein's avatar
      ovl: make i_ino consistent with st_ino in more cases · a00f405e
      Amir Goldstein authored
      [ Upstream commit 6dde1e42 ]
      
      Relax the condition that overlayfs supports nfs export, to require
      that i_ino is consistent with st_ino/d_ino.
      
      It is enough to require that st_ino and d_ino are consistent.
      
      This fixes the failure of xfstest generic/504, due to mismatch of
      st_ino to inode number in the output of /proc/locks.
      
      Fixes: 12574a9f ("ovl: consistent i_ino for non-samefs with xino")
      Cc: <stable@vger.kernel.org> # v4.19
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a00f405e
    • Amir Goldstein's avatar
      ovl: fix wrong flags check in FS_IOC_FS[SG]ETXATTR ioctls · d6623379
      Amir Goldstein authored
      [ Upstream commit 941d935a ]
      
      The ioctl argument was parsed as the wrong type.
      
      Fixes: b21d9c43 ("ovl: support the FS_IOC_FS[SG]ETXATTR ioctls")
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d6623379
    • Amir Goldstein's avatar
      ovl: support the FS_IOC_FS[SG]ETXATTR ioctls · 3cb5d7fa
      Amir Goldstein authored
      [ Upstream commit b21d9c43 ]
      
      They are the extended version of FS_IOC_FS[SG]ETFLAGS ioctls.
      xfs_io -c "chattr <flags>" uses the new ioctls for setting flags.
      
      This used to work in kernel pre v4.19, before stacked file ops
      introduced the ovl_ioctl whitelist.
      Reported-by: default avatarDave Chinner <david@fromorbit.com>
      Fixes: d1d04ef8 ("ovl: stack file ops")
      Cc: <stable@vger.kernel.org> # v4.19
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3cb5d7fa
    • Linus Torvalds's avatar
      gcc-9: silence 'address-of-packed-member' warning · 76343a13
      Linus Torvalds authored
      commit 6f303d60 upstream.
      
      We already did this for clang, but now gcc has that warning too.  Yes,
      yes, the address may be unaligned.  And that's kind of the point.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76343a13
    • Allan Xavier's avatar
      objtool: Support per-function rodata sections · 6a997c3a
      Allan Xavier authored
      commit 4a60aa05 upstream.
      
      Add support for processing switch jump tables in objects with multiple
      .rodata sections, such as those created by '-ffunction-sections' and
      '-fdata-sections'.  Currently, objtool always looks in .rodata for jump
      table information, which results in many "sibling call from callable
      instruction with modified stack frame" warnings with objects compiled
      using those flags.
      
      The fix is comprised of three parts:
      
      1. Flagging all .rodata sections when importing ELF information for
         easier checking later.
      
      2. Keeping a reference to the section each relocation is from in order
         to get the list_head for the other relocations in that section.
      
      3. Finding jump tables by following relocations to .rodata sections,
         rather than always referencing a single global .rodata section.
      
      The patch has been tested without data sections enabled and no
      differences in the resulting orc unwind information were seen.
      
      Note that as objtool adds terminators to end of each .text section the
      unwind information generated between a function+data sections build and
      a normal build aren't directly comparable. Manual inspection suggests
      that objtool is now generating the correct information, or at least
      making more of an effort to do so than it did previously.
      Signed-off-by: default avatarAllan Xavier <allan.x.xavier@oracle.com>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/099bdc375195c490dda04db777ee0b95d566ded1.1536325914.git.jpoimboe@redhat.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6a997c3a
    • Miguel Ojeda's avatar
      tracing: Silence GCC 9 array bounds warning · c493ead3
      Miguel Ojeda authored
      commit 0c97bf86 upstream.
      
      Starting with GCC 9, -Warray-bounds detects cases when memset is called
      starting on a member of a struct but the size to be cleared ends up
      writing over further members.
      
      Such a call happens in the trace code to clear, at once, all members
      after and including `seq` on struct trace_iterator:
      
          In function 'memset',
              inlined from 'ftrace_dump' at kernel/trace/trace.c:8914:3:
          ./include/linux/string.h:344:9: warning: '__builtin_memset' offset
          [8505, 8560] from the object at 'iter' is out of the bounds of
          referenced subobject 'seq' with type 'struct trace_seq' at offset
          4368 [-Warray-bounds]
            344 |  return __builtin_memset(p, c, size);
                |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      In order to avoid GCC complaining about it, we compute the address
      ourselves by adding the offsetof distance instead of referring
      directly to the member.
      
      Since there are two places doing this clear (trace.c and trace_kdb.c),
      take the chance to move the workaround into a single place in
      the internal header.
      
      Link: http://lkml.kernel.org/r/20190523124535.GA12931@gmail.comSigned-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      [ Removed unnecessary parenthesis around "iter" ]
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c493ead3
  2. 22 Jun, 2019 19 commits