Implement better vunmap() functionality; Enable NULL address (0 MFN) handling#312
Conversation
minipli-oss
left a comment
There was a problem hiding this comment.
The semantical change regarding vmap*(), get_free_page*() is unfortunate, as now all callers need to take care of (and be audited to actually do so!) to test for MAP_FAILED before trying to access the returned pointer. :/
The NULL pointer test was much more intuitive.... Can't we special case where we want to really map address zero? Like, by passing yet another flag MAP_NULL.
Or, to make users more aware, change the return value to int to represent an error code only and return va as an output parameter?
Ok, I went with a shortcut and a middle ground. Since the mapping of NULL va is not used as of now and should be very rare, hopefully it would suffice. |
minipli-oss
left a comment
There was a problem hiding this comment.
_vmap()'s handling of va == NULL is still tricky for the callers, but I guess this version is still better than the first.
So with the little nit addresses, lgtm!
Signed-off-by: Pawel Wieczorkiewicz <wipawel@grsecurity.net>
Signed-off-by: Pawel Wieczorkiewicz <wipawel@grsecurity.net>
Signed-off-by: Pawel Wieczorkiewicz <wipawel@grsecurity.net>
Previous naive implementation was creating new pagetable entries when no such mapping had been created. It wasn't also taking into account the order of the mapping, assuming all mappings were 4K. Also, return unmapped MFN and page order to let the caller handle corresponding frame. Signed-off-by: Pawel Wieczorkiewicz <wipawel@grsecurity.net>
Signed-off-by: Pawel Wieczorkiewicz <wipawel@grsecurity.net>
No description provided.