Skip to content

SHA2 ASAN interceptors on FreeBSD and NetBSD #110215

@botovq

Description

@botovq

The SHA2 *_{Init,Update,Final,Transform}() functions on FreeBSD (manual) and NetBSD (cf manual) collide with functions of the same name in OpenSSL. The signatures are incompatible (return types and contexts).

This leads to undesirable runtime failures when using -fsanitize=-address in combination with -lcrypto.

Not all of the below are problematic for both FreeBSD and NetBSD, but should probably be audited in detail and potentially be removed.

#define SANITIZER_INTERCEPT_SHA1 SI_NETBSD
#define SANITIZER_INTERCEPT_MD4 SI_NETBSD
#define SANITIZER_INTERCEPT_RMD160 SI_NETBSD
#define SANITIZER_INTERCEPT_MD5 (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_FSEEK (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_MD2 SI_NETBSD
#define SANITIZER_INTERCEPT_SHA2 (SI_NETBSD || SI_FREEBSD)

See libressl/portable#1098, openssl/openssl#25456, and https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281685 for more details.

Cc: @krytarowski @devnexen

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions