1. 25 8月, 2020 1 次提交
  2. 02 6月, 2020 2 次提交
  3. 04 2月, 2020 1 次提交
  4. 17 12月, 2019 1 次提交
  5. 12 12月, 2019 6 次提交
  6. 05 12月, 2019 1 次提交
  7. 28 11月, 2019 1 次提交
  8. 12 11月, 2019 1 次提交
    • B
      drm/i915/cmdparser: Fix jump whitelist clearing · ea0b163b
      Ben Hutchings 提交于
      When a jump_whitelist bitmap is reused, it needs to be cleared.
      Currently this is done with memset() and the size calculation assumes
      bitmaps are made of 32-bit words, not longs.  So on 64-bit
      architectures, only the first half of the bitmap is cleared.
      
      If some whitelist bits are carried over between successive batches
      submitted on the same context, this will presumably allow embedding
      the rogue instructions that we're trying to reject.
      
      Use bitmap_zero() instead, which gets the calculation right.
      
      Fixes: f8c08d8f ("drm/i915/cmdparser: Add support for backward jumps")
      Signed-off-by: NBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: NJon Bloomfield <jon.bloomfield@intel.com>
      ea0b163b
  9. 06 11月, 2019 7 次提交
    • J
      drm/i915/cmdparser: Ignore Length operands during command matching · 926abff2
      Jon Bloomfield 提交于
      Some of the gen instruction macros (e.g. MI_DISPLAY_FLIP) have the
      length directly encoded in them. Since these are used directly in
      the tables, the Length becomes part of the comparison used for
      matching during parsing. Thus, if the cmd being parsed has a
      different length to that in the table, it is not matched and the
      cmd is accepted via the default variable length path.
      
      Fix by masking out everything except the Opcode in the cmd tables
      
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Tyler Hicks <tyhicks@canonical.com>
      Signed-off-by: NJon Bloomfield <jon.bloomfield@intel.com>
      Reviewed-by: NChris Wilson <chris.p.wilson@intel.com>
      926abff2
    • J
      drm/i915/cmdparser: Add support for backward jumps · f8c08d8f
      Jon Bloomfield 提交于
      To keep things manageable, the pre-gen9 cmdparser does not
      attempt to track any form of nested BB_START's. This did not
      prevent usermode from using nested starts, or even chained
      batches because the cmdparser is not strictly enforced pre gen9.
      
      Instead, the existence of a nested BB_START would cause the batch
      to be emitted in insecure mode, and any privileged capabilities
      would not be available.
      
      For Gen9, the cmdparser becomes mandatory (for BCS at least), and
      so not providing any form of nested BB_START support becomes
      overly restrictive. Any such batch will simply not run.
      
      We make heavy use of backward jumps in igt, and it is much easier
      to add support for this restricted subset of nested jumps, than to
      rewrite the whole of our test suite to avoid them.
      
      Add the required logic to support limited backward jumps, to
      instructions that have already been validated by the parser.
      
      Note that it's not sufficient to simply approve any BB_START
      that jumps backwards in the buffer because this would allow an
      attacker to embed a rogue instruction sequence within the
      operand words of a harmless instruction (say LRI) and jump to
      that.
      
      We introduce a bit array to track every instr offset successfully
      validated, and test the target of BB_START against this. If the
      target offset hits, it is re-written to the same offset in the
      shadow buffer and the BB_START cmd is allowed.
      
      Note: This patch deliberately ignores checkpatch issues in the
      cmdtables, in order to match the style of the surrounding code.
      We'll correct the entire file in one go in a later patch.
      
      v2: set dispatch secure late (Mika)
      v3: rebase (Mika)
      v4: Clear whitelist on each parse
          Minor review updates (Chris)
      v5: Correct backward jump batching
      v6: fix compilation error due to struct eb shuffle (Mika)
      
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Tyler Hicks <tyhicks@canonical.com>
      Signed-off-by: NJon Bloomfield <jon.bloomfield@intel.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: NChris Wilson <chris.p.wilson@intel.com>
      f8c08d8f
    • J
      drm/i915/cmdparser: Use explicit goto for error paths · 0546a29c
      Jon Bloomfield 提交于
      In the next patch we will be adding a second valid
      termination condition which will require a small
      amount of refactoring to share logic with the BB_END
      case.
      
      Refactor all error conditions to jump to a dedicated
      exit path, with 'break' reserved only for a successful
      parse.
      
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Tyler Hicks <tyhicks@canonical.com>
      Signed-off-by: NJon Bloomfield <jon.bloomfield@intel.com>
      Reviewed-by: NChris Wilson <chris.p.wilson@intel.com>
      0546a29c
    • J
      drm/i915: Add gen9 BCS cmdparsing · 0f2f3975
      Jon Bloomfield 提交于
      For gen9 we enable cmdparsing on the BCS ring, specifically
      to catch inadvertent accesses to sensitive registers
      
      Unlike gen7/hsw, we use the parser only to block certain
      registers. We can rely on h/w to block restricted commands,
      so the command tables only provide enough info to allow the
      parser to delineate each command, and identify commands that
      access registers.
      
      Note: This patch deliberately ignores checkpatch issues in
      favour of matching the style of the surrounding code. We'll
      correct the entire file in one go in a later patch.
      
      v3: rebase (Mika)
      v4: Add RING_TIMESTAMP registers to whitelist (Jon)
      Signed-off-by: NJon Bloomfield <jon.bloomfield@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Tyler Hicks <tyhicks@canonical.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: NChris Wilson <chris.p.wilson@intel.com>
      0f2f3975
    • J
      drm/i915: Add support for mandatory cmdparsing · 311a50e7
      Jon Bloomfield 提交于
      The existing cmdparser for gen7 can be bypassed by specifying
      batch_len=0 in the execbuf call. This is safe because bypassing
      simply reduces the cmd-set available.
      
      In a later patch we will introduce cmdparsing for gen9, as a
      security measure, which must be strictly enforced since without
      it we are vulnerable to DoS attacks.
      
      Introduce the concept of 'required' cmd parsing that cannot be
      bypassed by submitting zero-length bb's.
      
      v2: rebase (Mika)
      v2: rebase (Mika)
      v3: fix conflict on engine flags (Mika)
      Signed-off-by: NJon Bloomfield <jon.bloomfield@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Tyler Hicks <tyhicks@canonical.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: NChris Wilson <chris.p.wilson@intel.com>
      311a50e7
    • J
      drm/i915: Remove Master tables from cmdparser · 66d8aba1
      Jon Bloomfield 提交于
      The previous patch has killed support for secure batches
      on gen6+, and hence the cmdparsers master tables are
      now dead code. Remove them.
      Signed-off-by: NJon Bloomfield <jon.bloomfield@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Tyler Hicks <tyhicks@canonical.com>
      Reviewed-by: NChris Wilson <chris.p.wilson@intel.com>
      66d8aba1
    • J
      drm/i915: Rename gen7 cmdparser tables · 0a2f661b
      Jon Bloomfield 提交于
      We're about to introduce some new tables for later gens, and the
      current naming for the gen7 tables will no longer make sense.
      
      v2: rebase
      Signed-off-by: NJon Bloomfield <jon.bloomfield@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Tyler Hicks <tyhicks@canonical.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: NChris Wilson <chris.p.wilson@intel.com>
      0a2f661b
  10. 09 8月, 2019 1 次提交
  11. 06 8月, 2019 1 次提交
  12. 28 5月, 2019 2 次提交
  13. 25 4月, 2019 1 次提交
  14. 06 3月, 2019 1 次提交
  15. 13 12月, 2018 1 次提交
  16. 07 2月, 2018 2 次提交
  17. 06 2月, 2018 2 次提交
  18. 29 11月, 2017 1 次提交
  19. 08 11月, 2017 1 次提交
    • C
      drm/i915: Silence smatch for cmdparser · 0ffba1fc
      Chris Wilson 提交于
      drivers/gpu/drm/i915/i915_cmd_parser.c:808:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:811:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:814:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:808:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:811:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:814:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:808:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:811:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:814:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:808:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:811:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:814:23: error: not an lvalue
      
      If we move the shift into each case not only do we kill the warning from
      smatch, but we shrink the code slightly:
      
         text	   data	    bss	    dec	    hex	filename
      1267906	  20587	   3168	1291661	 13b58d	before
      1267890	  20587	   3168	1291645	 13b57d	after
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Matthew Auld <matthew.william.auld@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107154055.19460-1-chris@chris-wilson.co.ukReviewed-by: NMatthew Auld <matthew.william.auld@gmail.com>
      Reviewed-by: NGabriel Krisman Bertazi <krisman@collabora.co.uk>
      0ffba1fc
  20. 31 8月, 2017 1 次提交
    • C
      drm/i915: Recreate vmapping even when the object is pinned · 3b24e7e8
      Chris Wilson 提交于
      Sometimes we know we are the only user of the bo, but since we take a
      protective pin_pages early on, an attempt to change the vmap on the
      object is denied because it is busy. i915_gem_object_pin_map() cannot
      tell from our single pin_count if the operation is safe. Instead we must
      pass that information down from the caller in the manner of
      I915_MAP_OVERRIDE.
      
      This issue has existed from the introduction of the mapping, but was
      never noticed as the only place where this conflict might happen is for
      cached kernel buffers (such as allocated by i915_gem_batch_pool_get()).
      Until recently there was only a single user (the cmdparser) so no
      conflicts ever occurred. However, we now use it to allocate batches for
      different operations (using MAP_WC on !llc for writes) in addition to the
      existing shadow batch (using MAP_WB for reads).
      
      We could either keep both mappings cached, or use a different write
      mechanism if we detect a MAP_WB already exists (i.e. clflush
      afterwards), but as we haven't seen this issue in the wild (it requires
      hitting the GPU reloc path in addition to the cmdparser) for simplicity
      just allow the mappings to be recreated.
      
      v2: Include the i915_MAP_OVERRIDE bit in the enum so the compiler knows
      about all the valid values.
      
      Fixes: 7dd4f672 ("drm/i915: Async GPU relocation processing")
      Testcase: igt/gem_lut_handle # byt, completely by accident
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20170828104631.8606-1-chris@chris-wilson.co.ukReviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      (cherry picked from commit a575c676)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      3b24e7e8
  21. 29 8月, 2017 1 次提交
    • C
      drm/i915: Recreate vmapping even when the object is pinned · a575c676
      Chris Wilson 提交于
      Sometimes we know we are the only user of the bo, but since we take a
      protective pin_pages early on, an attempt to change the vmap on the
      object is denied because it is busy. i915_gem_object_pin_map() cannot
      tell from our single pin_count if the operation is safe. Instead we must
      pass that information down from the caller in the manner of
      I915_MAP_OVERRIDE.
      
      This issue has existed from the introduction of the mapping, but was
      never noticed as the only place where this conflict might happen is for
      cached kernel buffers (such as allocated by i915_gem_batch_pool_get()).
      Until recently there was only a single user (the cmdparser) so no
      conflicts ever occurred. However, we now use it to allocate batches for
      different operations (using MAP_WC on !llc for writes) in addition to the
      existing shadow batch (using MAP_WB for reads).
      
      We could either keep both mappings cached, or use a different write
      mechanism if we detect a MAP_WB already exists (i.e. clflush
      afterwards), but as we haven't seen this issue in the wild (it requires
      hitting the GPU reloc path in addition to the cmdparser) for simplicity
      just allow the mappings to be recreated.
      
      v2: Include the i915_MAP_OVERRIDE bit in the enum so the compiler knows
      about all the valid values.
      
      Fixes: 7dd4f672 ("drm/i915: Async GPU relocation processing")
      Testcase: igt/gem_lut_handle # byt, completely by accident
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20170828104631.8606-1-chris@chris-wilson.co.ukReviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      a575c676
  22. 17 5月, 2017 1 次提交
  23. 11 4月, 2017 1 次提交
  24. 10 3月, 2017 1 次提交
  25. 07 1月, 2017 1 次提交