Skip to content

Commit

Permalink
AIX: Fix DeclareSymbolGlobal on AIX
Browse files Browse the repository at this point in the history
Port 929dd37

Original Commit Message:

    When CFI is enabled this adds a check against this list whenever a new
    return address must be set in a deoptimized frame, as a mitigation for
    ROP attacks.
    The list is known at linking time so that its content and the pointer
    to it can be stored in a read-only memory section.
    The check is performed in the signing function, which is no longer
    generic, as well as when setting the current pc of the frame.
    Since the pc is now only signed when setting the caller's pc, there
    is no need for ReplaceContext anymore.

R=salome.thirot@arm.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I5005096811c289707e2d080477c60ae2ed4bf38b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2365372
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#69502}
  • Loading branch information
Milad Farazmand authored and Commit Bot committed Aug 20, 2020
1 parent faed298 commit 0589a2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/snapshot/embedded/platform-embedded-file-writer-aix.cc
Expand Up @@ -57,7 +57,9 @@ void PlatformEmbeddedFileWriterAIX::DeclarePointerToSymbol(const char* name,
}

void PlatformEmbeddedFileWriterAIX::DeclareSymbolGlobal(const char* name) {
fprintf(fp_, ".globl %s\n", name);
// These symbols are not visible outside of the final binary, this allows for
// reduced binary size, and less work for the dynamic linker.
fprintf(fp_, ".globl %s, hidden\n", name);
}

void PlatformEmbeddedFileWriterAIX::AlignToCodeAlignment() {
Expand All @@ -73,6 +75,9 @@ void PlatformEmbeddedFileWriterAIX::Comment(const char* string) {
}

void PlatformEmbeddedFileWriterAIX::DeclareLabel(const char* name) {
// .global is required on AIX, if the label is used/referenced in another file
// later to be linked.
fprintf(fp_, ".globl %s\n", name);
fprintf(fp_, "%s:\n", name);
}

Expand All @@ -85,7 +90,9 @@ void PlatformEmbeddedFileWriterAIX::SourceInfo(int fileid, const char* filename,
void PlatformEmbeddedFileWriterAIX::DeclareFunctionBegin(const char* name,
uint32_t size) {
Newline();
DeclareSymbolGlobal(name);
if (ENABLE_CONTROL_FLOW_INTEGRITY_BOOL) {
DeclareSymbolGlobal(name);
}
fprintf(fp_, ".csect %s[DS]\n", name); // function descriptor
fprintf(fp_, "%s:\n", name);
fprintf(fp_, ".llong .%s, 0, 0\n", name);
Expand Down

0 comments on commit 0589a2a

Please sign in to comment.