History log of /fuchsia/zircon/system/utest/vmo/vmo.cpp
Revision Date Author Comments
# 229dcfe9 30-Aug-2018 Mohan Srinivasan <srmohan@google.com>

[kernel][vm] Add ZX_INFO_VMO to zx_object_get_info.

Adds ZX_INFO_VMO option to zx_object_get_info(). Returning back
the various vmo attributes.

ZX-2327.

Test: Added a unit test to query vmo attributes with ZX_INFO_VMO
to the vmo-test.

Change-Id: Ic16452aea3b71061b21141fa5c7a17b5a1f277ff


# 989ee4e8 13-Jun-2018 David Moore <davemoore@google.com>

[syscalls] Change vmar_... calls

- Create zx_vm_option_t type
- Change ZX_VM_FLAG_... to ZX_VM_... and make them new type.
- Change int32_t flags parameters to zx_vm_option_t options
- Make the options parameter be second.

- Modify vmar_..._old functions to keep other repos working.
Once they've all been updated these functions will go away.

ZX-2264
Test:CQ

Change-Id: I1faf4cc4e1e4dabf3d8ef680e398d83a545b0f09


# 28b325b3 14-Aug-2018 Adam Barth <abarth@google.com>

[fbl] Remove libzx dependency from libfbl

Code that depends on the Zircon syscalls should be in fzl instead.
See <https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md#fzl>

Test: fzl-test
Change-Id: Ic65425fc51136edf4d401097f6b483d56923104e


# 4956d002 21-Aug-2018 Mark Seaborn <mseaborn@google.com>

[utest] Remove empty-string "msg" args from EXPECT/ASSERT calls in C++

The "msg" argument is optional in C++. A number of instances of
empty-string "msg" arguments have appeared since I last removed them.

This cleanup was automated.

Bug: ZX-905
Test: compile
Change-Id: Ia5ef96a2bc5a91dd8d1d62c90802c26f44f1a31f


# 30ac10bf 18-Jun-2018 Carlos Pizano <cpu@google.com>

[zircon] non-resizable VMOS

This CL introduces the first option for VMO creation
ZX_VMO_NOT_RESIZABLE that 'locks' the size of a root (non-clone) VMO

Also enables the same for COW clones via ZX_VMO_CLONE_NON_RESIZEABLE

This is meant to answer safety hazards of having a client pass
VMOs to servers which the client can resize while the server is
copying data into via a memory map.

Today this is done via ZX_INFO_HANDLE_COUNT but that turns out
is racy.

This CL also cleans up vmo-tests so they using proble_for_read
and probe_for_write instead of using unrelated syscalls to test
memory mappings.

TEST=added unittests in vmo_tests

ZX-2279 #comment progress

Change-Id: If69ce772dcccd92db83f5bda313ae2343ebb448e


# 47cff597 26-Jun-2018 George Kulakowski <kulakowski@google.com>

[clock] zx_clock_get(ZX_CLOCK_MONOTONIC) -> zx_clock_get_monotonic()

Test: no functional change

Change-Id: Iaa513c521d96b178458acc707be3646067971701


# 8f341f20 09-Jun-2018 Adam Barth <abarth@chromium.org>

[cprng] Remove short reads from zx_cprng_draw

We never actually generate short reads from zx_cprng_draw. This CL
removes the |actual| out parameter. Now zx_cprng_draw either fails or
succeeds in drawing the amount requested, simplifying clients and
removing possible mistakes.

This CL is phase 1 of the transition, which introduces the new version as
zx_cprng_draw_new. Once all the clients are migrated, we'll change
zx_cprng_draw itself, migrate all the clients back, and then remove
zx_cprng_draw_new.

Change-Id: I2219d0517f103fb999014de1e846fa8b8a5ca20c


# 6d25116c 30-Mar-2018 Todd Eisenberger <teisenbe@google.com>

[kernel][vmo] Remove ZX_VMO_OP_LOOKUP

This opcode for zx_vmo_op_range is no longer needed now that the
zx_bti_pin interface exists.

ZX-1912 #done

Change-Id: I8e6ee26cd4f360959ea8fab6aff328987ea7427d


# 9db0af33 20-Mar-2018 Shai Barack <shayba@google.com>

[syscall][vmo] removal of zx_vmo_{read,write}() actual parameter 4/n

This reverts commit d7c91f0a8a876bd4de8808595cafcd4f2c3fd7a1.

Change-Id: I5c61410f62850583a970d3ff2f44b6d58901509a


# d7c91f0a 19-Mar-2018 Benjamin Brittain <bwb@google.com>

[revert] Revert "[syscall][vmo] removal of zx_vmo_{read,write}() actual parameter 4/n"

This reverts commit 2d25909b7ab244d73172c9f5bc11d85b49ccefbb.

Change-Id: I09efe4e1d69d7aeadb051936d3ddc8237e7d39cf


# 2d25909b 14-Mar-2018 Shai Barack <shayba@google.com>

[syscall][vmo] removal of zx_vmo_{read,write}() actual parameter 4/n

Remove actual from zx_vmo_{read,write}
Mark zx_vmo_{read,write}_old as deprecated
Retarget most uses of zx_vmo_{read,write}_old to zx_vmo_{read,write}.

Still need to migrate a handful of uses of _old that had meaningful
usage of actual.
This is good enough to go ahead and migrate uses in Garnet and Topaz.

ZX-1802

Change-Id: If57329f9c5183a0dacd29083decbaf771925145f


# 939f4207 12-Mar-2018 Shai Barack <shayba@google.com>

[syscall][vmo] removal of zx_vmo_{read,write}() actual parameter 1/n

In preparation for changing the zx_vmo_read() and write() syscalls,
introduce aliases (zx_vmo_read_old() and write_old()) for the existing
behaviour, migrate zircon callers to the aliases, and mark the original
syscalls as deprecated.

Once the garnet and above layers have been migrated, the original
syscalls will be adjusted to remove the "actual" argument, and the
temporary _old() versions will be deprecated, and then removed.

ZX-1802

Change-Id: I2fab9a59caf4093fb585ada6015197017767aba2


# 8315096a 05-Mar-2018 Travis Geiselbrecht <travisg@google.com>

[kernel][vmo][cached] Allow setting cache policy on regular paged VMOs

Only works for plain vmos, and then only if they're not cloned, mapped,
or committed in any way.

Currently sets the cache parameters for all mappings, but will work
towards requiring the caller match the cache policy.

ZX-1213 #progress

Change-Id: Ie3e30f66048a844e48385b628373121f8bd18d44


# 0829806d 01-Mar-2018 Mark Seaborn <mseaborn@google.com>

[unittest] Remove 'length' argument from EXPECT_STR_EQ()/ASSERT_STR_EQ()

The 'length' argument is redundant now that these two functions always
compare the whole strings.

I updated the call sites using an automated tool.

I've removed the now-unneeded EXPECT_STRING_EQ() wrapper in
syslog_socket_tests.cpp.

Change-Id: I80fff5c5ccdc44337125bc2b2d3386fc6606f1dc


# 82004d30 01-Aug-2017 Travis Geiselbrecht <travisg@google.com>

[kernel][vmo] page align the size of vmos

During creation or resize, always snap the size of the VMO to the
next page size boundary.

This will allow us to easily add more types of vmo clones and generally
sidestep a bunch of undefined situations concerning the partial last
page.

ZX-1622 #done

Change-Id: I4c60509e7b17d39c48fbbae998a34c98f25a7f3e


# ec9928ea 22-Jan-2018 Adam Barth <abarth@google.com>

[syscalls] Rename zx_time_get to zx_clock_get

This change frees up the get() method in for a zx_time_t accessor in the
zx::time class.

Change-Id: Ia4cdc7e3e558df5ba0cfeedb27a442abf4d6f305


# 10cbccb6 18-Dec-2017 Travis Geiselbrecht <travisg@google.com>

[tests][vmo] add a long running test to try to detect unmap TLB coherency issues

Actually doesn't seem to reproduce the problem, but is a decent stress
test anyway.

Change-Id: If86bc05f9578e6d6cd02a7bcd90c94796419828e


# 167e09fa 20-Dec-2017 Roland McGrath <mcgrathr@google.com>

[ulib][musl] Use the compiler's <stddef.h>

The compiler provides one that has all we need, so just use it.
Clean up headers defining NULL to use a shared definition, which
in turn is outsourced to the compiler's <stddef.h>.

This uncovered some C++ test code that was conflating uintptr_t
with pointers and comparing it to NULL, which worked out OK before
when musl's sloppy C++ NULL definition was being used but is caught
by the proper definition from the compiler's <stddef.h>.

TO-441

Change-Id: I0b055d2c6e4e2f94b517f3aad782dfc1ebe7e767


# a491d51f 11-Nov-2017 Brian Swetland <swetland@google.com>

[rights][syscalls] introduce ZX_RIGHT_WAIT

This right governs the ability to wait_one(), wait_many(),
or wait_async() on an object. Previously ZX_RIGHT_READ
governed this.

Adjusts userspace and test code to include ZX_RIGHT_WAIT in
various zx_handle_duplicate() and zx_handle_replace() calls.

Change-Id: I92ff9f976150d17f81bf4f3d2a36781e37833060


# 06131ad8 15-Nov-2017 Travis Geiselbrecht <travisg@google.com>

[kernel][arm64] handle page faults on cache maintenance instructions

Apparently if you translation fault on a cache maintenance operation,
it'll be marked as a write fault with an additional CM bit set. Treat
this bit as overriding the write bit and handle it as a read fault.

Change-Id: Ib332f6fc01409df5e0fa8ccf7a6b38845c902923


# dd6c153e 15-Nov-2017 Travis Geiselbrecht <travisg@google.com>

[test][vmo] add some range tests to the vmo cache ops

Change-Id: Ie0ecb45abf088e9a68258b831a3ade7ddd7934d2


# f3e2126c 12-Sep-2017 Roland McGrath <mcgrathr@google.com>

[zx] Magenta -> Zircon

The Great Renaming is here!

Change-Id: I3229bdeb2a3d0e40fb4db6fec8ca7d971fbffb94


# 59e644b1 07-Sep-2017 George Kulakowski <kulakowski@google.com>

[zircon][mxtl->fbl] Rename mxtl to fbl

Change-Id: Ie21b6498e1bfb0a7fa0315e40b9e5c3ee78646be


# 4b913ba9 10-Aug-2017 Mark Seaborn <mseaborn@google.com>

[unittest] Use ASSERT_NE()/EXPECT_NE() instead of ASSERT_NEQ()/EXPECT_NEQ()

This is to make the interface more consistent with gtest, which uses
the _NE suffix rather than _NEQ for "not equal".

Change-Id: Ic03fda7322ab79cbd806c8f849b6956d201c6d45


# fa086fac 10-Aug-2017 Mark Seaborn <mseaborn@google.com>

[utest] Remove empty-string msg args from EXPECT_*() calls in C++

The msg argument to EXPECT_*() and ASSERT_*() is optional in C++ now,
so we can drop this argument when it's an empty string.

In the earlier conversions, I only converted ASSERT_*() and forgot to
convert EXPECT_*() too.

This change also converts a few ASSERT_*() instances that appeared
since the earlier changes.

MG-905

Change-Id: I034c6d6a6b614ab0b315dcd409435c9fe9e27e6c


# e5f44579 02-Aug-2017 Todd Eisenberger <teisenbe@google.com>

[kernel][vm] Implement zero-permission mappings

We were seeing if we could avoid having a PROT_NONE equivalent in favor
of using VMARs to provide guard pages, but we have found that the VMAR
solution does not address some less common use patterns. In particular,
the use case of marking pages as inaccessible and later marking them
accessible was not addressed. This behavior could be implemented using
the existing system, but would require additional error-prone bookkeeping
in each usermode app that wants this behavior, and would preclude some
optimizations that could be done in the kernel around coalescing
adjacent mappings.

MG-426 #done

Change-Id: I94ff7b62bb516103ff5a27623d7039697868c463


# 4983c25c 02-Aug-2017 Mark Seaborn <mseaborn@google.com>

[utest] Remove empty-string msg args from ASSERT_*() calls in C++

The msg argument to ASSERT_*() is optional in C++ now, so we can drop
this argument when it's an empty string.

MG-905

Change-Id: I6a5d6917518f8c9c4865b761dcbefe296d54c924


# 4d1f40ec 12-Jul-2017 Todd Eisenberger <teisenbe@google.com>

[syscall][vmo] Correct behavior of COMMIT on cloned VMOs

- Fix behavior of COMMIT to be the same as write-faulting, rather than
always zero-filled.
- Document behavior of COMMIT on cloned vmo
- Add tests to verify documented behavior of COMMIT

MG-925 #comment Fix-up COMMIT behavior

Change-Id: I61e45d309fab12ef876e04b357c8dd7fa3abe188


# a4e7719d 12-Jul-2017 Todd Eisenberger <teisenbe@google.com>

[syscall][vmo] Document COW clone decommit behavior

- Add an explaination of the behavior to the docs
- Add a test to verify the behavior

MG-925 #comment Document decommit behavior

Change-Id: I5367d49976d0b993293043022eedc4168fd26925


# b31d7b7f 06-Jul-2017 George Kulakowski <kulakowski@google.com>

[cpp][countof] Prefer the typesafe mxtl::count_of in C++ code

Change-Id: I3e475731f6872e6daf764f31964bed9f09186c7c


# 9c455646 16-Jun-2017 George Kulakowski <kulakowski@google.com>

[utest][status] Use the MX_OK and MX_ERR_* mx_status_t names

Change-Id: Ia395c985d6d13cdad97e66d92933d13ddb75c8b8


# 39f72292 06-Jun-2017 Todd Eisenberger <teisenbe@google.com>

[utest][vmo] Add tests for misaligned decommits

MG-830 #comment Add tests

Change-Id: I877d9b5146e6fe392ab8b4d0b00a3e7fcfac2893


# 91180082 02-Jun-2017 Adam Barth <abarth@chromium.org>

[kernel] mx_vmo_clone should copy name

Requires MX_RIGHT_GET_PROPERTY to read the name from the original VMO.

Change-Id: I0744add2a048b2246971666edb38c0cf136a95fc


# 66c438fd 23-May-2017 Roland McGrath <mcgrathr@google.com>

[kernel][vmo] Give VMO clones property rights

A clone is a new object, so its creator should be able to get and
set its MX_PROP_NAME at will. Other places that duplicate VMO
handles also preserve the GET_PROPERTY right.

Also stop adding extra MAP/EXECUTE rights in COW clones and
instead fix VMO file stuff to preserve those rights in the first
place.

userboot now sets the name property on the bootfs file VMOs it
creates.

Change-Id: I5c142b47c4584212262ed81bb2647c5e2697c7dc


# eb3f6154 22-May-2017 Dave Bort <dbort@google.com>

[vmo] object_get/set_property can get/set VMO names

This requires adding MX_RIGHT_GET/SET_PROPERTY to the default VMO
handle rights.

For MG-689: "Useful names for VMARs/VMOs"

Change-Id: I1ee4e6bbd3a7df83b8ce0f0976afb881de8b62aa


# b914d310 23-Mar-2017 Christopher Anderson <cja@google.com>

[vmo] Move cache policy into VmObjectPhysical

This change adds cache policy to physical vmos as a temporary measure
while the driver and resource models work themselves out. Physical
vmos by default are configured to map as uncached and this can be
changed via new methods and syscalls. The cache policy can only be
changed if the vmo is not mapped presently, but at this time nothing
prevents two processes with the same unmapped vmo from changing the
policy out from under one another. As it stands, this serves to enable
drivers to move to a resource model with those caveats in mind until
a better solution can be added in the future.

Change-Id: If660abeace6887e81d21d0f4f8ac464dae8d991d


# 4eee213f 17-May-2017 Christopher Anderson <cja@google.com>

Revert "[vmo] Move cache policy into VmObjectPhysical"

magma needs write-combining for performance to be usable, reverting this
to get the patches in together.

This reverts commit 84594609e40577274a5ad3339ef11ad2c4a6aa8f.

Change-Id: Ie3e96bfbf00e808fd23e54d57c6b708346698956


# 84594609 23-Mar-2017 Christopher Anderson <cja@google.com>

[vmo] Move cache policy into VmObjectPhysical

This change adds cache policy to physical vmos as a temporary measure
while the driver and resource models work themselves out. Physical
vmos by default are configured to map as uncached and this can be
changed via new methods and syscalls. The cache policy can only be
changed if the vmo is not mapped presently, but at this time nothing
prevents two processes with the same unmapped vmo from changing the
policy out from under one another. As it stands, this serves to enable
drivers to move to a resource model with those caveats in mind until
a better solution can be added in the future.

Change-Id: I1a7a5776c5d08b74415f85ba7ac6dfb90c0d2d56


# 0d5ae8c9 12-May-2017 Dave Bort <dbort@google.com>

[ulib] Merge ulib/hexdump into ulib/pretty

Change-Id: I194595de04e83178121c455f31732d1046448850


# bca62941 04-Apr-2017 Travis Geiselbrecht <travisg@google.com>

[kernel][vm][clone] implement VMO clone operation

Add a syscall and mechanism to create a clone of a range
of an existing vmo into a new vmo. At the moment only
supports the COPY_ON_WRITE flag, so the cloned vmo will
fault in new copies of pages as they are written to.

Change-Id: I318182438a411952fdcf1cc121f59b600587c852


# a38bf5b8 23-Mar-2017 Abdulla Kamar <abdulla@google.com>

[vm] Rename Lookup to LookupUser, and add Lookup to VMO.

This allows us to do lookups with kernel-space pointers, and not just
user-space pointers.

Change-Id: I85f4907336a5975bb4eca3379928d732cf241235


# 99b8fde5 07-Mar-2017 Travis Geiselbrecht <travisg@google.com>

[kernel][vm] fix situation where demand faulting pages aren't cleaned up in shared mappings

If a vmo is mapped in two locations and one mapping has already mapped a read only page
(in this case the zero page) and a second mapping properly write faults in a new page
to back that section of the VMO, the first mapping must have that range shot down.

Change-Id: I87f9319fa9783207c43f665a4726b21768cef7f8


# f7531f80 10-Jan-2017 Travis Geiselbrecht <travisg@google.com>

[kernel][vm] add zero page optimization

Mostly a lot of shuffling around of code to better set up the page fault
and faulting path to be more flexible. Now VMOs will not read-allocate
and instead return a pointer to a single physical page in the system that is
intentionally full of zeros only.

It's not a massive optimization, but it actually forces a refactor of the
fault path to be more in lined with what happens later with true copy-on-write.

Change-Id: If20b40d7cca8efcbb2c77c111707f3f979d9a2d1


# 682950da 17-Feb-2017 George Kulakowski <kulakowski@google.com>

[musl][magenta] Move process handle header into magenta

Change-Id: I00eb8f5ca7fbaf9297f3b1e5b391be00ce5d11e2


# b9ee0617 13-Feb-2017 Travis Geiselbrecht <travisg@google.com>

[kernel][vm] fix bug in code that unmaps ranges of vmos when decommitting

Two bugs:
1) the unmap code would unmap way too much memory because it passed in a bytewise
size to arch_mmu_unmap instead of a page count. This hid a bug in vmo-test.
2) the logic to compute the offset into a mapping at a non zero vmo offset was
broken and wouldn't account for the offset.

Fix a typo in vmo-test.

Change-Id: I93dbd59722148ed6822f075152328d331d0eea10


# fc935d56 27-Jan-2017 Todd Eisenberger <teisenbe@google.com>

[utest][vmo] Remove fragile VMO test case

This test relied on a specific address range in the address space not
being allocated. The functionality it is testing is tested better
in the VMAR tests.

MG-484 #comment This removes the fragile test in favor of existing
better ones.

Change-Id: Ia1df9de081daea3da0e0b3a1ec59ae6ef2f471d8


# 618e1f08 02-Dec-2016 Todd Eisenberger <teisenbe@google.com>

[vmar][unmap] Remove size=0 compatibility hack

For compatibility with the old interface, we were allowing size=0
to be passed in to mean "unmap the entire mapping that contains
the base address".

Change-Id: I9f6f560a685aff37fcd56d92ffca4ed94655b88b


# 0efb7cee 22-Nov-2016 Todd Eisenberger <teisenbe@google.com>

[vmar][tests] Update all remaining tests to use the new VMAR interface

Change-Id: I4c56ce24a73c22738061dfbf54bfe2f48e9fd9d1


# ed4794c6 07-Nov-2016 Todd Eisenberger <teisenbe@google.com>

[vm] Replace VmRegions with VmAddressRegions

VmAddressRegions are the new VM partitioning layer. They are
a tree-structured partitioning of the address space in which
each region can be subdivided into additional regions and VM
mappings. This gives the caller more control over the address
space layout, such as being able to guarantee that parts of the
address space won't be used by anything else.

This patch implements the core of VMARs, but does not expose them
yet. It includes a compatibility layer in VmAspace for users of
the old interface.

This drops support for min_alloc_gap, which will be unnecessary
once the migration is finished.

This changes the behavior of VMM_FLAG_VALLOC_BASE, to actually
just be a hint to start the search for space near the top of the
user aspace.

The following should be coming in followup patches:
- Restricting invocation of the compatibility layer to the kernel
address space only
- Exposing new syscalls to allow usermode to manipulate VMARs
- Integrating those syscalls into our process creation flow
- Replacing the allocation scheme within the VMAR code to be randomized
rather than first-fit placement.

Change-Id: I550a3120320d4f6c4cf72caeb4ed3226c79104f7


# 7006ae17 07-Dec-2016 Roland McGrath <mcgrathr@google.com>

Remove mx_size_t and mx_ssize_t types

mx_ssize_t is no longer used. mx_size_t is superfluous and
can be replaced by the standard C type size_t.

Change-Id: I2137af6f166099d2e8aaca4fab63ff101f2a43ac


# 4818c616 01-Nov-2016 Travis Geiselbrecht <travisg@google.com>

[kernel][vm] implement resize on vmos

Now that decommit is implemented, resize is really just a special case.

Change-Id: I417dd7795c2f86b8ecc428b9055e64b7474f6a1c


# e3558f69 01-Nov-2016 Travis Geiselbrecht <travisg@google.com>

[kernel][vm] implement decommit hooks

Now can decommit a range of a vmo, which returns the pages to the free
pool and unmaps the appropriate range of any region that has it mapped.

Change-Id: I1781369dbbf2c35f253121a4f8c1a8ebaf762465


# 12be81b3 31-Oct-2016 Travis Geiselbrecht <travisg@google.com>

[kernel][vm] refactor VMOs into a base vmo class, a paged version, and a physical memory version

Can now create vmos that represent physical memory and map them.
Physical VMOs are not resizeable or read/writable, but can be mapped and shared
just like regular VMOs.

Not exposed to syscall layer yet.

Change-Id: I48ca4dd9e75392323b3a7b09833030338ad168b0


# 91ad1495 01-Nov-2016 Brian Swetland <swetland@google.com>

[syscalls] update cprng_add_entropy() and cprng_draw()

Change-Id: I59aa8884aa2df2426fb87fe4deeae8846f146cb1


# 13a7ef1f 01-Nov-2016 Brian Swetland <swetland@google.com>

[syscalls] update mx_handle_duplicate() and mx_handle_replace()

Change-Id: Ie332f4a924311c0bf1f93031712853c33027c411


# cac54027 01-Nov-2016 Brian Swetland <swetland@google.com>

[syscalls] update vmo_{create,read,write}()

Change-Id: I6b46a48813de4e74767174c2786d04cf414b017a


# 83cf29b2 13-Oct-2016 Travis Geiselbrecht <travisg@google.com>

[test][vmo] add test case for fixed and base region mapping

Change-Id: I30a602b777b8a92edbec9aafaec30950e1ad5a19


# cfce8de5 30-Sep-2016 Travis Geiselbrecht <travisg@google.com>

[utest][vmo] start a little user space benchmark for VMOs

Change-Id: I9849b80efe275139ff7303d23c7e20ddd898a17f


# f13ffcb4 13-Sep-2016 Travis Geiselbrecht <travisg@google.com>

[kernel][vmo] add a new vmo_op_range call for a few new operations

Implemented:
COMMIT which faults in a range of a vmo immediately
LOOKUP which returns an array of physical addresses for the range.
Other ops are not implemented yet, but placeholder cases exist.

Change-Id: I9dd9d4ebecb1c659c1b17b7a3f3d3babae52f0db


# 1c4e82f9 10-Sep-2016 Travis Geiselbrecht <travisg@google.com>

[utests][vmo] add a bunch of rights tests for the vmo object

Change-Id: Iaf981c4f7b3df3ea0be1216ec0ea430829815dfb