From: "Petr Tesařík" <petr@tesarici.cz>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Petr Tesarik" <petrtesarik@huaweicloud.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"David Kaplan" <david.kaplan@amd.com>,
"Larry Dewey" <larry.dewey@amd.com>,
"Elena Reshetova" <elena.reshetova@intel.com>,
"Carlos Bilbao" <carlos.bilbao@amd.com>,
"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Petr Mladek" <pmladek@suse.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Eric DeVolder" <eric.devolder@oracle.com>,
"Marc Aurèle La France" <tsi@tuyoix.net>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
"Nhat Pham" <nphamcs@gmail.com>,
"Christian Brauner (Microsoft)" <brauner@kernel.org>,
"Douglas Anderson" <dianders@chromium.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Guenter Roeck" <groeck@chromium.org>,
"Mike Christie" <michael.christie@oracle.com>,
"Maninder Singh" <maninder1.s@samsung.com>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>,
"Roberto Sassu" <roberto.sassu@huaweicloud.com>,
"Petr Tesarik" <petr.tesarik1@huawei-partners.com>,
"Kees Cook" <keescook@chromium.org>,
"Alexei Starovoitov" <alexei.starovoitov@gmail.com>
Subject: Re: [PATCH v1 5/5] sbm: SandBox Mode documentation
Date: Thu, 15 Feb 2024 07:42:57 +0100 [thread overview]
Message-ID: <20240215074257.10e00a53@meshulam.tesarici.cz> (raw)
In-Reply-To: <xg7iz7syomv3oobjktgn76fyxms4vfs66jul56ub36prwnncxm@hsjhc5m72ipq>
On Wed, 14 Feb 2024 15:19:04 -0500
Kent Overstreet <kent.overstreet@linux.dev> wrote:
> On Wed, Feb 14, 2024 at 09:09:37PM +0100, Petr Tesařík wrote:
> > On Wed, 14 Feb 2024 13:54:54 -0500
> > Kent Overstreet <kent.overstreet@linux.dev> wrote:
> >
> > > On Wed, Feb 14, 2024 at 05:31:12PM +0100, Petr Tesařík wrote:
> > > > On Wed, 14 Feb 2024 16:11:05 +0100
> > > > Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> > > >
> > > > > On Wed, Feb 14, 2024 at 03:55:24PM +0100, Petr Tesařík wrote:
> > > > > > OK, so why didn't I send the whole thing?
> > > > > >
> > > > > > Decomposition of the kernel requires many more changes, e.g. in linker
> > > > > > scripts. Some of them depend on this patch series. Before I go and
> > > > > > clean up my code into something that can be submitted, I want to get
> > > > > > feedback from guys like you, to know if the whole idea would be even
> > > > > > considered, aka "Fail Fast".
> > > > >
> > > > > We can't honestly consider this portion without seeing how it would
> > > > > work, as we don't even see a working implementation that uses it to
> > > > > verify it at all.
> > > > >
> > > > > The joy of adding new frameworks is that you need a user before anyone
> > > > > can spend the time to review it, sorry.
> > > >
> > > > Thank your for a quick assessment. Will it be sufficient if I send some
> > > > code for illustration (with some quick&dirty hacks to bridge the gaps),
> > > > or do you need clean and nice kernel code?
> > >
> > > Given that code is going to need a rewrite to make use of this anyways -
> > > why not just do the rewrite in Rust?
> >
> > Thank you for this question! I concur that rewriting the whole kernel
> > in Rust would be a better option. I see two differences:
> >
> > 1. amount of work
> > 2. regressions
> >
> > Rewriting something in Rust means pretty much writing it from scratch.
> > Doing that necessarily introduces regressions. Old code has been used.
> > It has been tested. In many corner cases. Lots of bugs have been found,
> > and they’ve been fixed. If you write code from scratch, you lose much
> > of the accumulated knowledge.
>
> But it's work that already has some growing momentum behind it,
> especially in the area you cited - decompression algorithms.
Fair enough, this is indeed going for a better solution.
> > More importantly, sandbox mode can be viewed as a tool that enforces
> > decomposition of kernel code. This decomposition is the main benefit.
> > It requires understanding the dependencies among different parts of the
> > kernel (both code flow and data flow), and that will in turn promote
> > better design.
>
> You see this as a tool for general purpose code...?
>
> Typical kernel code tends to be quite pointer heavy.
Yes. I believe this fact contributes to the difficulty of ensuring
memory safety in the kernel. With so much code potentially depnding on
any other kernel data structure, it does not help much that you protect
it as a whole. A finer-grained protection would make more sense.
> > > Then you get memory safety, which seems to be what you're trying to
> > > achieve here.
> > >
> > > Or, you say this is for when performance isn't critical - why not a user
> > > mode helper?
> >
> > Processes in user mode are susceptible to all kinds of attacks you may
> > want to avoid. Sandbox mode can be used in situations where user mode
> > does not exist, e.g. to display a boot logo or to unpack initramfs.
>
> [citation needed]
I assume you mean citation for the kinds of attacks, not for the
unavailability of user space before initramfs is unpacked. ;-)
Here you go:
On Wed, 2023-03-22 at 15:27 -0700, Alexei Starovoitov wrote:
> On Wed, Mar 22, 2023 at 5:08 AM Roberto Sassu
[...]
> <roberto.sassu@huaweicloud.com> wrote:
> > possible use case. The main goal is to move something that was running
> > in the kernel to user space, with the same isolation guarantees as if
> > the code was executed in the kernel.
>
> They are not the same guarantees.
> UMD is exactly equivalent to root process running in user space.
> Meaning it can be killed, ptraced, priority inverted, etc
https://lore.kernel.org/lkml/CAADnVQJC0h7rtuntt0tqS5BbxWsmyWs3ZSbboZMmUKetMG2VhA@mail.gmail.com/
Petr T
next prev parent reply other threads:[~2024-02-15 6:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 11:30 [PATCH v1 0/5] Introduce SandBox Mode (SBM) Petr Tesarik
2024-02-14 11:30 ` [PATCH v1 1/5] sbm: SandBox Mode core data types and functions Petr Tesarik
2024-02-14 11:30 ` [PATCH v1 2/5] sbm: sandbox input and output buffers Petr Tesarik
2024-02-14 11:30 ` [PATCH v1 3/5] sbm: call helpers and thunks Petr Tesarik
2024-02-14 11:30 ` [PATCH v1 4/5] sbm: SandBox Mode KUnit test suite Petr Tesarik
2024-02-15 19:14 ` kernel test robot
2024-02-16 1:53 ` kernel test robot
2024-02-14 11:30 ` [PATCH v1 5/5] sbm: SandBox Mode documentation Petr Tesarik
2024-02-14 13:30 ` Andrew Morton
2024-02-14 14:01 ` Greg Kroah-Hartman
2024-02-14 14:55 ` Petr Tesařík
2024-02-14 15:11 ` Greg Kroah-Hartman
2024-02-14 16:31 ` Petr Tesařík
2024-02-14 18:48 ` Greg Kroah-Hartman
2024-02-14 19:42 ` Petr Tesařík
2024-02-15 9:11 ` Greg Kroah-Hartman
2024-02-15 9:45 ` Petr Tesařík
2024-02-15 11:39 ` Greg Kroah-Hartman
2024-02-14 18:54 ` Kent Overstreet
2024-02-14 20:09 ` Petr Tesařík
2024-02-14 20:19 ` Kent Overstreet
2024-02-15 6:42 ` Petr Tesařík [this message]
2024-02-15 8:52 ` Roberto Sassu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240215074257.10e00a53@meshulam.tesarici.cz \
--to=petr@tesarici.cz \
--cc=akpm@linux-foundation.org \
--cc=alexei.starovoitov@gmail.com \
--cc=brauner@kernel.org \
--cc=carlos.bilbao@amd.com \
--cc=corbet@lwn.net \
--cc=david.kaplan@amd.com \
--cc=dianders@chromium.org \
--cc=elena.reshetova@intel.com \
--cc=eric.devolder@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=groeck@chromium.org \
--cc=gustavoars@kernel.org \
--cc=keescook@chromium.org \
--cc=kent.overstreet@linux.dev \
--cc=larry.dewey@amd.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maninder1.s@samsung.com \
--cc=mcgrof@kernel.org \
--cc=mhiramat@kernel.org \
--cc=michael.christie@oracle.com \
--cc=nphamcs@gmail.com \
--cc=paulmck@kernel.org \
--cc=petr.tesarik1@huawei-partners.com \
--cc=petrtesarik@huaweicloud.com \
--cc=pmladek@suse.com \
--cc=rdunlap@infradead.org \
--cc=roberto.sassu@huaweicloud.com \
--cc=tsi@tuyoix.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®