linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Xu <jeffxu@chromium.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <keescook@chromium.org>,
	srikar@linux.vnet.ibm.com,  Ryan Roberts <ryan.roberts@arm.com>,
	"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
	 "glider@google.com" <glider@google.com>,
	Matthew Wilcox <willy@infradead.org>,
	zokeefe@google.com,  hughd@google.com, luto@amacapital.net,
	 "jmarchan@redhat.com" <jmarchan@redhat.com>,
	"rientjes@google.com" <rientjes@google.com>,
	 Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	 LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org,  Andrew Morton <akpm@linux-foundation.org>
Subject: Re: question on [uprobes] special vma
Date: Fri, 2 Aug 2024 07:59:09 -0700	[thread overview]
Message-ID: <CABi2SkXqkC3wX4wnhXTXrLSs-6PLO-Fj4g=Hcvqq=ppv4QWUzA@mail.gmail.com> (raw)
In-Reply-To: <20240802090040.GB12343@redhat.com>

Hi Oleg

On Fri, Aug 2, 2024 at 2:00 AM Oleg Nesterov <oleg@redhat.com> wrote:
>
> Hi Jeff,
>
> On 08/01, Jeff Xu wrote:
> >
> > __create_xol_area() calls  _install_special_mapping() to create a vma
> > named [uprobes].
> >
> > I'm trying to find out the lifetime of this uprobes vma, e.g. when it
> > is created, will it ever be unmapped/remapped/changed during the
> > lifetime of the process.
> >
> > If  the uprobes vma remains the same during the lifetime of the
> > process,
>
> Yes,
>
That is nice.

> > I can call mseal on it so user space can't change it, i.e.
> > blocking munmap/mremap/mprotect/mmap, etc.
>
> I didn't even know about mm/mseal.c...
>
The TLDR: once the memory area is sealed,
mmap/munmap/mremap/mprotect/some of madvise will be blocked.

https://docs.kernel.org/userspace-api/mseal.html

On a related topic, Adhemerval Zanella has an RFC adding mseal support
for dynamic linker.

https://public-inbox.org/libc-alpha/20240731200307.2269811-1-adhemerval.zanella@linaro.org/

> at first glance do_mseal() just adds VM_SEALED for can_modify_vma().
>
> So it seems that xol_add_vma() can just pass the additional VM_SEALED
> flag to _install_special_mapping(), no?
>
Yes. Before I make that change, I want to confirm that [uprobes] VMA
is immutable during the lifetime of the process, hence this email.

> But why it depends on CONFIG_64_BIT?
>
It needn't, but the vm_flags_t in the vma struct for 32 bit is full,
adding 32 bit support will make split/merge code more complex, (at one
point of RFC process, 32 bit is included but later removed),

If we like to have 32 bit support, perhaps we need to refactor the mm
code to expand vm_flags first.

Thanks for your help !
-Jeff

> Oleg.
>


  reply	other threads:[~2024-08-02 14:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 23:38 Jeff Xu
2024-08-02  9:00 ` Oleg Nesterov
2024-08-02 14:59   ` Jeff Xu [this message]
2024-08-02 22:21     ` Oleg Nesterov

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='CABi2SkXqkC3wX4wnhXTXrLSs-6PLO-Fj4g=Hcvqq=ppv4QWUzA@mail.gmail.com' \
    --to=jeffxu@chromium.org \
    --cc=adrian.hunter@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=glider@google.com \
    --cc=hughd@google.com \
    --cc=jmarchan@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rientjes@google.com \
    --cc=ryan.roberts@arm.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=willy@infradead.org \
    --cc=zokeefe@google.com \
    /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