1. 07 3月, 2020 1 次提交
    • Z
      vgacon: Fix a UAF in vgacon_invert_region · 513dc792
      Zhang Xiaoxu 提交于
      When syzkaller tests, there is a UAF:
        BUG: KASan: use after free in vgacon_invert_region+0x9d/0x110 at addr
          ffff880000100000
        Read of size 2 by task syz-executor.1/16489
        page:ffffea0000004000 count:0 mapcount:-127 mapping:          (null)
        index:0x0
        page flags: 0xfffff00000000()
        page dumped because: kasan: bad access detected
        CPU: 1 PID: 16489 Comm: syz-executor.1 Not tainted
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
        rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
        Call Trace:
          [<ffffffffb119f309>] dump_stack+0x1e/0x20
          [<ffffffffb04af957>] kasan_report+0x577/0x950
          [<ffffffffb04ae652>] __asan_load2+0x62/0x80
          [<ffffffffb090f26d>] vgacon_invert_region+0x9d/0x110
          [<ffffffffb0a39d95>] invert_screen+0xe5/0x470
          [<ffffffffb0a21dcb>] set_selection+0x44b/0x12f0
          [<ffffffffb0a3bfae>] tioclinux+0xee/0x490
          [<ffffffffb0a1d114>] vt_ioctl+0xff4/0x2670
          [<ffffffffb0a0089a>] tty_ioctl+0x46a/0x1a10
          [<ffffffffb052db3d>] do_vfs_ioctl+0x5bd/0xc40
          [<ffffffffb052e2f2>] SyS_ioctl+0x132/0x170
          [<ffffffffb11c9b1b>] system_call_fastpath+0x22/0x27
          Memory state around the buggy address:
           ffff8800000fff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00
           00 00
           ffff8800000fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00
           00 00 00
          >ffff880000100000: ff ff ff ff ff ff ff ff ff ff ff ff ff
           ff ff ff
      
      It can be reproduce in the linux mainline by the program:
        #include <stdio.h>
        #include <stdlib.h>
        #include <unistd.h>
        #include <fcntl.h>
        #include <sys/types.h>
        #include <sys/stat.h>
        #include <sys/ioctl.h>
        #include <linux/vt.h>
      
        struct tiocl_selection {
          unsigned short xs;      /* X start */
          unsigned short ys;      /* Y start */
          unsigned short xe;      /* X end */
          unsigned short ye;      /* Y end */
          unsigned short sel_mode; /* selection mode */
        };
      
        #define TIOCL_SETSEL    2
        struct tiocl {
          unsigned char type;
          unsigned char pad;
          struct tiocl_selection sel;
        };
      
        int main()
        {
          int fd = 0;
          const char *dev = "/dev/char/4:1";
      
          struct vt_consize v = {0};
          struct tiocl tioc = {0};
      
          fd = open(dev, O_RDWR, 0);
      
          v.v_rows = 3346;
          ioctl(fd, VT_RESIZEX, &v);
      
          tioc.type = TIOCL_SETSEL;
          ioctl(fd, TIOCLINUX, &tioc);
      
          return 0;
        }
      
      When resize the screen, update the 'vc->vc_size_row' to the new_row_size,
      but when 'set_origin' in 'vgacon_set_origin', vgacon use 'vga_vram_base'
      for 'vc_origin' and 'vc_visible_origin', not 'vc_screenbuf'. It maybe
      smaller than 'vc_screenbuf'. When TIOCLINUX, use the new_row_size to calc
      the offset, it maybe larger than the vga_vram_size in vgacon driver, then
      bad access.
      Also, if set an larger screenbuf firstly, then set an more larger
      screenbuf, when copy old_origin to new_origin, a bad access may happen.
      
      So, If the screen size larger than vga_vram, resize screen should be
      failed. This alse fix CVE-2020-8649 and CVE-2020-8647.
      
      Linus pointed out that overflow checking seems absent. We're saved by
      the existing bounds checks in vc_do_resize() with rather strict
      limits:
      
      	if (cols > VC_RESIZE_MAXCOL || lines > VC_RESIZE_MAXROW)
      		return -EINVAL;
      
      Fixes: 0aec4867 ("[PATCH] SVGATextMode fix")
      Reference: CVE-2020-8647 and CVE-2020-8649
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NZhang Xiaoxu <zhangxiaoxu5@huawei.com>
      [danvet: augment commit message to point out overflow safety]
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200304022429.37738-1-zhangxiaoxu5@huawei.com
      513dc792
  2. 06 3月, 2020 5 次提交
  3. 05 3月, 2020 20 次提交
    • J
      xen/blkfront: fix ring info addressing · 4ab50af6
      Juergen Gross 提交于
      Commit 0265d6e8 ("xen/blkfront: limit allocated memory size to
      actual use case") made struct blkfront_ring_info size dynamic. This is
      fine when running with only one queue, but with multiple queues the
      addressing of the single queues has to be adapted as the structs are
      allocated in an array.
      
      Fixes: 0265d6e8 ("xen/blkfront: limit allocated memory size to actual use case")
      Reported-by: NSander Eikelenboom <linux@eikelenboom.it>
      Tested-by: NSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Acked-by: NRoger Pau Monné <roger.pau@citrix.com>
      Link: https://lore.kernel.org/r/20200305155129.28326-1-jgross@suse.comSigned-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      4ab50af6
    • J
      xen/xenbus: fix locking · 2f69a110
      Juergen Gross 提交于
      Commit 060eabe8 ("xenbus/backend: Protect xenbus callback with
      lock") introduced a bug by holding a lock while calling a function
      which might schedule.
      
      Fix that by using a semaphore instead.
      
      Fixes: 060eabe8 ("xenbus/backend: Protect xenbus callback with lock")
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/20200305100323.16736-1-jgross@suse.comReviewed-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      2f69a110
    • D
      xenbus: req->err should be updated before req->state · 8130b9d5
      Dongli Zhang 提交于
      This patch adds the barrier to guarantee that req->err is always updated
      before req->state.
      
      Otherwise, read_reply() would not return ERR_PTR(req->err) but
      req->body, when process_writes()->xb_write() is failed.
      Signed-off-by: NDongli Zhang <dongli.zhang@oracle.com>
      Link: https://lore.kernel.org/r/20200303221423.21962-2-dongli.zhang@oracle.comReviewed-by: NJulien Grall <jgrall@amazon.com>
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      8130b9d5
    • D
      xenbus: req->body should be updated before req->state · 1b6a51e8
      Dongli Zhang 提交于
      The req->body should be updated before req->state is updated and the
      order should be guaranteed by a barrier.
      
      Otherwise, read_reply() might return req->body = NULL.
      
      Below is sample callstack when the issue is reproduced on purpose by
      reordering the updates of req->body and req->state and adding delay in
      code between updates of req->state and req->body.
      
      [   22.356105] general protection fault: 0000 [#1] SMP PTI
      [   22.361185] CPU: 2 PID: 52 Comm: xenwatch Not tainted 5.5.0xen+ #6
      [   22.366727] Hardware name: Xen HVM domU, BIOS ...
      [   22.372245] RIP: 0010:_parse_integer_fixup_radix+0x6/0x60
      ... ...
      [   22.392163] RSP: 0018:ffffb2d64023fdf0 EFLAGS: 00010246
      [   22.395933] RAX: 0000000000000000 RBX: 75746e7562755f6d RCX: 0000000000000000
      [   22.400871] RDX: 0000000000000000 RSI: ffffb2d64023fdfc RDI: 75746e7562755f6d
      [   22.405874] RBP: 0000000000000000 R08: 00000000000001e8 R09: 0000000000cdcdcd
      [   22.410945] R10: ffffb2d6402ffe00 R11: ffff9d95395eaeb0 R12: ffff9d9535935000
      [   22.417613] R13: ffff9d9526d4a000 R14: ffff9d9526f4f340 R15: ffff9d9537654000
      [   22.423726] FS:  0000000000000000(0000) GS:ffff9d953bc80000(0000) knlGS:0000000000000000
      [   22.429898] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   22.434342] CR2: 000000c4206a9000 CR3: 00000001ea3fc002 CR4: 00000000001606e0
      [   22.439645] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   22.444941] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [   22.450342] Call Trace:
      [   22.452509]  simple_strtoull+0x27/0x70
      [   22.455572]  xenbus_transaction_start+0x31/0x50
      [   22.459104]  netback_changed+0x76c/0xcc1 [xen_netfront]
      [   22.463279]  ? find_watch+0x40/0x40
      [   22.466156]  xenwatch_thread+0xb4/0x150
      [   22.469309]  ? wait_woken+0x80/0x80
      [   22.472198]  kthread+0x10e/0x130
      [   22.474925]  ? kthread_park+0x80/0x80
      [   22.477946]  ret_from_fork+0x35/0x40
      [   22.480968] Modules linked in: xen_kbdfront xen_fbfront(+) xen_netfront xen_blkfront
      [   22.486783] ---[ end trace a9222030a747c3f7 ]---
      [   22.490424] RIP: 0010:_parse_integer_fixup_radix+0x6/0x60
      
      The virt_rmb() is added in the 'true' path of test_reply(). The "while"
      is changed to "do while" so that test_reply() is used as a read memory
      barrier.
      Signed-off-by: NDongli Zhang <dongli.zhang@oracle.com>
      Link: https://lore.kernel.org/r/20200303221423.21962-1-dongli.zhang@oracle.comReviewed-by: NJulien Grall <jgrall@amazon.com>
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      1b6a51e8
    • G
      xen: Replace zero-length array with flexible-array member · e8dc73c9
      Gustavo A. R. Silva 提交于
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Link: https://lore.kernel.org/r/20200226212612.GA4663@embeddedorReviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      e8dc73c9
    • H
      drm/amdgpu/display: navi1x copy dcn watermark clock settings to smu resume from s3 (v2) · 09ed6ba4
      Hersen Wu 提交于
       This interface is for dGPU Navi1x. Linux dc-pplib interface depends
       on window driver dc implementation.
      
       For Navi1x, clock settings of dcn watermarks are fixed. the settings
       should be passed to smu during boot up and resume from s3.
       boot up: dc calculate dcn watermark clock settings within dc_create,
       dcn20_resource_construct, then call pplib functions below to pass
       the settings to smu:
       smu_set_watermarks_for_clock_ranges
       smu_set_watermarks_table
       navi10_set_watermarks_table
       smu_write_watermarks_table
      
       For Renoir, clock settings of dcn watermark are also fixed values.
       dc has implemented different flow for window driver:
       dc_hardware_init / dc_set_power_state
       dcn10_init_hw
       notify_wm_ranges
       set_wm_ranges
      
       For Linux
       smu_set_watermarks_for_clock_ranges
       renoir_set_watermarks_table
       smu_write_watermarks_table
      
       dc_hardware_init -> amdgpu_dm_init
       dc_set_power_state --> dm_resume
      
       therefore, linux dc-pplib interface of navi10/12/14 is different
       from that of Renoir.
      
      v2: add missing unlock in error case
      Signed-off-by: NHersen Wu <hersenxs.wu@amd.com>
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      09ed6ba4
    • P
      drm/amd/powerplay: map mclk to fclk for COMBINATIONAL_BYPASS case · ab65a371
      Prike Liang 提交于
      When hit COMBINATIONAL_BYPASS the mclk will be bypass and can export
      fclk frequency to user usage.
      Signed-off-by: NPrike Liang <Prike.Liang@amd.com>
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      ab65a371
    • P
      drm/amd/powerplay: fix pre-check condition for setting clock range · 80381d40
      Prike Liang 提交于
      This fix will handle some MP1 FW issue like as mclk dpm table in renoir has a reverse
      dpm clock layout and a zero frequency dpm level as following case.
      
      cat pp_dpm_mclk
      0: 1200Mhz
      1: 1200Mhz
      2: 800Mhz
      3: 0Mhz
      Signed-off-by: NPrike Liang <Prike.Liang@amd.com>
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      80381d40
    • J
      drm/amd/display: fix dcc swath size calculations on dcn1 · a0275dfc
      Josip Pavic 提交于
      [Why]
      Swath sizes are being calculated incorrectly. The horizontal swath size
      should be the product of block height, viewport width, and bytes per
      element, but the calculation uses viewport height instead of width. The
      vertical swath size is similarly incorrectly calculated. The effect of
      this is that we report the wrong DCC caps.
      
      [How]
      Use viewport width in the horizontal swath size calculation and viewport
      height in the vertical swath size calculation.
      Signed-off-by: NJosip Pavic <Josip.Pavic@amd.com>
      Reviewed-by: NAric Cyr <Aric.Cyr@amd.com>
      Acked-by: NRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      a0275dfc
    • B
      drm/amd/display: Clear link settings on MST disable connector · 5ac7fd2f
      Bhawanpreet Lakha 提交于
      [Why]
      If we have a single MST display and we disconnect it, we dont disable that
      link. This causes the old link settings to still exist
      
      Now on a replug for MST we think its a link loss and will try to reallocate
      mst payload which will fail, throwing warning below.
      
      [  129.374192] [drm] Failed to updateMST allocation table forpipe idx:0
      [  129.374206] ------------[ cut here ]------------
      [  129.374284] WARNING: CPU: 14 PID: 1710 at
      drivers/gpu/drm/amd/amdgpu/../dal-dev/dc/core/dc_link.c:3153
      dc_link_allocate_mst_payload+0x1f7/0x220 [amdgpu]
      
      [  129.374285] Modules linked in: amdgpu(OE) amd_iommu_v2 gpu_sched ttm
      drm_kms_helper drm fb_sys_fops syscopyarea sysfillrect sysimgblt
      binfmt_misc nls_iso8859_1 edac_mce_amd snd_hda_codec_realtek
      snd_hda_codec_generic ledtrig_audio kvm snd_hda_codec_hdmi snd_hda_intel
      snd_intel_nhlt snd_hda_codec irqbypass snd_hda_core snd_hwdep snd_pcm
      snd_seq_midi snd_seq_midi_event snd_rawmidi crct10dif_pclmul snd_seq
      crc32_pclmul ghash_clmulni_intel snd_seq_device snd_timer snd aesni_intel
      eeepc_wmi crypto_simd asus_wmi joydev cryptd sparse_keymap input_leds
      soundcore video glue_helper wmi_bmof mxm_wmi k10temp ccp mac_hid
      sch_fq_codel parport_pc ppdev lp parport ip_tables x_tables autofs4
      hid_generic usbhid hid igb i2c_algo_bit ahci dca i2c_piix4 libahci
      gpio_amdpt wmi gpio_generic
      
      [  129.374318] CPU: 14 PID: 1710 Comm: kworker/14:2 Tainted: G        W  OE     5.4.0-rc7bhawan+ #480
      [  129.374318] Hardware name: System manufacturer System Product Name/PRIME X370-PRO, BIOS 0515 03/30/2017
      [  129.374397] Workqueue: events dm_irq_work_func [amdgpu]
      [  129.374468] RIP: 0010:dc_link_allocate_mst_payload+0x1f7/0x220 [amdgpu]
      [  129.374470] Code: 52 20 e8 1c 63 ad f4 48 8b 5d d0 65 48 33 1c 25 28 00
      00 00 b8 01 00 00 00 75 16 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3
      <0f> 0b e9 fa fe ff ff e8 ed 5b d6 f3 41 0f b6 b6 c4 02 00 00 48 c7
      [  129.374471] RSP: 0018:ffff9f9141e7fcc0 EFLAGS: 00010246
      [  129.374472] RAX: 0000000000000000 RBX: ffff91ef0762f800 RCX: 0000000000000000
      [  129.374473] RDX: 0000000000000005 RSI: ffffffffc0c4a988 RDI: 0000000000000004
      [  129.374474] RBP: ffff9f9141e7fd10 R08: 0000000000000005 R09: 0000000000000000
      [  129.374475] R10: 0000000000000002 R11: 0000000000000001 R12: ffff91eebd510c00
      [  129.374475] R13: ffff91eebd510e58 R14: ffff91ef052c01b8 R15: 0000000000000006
      [  129.374476] FS:  0000000000000000(0000) GS:ffff91ef0ef80000(0000) knlGS:0000000000000000
      [  129.374477] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  129.374478] CR2: 000055623ea01d50 CR3: 0000000408a8c000 CR4: 00000000003406e0
      [  129.374479] Call Trace:
      [  129.374550]  dc_link_reallocate_mst_payload+0x12e/0x150 [amdgpu]
      [  129.374617]  dc_link_handle_hpd_rx_irq+0x6d4/0x6e0 [amdgpu]
      [  129.374693]  handle_hpd_rx_irq+0x77/0x310 [amdgpu]
      [  129.374768]  dm_irq_work_func+0x53/0x70 [amdgpu]
      [  129.374774]  process_one_work+0x1fd/0x3f0
      [  129.374776]  worker_thread+0x255/0x410
      [  129.374778]  kthread+0x121/0x140
      [  129.374780]  ? process_one_work+0x3f0/0x3f0
      [  129.374781]  ? kthread_park+0x90/0x90
      [  129.374785]  ret_from_fork+0x22/0x40
      
      [How]
      when we disable MST we should clear the cur link settings (lane_count=0 is
      good enough). This will cause us to not reallocate payloads earlier than
      expected and not throw the warning
      Signed-off-by: NBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
      Reviewed-by: NHersen Wu <hersenxs.wu@amd.com>
      Acked-by: NRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      5ac7fd2f
    • T
      drm/amdgpu: disable 3D pipe 1 on Navi1x · 194bcf35
      Tianci.Yin 提交于
      [why]
      CP firmware decide to skip setting the state for 3D pipe 1 for Navi1x as there
      is no use case.
      
      [how]
      Disable 3D pipe 1 on Navi1x.
      Reviewed-by: NFeifei Xu <Feifei.Xu@amd.com>
      Reviewed-by: NMonk Liu <monk.liu@amd.com>
      Signed-off-by: NTianci.Yin <tianci.yin@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      194bcf35
    • L
      HID: hyperv: NULL check before some freeing functions is not needed. · 5313b2a5
      Lucas Tanure 提交于
      Fix below warnings reported by coccicheck:
      drivers/hid/hid-hyperv.c:197:2-7: WARNING: NULL check before some freeing functions is not needed.
      drivers/hid/hid-hyperv.c:211:2-7: WARNING: NULL check before some freeing functions is not needed.
      Signed-off-by: NLucas Tanure <tanure@linux.com>
      Reviewed-by: NMichael Kelley <mikelley@microsoft.com>
      Reviewed-by: NWei Liu <wei.liu@kernel.org>
      Acked-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NWei Liu <wei.liu@kernel.org>
      5313b2a5
    • Y
      drm/amdgpu: clean wptr on wb when gpu recovery · 2ab7e274
      Yintian Tao 提交于
      The TDR will be randomly failed due to compute ring
      test failure. If the compute ring wptr & 0x7ff(ring_buf_mask)
      is 0x100 then after map mqd the compute ring rptr will be
      synced with 0x100. And the ring test packet size is also 0x100.
      Then after invocation of amdgpu_ring_commit, the cp will not
      really handle the packet on the ring buffer because rptr is equal to wptr.
      Signed-off-by: NYintian Tao <yttao@amd.com>
      Acked-by: NChristian König <christian.koenig@amd.com>
      Reviewed-by: NMonk Liu <Monk.Liu@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      2ab7e274
    • B
      Revert "software node: Simplify software_node_release() function" · 7589238a
      Brendan Higgins 提交于
      This reverts commit 3df85a1a.
      
      The reverted commit says "It's possible to release the node ID
      immediately when fwnode_remove_software_node() is called, no need to
      wait for software_node_release() with that." However, releasing the node
      ID before waiting for software_node_release() to be called causes the
      node ID to be released before the kobject and the underlying sysfs
      entry; this means there is a period of time where a sysfs entry exists
      that is associated with an unallocated node ID.
      
      Once consequence of this is that there is a race condition where it is
      possible to call fwnode_create_software_node() with no parent node
      specified (NULL) and have it fail with -EEXIST because the node ID that
      was assigned is still associated with a stale sysfs entry that hasn't
      been cleaned up yet.
      
      Although it is difficult to reproduce this race condition under normal
      conditions, it can be deterministically reproduced with the following
      minconfig on UML:
      
      CONFIG_KUNIT_DRIVER_PE_TEST=y
      CONFIG_DEBUG_KERNEL=y
      CONFIG_DEBUG_OBJECTS=y
      CONFIG_DEBUG_OBJECTS_TIMERS=y
      CONFIG_DEBUG_KOBJECT_RELEASE=y
      CONFIG_KUNIT=y
      
      Running the tests with this configuration causes the following failure:
      
      <snip>
      kobject: 'node0' ((____ptrval____)): kobject_release, parent (____ptrval____) (delayed 400)
      	ok 1 - pe_test_uints
      sysfs: cannot create duplicate filename '/kernel/software_nodes/node0'
      CPU: 0 PID: 28 Comm: kunit_try_catch Not tainted 5.6.0-rc3-next-20200227 #14
      <snip>
      kobject_add_internal failed for node0 with -EEXIST, don't try to register things with the same name in the same directory.
      kobject: 'node0' ((____ptrval____)): kobject_release, parent (____ptrval____) (delayed 100)
      	# pe_test_uint_arrays: ASSERTION FAILED at drivers/base/test/property-entry-test.c:123
      	Expected node is not error, but is: -17
      	not ok 2 - pe_test_uint_arrays
      <snip>
      Reported-by: NHeidi Fahim <heidifahim@google.com>
      Signed-off-by: NBrendan Higgins <brendanhiggins@google.com>
      Reviewed-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Cc: 5.3+ <stable@vger.kernel.org> # 5.3+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7589238a
    • B
      RDMA/iwcm: Fix iwcm work deallocation · 810dbc69
      Bernard Metzler 提交于
      The dealloc_work_entries() function must update the work_free_list pointer
      while freeing its entries, since potentially called again on same list. A
      second iteration of the work list caused system crash. This happens, if
      work allocation fails during cma_iw_listen() and free_cm_id() tries to
      free the list again during cleanup.
      
      Fixes: 922a8e9f ("RDMA: iWARP Connection Manager.")
      Link: https://lore.kernel.org/r/20200302181614.17042-1-bmt@zurich.ibm.com
      Reported-by: syzbot+cb0c054eabfba4342146@syzkaller.appspotmail.com
      Signed-off-by: NBernard Metzler <bmt@zurich.ibm.com>
      Reviewed-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      810dbc69
    • B
      RDMA/siw: Fix failure handling during device creation · 12e5eef0
      Bernard Metzler 提交于
      A failing call to ib_device_set_netdev() during device creation caused
      system crash due to xa_destroy of uninitialized xarray hit by device
      deallocation. Fixed by moving xarray initialization before potential
      device deallocation.
      
      Fixes: bdcf26bf ("rdma/siw: network and RDMA core interface")
      Link: https://lore.kernel.org/r/20200302155814.9896-1-bmt@zurich.ibm.com
      Reported-by: syzbot+2e80962bedd9559fe0b3@syzkaller.appspotmail.com
      Signed-off-by: NBernard Metzler <bmt@zurich.ibm.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      12e5eef0
    • M
      RDMA/nldev: Fix crash when set a QP to a new counter but QPN is missing · 78f34a16
      Mark Zhang 提交于
      This fixes the kernel crash when a RDMA_NLDEV_CMD_STAT_SET command is
      received, but the QP number parameter is not available.
      
        iwpm_register_pid: Unable to send a nlmsg (client = 2)
        infiniband syz1: RDMA CMA: cma_listen_on_dev, error -98
        general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
        KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
        CPU: 0 PID: 9754 Comm: syz-executor069 Not tainted 5.6.0-rc2-syzkaller #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
        RIP: 0010:nla_get_u32 include/net/netlink.h:1474 [inline]
        RIP: 0010:nldev_stat_set_doit+0x63c/0xb70 drivers/infiniband/core/nldev.c:1760
        Code: fc 01 0f 84 58 03 00 00 e8 41 83 bf fb 4c 8b a3 58 fd ff ff 48 b8 00 00 00 00 00 fc ff df 49 8d 7c 24 04 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 6d
        RSP: 0018:ffffc900068bf350 EFLAGS: 00010247
        RAX: dffffc0000000000 RBX: ffffc900068bf728 RCX: ffffffff85b60470
        RDX: 0000000000000000 RSI: ffffffff85b6047f RDI: 0000000000000004
        RBP: ffffc900068bf750 R08: ffff88808c3ee140 R09: ffff8880a25e6010
        R10: ffffed10144bcddc R11: ffff8880a25e6ee3 R12: 0000000000000000
        R13: ffff88809acb0000 R14: ffff888092a42c80 R15: 000000009ef2e29a
        FS:  0000000001ff0880(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00007f4733e34000 CR3: 00000000a9b27000 CR4: 00000000001406f0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
          rdma_nl_rcv_msg drivers/infiniband/core/netlink.c:195 [inline]
          rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline]
          rdma_nl_rcv+0x5d9/0x980 drivers/infiniband/core/netlink.c:259
          netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
          netlink_unicast+0x59e/0x7e0 net/netlink/af_netlink.c:1329
          netlink_sendmsg+0x91c/0xea0 net/netlink/af_netlink.c:1918
          sock_sendmsg_nosec net/socket.c:652 [inline]
          sock_sendmsg+0xd7/0x130 net/socket.c:672
          ____sys_sendmsg+0x753/0x880 net/socket.c:2343
          ___sys_sendmsg+0x100/0x170 net/socket.c:2397
          __sys_sendmsg+0x105/0x1d0 net/socket.c:2430
          __do_sys_sendmsg net/socket.c:2439 [inline]
          __se_sys_sendmsg net/socket.c:2437 [inline]
          __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2437
          do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
          entry_SYSCALL_64_after_hwframe+0x49/0xbe
        RIP: 0033:0x4403d9
        Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
        RSP: 002b:00007ffc0efbc5c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
        RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004403d9
        RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000004
        RBP: 00000000006ca018 R08: 0000000000000008 R09: 00000000004002c8
        R10: 000000000000004a R11: 0000000000000246 R12: 0000000000401c60
        R13: 0000000000401cf0 R14: 0000000000000000 R15: 0000000000000000
      
      Fixes: b389327d ("RDMA/nldev: Allow counter manual mode configration through RDMA netlink")
      Link: https://lore.kernel.org/r/20200227125111.99142-1-leon@kernel.org
      Reported-by: syzbot+bd4af81bc51ee0283445@syzkaller.appspotmail.com
      Signed-off-by: NMark Zhang <markz@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      78f34a16
    • J
      RDMA/odp: Ensure the mm is still alive before creating an implicit child · a4e63bce
      Jason Gunthorpe 提交于
      Registration of a mmu_notifier requires the caller to hold a mmget() on
      the mm as registration is not permitted to race with exit_mmap(). There is
      a BUG_ON inside the mmu_notifier to guard against this.
      
      Normally creating a umem is done against current which implicitly holds
      the mmget(), however an implicit ODP child is created from a pagefault
      work queue and is not guaranteed to have a mmget().
      
      Call mmget() around this registration and abort faulting if the MM has
      gone to exit_mmap().
      
      Before the patch below the notifier was registered when the implicit ODP
      parent was created, so there was no chance to register a notifier outside
      of current.
      
      Fixes: c571feca ("RDMA/odp: use mmu_notifier_get/put for 'struct ib_ucontext_per_mm'")
      Link: https://lore.kernel.org/r/20200227114118.94736-1-leon@kernel.orgSigned-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      a4e63bce
    • M
      RDMA/core: Fix protection fault in ib_mr_pool_destroy · e38b55ea
      Maor Gottlieb 提交于
      Fix NULL pointer dereference in the error flow of ib_create_qp_user
      when accessing to uninitialized list pointers - rdma_mrs and sig_mrs.
      The following crash from syzkaller revealed it.
      
        kasan: GPF could be caused by NULL-ptr deref or user memory access
        general protection fault: 0000 [#1] SMP KASAN PTI
        CPU: 1 PID: 23167 Comm: syz-executor.1 Not tainted 5.5.0-rc5 #2
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
        rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
        RIP: 0010:ib_mr_pool_destroy+0x81/0x1f0
        Code: 00 00 fc ff df 49 c1 ec 03 4d 01 fc e8 a8 ea 72 fe 41 80 3c 24 00
        0f 85 62 01 00 00 48 8b 13 48 89 d6 4c 8d 6a c8 48 c1 ee 03 <42> 80 3c
        3e 00 0f 85 34 01 00 00 48 8d 7a 08 4c 8b 02 48 89 fe 48
        RSP: 0018:ffffc9000951f8b0 EFLAGS: 00010046
        RAX: 0000000000040000 RBX: ffff88810f268038 RCX: ffffffff82c41628
        RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc9000951f850
        RBP: ffff88810f268020 R08: 0000000000000004 R09: fffff520012a3f0a
        R10: 0000000000000001 R11: fffff520012a3f0a R12: ffffed1021e4d007
        R13: ffffffffffffffc8 R14: 0000000000000246 R15: dffffc0000000000
        FS:  00007f54bc788700(0000) GS:ffff88811b100000(0000)
        knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000000000000 CR3: 0000000116920002 CR4: 0000000000360ee0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         rdma_rw_cleanup_mrs+0x15/0x30
         ib_destroy_qp_user+0x674/0x7d0
         ib_create_qp_user+0xb01/0x11c0
         create_qp+0x1517/0x2130
         ib_uverbs_create_qp+0x13e/0x190
         ib_uverbs_write+0xaa5/0xdf0
         __vfs_write+0x7c/0x100
         vfs_write+0x168/0x4a0
         ksys_write+0xc8/0x200
         do_syscall_64+0x9c/0x390
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x465b49
        Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89
        f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
        f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
        RSP: 002b:00007f54bc787c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
        RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000465b49
        RDX: 0000000000000040 RSI: 0000000020000540 RDI: 0000000000000003
        RBP: 00007f54bc787c70 R08: 0000000000000000 R09: 0000000000000000
        R10: 0000000000000000 R11: 0000000000000246 R12: 00007f54bc7886bc
        R13: 00000000004ca2ec R14: 000000000070ded0 R15: 0000000000000005
      
      Fixes: a060b562 ("IB/core: generic RDMA READ/WRITE API")
      Link: https://lore.kernel.org/r/20200227112708.93023-1-leon@kernel.orgSigned-off-by: NMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Reviewed-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      e38b55ea
    • A
      IB/mlx5: Fix implicit ODP race · de5ed007
      Artemy Kovalyov 提交于
      Following race may occur because of the call_srcu and the placement of
      the synchronize_srcu vs the xa_erase.
      
      CPU0				   CPU1
      
      mlx5_ib_free_implicit_mr:	   destroy_unused_implicit_child_mr:
       xa_erase(odp_mkeys)
       synchronize_srcu()
      				    xa_lock(implicit_children)
      				    if (still in xarray)
      				       atomic_inc()
      				       call_srcu()
      				    xa_unlock(implicit_children)
       xa_erase(implicit_children):
         xa_lock(implicit_children)
         __xa_erase()
         xa_unlock(implicit_children)
      
       flush_workqueue()
      				   [..]
      				    free_implicit_child_mr_rcu:
      				     (via call_srcu)
      				      queue_work()
      
       WARN_ON(atomic_read())
      				   [..]
      				    free_implicit_child_mr_work:
      				     (via wq)
      				      free_implicit_child_mr()
       mlx5_mr_cache_invalidate()
      				     mlx5_ib_update_xlt() <-- UMR QP fail
      				     atomic_dec()
      
      The wait_event() solves the race because it blocks until
      free_implicit_child_mr_work() completes.
      
      Fixes: 5256edcb ("RDMA/mlx5: Rework implicit ODP destroy")
      Link: https://lore.kernel.org/r/20200227113918.94432-1-leon@kernel.orgSigned-off-by: NArtemy Kovalyov <artemyko@mellanox.com>
      Reviewed-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      de5ed007
  4. 04 3月, 2020 14 次提交