Backed out changeset 9d28ee24c377 (bug 1573270) for xpcshell failures at toolkit/modules/tests/xpcshell/test_firstStartup.js on a CLOSED TREE

This commit is contained in:
Coroiu Cristina 2019-11-26 02:29:15 +02:00
Родитель 10c317e37e
Коммит 535a7ca388
2 изменённых файлов: 0 добавлений и 44 удалений

Просмотреть файл

@ -111,10 +111,6 @@ bool SharedMemory::CreateInternal(size_t size, bool freezeable) {
DCHECK(mapped_file_ == NULL);
read_only_ = false;
// If the shared memory object has no DACL, any process can
// duplicate its handles with any access rights; e.g., re-add write
// access to a read-only handle. To prevent that, we give it an
// empty DACL, so that no process can do that.
SECURITY_ATTRIBUTES sa, *psa = nullptr;
SECURITY_DESCRIPTOR sd;
ACL dacl;
@ -133,8 +129,6 @@ bool SharedMemory::CreateInternal(size_t size, bool freezeable) {
return false;
}
// Older versions of Windows will silently ignore the security
// attributes unless the object has a name.
if (!mozilla::IsWin8Point1OrLater()) {
name.AssignLiteral("MozSharedMem_");
for (size_t i = 0; i < 4; ++i) {

Просмотреть файл

@ -11,10 +11,6 @@
#include "base/process_util.h"
#include "mozilla/ipc/SharedMemory.h"
#ifdef XP_WIN
#include <windows.h>
#endif
namespace mozilla {
// Try to map a frozen shm for writing. Threat model: the process is
@ -110,38 +106,4 @@ TEST(IPCSharedMemory, Reprotect)
}
#endif
#ifdef XP_WIN
// Try to regain write permissions on a read-only handle using
// DuplicateHandle; this will succeed if the object has no DACL.
// See also https://crbug.com/338538
TEST(IPCSharedMemory, WinUnfreeze)
{
base::SharedMemory shm;
// Create and initialize
ASSERT_TRUE(shm.CreateFreezeable(1));
ASSERT_TRUE(shm.Map(1));
auto mem = reinterpret_cast<char*>(shm.memory());
ASSERT_TRUE(mem);
*mem = 'A';
// Freeze
ASSERT_TRUE(shm.Freeze());
ASSERT_FALSE(shm.memory());
// Extract handle.
auto handle = base::SharedMemory::NULLHandle();
ASSERT_TRUE(shm.GiveToProcess(base::GetCurrentProcId(), &handle));
ASSERT_TRUE(shm.IsHandleValid(handle));
ASSERT_FALSE(shm.IsValid());
// Unfreeze.
bool unfroze = ::DuplicateHandle(GetCurrentProcess(), handle,
GetCurrentProcess(), &handle,
FILE_MAP_ALL_ACCESS, false,
DUPLICATE_CLOSE_SOURCE);
ASSERT_FALSE(unfroze);
}
#endif
} // namespace mozilla