1. 25 Feb, 2022 2 commits
    • Clemens Backes's avatar
      [wasm] Avoid passing nullptr to CodeSpaceWriteScope · 5d4acc4e
      Clemens Backes authored
      After https://crrev.com/c/3484317, passing {nullptr} to the
      {CodeSpaceWriteScope} won't work any more. Since the tests do not have a
      {NativeModule} to pass instead, make them use
      {pthread_jit_write_protect_np} directly.
      
      The jump-table assembler tests have dedicated threads for writing and
      executing the code, so we just switch once per thread. The icache test
      switches between writing and executing, so we use a little struct for
      switching.
      
      R=jkummerow@chromium.org, tebbi@chromium.org
      
      Bug: v8:12644, v8:11974
      Change-Id: I116f3ad75454f749cdc4635802a4617ff91548b2
      Cq-Include-Trybots: luci.v8.try:v8_mac_arm64_rel_ng
      Cq-Include-Trybots: luci.v8.try:v8_mac_arm64_dbg_ng
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3487995Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#79290}
      5d4acc4e
    • Clemens Backes's avatar
      [wasm] Fix CodeSpaceWriteScope for different modules · 1023ecee
      Clemens Backes authored
      In very rare cases we open CodeSpaceWriteScopes for multiple native
      modules at the same time, e.g. for tier down (debugging) via
      
        ExecuteCompilationUnits
      --> PublishCompilationResults
      --> OnFinishedUnits
      --> TriggerCallbacks
      --> AsyncCompileJob::CompilationStateCallback::call
      --> WasmEngine::UpdateNativeModuleCache
      --> RecompileNativeModule [for tier down]
      --> InitializeRecompilation
      --> FindFunctionsToRecompile
      --> CodeSpaceWriteScope
      
      Fixing this would be difficult because we actually want to keep the
      CodeSpaceWriteScope open during subsequent publishing. So instead,
      remove the assumption that scopes are always only open for one module at
      a time.
      In order to do this, we remove the {code_space_write_nesting_level_}
      counter and instead use the {current_native_module_} field in all
      configurations to check whether a scope is currently open, and for which
      module.
      
      R=jkummerow@chromium.org
      
      Bug: v8:12644, v8:11974
      Change-Id: Idd24c87f5938c43e867c41fa1cd3879def6f3873
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3484317Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#79286}
      1023ecee
  2. 17 Feb, 2022 1 commit
  3. 11 Aug, 2021 1 commit
    • Clemens Backes's avatar
      Reland "Reland: [wasm] Check correctness of thread-local write protection" · 3fd8025d
      Clemens Backes authored
      This is a reland of 1c0cca0f. It is
      modified now to use V8_HAS_PTHREAD_JIT_WRITE_PROTECT and is rebased on
      https://crrev.com/c/3085271 which fixes the definition of that macro.
      
      Original change's description:
      > Reland: [wasm] Check correctness of thread-local write protection
      >
      > The fix landed as a separate CL: https://crrev.com/c/3081522
      > This is an unmodified reland.
      >
      > Original description:
      > We make an undocumented assumption in {CodeSpaceWriteScope} that a
      > single thread will only work on one module at a time. If this is
      > violated, the thread-local {code_space_write_nesting_level_} would
      > prevent the second module from being switched to writable.
      >
      > This CL adds a second thread local (in debug only) to check that if
      > there is already a {CodeSpaceWriteScope} open that it contains the same
      > {NativeModule} as any nested scope.
      >
      > R=jkummerow@chromium.org
      >
      > Bug: v8:11974
      > Cq-Include-Trybots: luci.v8.try:v8_linux_gc_stress_dbg_ng
      > Cq-Include-Trybots: luci.v8.try:v8_mac64_gc_stress_dbg_ng
      > Change-Id: Id827b6ca472f695e4500584349aba159aa07eed1
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3080578
      > Commit-Queue: Clemens Backes <clemensb@chromium.org>
      > Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#76177}
      
      Bug: v8:11974
      Change-Id: Iffc510e85c8c56f26bfa88115ed3a8bdd33ef422
      Cq-Include-Trybots: luci.v8.try:v8_linux_gc_stress_dbg_ng
      Cq-Include-Trybots: luci.v8.try:v8_mac64_gc_stress_dbg_ng
      Cq-Include-Trybots: luci.v8.try:v8_mac_arm64_rel_ng
      Cq-Include-Trybots: luci.v8.try:v8_mac_arm64_dbg_ng
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3085269Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#76235}
      3fd8025d
  4. 10 Aug, 2021 1 commit
    • Minoru Chikamune's avatar
      Revert "Reland: [wasm] Check correctness of thread-local write protection" · 996e0380
      Minoru Chikamune authored
      This reverts commit 1c0cca0f.
      
      Reason for revert: this made tree closed. (https://crbug.com/1238174)
      
      Original change's description:
      > Reland: [wasm] Check correctness of thread-local write protection
      >
      > The fix landed as a separate CL: https://crrev.com/c/3081522
      > This is an unmodified reland.
      >
      > Original description:
      > We make an undocumented assumption in {CodeSpaceWriteScope} that a
      > single thread will only work on one module at a time. If this is
      > violated, the thread-local {code_space_write_nesting_level_} would
      > prevent the second module from being switched to writable.
      >
      > This CL adds a second thread local (in debug only) to check that if
      > there is already a {CodeSpaceWriteScope} open that it contains the same
      > {NativeModule} as any nested scope.
      >
      > R=​jkummerow@chromium.org
      >
      > Bug: v8:11974
      > Cq-Include-Trybots: luci.v8.try:v8_linux_gc_stress_dbg_ng
      > Cq-Include-Trybots: luci.v8.try:v8_mac64_gc_stress_dbg_ng
      > Change-Id: Id827b6ca472f695e4500584349aba159aa07eed1
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3080578
      > Commit-Queue: Clemens Backes <clemensb@chromium.org>
      > Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#76177}
      
      Bug: v8:11974, 1238174
      Change-Id: I74d8723344e4b9015d956ebfe3fda492280356b6
      Cq-Include-Trybots: luci.v8.try:v8_linux_gc_stress_dbg_ng
      Cq-Include-Trybots: luci.v8.try:v8_mac64_gc_stress_dbg_ng
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3084041
      Auto-Submit: Minoru Chikamune <chikamune@google.com>
      Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
      Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
      Cr-Commit-Position: refs/heads/master@{#76184}
      996e0380
  5. 09 Aug, 2021 1 commit
    • Clemens Backes's avatar
      Reland: [wasm] Check correctness of thread-local write protection · 1c0cca0f
      Clemens Backes authored
      The fix landed as a separate CL: https://crrev.com/c/3081522
      This is an unmodified reland.
      
      Original description:
      We make an undocumented assumption in {CodeSpaceWriteScope} that a
      single thread will only work on one module at a time. If this is
      violated, the thread-local {code_space_write_nesting_level_} would
      prevent the second module from being switched to writable.
      
      This CL adds a second thread local (in debug only) to check that if
      there is already a {CodeSpaceWriteScope} open that it contains the same
      {NativeModule} as any nested scope.
      
      R=jkummerow@chromium.org
      
      Bug: v8:11974
      Cq-Include-Trybots: luci.v8.try:v8_linux_gc_stress_dbg_ng
      Cq-Include-Trybots: luci.v8.try:v8_mac64_gc_stress_dbg_ng
      Change-Id: Id827b6ca472f695e4500584349aba159aa07eed1
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3080578
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#76177}
      1c0cca0f
  6. 06 Aug, 2021 3 commits
  7. 19 Jul, 2021 1 commit
  8. 15 Jul, 2021 2 commits
  9. 21 Jun, 2021 2 commits
    • Daniel Lehmann's avatar
      [wasm] Merge code space write scope implementations · 8a3c4881
      Daniel Lehmann authored
      Merges `NativeModuleModificationScope` (with an implementation using
      Intel PKU, if available, and mprotect otherwise) and
      `CodeSpaceWriteScope` (for Apple Silicon, where switching to RWX with
      mprotect is disallowed anyway, so MAP_JIT and thread-local switching
      must be used).
      
      Because `CodeSpaceWriteScope` sounded better (and is shorter), we kept
      its name (which unfortunately makes the diff a bit harder to read).
      
      R=clemensb@chromium.org
      CC=jkummerow@chromium.org
      
      Bug: v8:11714
      
      Cq-Include-Trybots: luci.v8.try:v8_linux64_fyi_rel_ng
      Change-Id: Ib2a7d18e72797a725ed34b904c70769166d811dd
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2972911Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Commit-Queue: Daniel Lehmann <dlehmann@google.com>
      Cr-Commit-Position: refs/heads/master@{#75272}
      8a3c4881
    • Daniel Lehmann's avatar
      [wasm] Move NativeModuleModificationScope impl · 2ef8f917
      Daniel Lehmann authored
      In an effort to merge `CODE_SPACE_WRITE_SCOPE` and
      `NativeModuleModificationScope`, this CL moves the interface and
      implementation of the latter into code-space-access.{h,cc}, where the
      former already lives. No other changes to the code itself.
      
      R=clemensb@chromium.org
      CC=jkummerow@chromium.org
      
      Bug: v8:11714
      
      Cq-Include-Trybots: luci.v8.try:v8_linux64_fyi_rel_ng
      Change-Id: I1aabce26f2033430523a7a3a0a4864e7267bee21
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2972803Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Commit-Queue: Daniel Lehmann <dlehmann@google.com>
      Cr-Commit-Position: refs/heads/master@{#75267}
      2ef8f917
  10. 16 Mar, 2021 1 commit
  11. 26 Nov, 2020 1 commit
  12. 09 Sep, 2020 1 commit