This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizer] Add MIPS vfork interception
Needs ReviewPublic

Authored by wzssyqa on Aug 18 2023, 5:13 AM.

Details

Summary

https://github.com/google/sanitizers/issues/925
claims that vfork can have better performance than fork, and
bionic is using vfork.

Let's support it for MIPS.

Tested on Debian's mipsel (mipsel-linux-gnu) and
mips64el (mips64el-linux-gnu) ports.

Test fails on MIPSr6 due to another problem:
https://github.com/llvm/llvm-project/issues/64974

Diff Detail

Event Timeline

wzssyqa created this revision.Aug 18 2023, 5:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2023, 5:13 AM
wzssyqa requested review of this revision.Aug 18 2023, 5:13 AM
wzssyqa updated this revision to Diff 551467.
wzssyqa added reviewers: MaskRay, brad, jrtc27.

If test/asan/TestCases/Linux/vfork.cpp passes now, adjust its REQUIRES to use the modern // REQUIRES: target={{....|mips64}}.*

MaskRay requested changes to this revision.Aug 19 2023, 8:20 PM
This revision now requires changes to proceed.Aug 19 2023, 8:20 PM
brad added inline comments.Aug 19 2023, 9:41 PM
compiler-rt/lib/asan/asan_interceptors_vfork.S
13

As this is already in alphabetical order it would be good if you could move your addition above riscv64.

wzssyqa updated this revision to Diff 552246.Aug 22 2023, 12:53 AM
wzssyqa retitled this revision from [sanitizer] add MIPS vfork interception to [Sanitizer] Add MIPS vfork interception.
wzssyqa edited the summary of this revision. (Show Details)
wzssyqa marked an inline comment as done.Aug 22 2023, 12:53 AM

This patch depends on https://reviews.llvm.org/D158491.

MaskRay added inline comments.Aug 23 2023, 6:27 PM
compiler-rt/lib/asan/asan_interceptors.h
123

Just ignore clang-format warning, and don't add indentation, to decrease the amount of unrelated changes.

compiler-rt/test/asan/TestCases/Linux/vfork.cpp
4

Can you name the mips platforms that you have tested?

wzssyqa added inline comments.Aug 24 2023, 11:34 PM
compiler-rt/test/asan/TestCases/Linux/vfork.cpp
4

Can you name the mips platforms that you have tested?

I tested it on Debian mipsel-linux-gnu and mips64el-linux-gnuabi64.

Should I add this info into the code, or commit msg?

wzssyqa updated this revision to Diff 553380.Aug 24 2023, 11:45 PM
wzssyqa edited the summary of this revision. (Show Details)
wzssyqa marked 2 inline comments as done.