This is an archive of the discontinued LLVM Phabricator instance.

Add interceptors for readlinkat, name_to_handle_at, open_by_handle_at
ClosedPublic

Authored by oliverchang on Jan 28 2018, 6:46 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

oliverchang created this revision.Jan 28 2018, 6:46 PM

check unpoisoned

krytarowski added inline comments.
lib/msan/msan_interceptors.cc
150 ↗(On Diff #131740)

Can push this interceptor to the generic code for all sanitizers?

eugenis added inline comments.
lib/msan/msan_interceptors.cc
150 ↗(On Diff #131740)

Ideally, both interceptors should be in sanitizer_common.

vitalybuka added inline comments.Jan 29 2018, 11:48 AM
lib/msan/msan_interceptors.cc
1050 ↗(On Diff #131740)

Maybe intercept open_by_handle_at as well?

Move to sanitizer_common, add open_by_handle_at interceptor.

oliverchang added inline comments.Jan 29 2018, 4:22 PM
lib/msan/msan_interceptors.cc
150 ↗(On Diff #131740)

Done, but I'm not sure where to move the tests (if I need to add all).

1050 ↗(On Diff #131740)

Done, but not sure how to test it since it requires CAP_DAC_READ_SEARCH

lib/sanitizer_common/sanitizer_platform_interceptors.h
449 ↗(On Diff #131897)

have a questions here: what happens when a function doesn't exist on a particular platform? it seems like readlinkat support was added fairly recently to certain platforms (e.g. added in MacOS 10.10) and may not be available everywhere despite it being part of posix.

krytarowski added inline comments.Jan 29 2018, 4:28 PM
lib/msan/msan_interceptors.cc
150 ↗(On Diff #131740)

compiler-rt/test/sanitizer_common/

remove unneeded inclueds

LGTM if you add sanitizer_common/ tests

lib/sanitizer_common/sanitizer_common_interceptors.inc
6641 ↗(On Diff #131900)

SSIZE_T res = REAL(readlink)(path, buf, bufsiz);

test/msan/name_to_handle_at.cc
16 ↗(On Diff #131900)

this test shouls stay here at it's msan specific

another test, with trivial function call, should be added under sanitizer_common/
sanitizer_common/ tests will be executed with other sanitizers

oliverchang marked an inline comment as done.

sanitizer_common tests, address comments

oliverchang retitled this revision from Add msan interceptors for readlinkat and name_to_handle_at to Add interceptors for readlinkat, name_to_handle_at, open_by_handle_at.Jan 29 2018, 7:30 PM
oliverchang edited the summary of this revision. (Show Details)
oliverchang added inline comments.
lib/sanitizer_common/sanitizer_common_interceptors.inc
6641 ↗(On Diff #131900)

Done here and in other interceptors also.

test/msan/name_to_handle_at.cc
16 ↗(On Diff #131900)

Done.

vitalybuka accepted this revision.Jan 29 2018, 11:50 PM
This revision is now accepted and ready to land.Jan 29 2018, 11:50 PM

Thanks! Would you mind committing this for me?

krytarowski added inline comments.Jan 30 2018, 4:05 AM
lib/sanitizer_common/sanitizer_common_interceptors.inc
6947 ↗(On Diff #131915)

I would drop empty newlines.

test/sanitizer_common/TestCases/Linux/readlink.cc
1 ↗(On Diff #131915)

This test should be available for all POSIX systems.

It works on NetBSD as it is.

krytarowski added inline comments.Jan 30 2018, 4:09 AM
test/sanitizer_common/TestCases/Linux/readlink.cc
1 ↗(On Diff #131915)

It might be a good idea to split the readlink(2) and readlinkat(2) into separate tests.
Also this -m64 should be dropped.

vitalybuka added inline comments.Jan 30 2018, 1:11 PM
test/sanitizer_common/TestCases/Linux/readlink.cc
1 ↗(On Diff #131915)

sgtm
Kamil, would you like to do so and land the patch?
No problem If not. I will split myself. I just have nothing other than Linux.

vitalybuka added inline comments.Jan 30 2018, 1:19 PM
test/sanitizer_common/TestCases/Linux/readlink.cc
1 ↗(On Diff #131915)

Don't bother, I am going to that myself.

This revision was automatically updated to reflect the committed changes.