Skip to content
Commit a71b54d8 authored by Vlad Tsyrklevich's avatar Vlad Tsyrklevich Committed by Commit Bot
Browse files

[cfi-icall] Refactor GL g_driver_* to be CFI-safe

Control Flow Integrity [1] indirect call (cfi-icall) checking can not
verify that dynamically resolved function pointers call their intended
function. To account for this, we place the function pointers in the
various g_driver_* structs in ProtectedMemory, a wrapper for keeping
variables in read-only memory except for when they are initialized.
Once they are set they can not be tampered with since the memory is set
back to read-only.

The generated bindings in gl_bindings_autogen_*.cc are not aware of the
fact that their implementation is held in protected memory, so instead
of using base::UnsanitizedCfiCall() we mark the individual function
stubs with __attribute__((no_sanitize("cfi-icall"))) to disable icall
checks on the generated bindings since their function pointer calls
are routed through protected memory.

[1] https://www.chromium.org/developers/testing/control-flow-integrity

Bug: 771365
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I6bbf1b9a4122e1d00f6d2a365ae3730b4bb95a73
Reviewed-on: https://chromium-review.googlesource.com/770252


Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarPeter Collingbourne <pcc@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524318}
parent e588e2d2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment