[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YYrDkUsJVcOzxMPL@hirez.programming.kicks-ass.net>
Date: Tue, 9 Nov 2021 19:53:05 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Ard Biesheuvel <ardb@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Josh Poimboeuf <jpoimboe@...hat.com>,
Jason Baron <jbaron@...mai.com>,
Steven Rostedt <rostedt@...dmis.org>,
Mark Rutland <mark.rutland@....com>,
Kees Cook <keescook@...omium.org>
Subject: Re: [RFC PATCH 3/7] static_call: use helper to access non-exported
key
On Tue, Nov 09, 2021 at 05:45:45PM +0100, Ard Biesheuvel wrote:
> @@ -196,13 +190,21 @@ extern long __static_call_return0(void);
> EXPORT_SYMBOL_GPL(STATIC_CALL_KEY(name)); \
> EXPORT_SYMBOL_GPL(STATIC_CALL_TRAMP(name))
>
> +#define EXPORT_STATIC_CALL_GETKEY_HELPER(name) \
> + struct static_call_key *STATIC_CALL_GETKEY(name)(void) { \
> + BUG_ON(!core_kernel_text( \
> + (unsigned long)__builtin_return_address(0))); \
> + return &STATIC_CALL_KEY(name); \
> + } \
> + EXPORT_SYMBOL_GPL(STATIC_CALL_GETKEY(name))
So if I were a nevarious module, I would look up the above symbol from
kallsyms (it is exported and easily obtainable) and then simply
read the text to discover the key address and we're in business.
Powered by blists - more mailing lists