[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202110280958.22E5F74@keescook>
Date: Thu, 28 Oct 2021 10:12:32 -0700
From: Kees Cook <keescook@...omium.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ard Biesheuvel <ardb@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Sami Tolvanen <samitolvanen@...gle.com>,
X86 ML <x86@...nel.org>, Josh Poimboeuf <jpoimboe@...hat.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Sedat Dilek <sedat.dilek@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
linux-hardening@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
llvm@...ts.linux.dev
Subject: Re: [PATCH v5 00/15] x86: Add support for Clang CFI
On Thu, Oct 28, 2021 at 01:09:39PM +0200, Peter Zijlstra wrote:
> On Wed, Oct 27, 2021 at 03:27:59PM -0700, Kees Cook wrote:
>
> > Right -- though wouldn't just adding __ro_after_init do the same?
> >
> > DEFINE_STATIC_CALL(static_call_name, func_a) __ro_after_init;
>
> That breaks modules (and your jump_label patch doing the same is
> similarly broken).
Well that's no fun. :) I'd like to understand this better so I can fix
it!
>
> When a module is loaded that uses the static_call(), it needs to
> register it's .static_call_sites range with the static_call_key which
> requires modifying it.
Reading static_call_add_module() leaves me with even more questions. ;)
It looks like module static calls need to write to kernel text? I don't
understand. Is this when a module is using an non-module key for a call
site? And in that case, this happens:
key |= s_key & STATIC_CALL_SITE_FLAGS;
Where "key" is not in the module?
And the flags can be:
#define STATIC_CALL_SITE_TAIL 1UL /* tail call */
#define STATIC_CALL_SITE_INIT 2UL /* init section */
But aren't these per-site attributes? Why are they stored per-key?
if (!init && static_call_is_init(site))
continue;
...
arch_static_call_transform(site_addr, NULL, func,
static_call_is_tail(site));
--
Kees Cook
Powered by blists - more mailing lists