1. 18 Mar, 2020 36 commits
  2. 17 Mar, 2020 1 commit
  3. 16 Mar, 2020 3 commits
    • Chris Wilson's avatar
      drm: Mark up racy check of drm_gem_object.handle_count · 6afe6929
      Chris Wilson authored
      [ 1715.899800] BUG: KCSAN: data-race in drm_gem_handle_create_tail / drm_gem_object_handle_put_unlocked
      [ 1715.899838]
      [ 1715.899861] write to 0xffff8881830f3604 of 4 bytes by task 7834 on cpu 1:
      [ 1715.899896]  drm_gem_handle_create_tail+0x62/0x250
      [ 1715.899927]  drm_gem_open_ioctl+0xc1/0x160
      [ 1715.899956]  drm_ioctl_kernel+0xe4/0x120
      [ 1715.899981]  drm_ioctl+0x297/0x4c7
      [ 1715.900003]  ksys_ioctl+0x89/0xb0
      [ 1715.900027]  __x64_sys_ioctl+0x42/0x60
      [ 1715.900052]  do_syscall_64+0x6e/0x2c0
      [ 1715.900079]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [ 1715.900100]
      [ 1715.900119] read to 0xffff8881830f3604 of 4 bytes by task 8137 on cpu 0:
      [ 1715.900149]  drm_gem_object_handle_put_unlocked+0x31/0x130
      [ 1715.900180]  drm_gem_object_release_handle+0x93/0xe0
      [ 1715.900208]  drm_gem_handle_delete+0x7b/0xe0
      [ 1715.900235]  drm_gem_close_ioctl+0x61/0x80
      [ 1715.900264]  drm_ioctl_kernel+0xe4/0x120
      [ 1715.900291]  drm_ioctl+0x297/0x4c7
      [ 1715.900316]  ksys_ioctl+0x89/0xb0
      [ 1715.900340]  __x64_sys_ioctl+0x42/0x60
      [ 1715.900363]  do_syscall_64+0x6e/0x2c0
      [ 1715.900388]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200309120151.7675-1-chris@chris-wilson.co.uk
      6afe6929
    • Chris Wilson's avatar
      drm/mm: Allow drm_mm_initialized() to be used outside of the locks · 2214ddc2
      Chris Wilson authored
      Mark up the potential racy read in drm_mm_initialized(), as we want a
      cheap and cheerful check:
      
      [  121.098731] BUG: KCSAN: data-race in _i915_gem_object_create_stolen [i915] / rm_hole
      [  121.098766]
      [  121.098789] write (marked) to 0xffff8881f01ed330 of 8 bytes by task 3568 on cpu 3:
      [  121.098831]  rm_hole+0x64/0x140
      [  121.098860]  drm_mm_insert_node_in_range+0x3d3/0x6c0
      [  121.099254]  i915_gem_stolen_insert_node_in_range+0x91/0xe0 [i915]
      [  121.099646]  _i915_gem_object_create_stolen+0x9d/0x100 [i915]
      [  121.100047]  i915_gem_object_create_region+0x7a/0xa0 [i915]
      [  121.100451]  i915_gem_object_create_stolen+0x33/0x50 [i915]
      [  121.100849]  intel_engine_create_ring+0x1af/0x280 [i915]
      [  121.101242]  __execlists_context_alloc+0xce/0x3d0 [i915]
      [  121.101635]  execlists_context_alloc+0x25/0x40 [i915]
      [  121.102030]  intel_context_alloc_state+0xb6/0xf0 [i915]
      [  121.102420]  __intel_context_do_pin+0x1ff/0x220 [i915]
      [  121.102815]  i915_gem_do_execbuffer+0x46b4/0x4c20 [i915]
      [  121.103211]  i915_gem_execbuffer2_ioctl+0x2c3/0x580 [i915]
      [  121.103244]  drm_ioctl_kernel+0xe4/0x120
      [  121.103269]  drm_ioctl+0x297/0x4c7
      [  121.103296]  ksys_ioctl+0x89/0xb0
      [  121.103321]  __x64_sys_ioctl+0x42/0x60
      [  121.103349]  do_syscall_64+0x6e/0x2c0
      [  121.103377]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  121.103403]
      [  121.103426] read to 0xffff8881f01ed330 of 8 bytes by task 3109 on cpu 1:
      [  121.103819]  _i915_gem_object_create_stolen+0x30/0x100 [i915]
      [  121.104228]  i915_gem_object_create_region+0x7a/0xa0 [i915]
      [  121.104631]  i915_gem_object_create_stolen+0x33/0x50 [i915]
      [  121.105025]  intel_engine_create_ring+0x1af/0x280 [i915]
      [  121.105420]  __execlists_context_alloc+0xce/0x3d0 [i915]
      [  121.105818]  execlists_context_alloc+0x25/0x40 [i915]
      [  121.106202]  intel_context_alloc_state+0xb6/0xf0 [i915]
      [  121.106595]  __intel_context_do_pin+0x1ff/0x220 [i915]
      [  121.106985]  i915_gem_do_execbuffer+0x46b4/0x4c20 [i915]
      [  121.107375]  i915_gem_execbuffer2_ioctl+0x2c3/0x580 [i915]
      [  121.107409]  drm_ioctl_kernel+0xe4/0x120
      [  121.107437]  drm_ioctl+0x297/0x4c7
      [  121.107464]  ksys_ioctl+0x89/0xb0
      [  121.107489]  __x64_sys_ioctl+0x42/0x60
      [  121.107511]  do_syscall_64+0x6e/0x2c0
      [  121.107535]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200309121529.16497-1-chris@chris-wilson.co.uk
      2214ddc2
    • Kees Cook's avatar
      drm/edid: Distribute switch variables for initialization · deec222e
      Kees Cook authored
      Variables declared in a switch statement before any case statements
      cannot be automatically initialized with compiler instrumentation (as
      they are not part of any execution flow). With GCC's proposed automatic
      stack variable initialization feature, this triggers a warning (and they
      don't get initialized). Clang's automatic stack variable initialization
      (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
      doesn't initialize such variables[1]. Note that these warnings (or silent
      skipping) happen before the dead-store elimination optimization phase,
      so even when the automatic initializations are later elided in favor of
      direct initializations, the warnings remain.
      
      To avoid these problems, lift such variables up into the next code
      block.
      
      drivers/gpu/drm/drm_edid.c: In function ‘drm_edid_to_eld’:
      drivers/gpu/drm/drm_edid.c:4395:9: warning: statement will never be
      executed [-Wswitch-unreachable]
       4395 |     int sad_count;
            |         ^~~~~~~~~
      
      [1] https://bugs.llvm.org/show_bug.cgi?id=44916
      
      v2: move into function block instead being switch-local (Ville Syrjälä)
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      [danvet: keep the changelog]
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/202003060930.DDCCB6659@keescook
      deec222e