7148 Commits

Author SHA1 Message Date
Michael Vogt
85bc5c7221 interface/builtin: add qualcomm-ipc-router interface for AF_QIPCRTR socket protocol
* interface/seccomp: add socket AF_QIPCRTR

AF_QIPCRTR (Qualcomm IPC router protocol) is used to communicate
with services provided by other hardware blocks in the system.

Snaps to access some Qualcomm hardware components need this protocol.

Signed-off-by: Robert Liu <robert.liu@canonical.com>

* snap-seccomp: add AF_QIPCRTR and PF_QIPCRTR

Signed-off-by: Robert Liu <robert.liu@canonical.com>

* interfaces/builtin: add qrtr

Signed-off-by: Robert Liu <robert.liu@canonical.com>

* interfaces/builtin/qrtr: limit type to sock_dgram only

Signed-off-by: Robert Liu <robert.liu@canonical.com>

* interfaces/builtin/qualcomm-ipc-router: rename from qrtr and add more details

Signed-off-by: Robert Liu <robert.liu@canonical.com>

* interfaces/builtin/qualcomm-ipc-router: update tests

Signed-off-by: Robert Liu <robert.liu@canonical.com>

* sandbox/apparmor: support checking for network qipcrtr dgram parser feature

This is not a required or even preferred feature at this time, it will just be
used by one specific interface for checking. Eventually it should become a
proper feature that is queried / included in the system-key perhaps, etc. but
the rest of the machinery for this is not available yet.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/qualcomm-ipc-router: only perform the conn if the parser supports it

If the apparmor_parser on the system doesn't support the qipcrtr-socket
feature, then we shouldn't proceed with the connection of the apparmor plug.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/apparmor: expose the apparmor sandbox features through Specification

This allows interfaces to specialize their policy or behavior based on what
features are available in both the parser and the kernel.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/qualcomm-ipc-router: adjust implementation to use spec.Features()

This is the better way where the individual interface doesn't need to import
the sandbox directly and can instead get the features from the specification.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* cmd/snap-seccomp: address gofmt for 1.13

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* tests/interfaces-many-core-provided: check on xenial, qualcomm-ipc-router fails

This interface does not work on xenial, so we should get an error message
trying to connect it.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces: rename MockSetFeatures -> MockFeatures

Thanks to Samuele for the suggestion.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/qualcomm-ipc-router: drop redundant dgram from rule

Thanks to Alex for pointing this out.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* snap-seccomp: import "github.com/mvo5/libseccomp-golang" without the "seccomp" prefix to avoid breaking the debian-sid patch

* tests: fix skip on 16.04 for qualcomm-ipc-router

* interfaces/repo: add comment about issue with AppArmorConnectedPlug failures

Explain a potential issue we are running into with the current state of the
qualcomm-ipc-router interface.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/qualcomm-ipc-router: switch to BeforePreparePlug based impl

Use BeforePreparePlug instead of AppArmorConnectedPlug since
AppArmorConnectedPlug returning non-nil error leads to an inability to process
other connection changes for that snap until snapd is restarted.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* Revert "interfaces/apparmor: expose the apparmor sandbox features through Specification"

This reverts commit bff6b6b2b5c62349e2605c199241c97a61ba6cb3.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/qualcomm-ipc-router: switch to using BeforeConnectPlug

BeforePreparePlug is actually run just when a plug is declared, not necessarily
when the plug is going to be connected. For qualcomm-ipc-router, we want to
reject the connection, not necessarily the plug by itself.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/builtin/qualcomm-ipc-router: fix method args to match interface

Also need to adjust the new interfaces.BeforeConnectPlug helper which tests
this as it was using the wrong type as well.

Thanks to Samuele for finding this.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* tests/main/interfaces-many-core-provided: fix if check for xenial to add UC16

Xenial and Ubuntu Core 16 suffer from the same problem so they both need to be
considered in this check.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

Co-authored-by: Ian Johnson <ian.johnson@canonical.com>
Co-authored-by: Michael Vogt <mvo@ubuntu.com>

Co-authored-by: Tsunghan Liu (Robert Liu) <robert.liu@canonical.com>
Co-authored-by: Ian Johnson <ian.johnson@canonical.com>
2021-09-03 15:55:11 -05:00
Ian Johnson
d3acb1f9fb Merge branch 'release/2.51' into release-2.51.7-changelog-for-2.52
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-08-27 18:04:06 -05:00
Maciej Borzecki
9e4072a6bf cmd/snap-seccomp/syscalls: update syscalls list to libseccomp v2.2.0-428-g5c22d4b
The latest libseccomp updated the syscalls list to match what is available in
Linux v5.14-rc7 [1].

1. 5c22d4b682

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-08-27 17:50:04 +02:00
Ian Johnson
f7d952f609 cmd/snap/model: support presence too, adjust formatting a bit
Thanks to Samuele for the suggestions.

Also skip some of the type checks on the name part of the snaps assertion,
since we could not have parsed the assertion if it had an invalid type.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-07-16 06:56:35 -05:00
Ian Johnson
8d0a93cd27 cmd/snap/model: support storage-safety and snaps headers too
The snaps header is only shown in verbose, while the storage-safety header is
shown in all modes when not empty.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-07-15 21:36:32 -05:00
Samuele Pedroni
3268a532e3 client, cmd/snap, daemon: refactor REST API for quotas to match CLI org
Merge pull request #10437 from anonymouse64/feature/quota-groups-the-final-countdown-1

The CLI has organization where the current and constraint keys are maps of the
unit of measure for the quota group to the value, so update the REST API to
match this.

This change will enable us to add new quota group types easily without adding
new fields to the JSON types we return, etc. The client changes also now are
transparent of whatever fields are passed, with the caveat that some of them
might get formatted specially like we do for memory in this PR.

This is a breaking REST API change to quotas, but the quota feature is still
experimental so it's okay. There should not be any more REST changes after
this PR.
2021-07-09 12:44:27 +02:00
Ian Johnson
a62abd6c97 Merge branch 'master' into feature/quota-groups-the-final-countdown-1
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-07-08 06:26:28 -05:00
Ian Johnson
11319a1c80 client/tests, cmd/quota/tests: use json.Number for exactness
Thanks to Michael for the suggestion!

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-07-08 06:26:19 -05:00
Samuele Pedroni
87b720b251 c/snap: drop spurious error check
this was moved as is from the original code

thanks @stolowski
2021-07-08 11:40:13 +02:00
Samuele Pedroni
d9a4499dbf c/snap,asserts: create/delete-key external keypair manager interaction
at least initially we don't support using snap commands to create/delete
keys under an external keypair manager, organize things such that though
we can produce appropriate error messages and we can implement
supporting this later if required
2021-07-08 11:39:47 +02:00
Ian Johnson
7500d95915 Merge branch 'master' into feature/quota-groups-the-final-countdown-1
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-07-06 16:59:06 -05:00
Ian Johnson
d082924c0f client, cmd/snap, daemon: re-re-re-factor the API implementation
As per request, a thrice baked API implementation.
🍽️ Bon Appétit!

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-07-06 16:59:03 -05:00
Sergio Cazzolato
4e53c052ae Merge remote-tracking branch 'upstream/master' into tests-remove-xenial-32-bits 2021-07-06 14:54:41 -03:00
Sergio Cazzolato
c8db00ce6d Merge branch 'master' into tests-remove-xenial-32-bits 2021-07-06 14:53:15 -03:00
Michael Vogt
b10feb8b17 Merge remote-tracking branch 'upstream/master' into ext-keymgr-2 2021-07-06 16:48:44 +02:00
Ian Johnson
f93a993c76 client, cmd/quota, daemon: change constraints + current maps to use ints
Instead of passing the values as strings, pass them as ints exactly with a map
of string -> interface{}. This induces a fair amount of overhead to parse
everywhere but still enables us to relatively easily add new keys/resource
types, assuming those types don't need special formatting like the memory does
with units.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-07-05 14:38:48 -05:00
Samuele Pedroni
b9f5d931df c/snap: test getKeypairManager failing on ext manager 2021-07-05 17:29:06 +02:00
Samuele Pedroni
626cc66f78 c/snap: fix key complete, oops
thanks @mvo5
2021-07-05 17:23:42 +02:00
Maciej Borzecki
46e24630bd cmd/libsnap-confine-private: tweak getline error handling
Unify getline error handling with the rest of the code.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-07-05 14:15:42 +02:00
Maciej Borzecki
80e762a77d cmd/libsnap-confine-update: do not fail when cgroup entries go away
Similarly to fixes in snap-update-ns, the snap processes can exist and the
entries in cgroup hierachy tree can go away at any time. Try to handle ENOENT
gracefully and not fail hard in such scenario.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-07-05 14:00:04 +02:00
Ian Johnson
6f89e0309f cmd/snap/quotas: adjust help texts for quota commands
Thanks to Graham for the suggestions here.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-07-02 10:46:24 -05:00
Ian Johnson
37e7842338 client, cmd/snap, daemon: refactor REST API for quotas to match CLI org
The CLI has organization where the current and constraint keys are maps of the
unit of measure for the quota group to the value, so update the REST API to
match this.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-07-02 10:38:37 -05:00
Ian Johnson
9dfdb372b1 Merge pull request #10420 from anonymouse64/feature/quota-groups-the-prequel-spinoff-6
many: use changes + tasks for quota group operations

The exported methods from the servicestate package all return tasksets now,
which is expected to be put into changes that are executed by the overlord
loop. This involves changes in many parts that use quotas, such as the tests,
where a new mock function to create a quota group in state without running any
servicectl commands as well as changes to the client side.
2021-07-01 17:19:14 -05:00
Sergio Cazzolato
aab394fc65 Removing ubuntu-32.04-32 system 2021-07-01 17:44:24 -03:00
Samuele Pedroni
8d8c0ecf85 c/snap: use KeypairManager.List also in keyName completion 2021-07-01 16:53:30 +02:00