summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2021-12-06 14:00:27 -0800
committerYabin Cui <yabinc@google.com>2021-12-13 10:18:38 -0800
commit1afbc971fdf90c3e3226ed7aa6b73f20478829ed (patch)
tree7060b020b00e2c8ccfcd4b3c46a22499f23530d7
parent970ba98ee22d24d42c5f1ee05aa8ec25fe90ea36 (diff)
downloadextras-android12-qpr3-s6-release.tar.gz
When generating sample records for 32bit arm processes, the dyn_stack_size may not be 8 byte aligned. And dyn_stack_size can be used to calculate new stack size. If the new stack size isn't 8 byte aligned, we can have alginment error later. So make sure new stack size is 8 byte aligned. Bug: 208187192 Bug: 210384787 Test: run simpleperf_unit_test Change-Id: Ibc2f99ba766419fdb491c49317b9fb5ae13138ef (cherry picked from commit 9290fc7b9d3609b854d2791428b2385bba427906)
-rw-r--r--simpleperf/RecordReadThread.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/simpleperf/RecordReadThread.cpp b/simpleperf/RecordReadThread.cpp
index 16af9292..a8229303 100644
--- a/simpleperf/RecordReadThread.cpp
+++ b/simpleperf/RecordReadThread.cpp
@@ -540,7 +540,7 @@ void RecordReadThread::PushRecordToRecordBuffer(KernelRecordReader* kernel_recor
// space in each sample to store stack data. However, a thread may use less stack than 64K.
// So not all the 64K stack data in a sample is valid, and we only need to keep valid stack
// data, whose size is dyn_stack_size.
- uint64_t new_stack_size = std::min<uint64_t>(dyn_stack_size, stack_size_limit);
+ uint64_t new_stack_size = Align(std::min<uint64_t>(dyn_stack_size, stack_size_limit), 8);
if (stack_size > new_stack_size) {
// Remove part of the stack data.
perf_event_header new_header = header;