-
Notifications
You must be signed in to change notification settings - Fork 8k
restore socket descriptor permission management #25804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5737e3f
f5c40e5
074bdc0
02beeea
522e2c3
41fcb9c
14ce08a
9b79f5f
b3c0b78
11568ce
7f41a68
5d95ae3
0817256
6ce4823
9c936e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,38 @@ enum _obj_init_check { | |
_OBJ_INIT_ANY = 1 | ||
}; | ||
|
||
/** | ||
* Return true if we are currently handling a system call from user mode | ||
* | ||
* Inside z_vrfy functions, we always know that we are handling | ||
* a system call invoked from user context. | ||
* | ||
* However, some checks that are only relevant to user mode must | ||
* instead be placed deeper within the implementation. This | ||
* API is useful to conditionally make these checks. | ||
* | ||
* For performance reasons, whenever possible, checks should be placed | ||
* in the relevant z_vrfy function since these are completely skipped | ||
* when a syscall is invoked. | ||
* | ||
* This will return true only if we are handling a syscall for a | ||
* user thread. If the system call was invoked from supervisor mode, | ||
* or we are not handling a system call, this will return false. | ||
* | ||
* @return whether the current context is handling a syscall for a user | ||
* mode thread | ||
*/ | ||
static inline bool z_is_in_user_syscall(void) | ||
|
||
{ | ||
/* This gets set on entry to the syscall's generasted z_mrsh | ||
* function and then cleared on exit. This code path is only | ||
* encountered when a syscall is made from user mode, system | ||
* calls from supervisor mode bypass everything directly to | ||
* the implementation function. | ||
*/ | ||
return !k_is_in_isr() && _current->syscall_frame != NULL; | ||
} | ||
|
||
/** | ||
* Ensure a system object is a valid object of the expected type | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stupid question, what are the objects not supported by
k_object_alloc
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a switch statement in
z_impl_k_object_alloc()
specifically for thisThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be better documented by the way, I'll send a separate PR to augment the doxygen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks !