[kernel][vm] Forbid zero length pins

Pinning a zero length range results in potentially inconsistent
semantics compared with non zero sized pin. For example, a non-zero
length pin will prevent a VMO from being resized smaller than the pin
offset. Whereas a zero length pin does not prevent this. This might be
okay, but then attemping to Unpin that zero length range can fail, as
it is outside the VMO.

Instead of forbidding zero length pins, unpin could instead be changed
to always consider a zero length unpin to be success. This is only
partially correct though, as we really should only consider a zero
length unpin to be correct if there was an equivalent zero length pin.
Unfortunately tracking this would require additional metadata to be
allocated. This issue, and the fact that it still leaves the
inconsistent resize semantics is why this option was not taken.

In the autocall cleanup of CommitRangeInternal any pinned portion is
automatically unpinned. Previously this would just always call Unpin,
even if the range to Unpin was zero. The range could be zero if the
VMO was resized before the first page was pinned. This can only
happen in the case of a user pager backed VMO where the resize
happens whilst blocked waiting for the page to populate.

The current user facing API already forbids zero length pin requests,
so this change is not visible outside of some existing in kernel
unittests that were updated.

Bug: 53711

Change-Id: Iabf5022bdd2404e25a3253871be90328982dc9d1
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/404534
Commit-Queue: Adrian Danis <adanis@google.com>
Reviewed-by: Rasha Eqbal <rashaeqbal@google.com>
Reviewed-by: Nick Maniscalco <maniscalco@google.com>
Testability-Review: Rasha Eqbal <rashaeqbal@google.com>
Testability-Review: Nick Maniscalco <maniscalco@google.com>
4 files changed
tree: c5b67a5835f709c217dd728dd397d04925805160
  1. boards/
  2. build/
  3. bundles/
  4. cts/
  5. docs/
  6. examples/
  7. garnet/
  8. products/
  9. scripts/
  10. sdk/
  11. src/
  12. third_party/
  13. tools/
  14. zircon/
  15. .clang-format
  16. .clang-tidy
  17. .gitattributes
  18. .gitignore
  19. .gn
  20. .style.yapf
  21. AUTHORS
  22. BUILD.gn
  23. CODE_OF_CONDUCT.md
  24. CONTRIBUTING.md
  25. LICENSE
  26. OWNERS
  27. PATENTS
  28. README.md
  29. rustfmt.toml
README.md

Fuchsia

Pink + Purple == Fuchsia (a new operating system)

What is Fuchsia?

Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.

Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.