From: Alexander Graf <graf@amazon.com>
To: Roman Kagan <rkagan@amazon.de>, <linux-kernel@vger.kernel.org>
Cc: Shuah Khan <shuah@kernel.org>,
Dragan Cvetic <dragan.cvetic@amd.com>,
Fares Mehanna <faresx@amazon.de>, Alexander Graf <graf@amazon.de>,
"Derek Kiernan" <derek.kiernan@amd.com>,
<linux-kselftest@vger.kernel.org>, <nh-open-source@amazon.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
<linux-mm@kvack.org>, David Woodhouse <dwmw@amazon.co.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH RFC 0/3] add support for mm-local memory allocations
Date: Wed, 28 Aug 2024 11:50:08 +0200 [thread overview]
Message-ID: <f2d6e44c-585f-460c-9d68-0be4d5fbe9fd@amazon.com> (raw)
In-Reply-To: <20240621201501.1059948-1-rkagan@amazon.de>
Hey Roman,
On 21.06.24 22:14, Roman Kagan wrote:
> In a series posted a few years ago [1], a proposal was put forward to allow the
> kernel to allocate memory local to a mm and thus push it out of reach for
> current and future speculation-based cross-process attacks. We still believe
> this is a nice thing to have.
>
> However, in the time passed since that post Linux mm has grown quite a few new
> goodies, so we'd like to explore possibilities to implement this functionality
> with less effort and churn leveraging the now available facilities.
>
> Specifically, this is a proof-of-concept attempt to implement mm-local
> allocations piggy-backing on memfd_secret(), using regular user addressess but
> pinning the pages and flipping the user/supervisor flag on the respective PTEs
> to make them directly accessible from kernel, and sealing the VMA to prevent
> userland from taking over the address range. The approach allowed to delegate
> all the heavy lifting -- address management, interactions with the direct map,
> cleanup on mm teardown -- to the existing infrastructure, and required zero
> architecture-specific code.
>
> Compared to the approach used in the orignal series, where a dedicated kernel
> address range and thus a dedicated PGD was used for mm-local allocations, the
> one proposed here may have certain drawbacks, in particular
>
> - using user addresses for kernel memory may violate assumptions in various
> parts of kernel code which we may not have identified with smoke tests we did
>
> - the allocated addresses are guessable by the userland (ATM they are even
> visible in /proc/PID/maps but that's fixable) which may weaken the security
> posture
>
> Also included is a simple test driver and selftest to smoke test and showcase
> the feature.
>
> The code is PoC RFC and lacks a lot of checks and special case handling, but
> demonstrates the idea. We'd appreciate any feedback on whether it's a viable
> approach or it should better be abandoned in favor of the one with dedicated
> PGD / kernel address range or yet something else.
>
> [1] https://lore.kernel.org/lkml/20190612170834.14855-1-mhillenb@amazon.de/
I haven't seen any negative feedback on the RFC, so when can I expect a
v1 of this patch set that addresses the non-production-readyness of it
that you call out above? :)
Alex
Amazon Web Services Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
prev parent reply other threads:[~2024-08-28 9:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 20:14 [PATCH RFC 0/3] add support for mm-local memory allocations Roman Kagan
2024-06-21 20:14 ` [PATCH RFC 1/3] mseal: expose interface to seal / unseal user memory ranges Roman Kagan
2024-06-21 20:15 ` [PATCH RFC 2/3] mm/secretmem: implement mm-local kernel allocations Roman Kagan
2024-06-26 22:43 ` kernel test robot
2024-06-26 23:06 ` kernel test robot
2024-06-21 20:15 ` [PATCH RFC 3/3] drivers/misc: add test driver and selftest for proclocal allocator Roman Kagan
2024-07-03 14:36 ` Greg Kroah-Hartman
2024-07-04 11:11 ` [PATCH RFC 0/3] add support for mm-local memory allocations David Woodhouse
2024-08-28 9:50 ` Alexander Graf [this message]
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=f2d6e44c-585f-460c-9d68-0be4d5fbe9fd@amazon.com \
--to=graf@amazon.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=derek.kiernan@amd.com \
--cc=dragan.cvetic@amd.com \
--cc=dwmw@amazon.co.uk \
--cc=faresx@amazon.de \
--cc=graf@amazon.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nh-open-source@amazon.com \
--cc=rkagan@amazon.de \
--cc=shuah@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.