Page MenuHomeFreeBSD

Add missing ioctl definitions to LLVM sanitizer
AcceptedPublic

Authored by se on May 10 2021, 5:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 1 2024, 1:03 AM
Unknown Object (File)
Oct 11 2023, 7:17 PM
Unknown Object (File)
Aug 13 2023, 6:38 AM
Unknown Object (File)
Aug 2 2023, 6:30 PM
Subscribers

Details

Reviewers
dim
Summary

During a test of the memory sanitizer I found that ioctl(FIONREAD, ..) caused an unjustified error abort.

Inspection of the sanitizer source code revealed that a lot of functions that are intercepted in NetBSD are not on FreeBSD.

This patch adds 4 FIO* definitions that are missing for FreeBSD.

I have not performed an exhaustive search for further missing ioctl() intercepts, but I'd expect there to be many ...

This change should be up-streamed to LLVM.

Test Plan

Apply patch and test with "cc -fsanitize=memory" used to compile a program that uses ioctl(FIONREAD, ...).

Without the patch, the program will be halted on the ioctl() with an error message about an illegal access.
With the patch, a binary is generated that correctly deals with this ioctl() and that does not halt execution when it is encountered.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

se requested review of this revision.May 10 2021, 5:00 PM
se created this revision.
se added a reviewer: dim.
dim added a subscriber: emaste.

Hm, this seems safe, but would indeed have to be checked with upstream too. They tend to want to change almost anything that comes in via reviews, so if you have time to wait, we could discuss it upstream first. Unless you're in a hurry and need this, then it's OK to commit.

This revision is now accepted and ready to land.May 10 2021, 6:14 PM
In D30190#677963, @dim wrote:

Hm, this seems safe, but would indeed have to be checked with upstream too. They tend to want to change almost anything that comes in via reviews, so if you have time to wait, we could discuss it upstream first. Unless you're in a hurry and need this, then it's OK to commit.

I'd rather see this come to our tree via the upstream. I'll just keep this change in my sources until the upstream update arrives ...