This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Add posix_spawn interceptor
ClosedPublic

Authored by vitalybuka on Oct 29 2021, 1:41 AM.

Details

Summary

To make pid initialized for Msan.

Diff Detail

Event Timeline

vitalybuka requested review of this revision.Oct 29 2021, 1:41 AM
vitalybuka created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 29 2021, 1:41 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript

Should we also add an MSan test?

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
2456

Looks like the two interceptors could share implementation in a helper function.

compiler-rt/test/sanitizer_common/TestCases/Posix/posix_spawn.c
20

These macros are unused.

eugenis added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
2434

Why not check the argv[] array, too?

vitalybuka marked 2 inline comments as done.

update

vitalybuka marked an inline comment as done.

check argv envp

This revision is now accepted and ready to land.Oct 29 2021, 11:49 AM
This revision was landed with ongoing or failed builds.Oct 31 2021, 12:11 PM
This revision was automatically updated to reflect the committed changes.

The test fails to link on Android: https://lab.llvm.org/buildbot/#/builders/77/builds/11014/steps/16/logs/stdio

ld.lld: error: undefined symbol: posix_spawnattr_init
>>> referenced by posix_spawn.c:19 (/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/posix_spawn.c:19)
>>>               /tmp/posix_spawn-9331fd.o:(main)
ld.lld: error: undefined symbol: posix_spawn_file_actions_init
>>> referenced by posix_spawn.c:23 (/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/posix_spawn.c:23)
>>>               /tmp/posix_spawn-9331fd.o:(main)

Disabled the test on Android: https://reviews.llvm.org/rGb298d6d16203

There might be a way to re-enable on Android by not using the init functions.

The test fails on macOS: https://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/4694/
Can you please take a look and revert if the fix is not obvious? Cheers.

The test fails on macOS: https://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/4694/
Can you please take a look and revert if the fix is not obvious? Cheers.

Sorry, just noticed, I'll revert of fix it soon.

The test fails on macOS: https://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/4694/
Can you please take a look and revert if the fix is not obvious? Cheers.

Sorry, just noticed, I'll revert of fix it soon.

For IOS 0d59efbba4e99140ef2dfb5c9f14a9d641e0ebe2