Commit 035b2d9c authored by Vlad Tsyrklevich's avatar Vlad Tsyrklevich Committed by Commit Bot

a11y: Deprecate use of base::ProtectedMemory

base::ProtectedMemory is being deprecated because it's not widely used
enough to make a security impact and justify its maintenance burden.
Replace use of base::ProtectedMemory with raw function pointers and add
an attribute to disable CFI-icall checking.

Bug: 1018834
Change-Id: I2ff1a9ad5415b8244b5b488fcf115b7481022c47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888775Reviewed-by: default avatarMartin Robinson <mrobinson@igalia.com>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710793}
parent 0df42d3f
......@@ -15,8 +15,8 @@
#include <vector>
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/debug/leak_annotations.h"
#include "base/memory/protected_memory_cfi.h"
#include "base/no_destructor.h"
#include "base/numerics/ranges.h"
#include "base/optional.h"
......@@ -2024,68 +2024,57 @@ using GetRowColumnSpanFunc = bool (*)(AtkTableCell* cell,
gint* row_span,
gint* col_span);
static PROTECTED_MEMORY_SECTION base::ProtectedMemory<GetTypeFunc>
g_atk_table_cell_get_type;
static GetTypeFunc g_atk_table_cell_get_type;
static PROTECTED_MEMORY_SECTION base::ProtectedMemory<GetColumnHeaderCellsFunc>
g_atk_table_cell_get_column_header_cells;
static GetColumnHeaderCellsFunc g_atk_table_cell_get_column_header_cells;
static PROTECTED_MEMORY_SECTION base::ProtectedMemory<GetRowHeaderCellsFunc>
g_atk_table_cell_get_row_header_cells;
static GetRowHeaderCellsFunc g_atk_table_cell_get_row_header_cells;
static PROTECTED_MEMORY_SECTION base::ProtectedMemory<GetRowColumnSpanFunc>
g_atk_table_cell_get_row_column_span;
static GetRowColumnSpanFunc g_atk_table_cell_get_row_column_span;
} // namespace
// static
NO_SANITIZE("cfi-icall")
GType AtkTableCellInterface::GetType() {
return base::UnsanitizedCfiCall(g_atk_table_cell_get_type)();
return g_atk_table_cell_get_type();
}
// static
NO_SANITIZE("cfi-icall")
GPtrArray* AtkTableCellInterface::GetColumnHeaderCells(AtkTableCell* cell) {
return base::UnsanitizedCfiCall(g_atk_table_cell_get_column_header_cells)(
cell);
return g_atk_table_cell_get_column_header_cells(cell);
}
// static
NO_SANITIZE("cfi-icall")
GPtrArray* AtkTableCellInterface::GetRowHeaderCells(AtkTableCell* cell) {
return base::UnsanitizedCfiCall(g_atk_table_cell_get_row_header_cells)(cell);
return g_atk_table_cell_get_row_header_cells(cell);
}
// static
NO_SANITIZE("cfi-icall")
bool AtkTableCellInterface::GetRowColumnSpan(AtkTableCell* cell,
gint* row,
gint* column,
gint* row_span,
gint* col_span) {
return base::UnsanitizedCfiCall(g_atk_table_cell_get_row_column_span)(
cell, row, column, row_span, col_span);
return g_atk_table_cell_get_row_column_span(cell, row, column, row_span,
col_span);
}
// static
bool AtkTableCellInterface::Exists() {
static base::ProtectedMemory<GetTypeFunc>::Initializer
init_atk_table_cell_get_type(
&g_atk_table_cell_get_type,
reinterpret_cast<GetTypeFunc>(
dlsym(RTLD_DEFAULT, "atk_table_cell_get_type")));
static base::ProtectedMemory<GetColumnHeaderCellsFunc>::Initializer
init_atk_table_cell_get_column_header_cells(
&g_atk_table_cell_get_column_header_cells,
reinterpret_cast<GetColumnHeaderCellsFunc>(
dlsym(RTLD_DEFAULT, "atk_table_cell_get_column_header_cells")));
static base::ProtectedMemory<GetRowHeaderCellsFunc>::Initializer
init_atk_table_cell_get_row_header_cells(
&g_atk_table_cell_get_row_header_cells,
reinterpret_cast<GetRowHeaderCellsFunc>(
dlsym(RTLD_DEFAULT, "atk_table_cell_get_row_header_cells")));
static base::ProtectedMemory<GetRowColumnSpanFunc>::Initializer
init_atk_table_cell_get_row_column_span(
&g_atk_table_cell_get_row_column_span,
reinterpret_cast<GetRowColumnSpanFunc>(
dlsym(RTLD_DEFAULT, "atk_table_cell_get_row_column_span")));
g_atk_table_cell_get_type = reinterpret_cast<GetTypeFunc>(
dlsym(RTLD_DEFAULT, "atk_table_cell_get_type"));
g_atk_table_cell_get_column_header_cells =
reinterpret_cast<GetColumnHeaderCellsFunc>(
dlsym(RTLD_DEFAULT, "atk_table_cell_get_column_header_cells"));
g_atk_table_cell_get_row_header_cells =
reinterpret_cast<GetRowHeaderCellsFunc>(
dlsym(RTLD_DEFAULT, "atk_table_cell_get_row_header_cells"));
g_atk_table_cell_get_row_column_span = reinterpret_cast<GetRowColumnSpanFunc>(
dlsym(RTLD_DEFAULT, "atk_table_cell_get_row_column_span"));
return *g_atk_table_cell_get_type;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment