-
Notifications
You must be signed in to change notification settings - Fork 35
Set ptracer permissions for IPC handle creation #1018
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
Conversation
|
It's for the ease-of-use of the UMF IPC API. Perhaps at least we should enable tracing with a new CMake option so the user enables tracing explicitly? And this would be disabled by default as UMF users not using IPC API would not be interested in setting
It works for |
This is about kernel level process security protection/permissions - common shared library between processes do not have to influence here. |
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.
26 tests out of 56 fail on WSL with the following error:
umf_example_ipc_ipcapi_producer: unified-memory-framework/src/ipc_cache.c:136: umfIpcHandleMappedCacheCreate: Assertion `IPC_MAPPED_CACHE_GLOBAL != NULL' failed.
Aborted (core dumped)
just a note here: we've established to rather updated docs, examples and our tests, than use the current solution... |
7cfadea
to
c86f19b
Compare
Updated PR with |
Use the prctl() call to let the parent process and its children open IPC handle. This is a more secure way than setting the ptrace_scope to 0 globally for all processes in the system. Co-authored-by: [email protected]
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.
beside minor issues, LGTM
// to copy producer's file descriptor, even when ptrace_scope is set to 1. | ||
ret = prctl(PR_SET_PTRACER, getppid()); | ||
if (ret == -1) { | ||
printf("prctl() call failed with errno %d (%s). This may indicate that " |
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.
perror?
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.
Done
@@ -336,6 +338,14 @@ int run_producer(int port, umf_memory_pool_ops_t *pool_ops, void *pool_params, | |||
int producer_socket = -1; | |||
char consumer_message[MSG_SIZE]; | |||
|
|||
ret = prctl(PR_SET_PTRACER, getppid()); | |||
if (ret == -1) { | |||
printf("prctl() call failed with errno %d (%s). This may indicate that " |
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.
perror
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.
Done
Patryk is off at the moment, so finishing up the minor issues left here - contd in #1040 |
Fixes: #979
Checklist