From: Jeff Xu <jeffxu@chromium.org>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
jeffxu@chromium.org, 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,
mhocko@suse.com, 42.hyeyoo@gmail.com, peterz@infradead.org,
ardb@google.com, enh@google.com, rientjes@google.com,
groeck@chromium.org, lorenzo.stoakes@oracle.com
Subject: Re: [PATCH v3 1/1] exec: seal system mappings
Date: Tue, 19 Nov 2024 12:57:39 -0800 [thread overview]
Message-ID: <CABi2SkUiJkqyT5=Dun8hHYEFVDcmjP0zz2No-EOm5GFMbLOSBQ@mail.gmail.com> (raw)
In-Reply-To: <w2kg2rvvp3vwgqlvvtnne2dccnhjamc2g5zxm2ko47khkodedw@ftzp7ekf4sft>
Hi Liam,
On Wed, Nov 13, 2024 at 4:54 PM Liam R. Howlett <Liam.Howlett@oracle.com> wrote:
> > Unlike the aforementioned mappings, the uprobe mapping is not
> > established during program startup. However, its lifetime is the same
> > as the process's lifetime [1]. It is sealed from creation.
>
> Why are you referencing mseal.rst for the uprobe mapping lifetime? I
> can't find anything in there about uprobe.
>
This should be [2], thanks for checking.
>
> It also can't be used on 32 bit systems, as per your kernel-parameters
> changes (and mseal specification). This is missing from the changelog.
>
sure, I will add that to the commit msg.
> > + exec.seal_system_mappings = [KNL]
> > + Format: { no | yes }
> > + Seal system mappings: vdso, vvar, sigpage, vsyscall,
> > + uprobe.
> > + This overwrites KCONFIG CONFIG_SEAL_SYSTEM_MAPPINGS
> ^^^^^^^^^ overrides ?
sure.
> > - if (vsyscall_mode == XONLY)
> > - vm_flags_init(&gate_vma, VM_EXEC);
> > + if (vsyscall_mode == XONLY) {
> > + unsigned long vm_flags = VM_EXEC;
> > +
> > + vm_flags |= seal_system_mappings();
> > +
>
> nit, extra line here.
>
removed.
> But.. this will add the VM_SEALED flag on any 64bit architecture that
> enables the SEAL_SYSTEM_MAPPINGS config. That will happen by bots with
> random config builds. I don't know if they have test cases that
> specifically unmap the vmas you are sealing (ppc64 probably tries to
> unmap the vdso).
>
> I do know that I've had syzbot bugs that unmap _all_ vmas. I'm guessing
> you will get bot notification on these failures for any 64bit
> architecture. You may want to look into it to avoid such fuzzing
> failures, but we still need this to be tested somehow.
>test_mremap_vdso.c
I found one selftest that could fail:
tools/testing/selftests/x86/test_mremap_vdso.c
I could add tools/testing/selftests/x86/config and add
CONFIG_SYSTEM_MAPPINGS=n there.
as instructed in selftest documentation [1]
[1] https://docs.kernel.org/dev-tools/kselftest.html#contributing-new-tests-details
>
> overwrite or override? I think the difference is that overwrite implies
> permanence where override doesn't. I'm fine with either, it just reads
> a bit odd to me.
>
sure, changed to override
> >
> > +config SEAL_SYSTEM_MAPPINGS
> > + bool "seal system mappings"
> > + default n
> > + depends on 64BIT
> > + depends on !CHECKPOINT_RESTORE
> > + help
> > + Seal system mappings such as vdso, vvar, sigpage, vsyscall, uprobes.
> > + Note: CHECKPOINT_RESTORE might relocate vdso mapping during restore,
> > + and remap will fail if the mapping is sealed, therefore
> > + !CHECKPOINT_RESTORE is added as dependency.
>
> You could also add a portion here about your override functionality on
> command line. "this can be disabled or enabled by..."
>
sure.
> I really think having something that can be found by searching for mseal
> is really desirable here. That is, make menuconfig, press / for search,
> type mseal -> find this feature. If this was MSEAL_SYSTEM_MAPPINGS,
> searching for seal or mseal would work and would serve to link the
> config option to the mseal document.
>
using "seal" would work here. I will add a note here to mseal.rst for reference.
> Right now there is no information in the help that will allow it to be
> found by 'mseal'. There is also nothing in the documentation that
> states this exists, which you should probably update with this feature?
>
I will update mseal.rst to include this feature.
Thanks for reviewing.
-Jeff
next prev parent reply other threads:[~2024-11-19 20:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 19:16 [PATCH v3 0/1] " jeffxu
2024-11-13 19:16 ` [PATCH v3 1/1] exec: " jeffxu
2024-11-13 20:47 ` Lorenzo Stoakes
2024-11-19 23:49 ` Jeff Xu
2024-11-14 0:54 ` Liam R. Howlett
2024-11-19 20:57 ` Jeff Xu [this message]
2024-11-13 20:36 ` [PATCH v3 0/1] " Lorenzo Stoakes
2024-11-19 23:48 ` 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='CABi2SkUiJkqyT5=Dun8hHYEFVDcmjP0zz2No-EOm5GFMbLOSBQ@mail.gmail.com' \
--to=jeffxu@chromium.org \
--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=anna-maria@linutronix.de \
--cc=ardb@google.com \
--cc=ardb@kernel.org \
--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=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=lorenzo.stoakes@oracle.com \
--cc=mark.rutland@arm.com \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--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