This is an archive of the discontinued LLVM Phabricator instance.

sanitizers: Add interceptors for getproto{ent,byname,bynumber}_r
ClosedPublic

Authored by guiand on Jun 23 2020, 5:46 PM.

Details

Summary

This also allows intercepting these getprotoent functions on Linux as well, since Linux exposes them.

Diff Detail

Event Timeline

guiand created this revision.Jun 23 2020, 5:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2020, 5:46 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
eugenis added inline comments.Jun 24 2020, 2:29 PM
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
7390

Move the common part into a helper function, ex. write_protoent().

compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
549–550

Android has getprotoent, but not getprotoent_r.

guiand updated this revision to Diff 273192.Jun 24 2020, 5:00 PM

Addressed comments

guiand marked 2 inline comments as done.Jun 24 2020, 5:01 PM
vitalybuka added inline comments.Jul 6 2020, 10:43 PM
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
778

it's unrelated to description
should be in a different patch?

guiand marked an inline comment as done.Jul 7 2020, 9:28 AM
guiand added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
778

Ah, looks like some changes snuck in that I meant to be in a different patchset. I'll split that out for sure.

guiand updated this revision to Diff 276116.Jul 7 2020, 10:07 AM

Removed changes from separate patchset

vitalybuka accepted this revision.Jul 7 2020, 2:39 PM
vitalybuka added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
7343–7344

drop {}

7387
if (!res && *result)
    write_protoent(ctx, *result);

here and below

This revision is now accepted and ready to land.Jul 7 2020, 2:39 PM
This revision was automatically updated to reflect the committed changes.
krytarowski added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
132

@guiand why did you remove it for NetBSD? This broke the build.

eugenis added inline comments.Sep 10 2020, 12:20 PM
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
132

Hmm looks like confusion caused by the file naming (netbsd implements posix, right?) multiplied by the lack of buildbot coverage.

Sorry for the breakage.
I can restore this chunk, or feel free to commit the fix directly.

eugenis added inline comments.Sep 10 2020, 12:21 PM
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
132

Ah I see you've done that already.
Good.