nvmap: Fix handle generation from IVC ID
- Search global handle list and if a handle for IVM ID exists, reference
that in client and return that to the user. Else, create a handle and
reference.
- Initial solution was to just check the client refs and if
any reference had IVM ID, use that reference else create the handle
but typical use case has 2 graphics components (window manager and
application). It is possible that application creates a handle and
reference and window manager later takes a reference to the handle.
The application deletes it's reference. After a few frames, producer
sends the same IVC ID and when application tries to create a handle it
fails because that region is already held by a handle. Hence, a global
search is needed. The drawback of the solution is that we cannot
detect denial of service i.e; If a rogue application guessed the IVC
ID and created an handle, handle creation from actual application
would also suceed since we search global handle list. If we still need
the protection then the application that first created the handle from
IVC ID should not free the handle but this might not be
straightforward as we had mentioned that once handle is created from
IVC ID, regular semantics would work for duping, freeing handles.
bug
1638591
Change-Id: I094f14abbbfa2b50393ca3d456577954ef948350
Signed-off-by: Raghavendra VK <rvk@nvidia.com>
Reviewed-on: http://git-master/r/743197
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>