This is an archive of the discontinued LLVM Phabricator instance.

Add interceptor for the setvbuf(3) from NetBSD
ClosedPublic

Authored by krytarowski on Nov 14 2018, 3:11 PM.

Details

Summary

setvbuf(3) is a routine to setup stream buffering.

Enable the interceptor for NetBSD.

Add dedicated tests for setvbuf(3) and functions
on top of this interface: setbuf, setbuffer, setlinebuf.

Based on original work by Yang Zheng.

Diff Detail

Event Timeline

krytarowski created this revision.Nov 14 2018, 3:11 PM
krytarowski edited the summary of this revision. (Show Details)Nov 15 2018, 7:14 PM
krytarowski added a subscriber: tomsun.0.7.
vitalybuka added inline comments.Nov 19 2018, 12:54 PM
lib/sanitizer_common/sanitizer_common_interceptors.inc
7274

do you need unpoison_file?

lib/sanitizer_common/sanitizer_platform_interceptors.h
519

This is not NETBSD specific?

vitalybuka added inline comments.Nov 19 2018, 12:56 PM
lib/sanitizer_common/sanitizer_common_interceptors.inc
7274

unpoison_file does nothing on netbsd
so it could be needed for Linux

vitalybuka accepted this revision.Nov 19 2018, 12:56 PM
This revision is now accepted and ready to land.Nov 19 2018, 12:56 PM
krytarowski added inline comments.Nov 19 2018, 2:17 PM
lib/sanitizer_common/sanitizer_common_interceptors.inc
7274

FILE is not sanitized as of today on NetBSD.

lib/sanitizer_common/sanitizer_platform_interceptors.h
519

It originated in BSD, went into SunOS, and from there to C89 or similar.. but I cannot test it on other OSes. Please enable and test it on them in a separate commit.

devnexen added inline comments.
lib/sanitizer_common/sanitizer_platform_interceptors.h
519

Would it be possible to put the test in the posix folder ? Would enable the feature on FreeBSD later on.

vitalybuka added inline comments.Nov 19 2018, 2:43 PM
lib/sanitizer_common/sanitizer_platform_interceptors.h
519

up to you. you can move it now with XFAIL, or move later

This revision was automatically updated to reflect the committed changes.
krytarowski added inline comments.Nov 19 2018, 2:50 PM
lib/sanitizer_common/sanitizer_platform_interceptors.h
519

Committed!

Sorry for inappropriate place, but when I've included an interceptor for devname_r(3), it was enabled for !NetBSD.. however there is wrong prototype for !NetBSD. NetBSD uses int as a return value, others use char*.

@devnexen could we drop SI_OPENBSD from this file, it's not used and probably won't be used.

devnexen added inline comments.Nov 19 2018, 2:55 PM
lib/sanitizer_common/sanitizer_platform_interceptors.h
519

I hesitate doing so ... Someone contacted me he would try to find a way to port asan on openbsd and thought I would drop this for good after a while (beginning next year) if I see no sign ...