1. 18 Apr, 2019 9 commits
    • Nikos Tsironis's avatar
      dm snapshot: Make exception tables scalable · f79ae415
      Nikos Tsironis authored
      Use list_bl to implement the exception hash tables' buckets. This change
      permits concurrent access, to distinct buckets, by multiple threads.
      
      Also, implement helper functions to lock and unlock the exception tables
      based on the chunk number of the exception at hand.
      
      We retain the global locking, by means of down_write(), which is
      replaced by the next commit.
      
      Still, we must acquire the per-bucket spinlocks when accessing the hash
      tables, since list_bl does not allow modification on unlocked lists.
      Co-developed-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Acked-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      f79ae415
    • Nikos Tsironis's avatar
      dm snapshot: Replace mutex with rw semaphore · 4ad8d880
      Nikos Tsironis authored
      dm-snapshot uses a single mutex to serialize every access to the
      snapshot state. This includes all accesses to the complete and pending
      exception tables, which occur at every origin write, every snapshot
      read/write and every exception completion.
      
      The lock statistics indicate that this mutex is a bottleneck (average
      wait time ~480 usecs for 8 processes doing random 4K writes to the
      origin device) preventing dm-snapshot to scale as the number of threads
      doing IO increases.
      
      The major contention points are __origin_write()/snapshot_map() and
      pending_complete(), i.e., the submission and completion of pending
      exceptions.
      
      Replace this mutex with a rw semaphore.
      
      We essentially revert commit ae1093be ("dm snapshot: use mutex
      instead of rw_semaphore") and together with the next two patches we
      substitute the single mutex with a fine-grained locking scheme, where we
      use a read-write semaphore to protect the mostly read fields of the
      snapshot structure, e.g., valid, active, etc., and per-bucket bit
      spinlocks to protect accesses to the complete and pending exception
      tables.
      Co-developed-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Acked-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      4ad8d880
    • Nikos Tsironis's avatar
      dm snapshot: Don't sleep holding the snapshot lock · 65fc7c37
      Nikos Tsironis authored
      When completing a pending exception, pending_complete() waits for all
      conflicting reads to drain, before inserting the final, completed
      exception. Conflicting reads are snapshot reads redirected to the
      origin, because the relevant chunk is not remapped to the COW device the
      moment we receive the read.
      
      The completed exception must be inserted into the exception table after
      all conflicting reads drain to ensure snapshot reads don't return
      corrupted data. This is required because inserting the completed
      exception into the exception table signals that the relevant chunk is
      remapped and both origin writes and snapshot merging will now overwrite
      the chunk in origin.
      
      This wait is done holding the snapshot lock to ensure that
      pending_complete() doesn't starve if new snapshot reads keep coming for
      this chunk.
      
      In preparation for the next commit, where we use a spinlock instead of a
      mutex to protect the exception tables, we remove the need for holding
      the lock while waiting for conflicting reads to drain.
      
      We achieve this in two steps:
      
      1. pending_complete() inserts the completed exception before waiting for
         conflicting reads to drain and removes the pending exception after
         all conflicting reads drain.
      
         This ensures that new snapshot reads will be redirected to the COW
         device, instead of the origin, and thus pending_complete() will not
         starve. Moreover, we use the existence of both a completed and
         a pending exception to signify that the COW is done but there are
         conflicting reads in flight.
      
      2. In __origin_write() we check first if there is a pending exception
         and then if there is a completed exception. If there is a pending
         exception any submitted BIO is delayed on the pe->origin_bios list and
         DM_MAPIO_SUBMITTED is returned. This ensures that neither writes to the
         origin nor snapshot merging can overwrite the origin chunk, until all
         conflicting reads drain, and thus snapshot reads will not return
         corrupted data.
      
      Summarizing, we now have the following possible combinations of pending
      and completed exceptions for a chunk, along with their meaning:
      
      A. No exceptions exist: The chunk has not been remapped yet.
      B. Only a pending exception exists: The chunk is currently being copied
         to the COW device.
      C. Both a pending and a completed exception exist: COW for this chunk
         has completed but there are snapshot reads in flight which had been
         redirected to the origin before the chunk was remapped.
      D. Only the completed exception exists: COW has been completed and there
         are no conflicting reads in flight.
      Co-developed-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Acked-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      65fc7c37
    • Nikos Tsironis's avatar
      list_bl: Add hlist_bl_add_before/behind helpers · 34191ae8
      Nikos Tsironis authored
      Add hlist_bl_add_before/behind helpers to add an element before/after an
      existing element in a bl_list.
      Co-developed-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Reviewed-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      34191ae8
    • Nikos Tsironis's avatar
      list: Don't use WRITE_ONCE() in hlist_add_behind() · ae325dcd
      Nikos Tsironis authored
      Commit 1c97be67 ("list: Use WRITE_ONCE() when adding to lists and
      hlists") introduced the use of WRITE_ONCE() to atomically write the list
      head's ->next pointer.
      
      hlist_add_behind() doesn't touch the hlist head's ->first pointer so
      there is no reason to use WRITE_ONCE() in this case.
      Co-developed-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Reviewed-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      ae325dcd
    • Nikos Tsironis's avatar
      dm cache metadata: Fix loading discard bitset · e28adc3b
      Nikos Tsironis authored
      Add missing dm_bitset_cursor_next() to properly advance the bitset
      cursor.
      
      Otherwise, the discarded state of all blocks is set according to the
      discarded state of the first block.
      
      Fixes: ae4a46a1 ("dm cache metadata: use bitset cursor api to load discard bitset")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNikos Tsironis <ntsironis@arrikto.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      e28adc3b
    • Damien Le Moal's avatar
      dm zoned: Fix zone report handling · 7aedf75f
      Damien Le Moal authored
      The function blkdev_report_zones() returns success even if no zone
      information is reported (empty report). Empty zone reports can only
      happen if the report start sector passed exceeds the device capacity.
      The conditions for this to happen are either a bug in the caller code,
      or, a change in the device that forced the low level driver to change
      the device capacity to a value that is lower than the report start
      sector. This situation includes a failed disk revalidation resulting in
      the disk capacity being changed to 0.
      
      If this change happens while dm-zoned is in its initialization phase
      executing dmz_init_zones(), this function may enter an infinite loop
      and hang the system. To avoid this, add a check to disallow empty zone
      reports and bail out early. Also fix the function dmz_update_zone() to
      make sure that the report for the requested zone was correctly obtained.
      
      Fixes: 3b1a94c8 ("dm zoned: drive-managed zoned block device target")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
      Reviewed-by: default avatarShaun Tancheff <shaun@tancheff.com>
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      7aedf75f
    • Dan Carpenter's avatar
      dm zoned: Silence a static checker warning · a3839bc6
      Dan Carpenter authored
      My static checker complains about this line from dmz_get_zoned_device()
      
      	aligned_capacity = dev->capacity & ~(blk_queue_zone_sectors(q) - 1);
      
      The problem is that "aligned_capacity" and "dev->capacity" are sector_t
      type (which is a u64 under most configs) but blk_queue_zone_sectors(q)
      returns a u32 so the higher 32 bits in aligned_capacity are cleared to
      zero.  This patch adds a cast to address the issue.
      
      Fixes: 114e0259 ("dm zoned: ignore last smaller runt zone")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      a3839bc6
    • Christoph Hellwig's avatar
      dm crypt: fix endianness annotations around org_sector_of_dmreq · c13b5487
      Christoph Hellwig authored
      The sector used here is a little endian value, so use the right
      type for it.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      c13b5487
  2. 14 Apr, 2019 6 commits
    • Linus Torvalds's avatar
      Linux 5.1-rc5 · dc4060a5
      Linus Torvalds authored
      dc4060a5
    • Linus Torvalds's avatar
      Merge branch 'page-refs' (page ref overflow) · 6b3a7077
      Linus Torvalds authored
      Merge page ref overflow branch.
      
      Jann Horn reported that he can overflow the page ref count with
      sufficient memory (and a filesystem that is intentionally extremely
      slow).
      
      Admittedly it's not exactly easy.  To have more than four billion
      references to a page requires a minimum of 32GB of kernel memory just
      for the pointers to the pages, much less any metadata to keep track of
      those pointers.  Jann needed a total of 140GB of memory and a specially
      crafted filesystem that leaves all reads pending (in order to not ever
      free the page references and just keep adding more).
      
      Still, we have a fairly straightforward way to limit the two obvious
      user-controllable sources of page references: direct-IO like page
      references gotten through get_user_pages(), and the splice pipe page
      duplication.  So let's just do that.
      
      * branch page-refs:
        fs: prevent page refcount overflow in pipe_buf_get
        mm: prevent get_user_pages() from overflowing page refcount
        mm: add 'try_get_page()' helper function
        mm: make page ref count overflow check tighter and more explicit
      6b3a7077
    • Matthew Wilcox's avatar
      fs: prevent page refcount overflow in pipe_buf_get · 15fab63e
      Matthew Wilcox authored
      Change pipe_buf_get() to return a bool indicating whether it succeeded
      in raising the refcount of the page (if the thing in the pipe is a page).
      This removes another mechanism for overflowing the page refcount.  All
      callers converted to handle a failure.
      Reported-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      15fab63e
    • Linus Torvalds's avatar
      mm: prevent get_user_pages() from overflowing page refcount · 8fde12ca
      Linus Torvalds authored
      If the page refcount wraps around past zero, it will be freed while
      there are still four billion references to it.  One of the possible
      avenues for an attacker to try to make this happen is by doing direct IO
      on a page multiple times.  This patch makes get_user_pages() refuse to
      take a new page reference if there are already more than two billion
      references to the page.
      Reported-by: default avatarJann Horn <jannh@google.com>
      Acked-by: default avatarMatthew Wilcox <willy@infradead.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8fde12ca
    • Linus Torvalds's avatar
      mm: add 'try_get_page()' helper function · 88b1a17d
      Linus Torvalds authored
      This is the same as the traditional 'get_page()' function, but instead
      of unconditionally incrementing the reference count of the page, it only
      does so if the count was "safe".  It returns whether the reference count
      was incremented (and is marked __must_check, since the caller obviously
      has to be aware of it).
      
      Also like 'get_page()', you can't use this function unless you already
      had a reference to the page.  The intent is that you can use this
      exactly like get_page(), but in situations where you want to limit the
      maximum reference count.
      
      The code currently does an unconditional WARN_ON_ONCE() if we ever hit
      the reference count issues (either zero or negative), as a notification
      that the conditional non-increment actually happened.
      
      NOTE! The count access for the "safety" check is inherently racy, but
      that doesn't matter since the buffer we use is basically half the range
      of the reference count (ie we look at the sign of the count).
      Acked-by: default avatarMatthew Wilcox <willy@infradead.org>
      Cc: Jann Horn <jannh@google.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      88b1a17d
    • Linus Torvalds's avatar
      mm: make page ref count overflow check tighter and more explicit · f958d7b5
      Linus Torvalds authored
      We have a VM_BUG_ON() to check that the page reference count doesn't
      underflow (or get close to overflow) by checking the sign of the count.
      
      That's all fine, but we actually want to allow people to use a "get page
      ref unless it's already very high" helper function, and we want that one
      to use the sign of the page ref (without triggering this VM_BUG_ON).
      
      Change the VM_BUG_ON to only check for small underflows (or _very_ close
      to overflowing), and ignore overflows which have strayed into negative
      territory.
      Acked-by: default avatarMatthew Wilcox <willy@infradead.org>
      Cc: Jann Horn <jannh@google.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f958d7b5
  3. 13 Apr, 2019 14 commits
  4. 12 Apr, 2019 11 commits
    • Leonard Crestez's avatar
      clk: imx: Fix PLL_1416X not rounding rates · f89b9e1b
      Leonard Crestez authored
      Code which initializes the "clk_init_data.ops" checks pll->rate_table
      before that field is ever assigned to so it always picks
      "clk_pll1416x_min_ops".
      
      This breaks dynamic rate rounding for features such as cpufreq.
      
      Fix by checking pll_clk->rate_table instead, here pll_clk refers to
      the constant initialization data coming from per-soc clk driver.
      Signed-off-by: default avatarLeonard Crestez <leonard.crestez@nxp.com>
      Fixes: 8646d4dc ("clk: imx: Add PLLs driver for imx8mm soc")
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      f89b9e1b
    • Weiyi Lu's avatar
      clk: mediatek: fix clk-gate flag setting · b3cf181c
      Weiyi Lu authored
      CLK_SET_RATE_PARENT would be dropped.
      Merge two flag setting together to correct the error.
      
      Fixes: 5a1cc4c2 ("clk: mediatek: Add flags to mtk_gate")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarWeiyi Lu <weiyi.lu@mediatek.com>
      Reviewed-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      b3cf181c
    • Linus Torvalds's avatar
      Merge tag 'dma-mapping-5.1-1' of git://git.infradead.org/users/hch/dma-mapping · 8ee15f32
      Linus Torvalds authored
      Pull dma-mapping fixes from Christoph Hellwig:
       "Fix a sparc64 sun4v_pci regression introduced in this merged window,
        and a dma-debug stracktrace regression from the big refactor last
        merge window"
      
      * tag 'dma-mapping-5.1-1' of git://git.infradead.org/users/hch/dma-mapping:
        dma-debug: only skip one stackframe entry
        sparc64/pci_sun4v: fix ATU checks for large DMA masks
      8ee15f32
    • Linus Torvalds's avatar
      Merge tag 'iommu-fix-v5.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 4876191c
      Linus Torvalds authored
      Pull IOMMU fix from Joerg Roedel:
       "Fix an AMD IOMMU issue where the driver didn't correctly setup the
        exclusion range in the hardware registers, resulting in exclusion
        ranges being one page too big.
      
        This can cause data corruption of the address of that last page is
        used by DMA operations"
      
      * tag 'iommu-fix-v5.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/amd: Set exclusion range correctly
      4876191c
    • Linus Torvalds's avatar
      Merge tag 'clang-format-for-linus-v5.1-rc5' of git://github.com/ojeda/linux · 8e72d95d
      Linus Torvalds authored
      Pull clang-format update from Miguel Ojeda:
       "The usual roughly-per-release .clang-format macro list update"
      
      * tag 'clang-format-for-linus-v5.1-rc5' of git://github.com/ojeda/linux:
        clang-format: Update with the latest for_each macro list
      8e72d95d
    • Linus Torvalds's avatar
      Merge tag 'mmc-v5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · ea951a94
      Linus Torvalds authored
      Pull MMC host fixes from Ulf Hansson:
      
       - alcor: Stabilize data write requests
      
       - sdhci-omap: Fix command error path during tuning
      
      * tag 'mmc-v5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: sdhci-omap: Don't finish_mrq() on a command error during tuning
        mmc: alcor: don't write data before command has completed
      ea951a94
    • Linus Torvalds's avatar
      Merge tag 'sound-5.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 372686e6
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Well, this one became unpleasantly larger than previous pull requests,
        but it's a kind of usual pattern: now it contains a collection of ASoC
        fixes, and nothing to worry too much.
      
        The fixes for ASoC core (DAPM, DPCM, topology) are all small and just
        covering corner cases. The rest changes are driver-specific, many of
        which are for x86 platforms and new drivers like STM32, in addition to
        the usual fixups for HD-audio"
      
      * tag 'sound-5.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (66 commits)
        ASoC: wcd9335: Fix missing regmap requirement
        ALSA: hda: Fix racy display power access
        ASoC: pcm: fix error handling when try_module_get() fails.
        ASoC: stm32: sai: fix master clock management
        ASoC: Intel: kbl: fix wrong number of channels
        ALSA: hda - Add two more machines to the power_save_blacklist
        ASoC: pcm: update module refcount if module_get_upon_open is set
        ASoC: core: conditionally increase module refcount on component open
        ASoC: stm32: fix sai driver name initialisation
        ASoC: topology: Use the correct dobj to free enum control values and texts
        ALSA: seq: Fix OOB-reads from strlcpy
        ASoC: intel: skylake: add remove() callback for component driver
        ASoC: cs35l35: Disable regulators on driver removal
        ALSA: xen-front: Do not use stream buffer size before it is set
        ASoC: rockchip: pdm: change dma burst to 8
        ASoC: rockchip: pdm: fix regmap_ops hang issue
        ASoC: simple-card: don't select DPCM via simple-audio-card
        ASoC: audio-graph-card: don't select DPCM via audio-graph-card
        ASoC: tlv320aic32x4: Change author's name
        ALSA: hda/realtek - Add quirk for Tuxedo XC 1509
        ...
      372686e6
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · f2a73469
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "Fix an ACPICA issue introduced during the 4.20 development cycle and
        causing some systems to crash because of leftover operation region
        data still maintained after the operation region in question has gone
        away (Erik Schmauss)"
      
      * tag 'acpi-5.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPICA: Namespace: remove address node from global list after method termination
      f2a73469
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2019-04-12' of git://anongit.freedesktop.org/drm/drm · 58890f31
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Fixes across the driver spectrum this week, the mediatek fbdev support
        might be a bit late for this round, but I looked over it and it's not
        very large and seems like a useful feature for them.
      
        Otherwise the main thing is a regression fix for i915 5.0 bug that
        caused black screens on a bunch of Dell XPS 15s I think, I know at
        least Fedora is waiting for this to land, and the udl fix is also for
        a regression since 5.0 where unplugging the device would end badly.
      
        core:
         - make atomic hooks optional
      
        i915:
         - Revert a 5.0 regression where some eDP panels stopped working
         - DSI related fixes for platforms up to IceLake
         - GVT (regression fix, warning fix, use-after free fix)
      
        amdgpu:
         - Cursor fixes
         - missing PCI ID fix for KFD
         - XGMI fix
         - shadow buffer handling after reset fix
      
        udl:
         - fix unplugging device crashes.
      
        mediatek:
         - stabilise MT2701 HDMI support
         - fbdev support
      
        tegra:
         - fix for build regression in rc1.
      
        sun4i:
         - Allwinner A6 max freq improvements
         - null ptr deref fix
      
        dw-hdmi:
         - SCDC configuration improvements
      
        omap:
         - CEC clock management policy fix"
      
      * tag 'drm-fixes-2019-04-12' of git://anongit.freedesktop.org/drm/drm: (32 commits)
        gpu: host1x: Fix compile error when IOMMU API is not available
        drm/i915/gvt: Roundup fb->height into tile's height at calucation fb->size
        drm/i915/dp: revert back to max link rate and lane count on eDP
        drm/i915/icl: Fix port disable sequence for mipi-dsi
        drm/i915/icl: Ungate ddi clocks before IO enable
        drm/mediatek: no change parent rate in round_rate() for MT2701 hdmi phy
        drm/mediatek: using new factor for tvdpll for MT2701 hdmi phy
        drm/mediatek: remove flag CLK_SET_RATE_PARENT for MT2701 hdmi phy
        drm/mediatek: make implementation of recalc_rate() for MT2701 hdmi phy
        drm/mediatek: fix the rate and divder of hdmi phy for MT2701
        drm/mediatek: fix possible object reference leak
        drm/i915: Get power refs in encoder->get_power_domains()
        drm/i915: Fix pipe_bpp readout for BXT/GLK DSI
        drm/amd/display: Fix negative cursor pos programming (v2)
        drm/sun4i: tcon top: Fix NULL/invalid pointer dereference in sun8i_tcon_top_un/bind
        drm/udl: add a release method and delay modeset teardown
        drm/i915/gvt: Prevent use-after-free in ppgtt_free_all_spt()
        drm/i915/gvt: Annotate iomem usage
        drm/sun4i: DW HDMI: Lower max. supported rate for H6
        Revert "Documentation/gpu/meson: Remove link to meson_canvas.c"
        ...
      58890f31
    • Will Deacon's avatar
      arm64: futex: Fix FUTEX_WAKE_OP atomic ops with non-zero result value · 045afc24
      Will Deacon authored
      Rather embarrassingly, our futex() FUTEX_WAKE_OP implementation doesn't
      explicitly set the return value on the non-faulting path and instead
      leaves it holding the result of the underlying atomic operation. This
      means that any FUTEX_WAKE_OP atomic operation which computes a non-zero
      value will be reported as having failed. Regrettably, I wrote the buggy
      code back in 2011 and it was upstreamed as part of the initial arm64
      support in 2012.
      
      The reasons we appear to get away with this are:
      
        1. FUTEX_WAKE_OP is rarely used and therefore doesn't appear to get
           exercised by futex() test applications
      
        2. If the result of the atomic operation is zero, the system call
           behaves correctly
      
        3. Prior to version 2.25, the only operation used by GLIBC set the
           futex to zero, and therefore worked as expected. From 2.25 onwards,
           FUTEX_WAKE_OP is not used by GLIBC at all.
      
      Fix the implementation by ensuring that the return value is either 0
      to indicate that the atomic operation completed successfully, or -EFAULT
      if we encountered a fault when accessing the user mapping.
      
      Cc: <stable@kernel.org>
      Fixes: 6170a974 ("arm64: Atomic operations")
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      045afc24
    • Joerg Roedel's avatar
      iommu/amd: Set exclusion range correctly · 3c677d20
      Joerg Roedel authored
      The exlcusion range limit register needs to contain the
      base-address of the last page that is part of the range, as
      bits 0-11 of this register are treated as 0xfff by the
      hardware for comparisons.
      
      So correctly set the exclusion range in the hardware to the
      last page which is _in_ the range.
      
      Fixes: b2026aa2 ('x86, AMD IOMMU: add functions for programming IOMMU MMIO space')
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      3c677d20