From: Michal Hocko <mhocko@kernel.org>
To: Igor Stoppa <igor.stoppa@huawei.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Dave Hansen <dave.hansen@intel.com>
Subject: Re: RFC v2: post-init-read-only protection for data allocated dynamically
Date: Thu, 4 May 2017 15:11:31 +0200 [thread overview]
Message-ID: <20170504131131.GI31540@dhcp22.suse.cz> (raw)
In-Reply-To: <83d4556c-b21c-7ae5-6e83-4621a74f9fd5@huawei.com>
On Thu 04-05-17 15:14:10, Igor Stoppa wrote:
[...]
> I wonder if you are thinking about loadable modules or maybe livepatch.
> My proposal, in its current form, is only about what is done when the
> kernel initialization is performed. So it would not take those cases
> under its umbrella. Actually it might be incompatible with livepatch, if
> any of the read-only data is supposed to be updated.
>
> Since it's meant to improve the current level of integrity, I would
> prefer to have a progressive approach and address modules/livepatch in a
> later phase, if this is not seen as a show stopper.
I believe that this is a fundamental question. Sealing sounds useful
for after-boot usecases as well and it would change the approach
considerably. Coming up with an ad-hoc solution for the boot only way
seems like a wrong way to me. And as you've said SELinux which is your
target already does the thing after the early boot.
[...]
> > Roughly it would mean that once kmem_cache_seal() is
> > called on a cache it would changed page tables to used slab pages to RO
> > state. This would obviously need some fiddling to make those pages not
> > usable for new allocations from sealed pages. It would also mean some
> > changes to kfree path but I guess this is doable.
>
> Ok, as it probably has already become evident, I have just started
> peeking into the memory subsystem, so this is the sort of guidance I was
> hoping I could receive =) - thank you
>
> Question: I see that some pages can be moved around. Would this apply to
> the slab-based solution, or can I assume that once I have certain
> physical pages sealed, they will not be altered anymore?
Slab pages are not migrateable currently. Even if they start being
migrateable it would be an opt-in because that requires pointers tracking
to make sure they are updated properly.
> >> * While I do not strictly need a new memory zone, memory zones are what
> >> kmalloc understands at the moment: AFAIK, it is not possible to tell
> >> kmalloc from which memory pool it should fish out the memory, other than
> >> having a reference to a memory zone.
> >
> > As I've said already. I think that a zone is a completely wrong
> > approach. How would it help anyway. It is the allocator on top of the
> > page allocator which has to do clever things to support sealing.
>
>
> Ok, as long as there is a way forward that fits my needs and has the
> possibility to be merged upstream, I'm fine with it.
>
> I suppose zones are the first thing one meets when reading the code, so
> they are probably the first target that comes to mind.
> That's what happened to me.
>
> I will probably come back with further questions, but I can then start
> putting together some prototype of what you described.
>
> I am fine with providing a generic solution, but I must make sure that
> it works with slub. I suppose what you proposed will do it, right?
I haven't researched that too deeply. In principle both SLAB and SLUB
maintain slab pages in a similar way so I do not see any fundamental
problems.
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-05-04 13:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-03 12:06 Igor Stoppa
[not found] ` <70a9d4db-f374-de45-413b-65b74c59edcb@intel.com>
2017-05-04 8:17 ` Igor Stoppa
2017-05-04 14:30 ` Dave Hansen
2017-05-05 8:53 ` Igor Stoppa
2017-05-04 11:21 ` Michal Hocko
2017-05-04 12:14 ` Igor Stoppa
2017-05-04 13:11 ` Michal Hocko [this message]
2017-05-04 13:37 ` Igor Stoppa
2017-05-04 14:01 ` Michal Hocko
2017-05-04 17:24 ` Dave Hansen
2017-05-05 12:08 ` Igor Stoppa
2017-05-05 12:19 ` Igor Stoppa
2017-05-10 7:45 ` Michal Hocko
2017-05-04 16:49 ` Laura Abbott
2017-05-05 10:42 ` Igor Stoppa
2017-05-08 15:25 ` Laura Abbott
2017-05-09 9:38 ` Igor Stoppa
2017-05-10 8:05 ` Michal Hocko
2017-05-10 8:57 ` Igor Stoppa
2017-05-10 11:43 ` Michal Hocko
2017-05-10 15:19 ` Igor Stoppa
2017-05-10 15:45 ` Dave Hansen
2017-05-19 10:51 ` Igor Stoppa
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=20170504131131.GI31540@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=dave.hansen@intel.com \
--cc=igor.stoppa@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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