[SYCL] Fix the check for read-only host pointer during memobj creation#2697
Merged
romanovvlad merged 2 commits intointel:syclfrom Nov 3, 2020
Merged
[SYCL] Fix the check for read-only host pointer during memobj creation#2697romanovvlad merged 2 commits intointel:syclfrom
romanovvlad merged 2 commits intointel:syclfrom
Conversation
Previously, whenever a native memory object was created, the original host pointer passed by the user was checked for being read-only, regardless of what host pointer was actually used at that point. This patch fixes the issue by assuming a writeable host pointer unless it's the one provided by the user. As a result, this fixes a double free issue that appeared with the following usage pattern: 1. Create a buffer with a const user pointer 2. Write-access it on host 3. Access it on a non-host device 4. Access it on host This error was caused by the allocation performed at step 2 being treated as read-only and, therefore, used with PI_MEM_FLAGS_HOST_PTR_COPY rather than PI_MEM_FLAGS_HOST_PTR_USE at step 3, while it was assumed otherwise during the release of this allocation. Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
romanovvlad
approved these changes
Nov 2, 2020
Contributor
|
/summary:run |
alexbatashev
pushed a commit
to alexbatashev/llvm
that referenced
this pull request
Nov 6, 2020
* upstream/sycl: [SYCL] Move tests with dependencies to on-device directory (intel#2732) [SYCL][Test] Remove leftovers for FPGA archives (intel#2735) [SYCL][NFC] Extend ABI tests to cover device code (intel#2725) [SYCL] Fix link to ESIMD tests (intel#2736) Added the SYCL_INTEL_mem_channel_property extension specification (intel#2688) [SYCL] Add support for new FPGA loop attribute nofusion (intel#2715) [SYCL] Remove host-task-dependency test added to llvm-test-suite (intel#2720) [SYCL] Remove warning about SYCL_EXTERNAL with pointers (intel#2722) [SYCL] dot_product support. (intel#2609) [SYCL][PI][L0] Fix a problem with kernels and programs destruction while they can be used (intel#2710) [SYCL] Fix the check for read-only host pointer during memobj creation (intel#2697)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, whenever a native memory object was created, the original host
pointer passed by the user was checked for being read-only, regardless
of what host pointer was actually used at that point. This patch fixes the
issue by assuming a writeable host pointer unless it's the one provided by
the user.
As a result, this fixes a double free issue that appeared with the
following usage pattern:
This error was caused by the allocation performed at step 2 being
treated as read-only and, therefore, used with
PI_MEM_FLAGS_HOST_PTR_COPY rather than PI_MEM_FLAGS_HOST_PTR_USE at step
3, while it was assumed otherwise during the release of this allocation.
Signed-off-by: Sergey Semenov sergey.semenov@intel.com