linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Berg <benjamin@sipsolutions.net>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Jeff Xu <jeffxu@chromium.org>
Cc: Kees Cook <kees@kernel.org>,
	akpm@linux-foundation.org, jannh@google.com,
		torvalds@linux-foundation.org, adhemerval.zanella@linaro.org,
	oleg@redhat.com,  linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org,  linux-mm@kvack.org,
	jorgelo@chromium.org, sroettger@google.com, ojeda@kernel.org,
		adobriyan@gmail.com, anna-maria@linutronix.de,
	mark.rutland@arm.com, 	linus.walleij@linaro.org, Jason@zx2c4.com,
	deller@gmx.de, rdunlap@infradead.org, 	davem@davemloft.net,
	hch@lst.de, peterx@redhat.com, hca@linux.ibm.com,
		f.fainelli@gmail.com, gerg@kernel.org,
	dave.hansen@linux.intel.com, 	mingo@kernel.org, ardb@kernel.org,
	Liam.Howlett@oracle.com, mhocko@suse.com,  42.hyeyoo@gmail.com,
	peterz@infradead.org, ardb@google.com, enh@google.com,
	rientjes@google.com, groeck@chromium.org, mpe@ellerman.id.au,
	Vlastimil Babka	 <vbabka@suse.cz>,
	Andrei Vagin <avagin@gmail.com>,
	Dmitry Safonov	 <0x7f454c46@gmail.com>,
	Mike Rapoport <mike.rapoport@gmail.com>,
	Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Subject: Re: [PATCH v4 1/1] exec: seal system mappings
Date: Thu, 16 Jan 2025 18:01:47 +0100	[thread overview]
Message-ID: <2e5de601da34342d8eb0d8319dcf81ff213c7ef0.camel@sipsolutions.net> (raw)
In-Reply-To: <7071878c-7857-4acd-ac27-f049cbc84de2@lucifer.local>

Hi Lorenzo,

On Thu, 2025-01-16 at 15:48 +0000, Lorenzo Stoakes wrote:
> On Wed, Jan 15, 2025 at 12:20:59PM -0800, Jeff Xu wrote:
> > On Wed, Jan 15, 2025 at 11:46 AM Lorenzo Stoakes
> > <lorenzo.stoakes@oracle.com> wrote:
> 
> [SNIP]
> > 
> > > I've made it abundantly clear that this (NACKed) series cannot allow the
> > > kernel to be in a broken state even if a user sets flags to do so.
> > > 
> > > This is because users might lack context to make this decision and
> > > incorrectly do so, and now we ship a known-broken kernel.
> > > 
> > > You are now suggesting disabling the !CRIU requirement. Which violates my
> > > _requirements_ (not optional features).
> > > 
> > Sure, I can add CRIU back.
> > 
> > Are you fine with UML and gViso not working under this CONFIG ?
> > UML/gViso doesn't use any KCONFIG like CRIU does.
> 
> Yeah this is a concern, wouldn't we be able to catch UML with a flag?
> 
> Apologies my fault for maybe not being totally up to date with this, but what
> exactly was the gViso (is it gVisor actually?)

UML is a separate architecture. It is a Linux kernel running as a
userspace application on top of an unmodified host kernel.

So really, UML is a mostly weird userspace program for the purpose of
this discussion. And a pretty buggy one too--it got broken by rseq
already.

What UML now does is:
 * Execute a tiny static binary
 * map special "stub" code/data pages at the topmost userspace address
   (replacing its stack)
 * continue execution inside the "stub" pages
 * unmap everything below the "stub" pages
 * use the unmap'ed area for userspace application mappings

I believe that the "unmap everything" step will fail with this feature.


Now, I am sure one can come up with solutions, e.g.:
   1. Simply print an explanation if the unmap() fails
   2. Find an address that is guaranteed to be below the VDSO and use a
      smaller address space for the UML userspace.
   3. Somehow tell the host kernel to not install the VDSO mappings
   4. Add the host VDSO pages as a sealed VMA within UML to guard them

UML is a bit of a niche and I am not sure it is worth worrying about it
too much.

Benjamin

> 
> > 
> > > You seem to be saying you're pushing an internal feature on upstream and
> > > only care about internal use cases, this is not how upstream works, as
> > > Matthew alludes to.
> > > 
> > > I have told you that my requirements are:
> > > 
> > > 1. You cannot allow a user to set config or boot options to have a
> > >    broken kernel configuration.
> > > 
> > Can you clarify on the definition of "broken kernel configuration":
> 
> Anything that'd unexpected break userland in a way that would be entirely
> unexpected.
> 
> Especially so if there is a real disconnect between the person who is
> enabling the feature and the program.
> 
> For instance if a distro wants to be big on security, is (as is entirely
> reasonable) concerned about an unsealed VDSO/VVAR/etc. being exploited, so
> turns on the flag, but _doesn't realise_ or doesn't communicate (such a big
> problem and difficult actually for many distros/vendors) that this will
> break certain programs - and then users do a kernel update, and *bang*
> their whole system is broken.
> 
> It's really this kind of scenario I'm worried about.
> 
> This is the crux of it really.
> 
> > 
> > Do you consider "setting mseal kernel cmd line under 32 bit build" as broken ?
> > If so, this problem is not solvable and I might just not try to solve
> > it for the next version.
> 
> Yeah, I really don't like the kernel cmd line thing, because of this risk
> of disconnect - your justification for it is prima facie reasonable - the
> distro didn't want to enable the thing by default but you want more
> security - but then we have this issue with the possible disconnect between
> 'hey here is security feature X' vs. 'security feature X breaks Y, Z +
> alpha'.
> 
> > 
> > If you just refer to a need to detect CRIU, in KCONFIG or/and kernel
> > cmd line,  this is solvable.
> > 
> > > 2. You must provide evidence that the arches you claim work with this,
> > >    actually do.
> > > 
> > Sure
> 
> See my reply to Kees as to what this comprises, sorry if I was not clear
> previously.
> 
> 
> > 
> > > You seem to have eliminated that from your summary as if the very thing
> > > that makes this series NACKed were not pertinent.
> > > 
> > In my last email, I tried to cover all code-logic related comments,
> > which is blocking me.
> > I also mentioned I will address non-code related comments
> > (threat-model/test etc),  later.
> 
> Ack.
> 
> I felt that you hadn't hit on my fundamental objections and this was in
> effect - a final analysis as to how you would be moving forward with v5 -
> but apologies if you did intend to separately discuss them.
> 
> > 
> > > if you do not address these correctly, I will simply have to reject your v5
> > > too and it'll waste everybody's time. I _genuinely_ don't want to have to
> > > do this.
> > > 
> > > Any solution MUST fulfil these requirements. I also want to see v5 as an
> > > RFC honestly at this stage, since it seems we are VERY MUCH in a discussion
> > > phase rather than a patch phase at this time.
> > > 
> > Sure.
> 
> To be clear - if the series is viable, I want to see it merged. And to
> further clarify - a simpler, smaller version of this that explicitly
> disallows breakage in config options suffices (though we must clarify the
> gVisor + UML things).
> 
> If I just wanted to reject this outright, I'd tell you :) (I don't).
> 
> I just need to feel vaguely less anxious about breaking things! :)
> 
> > 
> > > I really want to help you improve mseal and get things upstream, but I
> > > can't ignore my duty to ensure that the kernel remains stable and we don't
> > > hand kernel users (overly huge) footguns. I hate to be negative, but this
> > > is why I am pushing back so much here.
> > > 
> > Thanks. You can help me by answering my questions, and clarify your
> > requirements. I appreciate your time to make this feature useful.
> 
> Sure, hopefully I have done so, do follow up if anything was unclear.
> 
> > 
> > Please take note that the security feature often takes away
> > capabilities.  Sometimes it is impossible to meet security, usability
> > or performance goals simultaneously. I'm trying my best to get all
> > aspected satisfied.
> 
> Ack, and I realise it's often a difficult trade-off. I just worry about
> compounding complexity in consequences of kernel configuration vs. userland
> stuff + the disconnect between the two.
> 
> > 
> > -Jeff
> > 
> > > Thanks!
> 
> Cheers, Lorenzo
> 



  reply	other threads:[~2025-01-16 17:02 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 20:20 [PATCH v4 0/1] Seal " jeffxu
2024-11-25 20:20 ` [PATCH v4 1/1] exec: seal " jeffxu
2024-11-25 20:40   ` Matthew Wilcox
2024-12-02 17:22     ` Jeff Xu
2024-12-02 17:57       ` Lorenzo Stoakes
2024-12-02 20:05         ` Jeff Xu
2024-12-02 19:57       ` Jeff Xu
2024-12-02 18:29   ` Lorenzo Stoakes
2024-12-02 20:38     ` Jeff Xu
2024-12-03  7:35       ` Lorenzo Stoakes
2024-12-03 18:19         ` Jeff Xu
2024-12-03 20:16           ` Lorenzo Stoakes
2024-12-04 14:04   ` Benjamin Berg
2024-12-04 17:43     ` Jeff Xu
2024-12-04 18:24       ` Benjamin Berg
2024-12-10  4:12   ` Andrei Vagin
2024-12-11 22:46     ` Jeff Xu
2024-12-13  6:33       ` Andrei Vagin
2024-12-16 18:35         ` Jeff Xu
2024-12-16 18:56           ` Liam R. Howlett
2024-12-16 20:20             ` Jeff Xu
2024-12-17 22:18   ` Kees Cook
2025-01-02 19:15     ` Andrei Vagin
2025-01-03 20:48     ` Liam R. Howlett
2025-01-07  1:17       ` Kees Cook
2025-02-04 18:17       ` Johannes Berg
2025-01-03 21:38     ` Lorenzo Stoakes
2025-01-07  1:12       ` Kees Cook
2025-01-13 21:26         ` Jeff Xu
2025-01-14  4:19           ` Matthew Wilcox
2025-01-15 19:02           ` Jeff Xu
2025-01-15 19:46             ` Lorenzo Stoakes
2025-01-15 20:20               ` Jeff Xu
2025-01-16 15:48                 ` Lorenzo Stoakes
2025-01-16 17:01                   ` Benjamin Berg [this message]
2025-01-16 17:16                     ` Lorenzo Stoakes
2025-01-16 17:18                     ` Pedro Falcato
2025-01-17 18:20                       ` Jeff Xu
2025-01-17 19:35                         ` enh
2025-01-17 20:15                           ` Jeff Xu
2025-01-17 22:08                           ` Liam R. Howlett
2025-01-21 15:38                             ` enh
2025-01-22 17:23                               ` Liam R. Howlett
2025-01-22 22:29                                 ` enh
2025-01-23  8:40                                   ` Vlastimil Babka
2025-01-23 21:50                                     ` enh
2025-01-23 22:38                                       ` Matthew Wilcox
2025-02-06 14:19                                         ` enh
2025-02-06 13:20                           ` Thomas Weißschuh
2025-02-06 14:38                             ` enh
2025-02-06 15:28                               ` Thomas Weißschuh
2025-02-06 15:51                                 ` enh
2025-02-06 16:37                                   ` Thomas Weißschuh
2025-01-17 18:08                   ` Jeff Xu
2025-01-15 23:52               ` Kees Cook
2025-01-16  5:26                 ` Christoph Hellwig
2025-01-16 19:40                   ` Kees Cook
2025-01-17 10:14                     ` Heiko Carstens
2025-01-16 15:34                 ` Lorenzo Stoakes
2025-01-16 19:44                   ` Kees Cook
2024-11-26 16:39 ` [PATCH v4 0/1] Seal " Lorenzo Stoakes
2024-12-02 17:28   ` Jeff Xu

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=2e5de601da34342d8eb0d8319dcf81ff213c7ef0.camel@sipsolutions.net \
    --to=benjamin@sipsolutions.net \
    --cc=0x7f454c46@gmail.com \
    --cc=42.hyeyoo@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aleksandr.mikhalitsyn@canonical.com \
    --cc=anna-maria@linutronix.de \
    --cc=ardb@google.com \
    --cc=ardb@kernel.org \
    --cc=avagin@gmail.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=enh@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=gerg@kernel.org \
    --cc=groeck@chromium.org \
    --cc=hca@linux.ibm.com \
    --cc=hch@lst.de \
    --cc=jannh@google.com \
    --cc=jeffxu@chromium.org \
    --cc=jorgelo@chromium.org \
    --cc=kees@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mark.rutland@arm.com \
    --cc=mhocko@suse.com \
    --cc=mike.rapoport@gmail.com \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=ojeda@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterx@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=rientjes@google.com \
    --cc=sroettger@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@suse.cz \
    /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