This is an archive of the discontinued LLVM Phabricator instance.

[DFSAN] Add support for strncat
ClosedPublic

Authored by tkuchta on Jun 5 2023, 1:41 PM.

Details

Summary

This patch adds a support for the libc strncat() function in DFSAN

Diff Detail

Event Timeline

tkuchta created this revision.Jun 5 2023, 1:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2023, 1:41 PM
Herald added a subscriber: Enna1. · View Herald Transcript
tkuchta requested review of this revision.Jun 5 2023, 1:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2023, 1:41 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
browneee accepted this revision.Jun 5 2023, 2:40 PM
browneee added inline comments.
compiler-rt/test/dfsan/custom.cpp
373

Should we test the case where n < strlen(src) ?

In this case, the taint labels on the later bytes (not overridden due to the limit) should be unchanged, in addition to the taint labels on the middle changed bytes being changed.

I'd probably duplicate the function to do this.

This revision is now accepted and ready to land.Jun 5 2023, 2:40 PM
tkuchta updated this revision to Diff 528861.Jun 6 2023, 7:37 AM

Thank you for the comments. I have prepared and updated version with tests accounting for n < strlen(src)

browneee accepted this revision.Jun 6 2023, 3:08 PM
browneee added inline comments.
compiler-rt/test/dfsan/custom.cpp
342–344

Change back to

char *ret = strcat(p, src);
tkuchta updated this revision to Diff 529165.Jun 6 2023, 10:42 PM

Right, my bad - updated

Hello, please let me know if there is anything more to fix.

This revision was automatically updated to reflect the committed changes.