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

osutil: switch to -u UID:GID for strace-static #13950

Merged
merged 3 commits into from
May 22, 2024

Conversation

zyga
Copy link
Collaborator

@zyga zyga commented May 7, 2024

This moves us off the custom patch and onto an upstream feature we've heled develop. The feature is not released yet but the patch has been integrated into the strace-static snap.

canonical/strace-static-snap#3

Jira: SNAPDENG-19870

@zyga zyga requested review from bboozzoo and Meulengracht May 7, 2024 08:03
@@ -50,8 +50,8 @@ var ExcludedSyscalls = getExcludedSyscalls()

func findStrace(u *user.User) (stracePath string, userOpts []string, err error) {
if path := filepath.Join(dirs.SnapMountDir, "strace-static", "current", "bin", "strace"); osutil.FileExists(path) {
// strace-static cannot resolve usernames, pass uid/gid instead
return path, []string{"--uid", u.Uid, "--gid", u.Gid}, nil
// Strace v6.9 supports -u UID:GID which avoids the need to resolve usernames with nss.
Copy link
Member

Choose a reason for hiding this comment

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

Since it required v6.9 just help me understand, do we bundle strace-static or how are we fulfilling this requirement?

Copy link
Member

Choose a reason for hiding this comment

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

Ah right, looking more at this it needs the snap to be installed before this works?

What happens if I have an old strace snap?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are two cases:

  • you have the strace-static snap, just refresh or it doesn't work
  • you don't have the snap - this never worked then

There are about 200-300 users of strace-static, I think it's fine to do it without any extra complexity.

Copy link
Collaborator

@bboozzoo bboozzoo left a comment

Choose a reason for hiding this comment

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

LGTM

@zyga
Copy link
Collaborator Author

zyga commented May 20, 2024

The snap is currently building. Once it reaches candidate, I will re-trigger tests.

@zyga
Copy link
Collaborator Author

zyga commented May 20, 2024

The candidate channel is now ready (except for ppc and i386 which are EOL)

zyga added 2 commits May 21, 2024 17:15
This moves us off the custom patch and onto an upstream feature
we've heled develop. The feature is not released yet but the
patch has been integrated into the strace-static snap.

Jira: SNAPDENG-19870

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
The test tried to carefully match the error message to the version of strace
used, which in turn depends on the host OS. It's much easier to just check both
error mesages.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
@zyga zyga force-pushed the SNAPDENG-19870 branch 2 times, most recently from f34c3a5 to 346d123 Compare May 22, 2024 08:33
@zyga zyga requested a review from bboozzoo May 22, 2024 08:47
@zyga
Copy link
Collaborator Author

zyga commented May 22, 2024

@bboozzoo please re-review the last patch.

Copy link
Collaborator

@bboozzoo bboozzoo left a comment

Choose a reason for hiding this comment

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

LGTM

On systemd 255 systemctl kill fails after attempting to kill snapd.service with
the following message:

  $ sudo systemctl kill --signal=SIGKILL snapd.service
  Failed to kill unit snapd.service: Failed to send signal SIGKILL to auxiliary processes: Invalid argument

Kill the pid by hand to avoid triggering this behavior.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
@ernestl ernestl merged commit 7706a79 into snapcore:master May 22, 2024
47 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants