Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
interfaces/builtin: implement broadcom-asic-control interface #3623
Conversation
knitzsche
and others
added some commits
Jul 21, 2017
|
Support for kernel modules was now added. |
| + allow-installation: | ||
| + slot-snap-type: | ||
| + - core | ||
| + deny-auto-connection: true |
jhodapp
Jul 26, 2017
What's the difference between this and line 145 returning true for the AutoConnect method?
morphis
Jul 26, 2017
Contributor
See the comment in https://github.com/snapcore/snapd/pull/3623/files#diff-7657fbc6427572b16bb91d9568774554R144
AutoConnect is more or less a relict from older times. Base declaration has priority.
jhodapp
Jul 26, 2017
Ah yes, I forgot to comment on that comment. :) It didn't make sense to me. Can you reword that comment on line 144?
morphis
Jul 28, 2017
Contributor
What doesn't make sense? It's the same comment used on all other interfaces for the AutoConnect method.
jhodapp
Jul 28, 2017
So the comment states this:
// Allow what is allowed in the declarations
Maybe if you point to where the reader of the code could know what exactly is allowed, then it'd make more sense to me. It's just too general of a comment to add much value in my opinion.
| + } | ||
| + | ||
| + // Creation of the slot of this type is allowed only by a gadget or os snap | ||
| + if !(slot.Snap.Type == "os") { |
morphis
Jul 26, 2017
Contributor
The type of a core snap is still "os". See https://github.com/snapcore/snapd/blob/master/snap/types.go#L31 for details
jhodapp
Jul 26, 2017
Sounds like a bug in snapd that should be fixed before there's hundreds or thousands of interfaces.
zyga
added some commits
Jul 28, 2017
|
I pushed some API changes and cleanups. |
zyga
reviewed
Jul 28, 2017
| + return interfaces.StaticInfo{ | ||
| + Summary: broadcomAsicControlSummary, | ||
| + ImplicitOnCore: true, | ||
| + ImplicitOnClassic: true, |
zyga
Jul 28, 2017
Contributor
I wonder if this should be implicit on classic where it will show up for nearly everyone. It feels like a thing that we could do via classic gadgets if it is really needed there. WDYT?
jdstrand
Jul 28, 2017
Contributor
I think that this interface is very similar to dcdbas-control, which is implicit classic, and therefore we shouldn't make this PR do something else. If we want to clean this up and make conditional on gadgets, etc, that could be a future improvement.
| +` | ||
| + | ||
| +func (s *BroadcomAsicControlSuite) SetUpTest(c *C) { | ||
| + s.slot = &interfaces.Slot{ |
zyga
Jul 28, 2017
Contributor
Can you please just declare more snaps like you did above? I'd much rather see snaptest.MockInfo than hand-made structures.
| + c.Assert(s.plug.Sanitize(s.iface), IsNil) | ||
| +} | ||
| + | ||
| +func (s *BroadcomAsicControlSuite) TestUsedSecuritySystems(c *C) { |
zyga
Jul 28, 2017
Contributor
Can you please split this per backend. It will be easier to follow and you can use some shorter variable names (e.g. spec instead of apparmorSpec).
jhodapp
commented
Jul 28, 2017
•
jdstrand
reviewed
Jul 28, 2017
The base declaration, apparmor policy, udev rules and kernel modules all look ok, but please make the requested policy changes.
| +/sys/module/linux_user_bde/refcnt r, | ||
| +/sys/module/linux_bcm_knet/initstate r, | ||
| +/sys/module/linux_bcm_knet/holders/ r, | ||
| +/sys/module/linux_bcm_knet/refcnt r, |
jdstrand
Jul 28, 2017
Contributor
Since these are all only reads, I think the above can all be collapsed into (which is easier to read and futureproof):
/sys/module/linux_bcm_knet/{,**} r,
/sys/module/linux_kernel_bde/{,**} r,
/sys/module/linux_user_bde/{,**} r,
| +/sys/module/linux_bcm_knet/refcnt r, | ||
| +/dev/linux-user-bde rw, | ||
| +/dev/linux-kernel-bde rw, | ||
| +/dev/linux-bcm-knet wr, |
| + return interfaces.StaticInfo{ | ||
| + Summary: broadcomAsicControlSummary, | ||
| + ImplicitOnCore: true, | ||
| + ImplicitOnClassic: true, |
zyga
Jul 28, 2017
Contributor
I wonder if this should be implicit on classic where it will show up for nearly everyone. It feels like a thing that we could do via classic gadgets if it is really needed there. WDYT?
jdstrand
Jul 28, 2017
Contributor
I think that this interface is very similar to dcdbas-control, which is implicit classic, and therefore we shouldn't make this PR do something else. If we want to clean this up and make conditional on gadgets, etc, that could be a future improvement.
jhodapp
commented
Jul 28, 2017
|
@jdstrand Your last comment about implicit classic I don't quite follow. Are you simply stating that it doesn't need any special review/permission in order to use implicit classic before it gets merged, or something else? |
added some commits
Jul 31, 2017
|
@jhodapp - I was saying that I don't think the implicit parts of this interface need to change. |
jdstrand
approved these changes
Jul 31, 2017
The security policy changes look good, thanks.
codecov-io
commented
Jul 31, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #3623 +/- ##
==========================================
+ Coverage 75.19% 75.21% +0.02%
==========================================
Files 386 387 +1
Lines 33418 33452 +34
==========================================
+ Hits 25127 25162 +35
+ Misses 6480 6478 -2
- Partials 1811 1812 +1
Continue to review full report at Codecov.
|
jhodapp
commented
Aug 1, 2017
|
@zyga can you approve this and merge please? |
morphis commentedJul 26, 2017
•
Edited 1 time
-
morphis
Jul 26, 2017
This implements a new interface necessary to access certain device nodes exposed by the kernel drivers from Broadcom for their ASIC on switch devices.
This requires specific kernel modules to be available and loaded which will be soon shipped with the official Ubuntu kernel.