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

many: move notify.SysPath to apparmor.NotifySocketPath #15131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

olivercalder
Copy link
Member

Move the definition of the notify socket path from the notify package into the apparmor package. This means that the apparmor package no longer needs to import the notify package, so the notify package can import the apparmor package in the future without a circular import.

This is required for #15089 so that it can check the supported AppArmor kernel features by importing the apparmor package.

@github-actions github-actions bot added the Needs Documentation -auto- Label automatically added which indicates the change needs documentation label Feb 25, 2025
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

Attention: Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.

Project coverage is 78.06%. Comparing base (a272aac) to head (ba6dff8).
Report is 77 commits behind head on master.

Files with missing lines Patch % Lines
sandbox/apparmor/notify/version.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15131      +/-   ##
==========================================
- Coverage   78.07%   78.06%   -0.02%     
==========================================
  Files        1182     1185       +3     
  Lines      157743   158255     +512     
==========================================
+ Hits       123154   123537     +383     
- Misses      26943    27037      +94     
- Partials     7646     7681      +35     
Flag Coverage Δ
unittests 78.06% <54.54%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@zyga zyga left a comment

Choose a reason for hiding this comment

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

Looks good. I left a few comments. Please iterate in a follow up unless the last comment at the bottom warrants action now.

@@ -41,7 +41,11 @@ var (
// on the notify socket with that version, in which case we'll need to try
// the next version in the list.
versionLikelySupportedChecks = map[ProtocolVersion]func() bool{
3: SupportAvailable,
3: func() bool {
Copy link
Contributor

@zyga zyga Feb 25, 2025

Choose a reason for hiding this comment

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

Is this intentional?

I was asking about timing/staging this change in the patch.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, since SupportAvailable is going away, we can't call it here anymore. This was only ever really a placeholder anyway, since any caller interested in protocol version support is being called because prompting itself is supported, and prompting support first checks that the notify socket already exists. So this check was not necessary, just something we could do to make extra sure, until we introduce more interesting checks (e.g. in #15089)

Copy link
Member Author

Choose a reason for hiding this comment

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

This patch removes SupportAvailable (since notify.SysPath is being replaced by apparmor.NotifySocketPath), so I remove the call to it here as well, and in #15089 replace it with a proper check.

@@ -305,6 +304,14 @@ const (
Full
)

var (
Copy link
Contributor

Choose a reason for hiding this comment

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

Could those carry documentation (follow up is fine)

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably should. The other ones already existed, but I moved their declaration up to before they're set, since that made more sense to me. Just the last one is new, and it's the path to the socket over which communication can occur with kernel apparmor.

Copy link

github-actions bot commented Feb 25, 2025

Fri Feb 28 19:27:56 UTC 2025
The following results are from: https://github.com/canonical/snapd/actions/runs/13590682040

Failures:

Preparing:

  • google-core:ubuntu-core-24-64:tests/regression/lp-1797556
  • google-core:ubuntu-core-24-64:tests/main/interfaces-desktop-host-fonts-core
  • google-core:ubuntu-core-24-64:tests/main/snap-user-dir-perms-fixed:root
  • google-core:ubuntu-core-24-64:tests/main/snap-user-dir-perms-fixed:test

Executing:

  • google-core:ubuntu-core-24-64:tests/core/xdg-open-on-core
  • google-core:ubuntu-core-24-64:tests/core/create-user-2
  • google-core:ubuntu-core-24-64:tests/regression/lp-1813365
  • google-core:ubuntu-core-24-64:tests/main/system-usernames:daemon
  • google-core:ubuntu-core-24-64:tests/main/snap-confine-tmp-mount
  • google-core:ubuntu-core-24-64:tests/main/interfaces-many-core-provided
  • google-core:ubuntu-core-24-64:tests/main/snap-session-agent-unavailable-to-snaps
  • google-core:ubuntu-core-24-64:tests/main/interfaces-shared-memory-private
  • google-core:ubuntu-core-24-64:tests/smoke/sandbox
  • google-core:ubuntu-core-24-64:tests/main/snap-user-service-start-on-install
  • google-core:ubuntu-core-24-64:tests/regression/lp-2065077
  • google-core:ubuntu-core-24-64:tests/main/parallel-install-store
  • google-core:ubuntu-core-24-64:tests/core/remove-user
  • google-core:ubuntu-core-24-64:tests/main/snap-remove-terminate:fork_bomb
  • google-core:ubuntu-core-24-64:tests/main/snap-user-service-socket-activation
  • google-core:ubuntu-core-24-64:tests/main/snap-confine-undesired-mode-group
  • google-core:ubuntu-core-24-64:tests/main/cgroup-tracking:root
  • google-core:ubuntu-core-24-64:tests/main/interfaces-personal-files
  • google-core:ubuntu-core-24-64:tests/main/snap-user-service-restart-on-upgrade
  • google-core:ubuntu-core-24-64:tests/main/snapshot-users
  • google-core:ubuntu-core-24-64:tests/main/snap-session-agent-service-control
  • google-core:ubuntu-core-24-64:tests/main/refresh-app-awareness:strict
  • google-core:ubuntu-core-24-64:tests/main/snap-debug-stacktrace
  • google-core:ubuntu-core-24-64:tests/main/snap-session-agent-socket-activation
  • google-core:ubuntu-core-24-64:tests/main/parallel-install-basic
  • google-core:ubuntu-core-24-64:tests/smoke/install
  • google-core:ubuntu-core-24-64:tests/main/snapshot-cross-revno
  • google-core:ubuntu-core-24-64:tests/main/snap-download
  • google-core:ubuntu-core-24-64:tests/main/interfaces-browser-support:disallow
  • google-core:ubuntu-core-24-64:tests/main/interfaces-mount-observe
  • google-core:ubuntu-core-24-64:tests/main/interfaces-browser-support:allow
  • google-core:ubuntu-core-24-64:tests/main/system-usernames:snap_daemon
  • google-core:ubuntu-core-24-64:tests/main/parallel-install-local
  • google-core:ubuntu-core-24-64:tests/main/snap-routine-portal-info
  • google-core:ubuntu-core-24-64:tests/main/snap-user-service
  • google-core:ubuntu-core-24-64:tests/main/regression-home-snap-root-owned
  • google-core:ubuntu-core-24-64:tests/main/interfaces-system-observe
  • google-core:ubuntu-core-24-64:tests/main/sudo-env
  • google-core:ubuntu-core-24-64:tests/main/snap-user-service-upgrade-failure
  • google-core:ubuntu-core-24-64:tests/main/dbus-activation-session

Restoring:

  • google-core:ubuntu-core-24-64:tests/regression/lp-1797556
  • google-core:ubuntu-core-24-64:tests/main/snap-user-dir-perms-fixed:root
  • google-core:ubuntu-core-24-64:tests/main/snap-routine-portal-info
  • google-core:ubuntu-core-24-64:tests/main/snap-user-dir-perms-fixed:test

@olivercalder olivercalder force-pushed the prompting-notify-socket-change-package branch from 7ac2cb2 to 3fc325b Compare February 25, 2025 21:07
Copy link
Contributor

@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

@olivercalder olivercalder force-pushed the prompting-notify-socket-change-package branch from 3fc325b to 5bb38f8 Compare February 27, 2025 15:40
@olivercalder olivercalder reopened this Feb 27, 2025
@olivercalder
Copy link
Member Author

Github CI was stuck uploading spread results for hours, and cancellation wasn't working, so I closed and reopened to get it to actually restart.

Move the definition of the notify socket path from the notify package
into the apparmor package. This means that the apparmor package no
longer needs to import the notify package, so the notify package can
import the apparmor package in the future without a circular import.

Signed-off-by: Oliver Calder <[email protected]>
@olivercalder olivercalder force-pushed the prompting-notify-socket-change-package branch from 5bb38f8 to ba6dff8 Compare February 28, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Documentation -auto- Label automatically added which indicates the change needs documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants