RFR: 8334239: Introduce macro for ubsan method/function exclusions [v3]

Stefan Karlsson stefank at openjdk.org
Wed Jun 19 07:52:11 UTC 2024


On Wed, 19 Jun 2024 07:31:28 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> A number of functions/methods have to be excluded from ubsan detection (e.g. because they do things that ubsan warns about, however it is still valid what is done there).
>> We can simplify this by introducing a macro (similar to asan-related ATTRIBUTE_NO_ASAN, see sanitizers/address.hpp).
>> Currently something like this is used :
>> 
>> #if defined(__clang__) || defined(__GNUC__)
>> __attribute__((no_sanitize("undefined")))
>> #endif
>
> Matthias Baesken has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - change comment
>  - ubsan.hpp -> ub.hpp

I've listed some whitespace and punctuation nits.

I have a question/comment about this comment:

... special or even 'dangerous', for example causing desired signals/crashes or *overflows*.


Do we really intend to use ATTRIBUTE_NO_UBSAN to silence overflow issues? Don't we want to fix all of those?

src/hotspot/share/sanitizers/ub.hpp line 25:

> 23:  *
> 24:  */
> 25: #ifndef SHARE_SANITIZERS_UB_HPP

Suggestion:

 */

#ifndef SHARE_SANITIZERS_UB_HPP

src/hotspot/share/sanitizers/ub.hpp line 33:

> 31: // following function or method.
> 32: // Useful if the function or method is known to do something special or even 'dangerous', for
> 33: // example causing desired signals/crashes or overflows

Suggestion:

// example causing desired signals/crashes or overflows.

src/hotspot/share/sanitizers/ub.hpp line 42:

> 40: #endif
> 41: 
> 42: 

Suggestion:

-------------

PR Review: https://git.openjdk.org/jdk/pull/19722#pullrequestreview-2127350754
PR Review Comment: https://git.openjdk.org/jdk/pull/19722#discussion_r1645594087
PR Review Comment: https://git.openjdk.org/jdk/pull/19722#discussion_r1645595275
PR Review Comment: https://git.openjdk.org/jdk/pull/19722#discussion_r1645594391


More information about the hotspot-dev mailing list