Bug 1739654 - Update RLBox so that locks aren't used for app_pointer in single threaded contexts r=bholley

Differential Revision: https://phabricator.services.mozilla.com/D130482
This commit is contained in:
shravanrn@gmail.com 2021-11-05 16:46:34 +00:00
Родитель 97209d1f8a
Коммит e073c96dc5
2 изменённых файлов: 9 добавлений и 1 удалений

2
third_party/rlbox/README-mozilla поставляемый
Просмотреть файл

@ -1,7 +1,7 @@
This directory contains the rlbox source from the upstream repo:
https://github.com/PLSysSec/rlbox_sandboxing_api/
Current version: [commit 298c785d94fe3f502c52649be292fa9da71de2e9]
Current version: [commit 543a85c32652df9088302e9130b6b4ff5b0c0584]
UPDATING:

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

@ -23,7 +23,9 @@ private:
std::map<T_PointerTypeUnsigned, void*> pointer_map;
T_PointerTypeUnsigned counter = 1;
#ifndef RLBOX_SINGLE_THREADED_INVOCATIONS
RLBOX_SHARED_LOCK(map_mutex);
#endif
T_PointerType get_unused_index()
{
@ -55,7 +57,9 @@ public:
T_PointerType get_app_pointer_idx(void* ptr)
{
#ifndef RLBOX_SINGLE_THREADED_INVOCATIONS
RLBOX_ACQUIRE_UNIQUE_GUARD(lock, map_mutex);
#endif
T_PointerType idx = get_unused_index();
T_PointerTypeUnsigned idx_int = (T_PointerTypeUnsigned)idx;
pointer_map[idx_int] = ptr;
@ -64,7 +68,9 @@ public:
void remove_app_ptr(T_PointerType idx)
{
#ifndef RLBOX_SINGLE_THREADED_INVOCATIONS
RLBOX_ACQUIRE_UNIQUE_GUARD(lock, map_mutex);
#endif
T_PointerTypeUnsigned idx_int = (T_PointerTypeUnsigned)idx;
auto it = pointer_map.find(idx_int);
detail::dynamic_check(it != pointer_map.end(),
@ -74,7 +80,9 @@ public:
void* lookup_index(T_PointerType idx)
{
#ifndef RLBOX_SINGLE_THREADED_INVOCATIONS
RLBOX_ACQUIRE_SHARED_GUARD(lock, map_mutex);
#endif
T_PointerTypeUnsigned idx_int = (T_PointerTypeUnsigned)idx;
auto it = pointer_map.find(idx_int);
detail::dynamic_check(it != pointer_map.end(),