Skip to content

Commit 65eb1fd

Browse files
alexander-shaposhnikovxnnpack-bot
authored andcommitted
Add PTHREADPOOL_NO_SANITIZE_FUNCTION macro.
PiperOrigin-RevId: 908344162
1 parent 85d1718 commit 65eb1fd

7 files changed

Lines changed: 150 additions & 156 deletions

File tree

.github/workflows/build.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Setup ccache
3535
uses: hendrikmuhs/ccache-action@v1.2
3636
with:
37-
key: ${{ github.job }}
37+
key: v2-${{ github.job }}
3838
max-size: "500M"
3939
save: ${{ inputs.update-caches }}
4040
- name: Create output directory
@@ -65,7 +65,7 @@ jobs:
6565
- name: Setup ccache
6666
uses: hendrikmuhs/ccache-action@v1.2
6767
with:
68-
key: ${{ github.job }}
68+
key: v2-${{ github.job }}
6969
max-size: "500M"
7070
save: ${{ inputs.update-caches }}
7171
- name: Create output directory
@@ -90,7 +90,7 @@ jobs:
9090
- name: Setup ccache
9191
uses: hendrikmuhs/ccache-action@v1.2
9292
with:
93-
key: ${{ github.job }}
93+
key: v2-${{ github.job }}
9494
max-size: "500M"
9595
save: ${{ inputs.update-caches }}
9696
- name: Install Ninja
@@ -115,7 +115,7 @@ jobs:
115115
- name: Setup ccache
116116
uses: hendrikmuhs/ccache-action@v1.2
117117
with:
118-
key: ${{ github.job }}
118+
key: v2-${{ github.job }}
119119
max-size: "500M"
120120
save: ${{ inputs.update-caches }}
121121
- name: Install Ninja
@@ -144,7 +144,7 @@ jobs:
144144
- name: Setup ccache
145145
uses: hendrikmuhs/ccache-action@v1.2
146146
with:
147-
key: ${{ github.job }}
147+
key: v2-${{ github.job }}
148148
max-size: "500M"
149149
save: ${{ inputs.update-caches }}
150150
- name: Install Ninja
@@ -175,7 +175,7 @@ jobs:
175175
- name: Setup ccache
176176
uses: hendrikmuhs/ccache-action@v1.2
177177
with:
178-
key: ${{ github.job }}
178+
key: v2-${{ github.job }}
179179
max-size: "500M"
180180
save: ${{ inputs.update-caches }}
181181
- name: Create output directory
@@ -221,7 +221,7 @@ jobs:
221221
- name: Setup ccache
222222
uses: hendrikmuhs/ccache-action@v1.2
223223
with:
224-
key: ${{ github.job }}-${{ matrix.arch }}
224+
key: v2-${{ github.job }}-${{ matrix.arch }}
225225
max-size: "500M"
226226
save: ${{ inputs.update-caches }}
227227
- name: Force compiler binary mtime
@@ -303,9 +303,9 @@ jobs:
303303
uses: actions/cache/restore@v4
304304
with:
305305
path: "/home/runner/.cache/bazel"
306-
key: ${{ github.job }}
306+
key: v2-${{ github.job }}
307307
restore-keys: |
308-
${{ github.job }}-
308+
v2-${{ github.job }}-
309309
- name: Build and run tests
310310
if: ${{ inputs.run-tests }}
311311
env:
@@ -324,7 +324,7 @@ jobs:
324324
uses: actions/cache/save@v4
325325
with:
326326
path: "/home/runner/.cache/bazel"
327-
key: ${{ github.job }}-${{ github.sha }}
327+
key: v2-${{ github.job }}-${{ github.sha }}
328328

329329
bazel-linux-aarch64-clang18:
330330
runs-on: arm-ubuntu-arm-22.04-4core
@@ -346,9 +346,9 @@ jobs:
346346
uses: actions/cache/restore@v4
347347
with:
348348
path: "/home/runner/.cache/bazel"
349-
key: ${{ github.job }}
349+
key: v2-${{ github.job }}
350350
restore-keys: |
351-
${{ github.job }}-
351+
v2-${{ github.job }}-
352352
- name: Build and run tests
353353
if: ${{ inputs.run-tests }}
354354
env:
@@ -367,7 +367,7 @@ jobs:
367367
uses: actions/cache/save@v4
368368
with:
369369
path: "/home/runner/.cache/bazel"
370-
key: ${{ github.job }}-${{ github.sha }}
370+
key: v2-${{ github.job }}-${{ github.sha }}
371371

372372
bazel-linux-x86_64-gcc-9:
373373
runs-on: ubuntu-22.04-8core
@@ -390,9 +390,9 @@ jobs:
390390
uses: actions/cache/restore@v4
391391
with:
392392
path: "/home/runner/.cache/bazel"
393-
key: ${{ github.job }}
393+
key: v2-${{ github.job }}
394394
restore-keys: |
395-
${{ github.job }}-
395+
v2-${{ github.job }}-
396396
- name: Build tests
397397
run: |
398398
bazel build ${BAZEL_DEFINES} :pthreadpool_test :pthreadpool_cxx_test
@@ -412,4 +412,4 @@ jobs:
412412
uses: actions/cache/save@v4
413413
with:
414414
path: "/home/runner/.cache/bazel"
415-
key: ${{ github.job }}-${{ github.sha }}
415+
key: v2-${{ github.job }}-${{ github.sha }}

MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ module(
44
)
55

66
# Bazel rule definitions
7-
bazel_dep(name = "rules_cc", version = "0.1.1")
7+
bazel_dep(name = "rules_cc", version = "0.2.17")
88
bazel_dep(name = "rules_license", version = "1.0.0")
9-
bazel_dep(name = "rules_python", version = "1.0.0")
9+
bazel_dep(name = "rules_python", version = "1.7.0")
1010

1111
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
1212
pip.parse(
@@ -17,10 +17,10 @@ pip.parse(
1717
use_repo(pip, "pip")
1818

1919
# Bazel Skylib.
20-
bazel_dep(name = "bazel_skylib", version = "1.7.1")
20+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
2121

2222
# Bazel Platforms
23-
bazel_dep(name = "platforms", version = "0.0.10")
23+
bazel_dep(name = "platforms", version = "1.0.0")
2424

2525
# TODO: some (most? all?) of the http_archive() calls below could become bazel_dep() calls,
2626
# but it would require verifying that the semver provided by the Bazel registry matches the hash

WORKSPACE

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ workspace(name = "pthreadpool")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

5-
# Bazel rule definitions
6-
http_archive(
7-
name = "rules_cc",
8-
strip_prefix = "rules_cc-main",
9-
urls = ["https://github.com/bazelbuild/rules_cc/archive/master.zip"],
10-
)
11-
125
# LINT.IfChange(googletest)
136
# Google Test framework, used by most unit-tests.
147
http_archive(

include/pthreadpool.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ typedef void (*pthreadpool_task_3d_tile_1d_dynamic_with_id_with_thread_t)(
148148
*/
149149
#define PTHREADPOOL_FLAG_DONT_SPIN_WORKERS 0x00000004
150150

151+
// Disable function sanitization here. The thread pool calls these functions
152+
// via function pointers with void* contexts, which triggers false positives in
153+
// the function sanitizer when casting and calling the actual context type.
154+
#if defined(__clang__) && __has_attribute(no_sanitize)
155+
#define PTHREADPOOL_NO_SANITIZE_FUNCTION \
156+
__attribute__((no_sanitize("function")))
157+
#else
158+
#define PTHREADPOOL_NO_SANITIZE_FUNCTION
159+
#endif
160+
151161
#ifdef __cplusplus
152162
extern "C" {
153163
#endif

0 commit comments

Comments
 (0)