This is an archive of the discontinued LLVM Phabricator instance.

Add new interceptors for vis(3) API in NetBSD
ClosedPublic

Authored by krytarowski on Nov 15 2018, 11:50 AM.

Details

Summary

Add interceptors for the NetBSD style of vis(3) present inside libc:

  • vis
  • nvis
  • strvis
  • stravis
  • strnvis
  • strvisx
  • strnvisx
  • strenvisx
  • svis
  • snvis
  • strsvis
  • strsnvis
  • strsvisx
  • strsnvisx
  • strsenvisx
  • unvis
  • strunvis
  • strnunvis
  • strunvisx
  • strnunvisx

Add a dedicated test verifying the installed interceptors.

Based on original work by Yang Zheng.

Diff Detail

Event Timeline

krytarowski created this revision.Nov 15 2018, 11:50 AM
krytarowski edited the summary of this revision. (Show Details)
  • add more tests
  • add missing rename
krytarowski edited the summary of this revision. (Show Details)Nov 15 2018, 7:13 PM
krytarowski added a subscriber: tomsun.0.7.
vitalybuka added inline comments.Nov 19 2018, 11:30 AM
lib/sanitizer_common/sanitizer_common_interceptors.inc
7298

Min()

7331

len >= 0 is always true, it's unsigned type

7333

Min and few below

7536

they are so similar, is any idea how to minimize code size?

vitalybuka requested changes to this revision.Nov 29 2018, 1:58 PM

Just to hide from "Ready to Review" list

This revision now requires changes to proceed.Nov 29 2018, 1:58 PM
krytarowski marked 5 inline comments as done.
  • apply comments from review
lib/sanitizer_common/sanitizer_common_interceptors.inc
7331

len is signed

7536

Actually not and they differ in one way or another.

vitalybuka added inline comments.Dec 4 2018, 12:41 AM
lib/sanitizer_common/sanitizer_common_interceptors.inc
7382

The functions nvis() and snvis() will return NULL and the functions
strnvis(), strnvisx(), strsnvis(), and strsnvisx(), will return -1 when
the dlen destination buffer size is not enough to perform the conversion

I read this that it's always null terminated or (null or -1), so Min is not needed

And the same for the rest

vitalybuka requested changes to this revision.Dec 7 2018, 3:40 PM

Assume WIP

This revision now requires changes to proceed.Dec 7 2018, 3:40 PM
  • stop using Min() as noted
krytarowski marked an inline comment as done.Dec 11 2018, 3:21 AM
This revision is now accepted and ready to land.Dec 13 2018, 2:08 AM
This revision was automatically updated to reflect the committed changes.