[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180705072130.GA4534@gmail.com>
Date: Thu, 5 Jul 2018 09:21:30 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Daniel Borkmann <daniel@...earbox.net>,
David Miller <davem@...emloft.net>,
Thomas Gleixner <tglx@...utronix.de>,
syzbot+a4eb8c7766952a1ca872@...kaller.appspotmail.com,
Alexei Starovoitov <ast@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
Network Development <netdev@...r.kernel.org>,
syzkaller-bugs@...glegroups.com, X86 ML <x86@...nel.org>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Peter Zijlstra <peterz@...radead.org>,
Laura Abbott <labbott@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Eric Dumazet <edumazet@...gle.com>,
Rik van Riel <riel@...hat.com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>
Subject: Re: set_memory_* (was: Re: BUG: unable to handle kernel paging
request in bpf_int_jit_compile)
* Kees Cook <keescook@...omium.org> wrote:
> On Tue, Jun 26, 2018 at 3:53 PM, Daniel Borkmann <daniel@...earbox.net> wrote:
> > In any case, for pairs like set_memory_ro() + set_memory_rw() that are also used
> > outside of bpf e.g. STRICT_MODULE_RWX and friends which are mostly default these
> > days for some archs, is the choice to not check errors from there by design or from
> > historical context that it originated from 'debugging code' in that sense (DEBUG_RODATA /
> > DEBUG_SET_MODULE_RONX) earlier? Also if no-one checks for errors (and if that would
> > infact be the recommendation it is agreed upon) should the API be changed to void,
> > or generally should actual error checking occur on these + potential rollback; but
> > then question is what about restoring part from prior set_memory_ro() via set_memory_rw()?
> > Kees/others, do you happen to have some more context on recommended use around this
> > by any chance? (Would probably also help if we add some doc around assumptions into
> > include/linux/set_memory.h for future users.)
>
> If set_memory_* can fail, I think it needs to be __must_check, and all
> the callers need to deal with it gracefully. Those markings aren't
> "advisory": they're expected to actually do what they say.
Yes - but there's probably a few exceptions like early init code where the calls
not succeeding are signs of bugs - so any error return should probably be
WARN_ON()ed about.
Thanks,
Ingo
Powered by blists - more mailing lists