This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Add most ioctls from /usr/include/sound/.
ClosedPublic

Authored by earthdok on Jan 30 2014, 8:38 AM.

Details

Reviewers
eugenis

Diff Detail

Event Timeline

Two things:

  • I had to skip the ioctls defined in emu10k1.h and asequencer.h (mostly because the struct definitions there depend on DECLARE_BITMAP, which isn't defined in any of the headers I have on my machine. But we could redefine that macro - it's rather trivial).
  • I had to flip READ and WRITE to make it work. Looks like we interpret "WRITE" as "writes to memory", whereas in Linux "_IOW" means "writes to the device". So in most cases our WRITE maps to _IOR and READ maps to _IOR, but I suspect this may not be an exact mapping.

Should be: "WRITE maps to _IOR and READ maps to _IOW"

eugenis accepted this revision.Jan 30 2014, 10:18 AM

I think you are correct about _IOW and _IOR.
Please add a test for at least one of these, to see that there is no systematic error here (I realize that testing all of them is hardly possible).
LGTM

lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
663

Why not add READWRITE here in the same commit?

to see that there is no systematic error here

Would you consider the fact that this fixed my content_unittests crashes to be sufficient verification? (Obviously for regression testing one test would do nothing).

lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
663

fixed

earthdok updated this revision to Unknown Object (????).Jan 31 2014, 5:35 AM
  • add missing READWRITE condition
  • add a test
earthdok closed this revision.Dec 5 2014, 9:37 AM