linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Vagin <avagin@gmail.com>
To: jeffxu@chromium.org
Cc: akpm@linux-foundation.org, keescook@chromium.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,
	 Dmitry Safonov <0x7f454c46@gmail.com>,
	Mike Rapoport <mike.rapoport@gmail.com>,
	 Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>,
	Andrei Vagin <avagin@google.com>
Subject: Re: [PATCH v4 1/1] exec: seal system mappings
Date: Mon, 9 Dec 2024 20:12:33 -0800	[thread overview]
Message-ID: <CANaxB-wvHERPBu+17b5GP3pVv7pC8J0dkK9MUG1tSir4PQx=ZQ@mail.gmail.com> (raw)
In-Reply-To: <20241125202021.3684919-2-jeffxu@google.com>

On Mon, Nov 25, 2024 at 12:49 PM <jeffxu@chromium.org> wrote:
>
> From: Jeff Xu <jeffxu@chromium.org>
>
> Seal vdso, vvar, sigpage, uprobes and vsyscall.
>
> Those mappings are readonly or executable only, sealing can protect
> them from ever changing or unmapped during the life time of the process.
> For complete descriptions of memory sealing, please see mseal.rst [1].
>
> System mappings such as vdso, vvar, and sigpage (for arm) are
> generated by the kernel during program initialization, and are
> sealed after creation.
>
> Unlike the aforementioned mappings, the uprobe mapping is not
> established during program startup. However, its lifetime is the same
> as the process's lifetime [2]. It is sealed from creation.
>
> The vdso, vvar, sigpage, and uprobe mappings all invoke the
> _install_special_mapping() function. As no other mappings utilize this
> function, it is logical to incorporate sealing logic within
> _install_special_mapping(). This approach avoids the necessity of
> modifying code across various architecture-specific implementations.
>
> The vsyscall mapping, which has its own initialization function, is
> sealed in the XONLY case, it seems to be the most common and secure
> case of using vsyscall.
>
> It is important to note that the CHECKPOINT_RESTORE feature (CRIU) may
> alter the mapping of vdso, vvar, and sigpage during restore
> operations. Consequently, this feature cannot be universally enabled
> across all systems.
>
...
>
> +config SEAL_SYSTEM_MAPPINGS
> +       bool "seal system mappings"
> +       default n
> +       depends on 64BIT
> +       depends on ARCH_HAS_SEAL_SYSTEM_MAPPINGS
> +       depends on !CHECKPOINT_RESTORE

Hi Jeff,

I like the idea of this patchset, but I don’t like the idea of
forcing users to choose between this security feature and
checkpoint/restore functionality. We need to explore ways to make this
feature work with checkpoint/restore. Relying on CAP_CHECKPOINT_RESTORE
is the obvious approach.

CRIU just needs to move these mappings, and it doesn't need to change
their properties or modify their contents. With that in mind, here are
two options:
* Allow moving sealed mappings for processes with CAP_CHECKPOINT_RESTORE.
* Allow temporarily "unsealing" mappings for processes with
  CAP_CHECKPOINT_RESTORE. CRIU could unseal mappings, move them, and
  then seal them back.

Another approach might be to make this feature configurable on a
per-process basis (e.g., via prctl). Once enabled for a process, it
would be inherited by all its children. It can't be disabled unless a
process has CAP_CHECKPOINT_RESTORE.

I've added Mike, Dima, and Alex to the thread. They might have
other ideas.

Thanks,
Andrei


  parent reply	other threads:[~2024-12-10  4:12 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 [this message]
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
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='CANaxB-wvHERPBu+17b5GP3pVv7pC8J0dkK9MUG1tSir4PQx=ZQ@mail.gmail.com' \
    --to=avagin@gmail.com \
    --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@google.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=keescook@chromium.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --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 \
    /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