[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #18171 [Tor Browser]: Dlls brokenness with Windows10 Build 14251



#18171: Dlls brokenness with Windows10 Build 14251
-------------------------------------------------+-------------------------
 Reporter:  Coh_t                                |          Owner:  tbb-
     Type:  defect                               |  team
 Priority:  High                                 |         Status:
Component:  Tor Browser                          |  needs_information
 Severity:  Major                                |      Milestone:
 Keywords:  loneliness bug-no-bounty tbb-crash   |        Version:
  TorBrowserTeam201602                           |     Resolution:
Parent ID:                                       |  Actual Points:
  Sponsor:                                       |         Points:
-------------------------------------------------+-------------------------

Comment (by cypherpunks):

 And yet
 {{{ static void
  __write_memory (void *addr, const void *src, size_t len)
  {
 -  MEMORY_BASIC_INFORMATION b;
 -  DWORD oldprot;
 -  int call_unprotect = 0;
 -
    if (!len)
      return;

  #ifdef __MINGW64_VERSION_MAJOR
 +  /* Mark the section writable once, and unset it in
 +   * restore_modified_sections */
    mark_section_writable ((LPVOID) addr);
 -#endif
 +#else
 +  MEMORY_BASIC_INFORMATION b;
 +  DWORD oldprot = 0;
 +  int call_unprotect = 0;

    if (!VirtualQuery (addr, &b, sizeof(b)))
      {
        __report_error ("  VirtualQuery failed for %d bytes at address %p",
                       (int) sizeof(b), addr);
      }

    /* Temporarily allow write access to read-only protected memory.  */
 -  if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE)
 +  if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE
 +      && b.Protect != PAGE_WRITECOPY && b.Protect !=
 PAGE_EXECUTE_WRITECOPY)
      {
        call_unprotect = 1;
        VirtualProtect (b.BaseAddress, b.RegionSize,
 PAGE_EXECUTE_READWRITE,
                       &oldprot);
      }
 +#endif

    /* write the data. */
    memcpy (addr, src, len);
 +
 +#ifndef __MINGW64_VERSION_MAJOR
    /* Restore original protection. */
 -  if (call_unprotect && b.Protect != PAGE_EXECUTE_READWRITE && b.Protect
 != PAGE_READWRITE)
 +  if (call_unprotect
 +      && b.Protect != PAGE_EXECUTE_READWRITE && b.Protect !=
 PAGE_READWRITE
 +      && b.Protect != PAGE_WRITECOPY && b.Protect !=
 PAGE_EXECUTE_WRITECOPY)
      VirtualProtect (b.BaseAddress, b.RegionSize, oldprot, &oldprot);
 +#endif
  }
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18171#comment:69>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs