This is an archive of the discontinued LLVM Phabricator instance.

wrong usages of sem_open in the libFuzzer
ClosedPublic

Authored by tomsun.0.7 on May 8 2018, 7:27 PM.

Details

Summary

Fixed two non-standard usages of sem_open in the libFuzzer library and
one NetBSD-related modification with test script.

  • The return value to indicate error should be SEM_FAILED instead of (void *)-1 (please refer to "RETURN VALUE" section in this page). Actually, SEM_FAILED != (void *)-1 holds in NetBSD.
  • The SharedMemoryRegion::SemName function should return name starting with slash. Because the behaviour of name which does not start with slash is unspecified as the "DESCRIPTION" section specified:

If name does not begin with the <slash> character, the effect is implementation-defined.

  • The length of name is limited to 14 in NetBSD, it is suggested to reduce the length of equivalence server name in the test script.

Diff Detail

Event Timeline

tomsun.0.7 created this revision.May 8 2018, 7:27 PM
tomsun.0.7 edited the summary of this revision. (Show Details)May 8 2018, 7:29 PM

It looks good to me, but I will wait for the final word from @vitalybuka

BTW.
We usually want to see a diff as a result of git diff -U9999 for larger context.
Also the description shall be manually formatted for restricted number of columns,
otherwise we will get very long lines in a commit description.

tomsun.0.7 updated this revision to Diff 145845.May 8 2018, 7:40 PM
tomsun.0.7 edited the summary of this revision. (Show Details)

It looks good to me, but I will wait for the final word from @vitalybuka

BTW.
We usually want to see a diff as a result of git diff -U9999 for larger context.
Also the description shall be manually formatted for restricted number of columns,
otherwise we will get very long lines in a commit description.

Updated, thanks for the suggestions!

kcc added a subscriber: kcc.May 9 2018, 9:09 AM

I don't mind, but just a FYI: it's likely that I will delete this code in near future.

lib/fuzzer/FuzzerShmemPosix.cpp
35

please explain in a comment

kcc accepted this revision.May 10 2018, 10:05 AM

LGTM

This revision is now accepted and ready to land.May 10 2018, 10:05 AM
This revision was automatically updated to reflect the committed changes.