diff --git a/.github/workflows/approve-trivial.yml b/.github/workflows/approve-trivial.yml index 0f26defe5..f737036d4 100644 --- a/.github/workflows/approve-trivial.yml +++ b/.github/workflows/approve-trivial.yml @@ -17,6 +17,13 @@ jobs: scope: DataDog/java-profiler policy: self.approve-trivial.approve-pr - name: Auto-approve PR - uses: hmarr/auto-approve-action@8f929096a962e83ccdfa8afcf855f39f12d4dac7 # v4 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # 9.0.0 with: github-token: ${{ steps.octo-sts.outputs.token }} + script: | + await github.rest.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }) diff --git a/.github/workflows/create-next-milestone.yaml b/.github/workflows/create-next-milestone.yaml index 572987231..44ed27c62 100644 --- a/.github/workflows/create-next-milestone.yaml +++ b/.github/workflows/create-next-milestone.yaml @@ -13,12 +13,19 @@ jobs: steps: - name: Get next minor version id: semvers - uses: WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930 # 1.2.1 - with: - version: ${{ github.event.milestone.title }} + env: + MILESTONE_TITLE: ${{ github.event.milestone.title }} + run: | + MAJOR=$(echo "$MILESTONE_TITLE" | cut -d. -f1) + MINOR=$(echo "$MILESTONE_TITLE" | cut -d. -f2) + echo "minor=${MAJOR}.$((MINOR + 1)).0" >> "$GITHUB_OUTPUT" - name: Create next milestone - uses: WyriHaximus/github-action-create-milestone@6f8e11bb23890a15c6cc520abf7a36510dfd0f94 # 1.2.0 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # 9.0.0 with: - title: ${{ steps.semvers.outputs.minor }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + await github.rest.issues.createMilestone({ + owner: context.repo.owner, + repo: context.repo.repo, + title: '${{ steps.semvers.outputs.minor }}' + }) diff --git a/.github/workflows/increment-milestones-on-tag.yaml b/.github/workflows/increment-milestones-on-tag.yaml index 6c7db8a92..8fb0e3d6c 100644 --- a/.github/workflows/increment-milestones-on-tag.yaml +++ b/.github/workflows/increment-milestones-on-tag.yaml @@ -53,13 +53,20 @@ jobs: - name: Get next minor version if: fromJSON(steps.milestone.outputs.result) id: semvers - uses: WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930 # 1.2.1 - with: - version: ${{steps.milestoneTitle.outputs.result}} + env: + MILESTONE_TITLE: ${{ steps.milestoneTitle.outputs.result }} + run: | + MAJOR=$(echo "$MILESTONE_TITLE" | cut -d. -f1) + MINOR=$(echo "$MILESTONE_TITLE" | cut -d. -f2) + echo "minor=${MAJOR}.$((MINOR + 1)).0" >> "$GITHUB_OUTPUT" - name: Create next milestone if: fromJSON(steps.milestone.outputs.result) - uses: WyriHaximus/github-action-create-milestone@6f8e11bb23890a15c6cc520abf7a36510dfd0f94 # 1.2.0 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # 9.0.0 with: - title: ${{ steps.semvers.outputs.minor }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + await github.rest.issues.createMilestone({ + owner: context.repo.owner, + repo: context.repo.repo, + title: '${{ steps.semvers.outputs.minor }}' + }) diff --git a/ddprof-lib/src/main/cpp/buffers.h b/ddprof-lib/src/main/cpp/buffers.h index 9380473de..098752258 100644 --- a/ddprof-lib/src/main/cpp/buffers.h +++ b/ddprof-lib/src/main/cpp/buffers.h @@ -65,29 +65,22 @@ class Buffer { void reset() { _offset = 0; } - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 __attribute__((no_sanitize("bounds"))) - #endif void put(const char *v, u32 len) { assert(static_cast(_offset + len) < limit()); memcpy(_data + _offset, v, len); _offset += (int)len; } - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 + // RecordingBuffer extends _data[] beyond its declared size via struct layout; + // suppress bounds sanitizer on all architectures to avoid false positives. __attribute__((no_sanitize("bounds"))) - #endif void put8(char v) { assert(_offset < limit()); _data[_offset++] = v; } - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 __attribute__((no_sanitize("bounds"))) - #endif void put16(short v) { assert(_offset + 2 < limit()); *(short *)(_data + _offset) = htons(v); @@ -97,11 +90,8 @@ class Buffer { // java-profiler/ddprof-lib/src/main/cpp/buffers.h:92:34: runtime error: // store to misaligned address 0x7f3c446ec81e for type 'int', which // requires 4 byte alignment 0x7f3c446ec81e: note: pointer points here - __attribute__((no_sanitize("undefined"))) - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 + __attribute__((no_sanitize("undefined"))) __attribute__((no_sanitize("bounds"))) - #endif void put32(int v) { assert(_offset + 4 < limit()); *(int *)(_data + _offset) = htonl(v); @@ -113,10 +103,7 @@ class Buffer { // 'u64', which requires 8 byte alignment // 0x766bb5a1e814: note: pointer points here __attribute__((no_sanitize("undefined"))) - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 __attribute__((no_sanitize("bounds"))) - #endif void put64(u64 v) { assert(_offset + 8 < limit()); *(u64 *)(_data + _offset) = OS::hton64(v); @@ -135,10 +122,7 @@ class Buffer { put32(u.i); } - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 __attribute__((no_sanitize("bounds"))) - #endif void putVar32(u32 v) { assert(_offset + 5 < limit()); while (v > 0x7f) { @@ -149,10 +133,7 @@ class Buffer { assert(_offset < limit()); } - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 __attribute__((no_sanitize("bounds"))) - #endif void putVar64(u64 v) { assert(_offset + 9 < limit()); int iter = 0; @@ -185,10 +166,7 @@ class Buffer { } } - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 __attribute__((no_sanitize("bounds"))) - #endif void putUtf8(const char *v, u32 len) { len = len < MAX_STRING_LENGTH ? len : MAX_STRING_LENGTH; put8(3); @@ -196,16 +174,10 @@ class Buffer { put(v, len); } - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 __attribute__((no_sanitize("bounds"))) - #endif void put8(int offset, char v) { _data[offset] = v; } - #ifdef __aarch64__ - // the trickery of RecordingBuffer extending Buffer::_data array may trip off asan on aarch64 __attribute__((no_sanitize("bounds"))) - #endif void putVar32(int offset, u32 v) { assert(offset + 4 < limit()); _data[offset] = v | 0x80; diff --git a/ddprof-lib/src/test/cpp/remoteargs_ut.cpp b/ddprof-lib/src/test/cpp/remoteargs_ut.cpp index 1778fd455..4286cf9a2 100644 --- a/ddprof-lib/src/test/cpp/remoteargs_ut.cpp +++ b/ddprof-lib/src/test/cpp/remoteargs_ut.cpp @@ -97,33 +97,33 @@ TEST_F(RemoteArgsTest, RemoteSymbolicationNoValue) { } TEST_F(RemoteArgsTest, RemoteSymbolicationNumericValues) { - Arguments args; - - // Test numeric 1 (should enable) - Error error = args.parse("remotesym=1"); - EXPECT_FALSE(error); - EXPECT_TRUE(args._remote_symbolication); - - // Test numeric 0 (should disable) - args = Arguments(); - error = args.parse("remotesym=0"); - EXPECT_FALSE(error); - EXPECT_FALSE(args._remote_symbolication); + { + Arguments args; + Error error = args.parse("remotesym=1"); + EXPECT_FALSE(error); + EXPECT_TRUE(args._remote_symbolication); + } + { + Arguments args; + Error error = args.parse("remotesym=0"); + EXPECT_FALSE(error); + EXPECT_FALSE(args._remote_symbolication); + } } TEST_F(RemoteArgsTest, RemoteSymbolicationNoVariant) { - Arguments args; - - // Test "no" (should disable) - Error error = args.parse("remotesym=no"); - EXPECT_FALSE(error); - EXPECT_FALSE(args._remote_symbolication); - - // Test "n" (should disable) - args = Arguments(); - error = args.parse("remotesym=n"); - EXPECT_FALSE(error); - EXPECT_FALSE(args._remote_symbolication); + { + Arguments args; + Error error = args.parse("remotesym=no"); + EXPECT_FALSE(error); + EXPECT_FALSE(args._remote_symbolication); + } + { + Arguments args; + Error error = args.parse("remotesym=n"); + EXPECT_FALSE(error); + EXPECT_FALSE(args._remote_symbolication); + } } TEST_F(RemoteArgsTest, RemoteSymbolicationInvalidValue) {