Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1012,10 +1012,6 @@ jobs:
with:
ref: ${{ fromJson(inputs.branch).ref }}
fetch-depth: 0
# ASLR can cause a lot of noise due to missed sse opportunities for memcpy
# and other operations, so we disable it during benchmarking.
- name: Disable ASLR
run: echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
- name: apt
run: |
set -x
Expand Down
4 changes: 4 additions & 0 deletions benchmark/benchmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,16 @@ function runValgrindPhpCgiCommand(
): array {
global $phpCgi;

// ASLR can cause a lot of noise due to missed SSE opportunities for memcpy and other operations
$aslrDisable = checkPersonalityAslrDisablePermission();

$profileOut = __DIR__ . "/profiles/callgrind.out.$name";
if ($jit) {
$profileOut .= '.jit';
}

$process = runCommand([
...($aslrDisable ? ['setarch', '--addr-no-randomize'] : []),
'valgrind',
'--tool=callgrind',
'--dump-instr=yes',
Expand Down
13 changes: 13 additions & 0 deletions benchmark/shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,16 @@ function cloneRepo(string $path, string $url) {
}
runCommand(['git', 'clone', '-q', '--end-of-options', $url, $repo], dirname($path));
}

function checkPersonalityAslrDisablePermission(): bool {
$processResult = runCommand(['sh', '-c', 'setarch --addr-no-randomize sh -c \'cat /proc/self/personality\' || true'], null, false);

$n = hexdec($processResult->stdout);
if (($n & 0x4_00_00) === 0) {
fwrite(STDOUT, 'Unable to disable ASLR: ' . trim($processResult->stderr) . "\n");

return false;
}

return true;
}
Loading