pw_tokenizer: Apply no_sanitize("address") to tokenizer string entries

ASAN applies a 32-byte alignment to global variables as part of its
redzone strategy. This breaks the requirement that the
_pw_tokenizer_string_entry_* variables are 1-byte aligned so they appear
consecutively in the ELF section without any padding.

This isn't normally an issue as ASAN isn't used on firmware builds where
tokenization is used. But in the case of self-detokenizing programs
(namely tests), this causes ASAN violations and corrupt token entry ELF
section data.

Applying __attribute__((no_sanitize("address"))) to these variables
bypasses this behavior.

See also: https://pwrev.dev/c/pigweed/pigweed/+/328273/comments/7ee80b04_6fde2fa2

Bug: 448430357
Change-Id: I1008a9331a38b0a1325d8317ca1de4a2c45895f4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/328692
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Docs-Not-Needed: Jonathon Reinhart <jrreinhart@google.com>
Tests-Not-Needed: Jonathon Reinhart <jrreinhart@google.com>
Commit-Queue: Jonathon Reinhart <jrreinhart@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2 files changed
tree: 4fb0195546c985ab433d873588db98738f4812f9
  1. .allstar/
  2. .gemini/
  3. .github/
  4. .vscode/
  5. build_overrides/
  6. docker/
  7. docs/
  8. kudzu/
  9. pw_alignment/
  10. pw_allocator/
  11. pw_analog/
  12. pw_android_toolchain/
  13. pw_arduino_build/
  14. pw_assert/
  15. pw_assert_basic/
  16. pw_assert_fuchsia/
  17. pw_assert_log/
  18. pw_assert_tokenized/
  19. pw_assert_trap/
  20. pw_assert_zephyr/
  21. pw_async/
  22. pw_async2/
  23. pw_async2_basic/
  24. pw_async2_epoll/
  25. pw_async_basic/
  26. pw_async_fuchsia/
  27. pw_atomic/
  28. pw_base64/
  29. pw_bloat/
  30. pw_blob_store/
  31. pw_bluetooth/
  32. pw_bluetooth_hci/
  33. pw_bluetooth_profiles/
  34. pw_bluetooth_proxy/
  35. pw_bluetooth_sapphire/
  36. pw_boot/
  37. pw_boot_cortex_m/
  38. pw_build/
  39. pw_build_android/
  40. pw_build_info/
  41. pw_build_mcuxpresso/
  42. pw_bytes/
  43. pw_change/
  44. pw_channel/
  45. pw_checksum/
  46. pw_chre/
  47. pw_chrono/
  48. pw_chrono_embos/
  49. pw_chrono_freertos/
  50. pw_chrono_rp2040/
  51. pw_chrono_stl/
  52. pw_chrono_threadx/
  53. pw_chrono_zephyr/
  54. pw_cli/
  55. pw_cli_analytics/
  56. pw_clock_tree/
  57. pw_clock_tree_mcuxpresso/
  58. pw_compilation_testing/
  59. pw_config_loader/
  60. pw_console/
  61. pw_containers/
  62. pw_cpu_exception/
  63. pw_cpu_exception_cortex_m/
  64. pw_cpu_exception_risc_v/
  65. pw_crypto/
  66. pw_digital_io/
  67. pw_digital_io_linux/
  68. pw_digital_io_mcuxpresso/
  69. pw_digital_io_rp2040/
  70. pw_digital_io_zephyr/
  71. pw_display/
  72. pw_dma_mcuxpresso/
  73. pw_docgen/
  74. pw_doctor/
  75. pw_elf/
  76. pw_emu/
  77. pw_env_setup/
  78. pw_env_setup_zephyr/
  79. pw_file/
  80. pw_flatbuffers/
  81. pw_format/
  82. pw_function/
  83. pw_fuzzer/
  84. pw_grpc/
  85. pw_hdlc/
  86. pw_hex_dump/
  87. pw_i2c/
  88. pw_i2c_linux/
  89. pw_i2c_mcuxpresso/
  90. pw_i2c_rp2040/
  91. pw_i2c_zephyr/
  92. pw_ide/
  93. pw_interrupt/
  94. pw_interrupt_cortex_m/
  95. pw_interrupt_freertos/
  96. pw_interrupt_zephyr/
  97. pw_intrusive_ptr/
  98. pw_json/
  99. pw_kernel/
  100. pw_kvs/
  101. pw_libc/
  102. pw_libcxx/
  103. pw_log/
  104. pw_log_android/
  105. pw_log_basic/
  106. pw_log_fuchsia/
  107. pw_log_null/
  108. pw_log_rpc/
  109. pw_log_string/
  110. pw_log_tokenized/
  111. pw_log_zephyr/
  112. pw_malloc/
  113. pw_malloc_freelist/
  114. pw_malloc_freertos/
  115. pw_metric/
  116. pw_module/
  117. pw_multibuf/
  118. pw_multisink/
  119. pw_numeric/
  120. pw_package/
  121. pw_perf_test/
  122. pw_persistent_ram/
  123. pw_polyfill/
  124. pw_preprocessor/
  125. pw_presubmit/
  126. pw_protobuf/
  127. pw_protobuf_compiler/
  128. pw_random/
  129. pw_random_fuchsia/
  130. pw_result/
  131. pw_ring_buffer/
  132. pw_router/
  133. pw_rpc/
  134. pw_rpc_transport/
  135. pw_rust/
  136. pw_sensor/
  137. pw_snapshot/
  138. pw_software_update/
  139. pw_span/
  140. pw_spi/
  141. pw_spi_linux/
  142. pw_spi_mcuxpresso/
  143. pw_spi_rp2040/
  144. pw_status/
  145. pw_stm32cube_build/
  146. pw_stream/
  147. pw_stream_shmem_mcuxpresso/
  148. pw_stream_uart_linux/
  149. pw_stream_uart_mcuxpresso/
  150. pw_string/
  151. pw_symbolizer/
  152. pw_sync/
  153. pw_sync_baremetal/
  154. pw_sync_embos/
  155. pw_sync_freertos/
  156. pw_sync_stl/
  157. pw_sync_threadx/
  158. pw_sync_zephyr/
  159. pw_sys_io/
  160. pw_sys_io_ambiq_sdk/
  161. pw_sys_io_arduino/
  162. pw_sys_io_baremetal_lm3s6965evb/
  163. pw_sys_io_baremetal_stm32f429/
  164. pw_sys_io_emcraft_sf2/
  165. pw_sys_io_mcuxpresso/
  166. pw_sys_io_rp2040/
  167. pw_sys_io_stdio/
  168. pw_sys_io_stm32cube/
  169. pw_sys_io_zephyr/
  170. pw_system/
  171. pw_target_runner/
  172. pw_thread/
  173. pw_thread_embos/
  174. pw_thread_freertos/
  175. pw_thread_stl/
  176. pw_thread_threadx/
  177. pw_thread_zephyr/
  178. pw_tls_client/
  179. pw_tls_client_boringssl/
  180. pw_tls_client_mbedtls/
  181. pw_tokenizer/
  182. pw_toolchain/
  183. pw_trace/
  184. pw_trace_tokenized/
  185. pw_transfer/
  186. pw_uart/
  187. pw_uart_mcuxpresso/
  188. pw_unit_test/
  189. pw_uuid/
  190. pw_varint/
  191. pw_watch/
  192. pw_web/
  193. pw_work_queue/
  194. seed/
  195. targets/
  196. third_party/
  197. ts/
  198. zephyr/
  199. .bazelignore
  200. .bazelrc
  201. .bazelversion
  202. .black.toml
  203. .clang-format
  204. .clang-tidy
  205. .eslintrc.cjs
  206. .git-blame-ignore-revs
  207. .gitattributes
  208. .gitignore
  209. .gn
  210. .mypy.ini
  211. .prettierignore
  212. .prettierrc.cjs
  213. .pw_ide.yaml
  214. .pylintrc
  215. .ruff.toml
  216. activate.bat
  217. Android.bp
  218. AUTHORS
  219. bootstrap.bat
  220. bootstrap.fish
  221. bootstrap.sh
  222. BUILD.bazel
  223. BUILD.gn
  224. BUILDCONFIG.gn
  225. CMakeLists.txt
  226. GEMINI.md
  227. go.mod
  228. go.sum
  229. jest.config.ts
  230. Kconfig.zephyr
  231. LICENSE
  232. MODULE.bazel
  233. MODULE.bazel.lock
  234. modules.gni
  235. OWNERS
  236. package-lock.json
  237. package.json
  238. pigweed.json
  239. PIGWEED_MODULES
  240. pnpm-lock.yaml
  241. pw
  242. README.md
  243. REPO.bazel
  244. rollup-protos.config.js
  245. rollup.config.js
  246. rustfmt.toml
  247. tsconfig.json
  248. workflows.json
  249. WORKSPACE
  250. WORKSPACE_OWNERS
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links