From: Tianlin Li <tli@digitalocean.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-hardening@lists.openwall.com,
Kees Cook <keescook@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
Russell King <linux@armlinux.org.uk>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, Greentime Hu <green.hu@gmail.com>,
Vincent Chen <deanbo422@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>, "H . Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Jessica Yu <jeyu@kernel.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
Petr Mladek <pmladek@suse.com>,
Joe Lawrence <joe.lawrence@redhat.com>
Subject: Re: [RFC PATCH] kernel/module: have the callers of set_memory_*() check the return value
Date: Tue, 19 Nov 2019 15:54:44 -0600 [thread overview]
Message-ID: <16D5632C-27F1-4B9C-9255-A0B67582623D@digitalocean.com> (raw)
In-Reply-To: <20191119213854.GP3079@worktop.programming.kicks-ass.net>
[-- Attachment #1: Type: text/plain, Size: 2060 bytes --]
> On Nov 19, 2019, at 3:38 PM, Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Tue, Nov 19, 2019 at 09:51:49AM -0600, Tianlin Li wrote:
>> Right now several architectures allow their set_memory_*() family of
>> functions to fail, but callers may not be checking the return values. We
>> need to fix the callers and add the __must_check attribute. They also may
>> not provide any level of atomicity, in the sense that the memory
>> protections may be left incomplete on failure. This issue likely has a few
>> steps on effects architectures[1]:
>> 1)Have all callers of set_memory_*() helpers check the return value.
>> 2)Add __much_check to all set_memory_*() helpers so that new uses do not
>> ignore the return value.
>> 3)Add atomicity to the calls so that the memory protections aren't left in
>> a partial state.
>>
>> Ideally, the failure of set_memory_*() should be passed up the call stack,
>> and callers should examine the failure and deal with it. But currently,
>> some callers just have void return type.
>>
>> We need to fix the callers to handle the return all the way to the top of
>> stack, and it will require a large series of patches to finish all the three
>> steps mentioned above. I start with kernel/module, and will move onto other
>> subsystems. I am not entirely sure about the failure modes for each caller.
>> So I would like to get some comments before I move forward. This single
>> patch is just for fixing the return value of set_memory_*() function in
>> kernel/module, and also the related callers. Any feedback would be greatly
>> appreciated.
>
> Please have a look here:
>
> https://lkml.kernel.org/r/20191111131252.921588318@infradead.org <https://lkml.kernel.org/r/20191111131252.921588318@infradead.org>
>
> Much of the code you're patching is slated for removal.
>
> Josh also has patches reworking KLP and there's some ARM64 patches
> pending at which point we can also delete module_disable_ro().
Thanks for the information. I will check the code.
[-- Attachment #2: Type: text/html, Size: 9435 bytes --]
next prev parent reply other threads:[~2019-11-19 21:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 15:51 [RFC PATCH] kernel/module: have the callers of set_memory_*() check the return value Tianlin Li
2019-11-19 17:07 ` Kees Cook
2019-11-19 21:43 ` Peter Zijlstra
2019-11-19 21:51 ` Tianlin Li
2019-11-19 21:38 ` Peter Zijlstra
2019-11-19 21:54 ` Tianlin Li [this message]
2019-11-20 9:58 ` Borislav Petkov
2019-11-20 16:19 ` Tianlin Li
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=16D5632C-27F1-4B9C-9255-A0B67582623D@digitalocean.com \
--to=tli@digitalocean.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=deanbo422@gmail.com \
--cc=green.hu@gmail.com \
--cc=hpa@zytor.com \
--cc=jeyu@kernel.org \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux@armlinux.org.uk \
--cc=mbenes@suse.cz \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).