lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 9 Nov 2021 20:45:42 +0100
From:   Ard Biesheuvel <ardb@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux ARM <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, 9 Nov 2021 at 20:42, Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Tue, Nov 09, 2021 at 07:54:23PM +0100, Ard Biesheuvel wrote:
> > On Tue, 9 Nov 2021 at 19:53, Peter Zijlstra <peterz@...radead.org> wrote:
> > >
> > > 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.
> > >
> >
> > Yeah I realised that. So would you prefer to have a
> > .static_call_tramp_key section in each module and look up the keys in
> > the module loader?
>
> Think so... do you actually have a need for this?

Well, not exactly. But the XOR patch I sent earlier today does cover
this use case, and would be broken if we implemented inline static
calls on arm64.

So the easy fix is to allow EXPORT_STATIC_CALL_RO() only from the core
kernel, and require EXPORT_STATIC_CALL_RW() otherwise. That way, this
can never end up being used in a way that breaks at runtime. Would you
prefer doing that instead?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ