Skip to content

binder: Check for underflow when subtracting from user-provided value.#375

Merged
wedsonaf merged 1 commit intoRust-for-Linux:rustfrom
wedsonaf:underflow
Jun 11, 2021
Merged

binder: Check for underflow when subtracting from user-provided value.#375
wedsonaf merged 1 commit intoRust-for-Linux:rustfrom
wedsonaf:underflow

Conversation

@wedsonaf
Copy link
Copy Markdown

Fixes #365.

Signed-off-by: Wedson Almeida Filho wedsonaf@google.com

Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
@ksquirrel
Copy link
Copy Markdown
Member

Review of 483683d4d217:

  • ✔️ Commit 483683d: Looks fine!

Copy link
Copy Markdown
Collaborator

@TheSven73 TheSven73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Immediate approval, LGTM, I don't want to hold off merging this.

Follow-up question: what causes ptr < mapping.address to be true ?

@wedsonaf
Copy link
Copy Markdown
Author

Follow-up question: what causes ptr < mapping.address to be true ?

In the first function, ptr is directly controlled by userspace via an ioctl. In the second one, it should be valid (i.e., >= mapping.address) when it starts off, but given that we release the mappings lock, it is possible for mapping.address to change to something < ptr.

None of these affect memory safety, but they may affect correctness.

@wedsonaf wedsonaf merged commit 62bc7aa into Rust-for-Linux:rust Jun 11, 2021
@wedsonaf wedsonaf deleted the underflow branch June 11, 2021 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

binder benchmark causes kernel BUG on Raspberry Pi

4 participants