Skip to content
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

rfc15: describe IMP signal handling + minor updates #429

Merged
merged 5 commits into from
Oct 18, 2024

Conversation

garlick
Copy link
Member

@garlick garlick commented Oct 17, 2024

Problem: RFC 15 only describes flux imp kill but we need the IMP to forward signals.

Take a stab at describing this behavior, admittedly without a lot of detail as yet - perhaps we can fix that by coming to some agreement on those details. But this is a start anyway.

Problem: the RFC states that the IMP takes its input on stdin
to avoid placing sensitive data on the command line, but stdin
is no longer used for this.

Now the IMP obtains its input by calling a helper program provided
by the instance instead of stdin.  The helper is run from the
unprivileged part of the IMP.

For now, just drop the incorrect detail which wasn't necessary
in that part of the text anyway.

See also: flux-framework/flux-security#163
Problem: it seems like the intent was to render R_local as R with a
subscript, but this was not quite achieved.

Use :math: which makes this simple.
Problem: the spec says that the IMP exits after starting the job
shell but this is no longer the case.

The IMP must linger in order to finalize the PAM session.

Reword the post-verification execution section to reflect this behavior.

See also: flux-framework/flux-security#150
Copy link
Contributor

@grondo grondo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!! Just added one comment and a typo I happened to notice.

@@ -372,13 +372,25 @@ A multi-user instance of Flux not only requires the ability to execute
work as a guest user, but it must also have privilege to monitor and
kill these processes as part of normal resource manager operation.

Signaling and terminating jobs in a multi-user instance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit message typo: forard

spec_15.rst Outdated
Comment on lines 392 to 393
The mechanism by which processes are identified to receive SIGKILL is
outside the scope of this document.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is the consensus that we no longer need flux-imp kill? That would be kind of nice because it is a bit of code to maintain and has to read cgroup files to determine if the calling user has permission to signal a process.

It feels like we will need to add details here because there are two modes (at least) in which the IMP operates:

  1. sdexec: The IMP should be the first processes in a cgroup created by the flux user systemd instance for the specific job. In this case the IMP can use cgroup.procs to gather the list of PIDs to forward signals.
  2. without sdexec: The IMP is in a cgroup shared with the parent broker (system instance broker) and all other concurrently running jobs. It should not use cgroup.procs to gather the list of PIDs to signal, since that would include everything Flux is running on the node including the broker.

If we can codify in the RFC how to differentiate these two environments, then the implementation of the IMP signal forwarding would be much simpler (and documented). For instance, to follow current practice we could state something like "The IMP shall get the basename of the current cgroup directory at startup. If the directory begins with imp-shell, then the IMP SHALL forward SIGKILL to all PIDs listed in cgroup.procs. Otherwise, the IMP SHALL forward SIGKILL only to its direct child and optionally MAY include descendants."

Ignore me if you already had this in mind (and is what you meant when you said details could be added later)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, your succinct description of how this should work is excellent. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping you would swoop in with those details and you did! Let me put that in and we'll see how it looks.

Yes, I concur that flux imp kill isn't needed. At least I can't think why we need it. Dropping it will also simplify bulk-exec since the regular subprocess kill should work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait a sec, when flux imp run is used, we might need flux imp kill unless we change that to work the same way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch. 😞

Problem: the IMP kill subcommand is briefly mentioned as the way
to signal guest processes, but this is inadequate in practice.

Now that the IMP lingers, just have it forward signals to the job
shell.  In addition, describe a surrogate signal that tells the
IMP to do its best to clean up the entire job container.

See also: flux-framework/flux-core#6011
Problem: the method for delivering SIGKILL to all members of the
job's container is not described.

Describe the mechanism.
@garlick
Copy link
Member Author

garlick commented Oct 17, 2024

Pushed those changes, thanks!

Copy link
Contributor

@grondo grondo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. Once this is merged we can open an issue to implement the RFC in flux-security.

@garlick
Copy link
Member Author

garlick commented Oct 18, 2024

I guess a question is should we address flux imp run? We could have it wait for its children and forward signals too. Or if we aren't going to do that we probably should add back flux imp kill to the RFC.

Actually let's deal with that in a follow on PR and get this merged since it's a somewhat independent issue. I'll set MWP here.

@mergify mergify bot merged commit 205c74c into flux-framework:master Oct 18, 2024
7 checks passed
@garlick garlick deleted the imp_changes branch October 18, 2024 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants