kernel: add k_object_access_all_grant() API

This is a helper API for objects that are intended to be globally
accessible.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-10-04 12:10:32 -07:00 committed by Anas Nashif
commit 3b5ae804ad
2 changed files with 51 additions and 5 deletions

View file

@ -229,6 +229,23 @@ void _k_object_init(void *obj);
*/
void k_object_access_grant(void *object, struct k_thread *thread);
/**
* grant all present and future threads access to an object
*
* If the caller is from supervisor mode, or the caller is from user mode and
* have sufficient permissions on the object, then that object will have
* permissions granted to it for *all* current and future threads running in
* the system, effectively becoming a public kernel object.
*
* Use of this API should be avoided on systems that are running untrusted code
* as it is possible for such code to derive the addresses of kernel objects
* and perform unwanted operations on them.
*
* @param object Address of kernel object
*/
void k_object_access_all_grant(void *object);
#else
static inline int _k_object_validate(void *obj, enum k_objects otype, int init)
{