-
Notifications
You must be signed in to change notification settings - Fork 69
dcp: Restore UID/GID after setting with --uid/--gid #586
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
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 @bdevcich for debugging this! I have just one nit.
src/dcp/dcp.c
Outdated
if (setgroups(0, NULL) < 0) { | ||
MFU_LOG(MFU_LOG_ERR, "Could not setgroups: %s", strerror(errno)); | ||
mfu_finalize(); | ||
MPI_Finalize(); | ||
return 1; | ||
} | ||
|
||
/* record the original groups */ | ||
getgroups(MAX_GIDS, &gids); |
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.
Please check this for failure and report it (e.g. errno==EINVAL means MAX_GIDS was too small), or dynamically get the size needed and allocate the buffer for the gids.
It was my bug, so I felt obligated! 😄 |
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.
LGTM. Thanks!
Hi @bdevcich can you squash these commits and re-push? Thanks |
When `--uid` or `--gid` is used, MPI_Init() is called as the original user. The original uid/gid is not being restored prior to calling MPI_Finalize(), which leads to cleanup issues. Resolves hpc#585. Signed-off-by: Blake Devcich <[email protected]>
78e16e3
to
d56910b
Compare
@ofaaland done! |
@ofaaland can you merge? I don't have permission to do so. |
Odd, I thought I already had. I'll try again. |
@bdevcich there you go. Thanks again! |
When
--uid
or--gid
is used, MPI_Init() is called as the original user. The original uid/gid is not being restored prior to calling MPI_Finalize(), which leads to cleanup issues.Resolves #585.