1 |
On Mon, 2022-06-27 at 15:49 -0400, Mike Gilbert wrote: |
2 |
> On Mon, Jun 27, 2022 at 3:42 PM Georgy Yakovlev |
3 |
> <gyakovlev@g.o> wrote: |
4 |
> > |
5 |
> > On Mon, 2022-06-27 at 14:56 -0400, Mike Gilbert wrote: |
6 |
> > > On Mon, Jun 27, 2022 at 2:35 PM Kenton Groombridge |
7 |
> > > <concord@g.o> wrote: |
8 |
> > > > > so looks like we need to combine both methods and do the |
9 |
> > > > > following: |
10 |
> > > > > - if signing requested without compression - sign in |
11 |
> > > > > pkg_preinst. |
12 |
> > > > > - if signing requested with compression - sign in |
13 |
> > > > > src_install |
14 |
> > > > > |
15 |
> > > > |
16 |
> > > > Why can't we do both in pkg_preinst? I am thinking it would be |
17 |
> > > > best |
18 |
> > > > if |
19 |
> > > > we drop the current compression implementation and rework your |
20 |
> > > > old |
21 |
> > > > code |
22 |
> > > > to handle both compression and signing since the signing code |
23 |
> > > > is |
24 |
> > > > more or |
25 |
> > > > less already complete. |
26 |
> > > |
27 |
> > > Signing modules in pkg_preinst seems like a bad idea to me. That |
28 |
> > > means |
29 |
> > > you need to copy your private keys around to every host where the |
30 |
> > > package might be installed. |
31 |
> > > |
32 |
> > > If you sign in src_compile or src_install, you only need private |
33 |
> > > keys |
34 |
> > > on the system building your binpkg. |
35 |
> > > |
36 |
> > |
37 |
> > unfortunately portage will unconditionally strip .ko objects, |
38 |
> > rendering |
39 |
> > modules unloadable by stripping signature, unless we do dostrip -x |
40 |
> > (requires EAPI7+, which should not be a problem nowadays, but was a |
41 |
> > problem back in 2018), which can be quite unfortunate on debug |
42 |
> > enabled |
43 |
> > kernels. |
44 |
> |
45 |
> Sounds like something to fix/change in Portage. It could probably be |
46 |
> updated to not strip the signature. However, I would guess the |
47 |
> signature needs to be updated after the binary is modified in any |
48 |
> case. |
49 |
> |
50 |
> Or as a workaround you could disable automatic striping via dostrip - |
51 |
> x |
52 |
> and run the proper commands to strip the modules in src_install as |
53 |
> well. |
54 |
> |
55 |
I think even strip itself does not have proper options not to break |
56 |
module. Several years back it was the case, basically one has to strip |
57 |
first, sign second, otherwise module will be unloadable. |
58 |
|
59 |
"Signed modules are BRITTLE as the signature is outside of the defined |
60 |
ELF container. Thus they MAY NOT be stripped once the signature is |
61 |
computed and attached. Note the entire module is the signed payload, |
62 |
including any and all debug information present at the time of |
63 |
signing." |
64 |
|
65 |
https://www.kernel.org/doc/html/v4.15/admin-guide/module-signing.html#signed-modules-and-stripping |