Skip to content

Conversation

@alyssais
Copy link
Member

@alyssais alyssais commented Jul 3, 2024

TIOCGWINSZ modifies its argument, so it needs to mutably borrow it. Unfortunately, ioctl()'s signature is not able to enforce this, and the write happens in the kernel, so I don't think anything like miri, valgrind, UBSan, etc. would have been able to catch this.

The UB passing an immutable reference caused resulted, for me, in get_win_size() returning (0, 0) since LLVM commit
llvm/llvm-project@9a09c73 ("[BasicAA] Make isNotCapturedBeforeOrAt() check for calls more precise (#69931)").

I've had a look through the other ioctl() calls in Cloud Hypervisor, and I don't think any others have the same problem.

TIOCGWINSZ modifies its argument, so it needs to mutably borrow it.
Unfortunately, ioctl()'s signature is not able to enforce this, and
the write happens in the kernel, so I don't think anything like miri,
valgrind, UBSan, etc. would have been able to catch this.

The UB passing an immutable reference caused resulted, for me, in
get_win_size() returning (0, 0) since LLVM commit
9a09c737a052 ("[BasicAA] Make isNotCapturedBeforeOrAt() check for
calls more precise (#69931)").

I've had a look through the other ioctl() calls in Cloud Hypervisor,
and I don't think any others have the same problem.

Signed-off-by: Alyssa Ross <[email protected]>
@alyssais alyssais requested a review from a team as a code owner July 3, 2024 20:36
@liuw liuw enabled auto-merge July 3, 2024 21:16
@liuw liuw added this pull request to the merge queue Jul 3, 2024
@rbradford
Copy link
Member

Thanks!

Merged via the queue into cloud-hypervisor:main with commit e7c7a30 Jul 3, 2024
@alyssais alyssais deleted the ub branch July 4, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants