[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240222085302.35f3a2c3@meshulam.tesarici.cz>
Date: Thu, 22 Feb 2024 08:53:02 +0100
From: Petr Tesařík <petr@...arici.cz>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Petr Tesarik <petr.tesarik1@...wei-partners.com>, Roberto Sassu
<roberto.sassu@...weicloud.com>, Matthew Wilcox <willy@...radead.org>, Petr
Tesarik <petrtesarik@...weicloud.com>, Dave Hansen <dave.hansen@...el.com>,
Jonathan Corbet <corbet@....net>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, Dave Hansen
<dave.hansen@...ux.intel.com>, "maintainer:X86 ARCHITECTURE (32-BIT AND
64-BIT)" <x86@...nel.org>, Andy Lutomirski <luto@...nel.org>, Oleg Nesterov
<oleg@...hat.com>, Peter Zijlstra <peterz@...radead.org>, Xin Li
<xin3.li@...el.com>, Arnd Bergmann <arnd@...db.de>, Andrew Morton
<akpm@...ux-foundation.org>, Rick Edgecombe <rick.p.edgecombe@...el.com>,
Kees Cook <keescook@...omium.org>, "Masami Hiramatsu (Google)"
<mhiramat@...nel.org>, Pengfei Xu <pengfei.xu@...el.com>, Josh Poimboeuf
<jpoimboe@...nel.org>, Ze Gao <zegao2021@...il.com>, "Kirill A. Shutemov"
<kirill.shutemov@...ux.intel.com>, Kai Huang <kai.huang@...el.com>, David
Woodhouse <dwmw@...zon.co.uk>, Brian Gerst <brgerst@...il.com>, Jason
Gunthorpe <jgg@...pe.ca>, Joerg Roedel <jroedel@...e.de>, "Mike Rapoport
(IBM)" <rppt@...nel.org>, Tina Zhang <tina.zhang@...el.com>, Jacob Pan
<jacob.jun.pan@...ux.intel.com>, "open list:DOCUMENTATION"
<linux-doc@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>,
David Howells <dhowells@...hat.com>
Subject: Re: [RFC 6/8] KEYS: PGP data parser
On Wed, 21 Feb 2024 06:02:30 -0800
"H. Peter Anvin" <hpa@...or.com> wrote:
> On February 20, 2024 2:55:12 AM PST, Petr Tesarik <petr.tesarik1@...wei-partners.com> wrote:
> >On 2/16/2024 6:08 PM, H. Peter Anvin wrote:
> >> On February 16, 2024 8:53:01 AM PST, Roberto Sassu <roberto.sassu@...weicloud.com> wrote:
> >>> On Fri, 2024-02-16 at 16:44 +0000, Matthew Wilcox wrote:
> >>>> On Fri, Feb 16, 2024 at 04:24:33PM +0100, Petr Tesarik wrote:
> >>>>> From: David Howells <dhowells@...hat.com>
> >>>>>
> >>>>> Implement a PGP data parser for the crypto key type to use when
> >>>>> instantiating a key.
> >>>>>
> >>>>> This parser attempts to parse the instantiation data as a PGP packet
> >>>>> sequence (RFC 4880) and if it parses okay, attempts to extract a public-key
> >>>>> algorithm key or subkey from it.
> >>>>
> >>>> I don't understand why we want to do this in-kernel instead of in
> >>>> userspace and then pass in the actual key.
> >>>
> >>> Sigh, this is a long discussion.
> >>>
> >>> PGP keys would be used as a system-wide trust anchor to verify RPM
> >>> package headers, which already contain file digests that can be used as
> >>> reference values for kernel-enforced integrity appraisal.
> >>>
> >>> With the assumptions that:
> >>>
> >>> - In a locked-down system the kernel has more privileges than root
> >>> - The kernel cannot offload this task to an user space process due to
> >>> insufficient isolation
> >>>
> >>> the only available option is to do it in the kernel (that is what I got
> >>> as suggestion).
> >>>
> >>> Roberto
> >>>
> >>>
> >>
> >> Ok, at least one of those assumptions is false, and *definitely* this approach seems to be a solution in search of a problem.
> >
> >As a matter of fact, there is some truth to this observation.
> >
> >The frustrating story of Roberto's PGP parser sparked the idea, but it
> >would clearly be overkill to add all this code just for this one parser.
> >I started looking around if there are other potential uses of a sandbox
> >mode, which might justify the effort. I quickly found out that it is
> >difficult to find a self-contained part of the kernel.
> >
> >Now I believe that these dependencies among different parts of the
> >kernel present an issue, both to kernel security and to maintainability
> >of the source code. Even if sandbox mode as such is rejected (hopefully
> >with an explanation of the reasons), I believe that it is good to split
> >the kernel into smaller parts and reduce their interdependencies. In
> >this sense, sandbox mode is a way to express and enforce the remaining
> >dependencies.
> >
> >Petr T
>
> Congratulations. You just reinvented the microkernel.
Oh, I have never claimed that the idea is completely new. There is a
lot of prior research in this field; the most advanced project is
probably Lightweight Execution Domains (LXDs), presented at USENIX ATC
in 2019 [1]. This one even adds a full-blown microkernel...
However, these projects have not gone anywhere, for some reason. I
tried to understand the reason and it seems to me that it is not the
underlying concept. I believe the main issue is that it would require
extremely intrusive changes in the overall design of the kernel. For
example LXDs run their microkernel on a dedicated CPU core and it uses
IDL to generate the glue code which passes data between Linux and this
newly introduced microkernel...
Our development process is more suited to incremental changes. This is
reflected by SandBox Mode. It allows to start small, keep the existing
overall design, and chip off only a few selected parts.
In short, SBM does borrow some ideas from microkernels but it does not
turn Linux into a microkernel. OTOH it enhances your freedom of
choice. If you change your mind and decide to make a Linux microkernel
after all, SBM will be able to help you during the transition.
Petr T
[1] https://www.usenix.org/system/files/atc19-narayanan.pdf
Powered by blists - more mailing lists